pub const ext = @import("ext.zig");
const gtk = @This();

const std = @import("std");
const compat = @import("compat");
const gsk = @import("gsk4");
const graphene = @import("graphene1");
const gobject = @import("gobject2");
const glib = @import("glib2");
const gdk = @import("gdk4");
const cairo = @import("cairo1");
const pangocairo = @import("pangocairo1");
const pango = @import("pango1");
const harfbuzz = @import("harfbuzz0");
const freetype2 = @import("freetype22");
const gio = @import("gio2");
const gmodule = @import("gmodule2");
const gdkpixbuf = @import("gdkpixbuf2");
/// The rectangle representing the area allocated for a widget by its parent.
pub const Allocation = gdk.Rectangle;

/// Communicates with platform-specific assistive technologies API.
///
/// Each platform supported by GTK implements a `GtkATContext` subclass, and
/// is responsible for updating the accessible state in response to state
/// changes in `GtkAccessible`.
pub const ATContext = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ATContextClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkAccessible` that created the `GtkATContext` instance.
        pub const accessible = struct {
            pub const name = "accessible";

            pub const Type = ?*gtk.Accessible;
        };

        /// The accessible role used by the AT context.
        ///
        /// Depending on the given role, different states and properties can be
        /// set or retrieved.
        pub const accessible_role = struct {
            pub const name = "accessible-role";

            pub const Type = gtk.AccessibleRole;
        };

        /// The `GdkDisplay` for the `GtkATContext`.
        pub const display = struct {
            pub const name = "display";

            pub const Type = ?*gdk.Display;
        };

        /// Whether the `GtkATContext` has been realized or not.
        pub const realized = struct {
            pub const name = "realized";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the attributes of the accessible for the
        /// `GtkATContext` instance change.
        pub const state_change = struct {
            pub const name = "state-change";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ATContext, p_instance))),
                    gobject.signalLookup("state-change", ATContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkATContext` instance for the given accessible role,
    /// accessible instance, and display connection.
    ///
    /// The `GtkATContext` implementation being instantiated will depend on the
    /// platform.
    extern fn gtk_at_context_create(p_accessible_role: gtk.AccessibleRole, p_accessible: *gtk.Accessible, p_display: *gdk.Display) ?*gtk.ATContext;
    pub const create = gtk_at_context_create;

    /// Retrieves the `GtkAccessible` using this context.
    extern fn gtk_at_context_get_accessible(p_self: *ATContext) *gtk.Accessible;
    pub const getAccessible = gtk_at_context_get_accessible;

    /// Retrieves the accessible role of this context.
    extern fn gtk_at_context_get_accessible_role(p_self: *ATContext) gtk.AccessibleRole;
    pub const getAccessibleRole = gtk_at_context_get_accessible_role;

    extern fn gtk_at_context_get_type() usize;
    pub const getGObjectType = gtk_at_context_get_type;

    extern fn g_object_ref(p_self: *gtk.ATContext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ATContext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ATContext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays information about a program.
///
/// The shown information includes the programs' logo, name, copyright,
/// website and license. It is also possible to give credits to the authors,
/// documenters, translators and artists who have worked on the program.
///
/// An about dialog is typically opened when the user selects the `About`
/// option from the `Help` menu. All parts of the dialog are optional.
///
/// <picture>
///   <source srcset="aboutdialot-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkAboutDialog" src="aboutdialog.png">
/// </picture>
///
/// About dialogs often contain links and email addresses. `GtkAboutDialog`
/// displays these as clickable links. By default, it calls `gtk.FileLauncher.launch`
/// when a user clicks one. The behaviour can be overridden with the
/// `gtk.AboutDialog.signals.activate_link` signal.
///
/// To specify a person with an email address, use a string like
/// `Edgar Allan Poe <edgar`poe`.com>`. To specify a website with a title,
/// use a string like `GTK team https://www.gtk.org`.
///
/// To make constructing an about dialog as convenient as possible, you can
/// use the function `gtk.showAboutDialog` which constructs and shows
/// a dialog and keeps it around so that it can be shown again.
///
/// Note that GTK sets a default title of `_("About `s`")` on the dialog
/// window (where ``s`` is replaced by the name of the application, but in
/// order to ensure proper translation of the title, applications should
/// set the title property explicitly when constructing an about dialog,
/// as shown in the following example:
///
/// ```c
/// GFile *logo_file = g_file_new_for_path ("./logo.png");
/// GdkTexture *example_logo = gdk_texture_new_from_file (logo_file, NULL);
/// g_object_unref (logo_file);
///
/// gtk_show_about_dialog (NULL,
///                        "program-name", "ExampleCode",
///                        "logo", example_logo,
///                        "title", _("About ExampleCode"),
///                        NULL);
/// ```
///
/// ## Shortcuts and Gestures
///
/// `GtkAboutDialog` supports the following keyboard shortcuts:
///
/// - <kbd>Escape</kbd> closes the window.
///
/// ## CSS nodes
///
/// `GtkAboutDialog` has a single CSS node with the name `window` and style
/// class `.aboutdialog`.
pub const AboutDialog = opaque {
    pub const Parent = gtk.Window;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = AboutDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The people who contributed artwork to the program.
        ///
        /// Each string may contain email addresses and URLs, which will be displayed
        /// as links.
        pub const artists = struct {
            pub const name = "artists";

            pub const Type = ?[*][*:0]u8;
        };

        /// The authors of the program.
        ///
        /// Each string may contain email addresses and URLs, which will be displayed
        /// as links, see the introduction for more details.
        pub const authors = struct {
            pub const name = "authors";

            pub const Type = ?[*][*:0]u8;
        };

        /// Comments about the program.
        ///
        /// This string is displayed in a label in the main dialog, thus it
        /// should be a short explanation of the main purpose of the program,
        /// not a detailed list of features.
        pub const comments = struct {
            pub const name = "comments";

            pub const Type = ?[*:0]u8;
        };

        /// Copyright information for the program.
        pub const copyright = struct {
            pub const name = "copyright";

            pub const Type = ?[*:0]u8;
        };

        /// The people documenting the program.
        ///
        /// Each string may contain email addresses and URLs, which will be displayed
        /// as links, see the introduction for more details.
        pub const documenters = struct {
            pub const name = "documenters";

            pub const Type = ?[*][*:0]u8;
        };

        /// The license of the program, as free-form text.
        ///
        /// This string is displayed in a text view in a secondary dialog, therefore
        /// it is fine to use a long multi-paragraph text. Note that the text is only
        /// wrapped in the text view if the "wrap-license" property is set to `TRUE`;
        /// otherwise the text itself must contain the intended linebreaks.
        ///
        /// When setting this property to a non-`NULL` value, the
        /// `gtk.AboutDialog.properties.license_type` property is set to
        /// `gtk.@"License.custom"` as a side effect.
        ///
        /// The text may contain links in this format `<http://www.some.place/>`
        /// and email references in the form `<mail-to`some`.body>`, and these will
        /// be converted into clickable links.
        pub const license = struct {
            pub const name = "license";

            pub const Type = ?[*:0]u8;
        };

        /// The license of the program.
        ///
        /// The `GtkAboutDialog` will automatically fill out a standard disclaimer
        /// and link the user to the appropriate online resource for the license
        /// text.
        ///
        /// If `gtk.@"License.unknown"` is used, the link used will be the same
        /// specified in the `gtk.AboutDialog.properties.website` property.
        ///
        /// If `gtk.@"License.custom"` is used, the current contents of the
        /// `gtk.AboutDialog.properties.license` property are used.
        ///
        /// For any other `gtk.License` value, the contents of the
        /// `gtk.AboutDialog.properties.license` property are also set by
        /// this property as a side effect.
        pub const license_type = struct {
            pub const name = "license-type";

            pub const Type = gtk.License;
        };

        /// A logo for the about box.
        ///
        /// If it is `NULL`, the default window icon set with
        /// `gtk.Window.setDefaultIconName` will be used.
        pub const logo = struct {
            pub const name = "logo";

            pub const Type = ?*gdk.Paintable;
        };

        /// A named icon to use as the logo for the about box.
        ///
        /// This property overrides the `gtk.AboutDialog.properties.logo` property.
        pub const logo_icon_name = struct {
            pub const name = "logo-icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// The name of the program.
        ///
        /// If this is not set, it defaults to the value returned by
        /// `glib.getApplicationName`.
        pub const program_name = struct {
            pub const name = "program-name";

            pub const Type = ?[*:0]u8;
        };

        /// Information about the system on which the program is running.
        ///
        /// This information is displayed in a separate page, therefore it is fine
        /// to use a long multi-paragraph text. Note that the text should contain
        /// the intended linebreaks.
        ///
        /// The text may contain links in this format `<http://www.some.place/>`
        /// and email references in the form `<mail-to`some`.body>`, and these will
        /// be converted into clickable links.
        pub const system_information = struct {
            pub const name = "system-information";

            pub const Type = ?[*:0]u8;
        };

        /// Credits to the translators.
        ///
        /// This string should be marked as translatable.
        ///
        /// The string may contain email addresses and URLs, which will be displayed
        /// as links, see the introduction for more details.
        pub const translator_credits = struct {
            pub const name = "translator-credits";

            pub const Type = ?[*:0]u8;
        };

        /// The version of the program.
        pub const version = struct {
            pub const name = "version";

            pub const Type = ?[*:0]u8;
        };

        /// The URL for the link to the website of the program.
        ///
        /// This should be a string starting with `http://` or `https://`.
        pub const website = struct {
            pub const name = "website";

            pub const Type = ?[*:0]u8;
        };

        /// The label for the link to the website of the program.
        pub const website_label = struct {
            pub const name = "website-label";

            pub const Type = ?[*:0]u8;
        };

        /// Whether to wrap the text in the license dialog.
        pub const wrap_license = struct {
            pub const name = "wrap-license";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted every time a URL is activated.
        ///
        /// Applications may connect to it to override the default behaviour,
        /// which is to call `gtk.FileLauncher.launch`.
        pub const activate_link = struct {
            pub const name = "activate-link";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_uri: [*:0]u8, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(AboutDialog, p_instance))),
                    gobject.signalLookup("activate-link", AboutDialog.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkAboutDialog`.
    extern fn gtk_about_dialog_new() *gtk.AboutDialog;
    pub const new = gtk_about_dialog_new;

    /// Creates a new section in the "Credits" page.
    extern fn gtk_about_dialog_add_credit_section(p_about: *AboutDialog, p_section_name: [*:0]const u8, p_people: [*][*:0]const u8) void;
    pub const addCreditSection = gtk_about_dialog_add_credit_section;

    /// Returns the names of the artists which are displayed
    /// in the credits page.
    extern fn gtk_about_dialog_get_artists(p_about: *AboutDialog) [*]const [*:0]const u8;
    pub const getArtists = gtk_about_dialog_get_artists;

    /// Returns the names of the authors which are displayed
    /// in the credits page.
    extern fn gtk_about_dialog_get_authors(p_about: *AboutDialog) [*]const [*:0]const u8;
    pub const getAuthors = gtk_about_dialog_get_authors;

    /// Returns the comments string.
    extern fn gtk_about_dialog_get_comments(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getComments = gtk_about_dialog_get_comments;

    /// Returns the copyright string.
    extern fn gtk_about_dialog_get_copyright(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getCopyright = gtk_about_dialog_get_copyright;

    /// Returns the name of the documenters which are displayed
    /// in the credits page.
    extern fn gtk_about_dialog_get_documenters(p_about: *AboutDialog) [*]const [*:0]const u8;
    pub const getDocumenters = gtk_about_dialog_get_documenters;

    /// Returns the license information.
    extern fn gtk_about_dialog_get_license(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getLicense = gtk_about_dialog_get_license;

    /// Retrieves the license type.
    extern fn gtk_about_dialog_get_license_type(p_about: *AboutDialog) gtk.License;
    pub const getLicenseType = gtk_about_dialog_get_license_type;

    /// Returns the paintable displayed as logo in the about dialog.
    extern fn gtk_about_dialog_get_logo(p_about: *AboutDialog) ?*gdk.Paintable;
    pub const getLogo = gtk_about_dialog_get_logo;

    /// Returns the icon name displayed as logo in the about dialog.
    extern fn gtk_about_dialog_get_logo_icon_name(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getLogoIconName = gtk_about_dialog_get_logo_icon_name;

    /// Returns the program name displayed in the about dialog.
    extern fn gtk_about_dialog_get_program_name(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getProgramName = gtk_about_dialog_get_program_name;

    /// Returns the system information that is shown in the about dialog.
    extern fn gtk_about_dialog_get_system_information(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getSystemInformation = gtk_about_dialog_get_system_information;

    /// Returns the translator credits string which is displayed
    /// in the credits page.
    extern fn gtk_about_dialog_get_translator_credits(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getTranslatorCredits = gtk_about_dialog_get_translator_credits;

    /// Returns the version string.
    extern fn gtk_about_dialog_get_version(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getVersion = gtk_about_dialog_get_version;

    /// Returns the website URL.
    extern fn gtk_about_dialog_get_website(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getWebsite = gtk_about_dialog_get_website;

    /// Returns the label used for the website link.
    extern fn gtk_about_dialog_get_website_label(p_about: *AboutDialog) ?[*:0]const u8;
    pub const getWebsiteLabel = gtk_about_dialog_get_website_label;

    /// Returns whether the license text in the about dialog is
    /// automatically wrapped.
    extern fn gtk_about_dialog_get_wrap_license(p_about: *AboutDialog) c_int;
    pub const getWrapLicense = gtk_about_dialog_get_wrap_license;

    /// Sets the names of the artists to be displayed
    /// in the "Credits" page.
    extern fn gtk_about_dialog_set_artists(p_about: *AboutDialog, p_artists: [*][*:0]const u8) void;
    pub const setArtists = gtk_about_dialog_set_artists;

    /// Sets the names of the authors which are displayed
    /// in the "Credits" page of the about dialog.
    extern fn gtk_about_dialog_set_authors(p_about: *AboutDialog, p_authors: [*][*:0]const u8) void;
    pub const setAuthors = gtk_about_dialog_set_authors;

    /// Sets the comments string to display in the about dialog.
    ///
    /// This should be a short string of one or two lines.
    extern fn gtk_about_dialog_set_comments(p_about: *AboutDialog, p_comments: ?[*:0]const u8) void;
    pub const setComments = gtk_about_dialog_set_comments;

    /// Sets the copyright string to display in the about dialog.
    ///
    /// This should be a short string of one or two lines.
    extern fn gtk_about_dialog_set_copyright(p_about: *AboutDialog, p_copyright: ?[*:0]const u8) void;
    pub const setCopyright = gtk_about_dialog_set_copyright;

    /// Sets the names of the documenters which are displayed
    /// in the "Credits" page.
    extern fn gtk_about_dialog_set_documenters(p_about: *AboutDialog, p_documenters: [*][*:0]const u8) void;
    pub const setDocumenters = gtk_about_dialog_set_documenters;

    /// Sets the license information to be displayed in the
    /// about dialog.
    ///
    /// If `license` is `NULL`, the license page is hidden.
    extern fn gtk_about_dialog_set_license(p_about: *AboutDialog, p_license: ?[*:0]const u8) void;
    pub const setLicense = gtk_about_dialog_set_license;

    /// Sets the license of the application showing the about dialog
    /// from a list of known licenses.
    ///
    /// This function overrides the license set using
    /// `gtk.AboutDialog.setLicense`.
    extern fn gtk_about_dialog_set_license_type(p_about: *AboutDialog, p_license_type: gtk.License) void;
    pub const setLicenseType = gtk_about_dialog_set_license_type;

    /// Sets the logo in the about dialog.
    extern fn gtk_about_dialog_set_logo(p_about: *AboutDialog, p_logo: ?*gdk.Paintable) void;
    pub const setLogo = gtk_about_dialog_set_logo;

    /// Sets the icon name to be displayed as logo in the about dialog.
    extern fn gtk_about_dialog_set_logo_icon_name(p_about: *AboutDialog, p_icon_name: ?[*:0]const u8) void;
    pub const setLogoIconName = gtk_about_dialog_set_logo_icon_name;

    /// Sets the name to display in the about dialog.
    ///
    /// If `name` is not set, the string returned
    /// by ``glib.getApplicationName`` is used.
    extern fn gtk_about_dialog_set_program_name(p_about: *AboutDialog, p_name: ?[*:0]const u8) void;
    pub const setProgramName = gtk_about_dialog_set_program_name;

    /// Sets the system information to be displayed in the about
    /// dialog.
    ///
    /// If `system_information` is `NULL`, the system information
    /// page is hidden.
    ///
    /// See `gtk.AboutDialog.properties.system_information`.
    extern fn gtk_about_dialog_set_system_information(p_about: *AboutDialog, p_system_information: ?[*:0]const u8) void;
    pub const setSystemInformation = gtk_about_dialog_set_system_information;

    /// Sets the translator credits string which is displayed in
    /// the credits page.
    ///
    /// The intended use for this string is to display the translator
    /// of the language which is currently used in the user interface.
    /// Using ``gettext``, a simple way to achieve that is to mark the
    /// string for translation:
    ///
    /// ```c
    /// GtkWidget *about = gtk_about_dialog_new ();
    ///  gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (about),
    ///                                           _("translator-credits"));
    /// ```
    ///
    /// It is a good idea to use the customary `msgid` “translator-credits”
    /// for this purpose, since translators will already know the purpose of
    /// that `msgid`, and since `GtkAboutDialog` will detect if “translator-credits”
    /// is untranslated and omit translator credits.
    extern fn gtk_about_dialog_set_translator_credits(p_about: *AboutDialog, p_translator_credits: ?[*:0]const u8) void;
    pub const setTranslatorCredits = gtk_about_dialog_set_translator_credits;

    /// Sets the version string to display in the about dialog.
    extern fn gtk_about_dialog_set_version(p_about: *AboutDialog, p_version: ?[*:0]const u8) void;
    pub const setVersion = gtk_about_dialog_set_version;

    /// Sets the URL to use for the website link.
    extern fn gtk_about_dialog_set_website(p_about: *AboutDialog, p_website: ?[*:0]const u8) void;
    pub const setWebsite = gtk_about_dialog_set_website;

    /// Sets the label to be used for the website link.
    extern fn gtk_about_dialog_set_website_label(p_about: *AboutDialog, p_website_label: [*:0]const u8) void;
    pub const setWebsiteLabel = gtk_about_dialog_set_website_label;

    /// Sets whether the license text in the about dialog should be
    /// automatically wrapped.
    extern fn gtk_about_dialog_set_wrap_license(p_about: *AboutDialog, p_wrap_license: c_int) void;
    pub const setWrapLicense = gtk_about_dialog_set_wrap_license;

    extern fn gtk_about_dialog_get_type() usize;
    pub const getGObjectType = gtk_about_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.AboutDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AboutDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AboutDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents a link (i.e. a uri).
///
/// A widget that contains one or more links should implement
/// the `gtk.AccessibleHypertext` interface and return
/// `GtkAccessibleHyperlink` objects for each of the links.
pub const AccessibleHyperlink = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.Accessible};
    pub const Class = gtk.AccessibleHyperlinkClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates an accessible object that represents a hyperlink.
    ///
    /// This is meant to be used with an implementation of the
    /// `gtk.AccessibleHypertext` interface.
    extern fn gtk_accessible_hyperlink_new(p_parent: *gtk.AccessibleHypertext, p_index: c_uint, p_uri: [*:0]const u8, p_bounds: *gtk.AccessibleTextRange) *gtk.AccessibleHyperlink;
    pub const new = gtk_accessible_hyperlink_new;

    /// Sets a platform state on the accessible.
    extern fn gtk_accessible_hyperlink_set_platform_state(p_self: *AccessibleHyperlink, p_state: gtk.AccessiblePlatformState, p_enabled: c_int) void;
    pub const setPlatformState = gtk_accessible_hyperlink_set_platform_state;

    extern fn gtk_accessible_hyperlink_get_type() usize;
    pub const getGObjectType = gtk_accessible_hyperlink_get_type;

    extern fn g_object_ref(p_self: *gtk.AccessibleHyperlink) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AccessibleHyperlink) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AccessibleHyperlink, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents contextual actions.
///
/// <picture>
///   <source srcset="action-bar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkActionBar" src="action-bar.png">
/// </picture>
///
/// `GtkActionBar` is expected to be displayed below the content and expand
/// horizontally to fill the area.
///
/// It allows placing children at the start or the end. In addition, it
/// contains an internal centered box which is centered with respect to
/// the full width of the box, even if the children at either side take
/// up different amounts of space.
///
/// # GtkActionBar as GtkBuildable
///
/// The `GtkActionBar` implementation of the `GtkBuildable` interface supports
/// adding children at the start or end sides by specifying “start” or “end” as
/// the “type” attribute of a `<child>` element, or setting the center widget
/// by specifying “center” value.
///
/// # CSS nodes
///
/// ```
/// actionbar
/// ╰── revealer
///     ╰── box
///         ├── box.start
///         │   ╰── [start children]
///         ├── [center widget]
///         ╰── box.end
///             ╰── [end children]
/// ```
///
/// A `GtkActionBar`'s CSS node is called `actionbar`. It contains a `revealer`
/// subnode, which contains a `box` subnode, which contains two `box` subnodes at
/// the start and end of the action bar, with `start` and `end` style classes
/// respectively, as well as a center node that represents the center child.
///
/// Each of the boxes contains children packed for that side.
pub const ActionBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = ActionBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Controls whether the action bar shows its contents.
        pub const revealed = struct {
            pub const name = "revealed";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new action bar widget.
    extern fn gtk_action_bar_new() *gtk.ActionBar;
    pub const new = gtk_action_bar_new;

    /// Retrieves the center bar widget of the bar.
    extern fn gtk_action_bar_get_center_widget(p_action_bar: *ActionBar) ?*gtk.Widget;
    pub const getCenterWidget = gtk_action_bar_get_center_widget;

    /// Gets whether the contents of the action bar are revealed.
    extern fn gtk_action_bar_get_revealed(p_action_bar: *ActionBar) c_int;
    pub const getRevealed = gtk_action_bar_get_revealed;

    /// Adds a child to the action bar, packed with reference to the
    /// end of the action bar.
    extern fn gtk_action_bar_pack_end(p_action_bar: *ActionBar, p_child: *gtk.Widget) void;
    pub const packEnd = gtk_action_bar_pack_end;

    /// Adds a child to the action, packed with reference to the
    /// start of the action bar.
    extern fn gtk_action_bar_pack_start(p_action_bar: *ActionBar, p_child: *gtk.Widget) void;
    pub const packStart = gtk_action_bar_pack_start;

    /// Removes a child from the action bar.
    extern fn gtk_action_bar_remove(p_action_bar: *ActionBar, p_child: *gtk.Widget) void;
    pub const remove = gtk_action_bar_remove;

    /// Sets the center widget for the action bar.
    extern fn gtk_action_bar_set_center_widget(p_action_bar: *ActionBar, p_center_widget: ?*gtk.Widget) void;
    pub const setCenterWidget = gtk_action_bar_set_center_widget;

    /// Reveals or conceals the content of the action bar.
    ///
    /// Note: this does not show or hide the action bar in the
    /// `gtk.Widget.properties.visible` sense, so revealing has
    /// no effect if the action bar is hidden.
    extern fn gtk_action_bar_set_revealed(p_action_bar: *ActionBar, p_revealed: c_int) void;
    pub const setRevealed = gtk_action_bar_set_revealed;

    extern fn gtk_action_bar_get_type() usize;
    pub const getGObjectType = gtk_action_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.ActionBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ActionBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ActionBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Activates a widget.
///
/// Widgets are activated by calling `gtk.Widget.activate`.
pub const ActivateAction = opaque {
    pub const Parent = gtk.ShortcutAction;
    pub const Implements = [_]type{};
    pub const Class = gtk.ActivateActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Gets the activate action.
    ///
    /// This is an action that calls `gtk.Widget.activate`
    /// on the given widget upon activation.
    extern fn gtk_activate_action_get() *gtk.ActivateAction;
    pub const get = gtk_activate_action_get;

    extern fn gtk_activate_action_get_type() usize;
    pub const getGObjectType = gtk_activate_action_get_type;

    extern fn g_object_ref(p_self: *gtk.ActivateAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ActivateAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ActivateAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A model for a numeric value.
///
/// The `GtkAdjustment` has an associated lower and upper bound.
/// It also contains step and page increments, and a page size.
///
/// Adjustments are used within several GTK widgets, including
/// `gtk.SpinButton`, `gtk.Viewport`, `gtk.Scrollbar`
/// and `gtk.Scale`.
///
/// The `GtkAdjustment` object does not update the value itself. Instead
/// it is left up to the owner of the `GtkAdjustment` to control the value.
pub const Adjustment = extern struct {
    pub const Parent = gobject.InitiallyUnowned;
    pub const Implements = [_]type{};
    pub const Class = gtk.AdjustmentClass;
    f_parent_instance: gobject.InitiallyUnowned,

    pub const virtual_methods = struct {
        pub const changed = struct {
            pub fn call(p_class: anytype, p_adjustment: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Adjustment.Class, p_class).f_changed.?(gobject.ext.as(Adjustment, p_adjustment));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_adjustment: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Adjustment.Class, p_class).f_changed = @ptrCast(p_implementation);
            }
        };

        pub const value_changed = struct {
            pub fn call(p_class: anytype, p_adjustment: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Adjustment.Class, p_class).f_value_changed.?(gobject.ext.as(Adjustment, p_adjustment));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_adjustment: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Adjustment.Class, p_class).f_value_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The minimum value of the adjustment.
        pub const lower = struct {
            pub const name = "lower";

            pub const Type = f64;
        };

        /// The page increment of the adjustment.
        pub const page_increment = struct {
            pub const name = "page-increment";

            pub const Type = f64;
        };

        /// The page size of the adjustment.
        ///
        /// Note that the page-size is irrelevant and should be set to zero
        /// if the adjustment is used for a simple scalar value, e.g. in a
        /// `GtkSpinButton`.
        pub const page_size = struct {
            pub const name = "page-size";

            pub const Type = f64;
        };

        /// The step increment of the adjustment.
        pub const step_increment = struct {
            pub const name = "step-increment";

            pub const Type = f64;
        };

        /// The maximum value of the adjustment.
        ///
        /// Note that values will be restricted by `upper - page-size` if the page-size
        /// property is nonzero.
        pub const upper = struct {
            pub const name = "upper";

            pub const Type = f64;
        };

        /// The value of the adjustment.
        pub const value = struct {
            pub const name = "value";

            pub const Type = f64;
        };
    };

    pub const signals = struct {
        /// Emitted when one or more of the `GtkAdjustment` properties have been
        /// changed.
        ///
        /// Note that the `gtk.Adjustment.properties.value` property is
        /// covered by the `gtk.Adjustment.signals.value_changed` signal.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Adjustment, p_instance))),
                    gobject.signalLookup("changed", Adjustment.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the value has been changed.
        pub const value_changed = struct {
            pub const name = "value-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Adjustment, p_instance))),
                    gobject.signalLookup("value-changed", Adjustment.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkAdjustment`.
    extern fn gtk_adjustment_new(p_value: f64, p_lower: f64, p_upper: f64, p_step_increment: f64, p_page_increment: f64, p_page_size: f64) *gtk.Adjustment;
    pub const new = gtk_adjustment_new;

    /// Updates the value of the adjustment to ensure that the
    /// given range is contained in the current page.
    ///
    /// The current page goes from `value` to `value` + `page-size`.
    /// If the range is larger than the page size, then only the
    /// start of it will be in the current page.
    ///
    /// A `gtk.Adjustment.signals.value_changed` signal will be emitted
    /// if the value is changed.
    extern fn gtk_adjustment_clamp_page(p_adjustment: *Adjustment, p_lower: f64, p_upper: f64) void;
    pub const clampPage = gtk_adjustment_clamp_page;

    /// Sets all properties of the adjustment at once.
    ///
    /// Use this function to avoid multiple emissions of the
    /// `gtk.Adjustment.signals.changed` signal. See
    /// `gtk.Adjustment.setLower` for an alternative
    /// way of compressing multiple emissions of
    /// `gtk.Adjustment.signals.changed` into one.
    extern fn gtk_adjustment_configure(p_adjustment: *Adjustment, p_value: f64, p_lower: f64, p_upper: f64, p_step_increment: f64, p_page_increment: f64, p_page_size: f64) void;
    pub const configure = gtk_adjustment_configure;

    /// Retrieves the minimum value of the adjustment.
    extern fn gtk_adjustment_get_lower(p_adjustment: *Adjustment) f64;
    pub const getLower = gtk_adjustment_get_lower;

    /// Gets the smaller of step increment and page increment.
    extern fn gtk_adjustment_get_minimum_increment(p_adjustment: *Adjustment) f64;
    pub const getMinimumIncrement = gtk_adjustment_get_minimum_increment;

    /// Retrieves the page increment of the adjustment.
    extern fn gtk_adjustment_get_page_increment(p_adjustment: *Adjustment) f64;
    pub const getPageIncrement = gtk_adjustment_get_page_increment;

    /// Retrieves the page size of the adjustment.
    extern fn gtk_adjustment_get_page_size(p_adjustment: *Adjustment) f64;
    pub const getPageSize = gtk_adjustment_get_page_size;

    /// Retrieves the step increment of the adjustment.
    extern fn gtk_adjustment_get_step_increment(p_adjustment: *Adjustment) f64;
    pub const getStepIncrement = gtk_adjustment_get_step_increment;

    /// Retrieves the maximum value of the adjustment.
    extern fn gtk_adjustment_get_upper(p_adjustment: *Adjustment) f64;
    pub const getUpper = gtk_adjustment_get_upper;

    /// Gets the current value of the adjustment.
    extern fn gtk_adjustment_get_value(p_adjustment: *Adjustment) f64;
    pub const getValue = gtk_adjustment_get_value;

    /// Sets the minimum value of the adjustment.
    ///
    /// When setting multiple adjustment properties via their individual
    /// setters, multiple `gtk.Adjustment.signals.changed` signals will
    /// be emitted. However, since the emission of the
    /// `gtk.Adjustment.signals.changed` signal is tied to the emission
    /// of the ::notify signals of the changed properties, it’s possible
    /// to compress the `gtk.Adjustment.signals.changed` signals into one
    /// by calling `gobject.Object.freezeNotify` and `gobject.Object.thawNotify`
    /// around the calls to the individual setters.
    ///
    /// Alternatively, using a single `gobject.Object.set` for all the properties
    /// to change, or using `gtk.Adjustment.configure` has the same effect.
    extern fn gtk_adjustment_set_lower(p_adjustment: *Adjustment, p_lower: f64) void;
    pub const setLower = gtk_adjustment_set_lower;

    /// Sets the page increment of the adjustment.
    ///
    /// See `gtk.Adjustment.setLower` about how to compress
    /// multiple emissions of the `gtk.Adjustment.signals.changed`
    /// signal when setting multiple adjustment properties.
    extern fn gtk_adjustment_set_page_increment(p_adjustment: *Adjustment, p_page_increment: f64) void;
    pub const setPageIncrement = gtk_adjustment_set_page_increment;

    /// Sets the page size of the adjustment.
    ///
    /// See `gtk.Adjustment.setLower` about how to compress
    /// multiple emissions of the `gtk.Adjustment.signals.changed`
    /// signal when setting multiple adjustment properties.
    extern fn gtk_adjustment_set_page_size(p_adjustment: *Adjustment, p_page_size: f64) void;
    pub const setPageSize = gtk_adjustment_set_page_size;

    /// Sets the step increment of the adjustment.
    ///
    /// See `gtk.Adjustment.setLower` about how to compress
    /// multiple emissions of the `gtk.Adjustment.signals.changed`
    /// signal when setting multiple adjustment properties.
    extern fn gtk_adjustment_set_step_increment(p_adjustment: *Adjustment, p_step_increment: f64) void;
    pub const setStepIncrement = gtk_adjustment_set_step_increment;

    /// Sets the maximum value of the adjustment.
    ///
    /// Note that values will be restricted by `upper - page-size`
    /// if the page-size property is nonzero.
    ///
    /// See `gtk.Adjustment.setLower` about how to compress
    /// multiple emissions of the `gtk.Adjustment.signals.changed`
    /// signal when setting multiple adjustment properties.
    extern fn gtk_adjustment_set_upper(p_adjustment: *Adjustment, p_upper: f64) void;
    pub const setUpper = gtk_adjustment_set_upper;

    /// Sets the `GtkAdjustment` value.
    ///
    /// The value is clamped to lie between `gtk.Adjustment.properties.lower`
    /// and `gtk.Adjustment.properties.upper`.
    ///
    /// Note that for adjustments which are used in a `GtkScrollbar`,
    /// the effective range of allowed values goes from
    /// `gtk.Adjustment.properties.lower` to
    /// `gtk.Adjustment.properties.upper` - `gtk.Adjustment.properties.page_size`.
    extern fn gtk_adjustment_set_value(p_adjustment: *Adjustment, p_value: f64) void;
    pub const setValue = gtk_adjustment_set_value;

    extern fn gtk_adjustment_get_type() usize;
    pub const getGObjectType = gtk_adjustment_get_type;

    extern fn g_object_ref(p_self: *gtk.Adjustment) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Adjustment) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Adjustment, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Collects the arguments that are needed to present a message to the user.
///
/// The message is shown with the `gtk.AlertDialog.choose`
/// function.
///
/// If you don't need to wait for a button to be clicked, you can use
/// `gtk.AlertDialog.show`.
pub const AlertDialog = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.AlertDialogClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Labels for buttons to show in the alert.
        ///
        /// The labels should be translated and may contain
        /// a `_` character to indicate the mnemonic character.
        ///
        /// If this property is not set, then a 'Close' button is
        /// automatically created.
        pub const buttons = struct {
            pub const name = "buttons";

            pub const Type = ?[*][*:0]u8;
        };

        /// Determines what happens when the <kbd>Escape</kbd> key is pressed
        /// while the alert is shown.
        ///
        /// If this property holds the index of a button in `gtk.AlertDialog.properties.buttons`,
        /// then pressing Escape is treated as if that button was pressed. If it is -1
        /// or not a valid index for the `buttons` array, then an error is returned.
        ///
        /// If `buttons` is `NULL`, then the automatically created 'Close' button
        /// is treated as both cancel and default button, so 0 is returned.
        pub const cancel_button = struct {
            pub const name = "cancel-button";

            pub const Type = c_int;
        };

        /// Determines what happens when the <kbd>Return</kbd> key is pressed
        /// while the alert is shown.
        ///
        /// If this property holds the index of a button in `gtk.AlertDialog.properties.buttons`,
        /// then pressing Return is treated as if that button was pressed. If it is -1
        /// or not a valid index for the `buttons` array, then nothing happens.
        ///
        /// If `buttons` is `NULL`, then the automatically created 'Close' button
        /// is treated as both cancel and default button, so 0 is returned.
        pub const default_button = struct {
            pub const name = "default-button";

            pub const Type = c_int;
        };

        /// The detail text for the alert.
        pub const detail = struct {
            pub const name = "detail";

            pub const Type = ?[*:0]u8;
        };

        /// The message for the alert.
        pub const message = struct {
            pub const name = "message";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the alert is modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkAlertDialog` object.
    ///
    /// The message will be set to the formatted string
    /// resulting from the arguments.
    extern fn gtk_alert_dialog_new(p_format: [*:0]const u8, ...) *gtk.AlertDialog;
    pub const new = gtk_alert_dialog_new;

    /// Shows the alert to the user.
    ///
    /// It is ok to pass `NULL` for the callback if the alert
    /// does not have more than one button. A simpler API for
    /// this case is `gtk.AlertDialog.show`.
    extern fn gtk_alert_dialog_choose(p_self: *AlertDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const choose = gtk_alert_dialog_choose;

    /// Finishes the `gtk.AlertDialog.choose` call.
    extern fn gtk_alert_dialog_choose_finish(p_self: *AlertDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) c_int;
    pub const chooseFinish = gtk_alert_dialog_choose_finish;

    /// Returns the button labels for the alert.
    extern fn gtk_alert_dialog_get_buttons(p_self: *AlertDialog) ?[*]const [*:0]const u8;
    pub const getButtons = gtk_alert_dialog_get_buttons;

    /// Returns the index of the cancel button.
    extern fn gtk_alert_dialog_get_cancel_button(p_self: *AlertDialog) c_int;
    pub const getCancelButton = gtk_alert_dialog_get_cancel_button;

    /// Returns the index of the default button.
    extern fn gtk_alert_dialog_get_default_button(p_self: *AlertDialog) c_int;
    pub const getDefaultButton = gtk_alert_dialog_get_default_button;

    /// Returns the detail text that will be shown in the alert.
    extern fn gtk_alert_dialog_get_detail(p_self: *AlertDialog) [*:0]const u8;
    pub const getDetail = gtk_alert_dialog_get_detail;

    /// Returns the message that will be shown in the alert.
    extern fn gtk_alert_dialog_get_message(p_self: *AlertDialog) [*:0]const u8;
    pub const getMessage = gtk_alert_dialog_get_message;

    /// Returns whether the alert blocks interaction
    /// with the parent window while it is presented.
    extern fn gtk_alert_dialog_get_modal(p_self: *AlertDialog) c_int;
    pub const getModal = gtk_alert_dialog_get_modal;

    /// Sets the button labels for the alert.
    extern fn gtk_alert_dialog_set_buttons(p_self: *AlertDialog, p_labels: [*]const [*:0]const u8) void;
    pub const setButtons = gtk_alert_dialog_set_buttons;

    /// Sets the index of the cancel button.
    ///
    /// See `gtk.AlertDialog.properties.cancel_button` for
    /// details of how this value is used.
    extern fn gtk_alert_dialog_set_cancel_button(p_self: *AlertDialog, p_button: c_int) void;
    pub const setCancelButton = gtk_alert_dialog_set_cancel_button;

    /// Sets the index of the default button.
    ///
    /// See `gtk.AlertDialog.properties.default_button` for
    /// details of how this value is used.
    extern fn gtk_alert_dialog_set_default_button(p_self: *AlertDialog, p_button: c_int) void;
    pub const setDefaultButton = gtk_alert_dialog_set_default_button;

    /// Sets the detail text that will be shown in the alert.
    extern fn gtk_alert_dialog_set_detail(p_self: *AlertDialog, p_detail: [*:0]const u8) void;
    pub const setDetail = gtk_alert_dialog_set_detail;

    /// Sets the message that will be shown in the alert.
    extern fn gtk_alert_dialog_set_message(p_self: *AlertDialog, p_message: [*:0]const u8) void;
    pub const setMessage = gtk_alert_dialog_set_message;

    /// Sets whether the alert blocks interaction
    /// with the parent window while it is presented.
    extern fn gtk_alert_dialog_set_modal(p_self: *AlertDialog, p_modal: c_int) void;
    pub const setModal = gtk_alert_dialog_set_modal;

    /// Shows the alert to the user.
    ///
    /// This function is a simpler version of `gtk.AlertDialog.choose`
    /// intended for dialogs with a single button.
    ///
    /// If you want to cancel the dialog or if the alert has more than one
    /// button, you should use that function instead and provide it with a
    /// `gio.Cancellable` and callback respectively.
    extern fn gtk_alert_dialog_show(p_self: *AlertDialog, p_parent: ?*gtk.Window) void;
    pub const show = gtk_alert_dialog_show;

    extern fn gtk_alert_dialog_get_type() usize;
    pub const getGObjectType = gtk_alert_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.AlertDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AlertDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AlertDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Combines two shortcut triggers.
///
/// The `GtkAlternativeTrigger` triggers when either of the two trigger.
///
/// This can be cascaded to combine more than two triggers.
pub const AlternativeTrigger = opaque {
    pub const Parent = gtk.ShortcutTrigger;
    pub const Implements = [_]type{};
    pub const Class = gtk.AlternativeTriggerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The first `GtkShortcutTrigger` to check.
        pub const first = struct {
            pub const name = "first";

            pub const Type = ?*gtk.ShortcutTrigger;
        };

        /// The second `GtkShortcutTrigger` to check.
        pub const second = struct {
            pub const name = "second";

            pub const Type = ?*gtk.ShortcutTrigger;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkShortcutTrigger` that will trigger whenever
    /// either of the two given triggers gets triggered.
    ///
    /// Note that nesting is allowed, so if you want more than two
    /// alternative, create a new alternative trigger for each option.
    extern fn gtk_alternative_trigger_new(p_first: *gtk.ShortcutTrigger, p_second: *gtk.ShortcutTrigger) *gtk.AlternativeTrigger;
    pub const new = gtk_alternative_trigger_new;

    /// Gets the first of the two alternative triggers that may
    /// trigger `self`.
    ///
    /// `gtk.AlternativeTrigger.getSecond` will return
    /// the other one.
    extern fn gtk_alternative_trigger_get_first(p_self: *AlternativeTrigger) *gtk.ShortcutTrigger;
    pub const getFirst = gtk_alternative_trigger_get_first;

    /// Gets the second of the two alternative triggers that may
    /// trigger `self`.
    ///
    /// `gtk.AlternativeTrigger.getFirst` will return
    /// the other one.
    extern fn gtk_alternative_trigger_get_second(p_self: *AlternativeTrigger) *gtk.ShortcutTrigger;
    pub const getSecond = gtk_alternative_trigger_get_second;

    extern fn gtk_alternative_trigger_get_type() usize;
    pub const getGObjectType = gtk_alternative_trigger_get_type;

    extern fn g_object_ref(p_self: *gtk.AlternativeTrigger) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AlternativeTrigger) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AlternativeTrigger, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Matches an item when at least one of its filters matches.
///
/// To add filters to a `GtkAnyFilter`, use `gtk.MultiFilter.append`.
pub const AnyFilter = opaque {
    pub const Parent = gtk.MultiFilter;
    pub const Implements = [_]type{ gio.ListModel, gtk.Buildable };
    pub const Class = gtk.AnyFilterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new empty "any" filter.
    ///
    /// Use `gtk.MultiFilter.append` to add filters to it.
    ///
    /// This filter matches an item if any of the filters added to it
    /// matches the item. In particular, this means that if no filter
    /// has been added to it, the filter matches no item.
    extern fn gtk_any_filter_new() *gtk.AnyFilter;
    pub const new = gtk_any_filter_new;

    extern fn gtk_any_filter_get_type() usize;
    pub const getGObjectType = gtk_any_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.AnyFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AnyFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AnyFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkAppChooserButton` lets the user select an application.
///
/// <picture>
///   <source srcset="appchooserbutton-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkAppChooserButton" src="appchooserbutton.png">
/// </picture>
///
/// Initially, a `GtkAppChooserButton` selects the first application
/// in its list, which will either be the most-recently used application
/// or, if `gtk.AppChooserButton.properties.show_default_item` is `TRUE`, the
/// default application.
///
/// The list of applications shown in a `GtkAppChooserButton` includes
/// the recommended applications for the given content type. When
/// `gtk.AppChooserButton.properties.show_default_item` is set, the default
/// application is also included. To let the user chooser other applications,
/// you can set the `gtk.AppChooserButton.properties.show_dialog_item` property,
/// which allows to open a full `gtk.AppChooserDialog`.
///
/// It is possible to add custom items to the list, using
/// `gtk.AppChooserButton.appendCustomItem`. These items cause
/// the `gtk.AppChooserButton.signals.custom_item_activated` signal to be
/// emitted when they are selected.
///
/// To track changes in the selected application, use the
/// `gtk.AppChooserButton.signals.changed` signal.
///
/// ## CSS nodes
///
/// `GtkAppChooserButton` has a single CSS node with the name “appchooserbutton”.
pub const AppChooserButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AppChooser, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = AppChooserButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The text to show at the top of the dialog that can be
        /// opened from the button.
        ///
        /// The string may contain Pango markup.
        pub const heading = struct {
            pub const name = "heading";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the app chooser dialog should be modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// Determines whether the dropdown menu shows the default application
        /// on top for the provided content type.
        pub const show_default_item = struct {
            pub const name = "show-default-item";

            pub const Type = c_int;
        };

        /// Determines whether the dropdown menu shows an item to open
        /// a `GtkAppChooserDialog`.
        pub const show_dialog_item = struct {
            pub const name = "show-dialog-item";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to when the button is activated.
        ///
        /// The `::activate` signal on `GtkAppChooserButton` is an action signal and
        /// emitting it causes the button to pop up its dialog.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(AppChooserButton, p_instance))),
                    gobject.signalLookup("activate", AppChooserButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the active application changes.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(AppChooserButton, p_instance))),
                    gobject.signalLookup("changed", AppChooserButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a custom item is activated.
        ///
        /// Use `gtk.AppChooserButton.appendCustomItem`,
        /// to add custom items.
        pub const custom_item_activated = struct {
            pub const name = "custom-item-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_item_name: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(AppChooserButton, p_instance))),
                    gobject.signalLookup("custom-item-activated", AppChooserButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkAppChooserButton` for applications
    /// that can handle content of the given type.
    extern fn gtk_app_chooser_button_new(p_content_type: [*:0]const u8) *gtk.AppChooserButton;
    pub const new = gtk_app_chooser_button_new;

    /// Appends a custom item to the list of applications that is shown
    /// in the popup.
    ///
    /// The item name must be unique per-widget. Clients can use the
    /// provided name as a detail for the
    /// `gtk.AppChooserButton.signals.custom_item_activated` signal, to add a
    /// callback for the activation of a particular custom item in the list.
    ///
    /// See also `gtk.AppChooserButton.appendSeparator`.
    extern fn gtk_app_chooser_button_append_custom_item(p_self: *AppChooserButton, p_name: [*:0]const u8, p_label: [*:0]const u8, p_icon: *gio.Icon) void;
    pub const appendCustomItem = gtk_app_chooser_button_append_custom_item;

    /// Appends a separator to the list of applications that is shown
    /// in the popup.
    extern fn gtk_app_chooser_button_append_separator(p_self: *AppChooserButton) void;
    pub const appendSeparator = gtk_app_chooser_button_append_separator;

    /// Returns the text to display at the top of the dialog.
    extern fn gtk_app_chooser_button_get_heading(p_self: *AppChooserButton) ?[*:0]const u8;
    pub const getHeading = gtk_app_chooser_button_get_heading;

    /// Gets whether the dialog is modal.
    extern fn gtk_app_chooser_button_get_modal(p_self: *AppChooserButton) c_int;
    pub const getModal = gtk_app_chooser_button_get_modal;

    /// Returns whether the dropdown menu should show the default
    /// application at the top.
    extern fn gtk_app_chooser_button_get_show_default_item(p_self: *AppChooserButton) c_int;
    pub const getShowDefaultItem = gtk_app_chooser_button_get_show_default_item;

    /// Returns whether the dropdown menu shows an item
    /// for a `GtkAppChooserDialog`.
    extern fn gtk_app_chooser_button_get_show_dialog_item(p_self: *AppChooserButton) c_int;
    pub const getShowDialogItem = gtk_app_chooser_button_get_show_dialog_item;

    /// Selects a custom item.
    ///
    /// See `gtk.AppChooserButton.appendCustomItem`.
    ///
    /// Use `gtk.AppChooser.refresh` to bring the selection
    /// to its initial state.
    extern fn gtk_app_chooser_button_set_active_custom_item(p_self: *AppChooserButton, p_name: [*:0]const u8) void;
    pub const setActiveCustomItem = gtk_app_chooser_button_set_active_custom_item;

    /// Sets the text to display at the top of the dialog.
    ///
    /// If the heading is not set, the dialog displays a default text.
    extern fn gtk_app_chooser_button_set_heading(p_self: *AppChooserButton, p_heading: [*:0]const u8) void;
    pub const setHeading = gtk_app_chooser_button_set_heading;

    /// Sets whether the dialog should be modal.
    extern fn gtk_app_chooser_button_set_modal(p_self: *AppChooserButton, p_modal: c_int) void;
    pub const setModal = gtk_app_chooser_button_set_modal;

    /// Sets whether the dropdown menu of this button should show the
    /// default application for the given content type at top.
    extern fn gtk_app_chooser_button_set_show_default_item(p_self: *AppChooserButton, p_setting: c_int) void;
    pub const setShowDefaultItem = gtk_app_chooser_button_set_show_default_item;

    /// Sets whether the dropdown menu of this button should show an
    /// entry to trigger a `GtkAppChooserDialog`.
    extern fn gtk_app_chooser_button_set_show_dialog_item(p_self: *AppChooserButton, p_setting: c_int) void;
    pub const setShowDialogItem = gtk_app_chooser_button_set_show_dialog_item;

    extern fn gtk_app_chooser_button_get_type() usize;
    pub const getGObjectType = gtk_app_chooser_button_get_type;

    extern fn g_object_ref(p_self: *gtk.AppChooserButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AppChooserButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AppChooserButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkAppChooserDialog` shows a `GtkAppChooserWidget` inside a `GtkDialog`.
///
/// <picture>
///   <source srcset="appchooserdialog-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkAppChooserDialog" src="appchooserdialog.png">
/// </picture>
///
/// Note that `GtkAppChooserDialog` does not have any interesting methods
/// of its own. Instead, you should get the embedded `GtkAppChooserWidget`
/// using `gtk.AppChooserDialog.getWidget` and call its methods if
/// the generic `gtk.AppChooser` interface is not sufficient for
/// your needs.
///
/// To set the heading that is shown above the `GtkAppChooserWidget`,
/// use `gtk.AppChooserDialog.setHeading`.
///
/// ## CSS nodes
///
/// `GtkAppChooserDialog` has a single CSS node with the name `window` and style
/// class `.appchooser`.
pub const AppChooserDialog = opaque {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AppChooser, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = AppChooserDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The GFile used by the `GtkAppChooserDialog`.
        ///
        /// The dialog's `GtkAppChooserWidget` content type will
        /// be guessed from the file, if present.
        pub const gfile = struct {
            pub const name = "gfile";

            pub const Type = ?*gio.File;
        };

        /// The text to show at the top of the dialog.
        ///
        /// The string may contain Pango markup.
        pub const heading = struct {
            pub const name = "heading";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkAppChooserDialog` for the provided `GFile`.
    ///
    /// The dialog will show applications that can open the file.
    extern fn gtk_app_chooser_dialog_new(p_parent: ?*gtk.Window, p_flags: gtk.DialogFlags, p_file: *gio.File) *gtk.AppChooserDialog;
    pub const new = gtk_app_chooser_dialog_new;

    /// Creates a new `GtkAppChooserDialog` for the provided content type.
    ///
    /// The dialog will show applications that can open the content type.
    extern fn gtk_app_chooser_dialog_new_for_content_type(p_parent: ?*gtk.Window, p_flags: gtk.DialogFlags, p_content_type: [*:0]const u8) *gtk.AppChooserDialog;
    pub const newForContentType = gtk_app_chooser_dialog_new_for_content_type;

    /// Returns the text to display at the top of the dialog.
    extern fn gtk_app_chooser_dialog_get_heading(p_self: *AppChooserDialog) ?[*:0]const u8;
    pub const getHeading = gtk_app_chooser_dialog_get_heading;

    /// Returns the `GtkAppChooserWidget` of this dialog.
    extern fn gtk_app_chooser_dialog_get_widget(p_self: *AppChooserDialog) *gtk.Widget;
    pub const getWidget = gtk_app_chooser_dialog_get_widget;

    /// Sets the text to display at the top of the dialog.
    ///
    /// If the heading is not set, the dialog displays a default text.
    extern fn gtk_app_chooser_dialog_set_heading(p_self: *AppChooserDialog, p_heading: [*:0]const u8) void;
    pub const setHeading = gtk_app_chooser_dialog_set_heading;

    extern fn gtk_app_chooser_dialog_get_type() usize;
    pub const getGObjectType = gtk_app_chooser_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.AppChooserDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AppChooserDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AppChooserDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkAppChooserWidget` is a widget for selecting applications.
///
/// It is the main building block for `gtk.AppChooserDialog`.
/// Most applications only need to use the latter; but you can use
/// this widget as part of a larger widget if you have special needs.
///
/// `GtkAppChooserWidget` offers detailed control over what applications
/// are shown, using the
/// `gtk.AppChooserWidget.properties.show_default`,
/// `gtk.AppChooserWidget.properties.show_recommended`,
/// `gtk.AppChooserWidget.properties.show_fallback`,
/// `gtk.AppChooserWidget.properties.show_other` and
/// `gtk.AppChooserWidget.properties.show_all` properties. See the
/// `gtk.AppChooser` documentation for more information about these
/// groups of applications.
///
/// To keep track of the selected application, use the
/// `gtk.AppChooserWidget.signals.application_selected` and
/// `gtk.AppChooserWidget.signals.application_activated` signals.
///
/// ## CSS nodes
///
/// `GtkAppChooserWidget` has a single CSS node with name appchooser.
pub const AppChooserWidget = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AppChooser, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = AppChooserWidget;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The text that appears in the widget when there are no applications
        /// for the given content type.
        pub const default_text = struct {
            pub const name = "default-text";

            pub const Type = ?[*:0]u8;
        };

        /// If `TRUE`, the app chooser presents all applications
        /// in a single list, without subsections for default,
        /// recommended or related applications.
        pub const show_all = struct {
            pub const name = "show-all";

            pub const Type = c_int;
        };

        /// Determines whether the app chooser should show the default
        /// handler for the content type in a separate section.
        ///
        /// If `FALSE`, the default handler is listed among the recommended
        /// applications.
        pub const show_default = struct {
            pub const name = "show-default";

            pub const Type = c_int;
        };

        /// Determines whether the app chooser should show a section
        /// for fallback applications.
        ///
        /// If `FALSE`, the fallback applications are listed among the
        /// other applications.
        pub const show_fallback = struct {
            pub const name = "show-fallback";

            pub const Type = c_int;
        };

        /// Determines whether the app chooser should show a section
        /// for other applications.
        pub const show_other = struct {
            pub const name = "show-other";

            pub const Type = c_int;
        };

        /// Determines whether the app chooser should show a section
        /// for recommended applications.
        ///
        /// If `FALSE`, the recommended applications are listed
        /// among the other applications.
        pub const show_recommended = struct {
            pub const name = "show-recommended";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when an application item is activated from the widget's list.
        ///
        /// This usually happens when the user double clicks an item, or an item
        /// is selected and the user presses one of the keys Space, Shift+Space,
        /// Return or Enter.
        pub const application_activated = struct {
            pub const name = "application-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_application: *gio.AppInfo, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(AppChooserWidget, p_instance))),
                    gobject.signalLookup("application-activated", AppChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when an application item is selected from the widget's list.
        pub const application_selected = struct {
            pub const name = "application-selected";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_application: *gio.AppInfo, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(AppChooserWidget, p_instance))),
                    gobject.signalLookup("application-selected", AppChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkAppChooserWidget` for applications
    /// that can handle content of the given type.
    extern fn gtk_app_chooser_widget_new(p_content_type: [*:0]const u8) *gtk.AppChooserWidget;
    pub const new = gtk_app_chooser_widget_new;

    /// Returns the text that is shown if there are not applications
    /// that can handle the content type.
    extern fn gtk_app_chooser_widget_get_default_text(p_self: *AppChooserWidget) ?[*:0]const u8;
    pub const getDefaultText = gtk_app_chooser_widget_get_default_text;

    /// Gets whether the app chooser should show all applications
    /// in a flat list.
    extern fn gtk_app_chooser_widget_get_show_all(p_self: *AppChooserWidget) c_int;
    pub const getShowAll = gtk_app_chooser_widget_get_show_all;

    /// Gets whether the app chooser should show the default handler
    /// for the content type in a separate section.
    extern fn gtk_app_chooser_widget_get_show_default(p_self: *AppChooserWidget) c_int;
    pub const getShowDefault = gtk_app_chooser_widget_get_show_default;

    /// Gets whether the app chooser should show related applications
    /// for the content type in a separate section.
    extern fn gtk_app_chooser_widget_get_show_fallback(p_self: *AppChooserWidget) c_int;
    pub const getShowFallback = gtk_app_chooser_widget_get_show_fallback;

    /// Gets whether the app chooser should show applications
    /// which are unrelated to the content type.
    extern fn gtk_app_chooser_widget_get_show_other(p_self: *AppChooserWidget) c_int;
    pub const getShowOther = gtk_app_chooser_widget_get_show_other;

    /// Gets whether the app chooser should show recommended applications
    /// for the content type in a separate section.
    extern fn gtk_app_chooser_widget_get_show_recommended(p_self: *AppChooserWidget) c_int;
    pub const getShowRecommended = gtk_app_chooser_widget_get_show_recommended;

    /// Sets the text that is shown if there are not applications
    /// that can handle the content type.
    extern fn gtk_app_chooser_widget_set_default_text(p_self: *AppChooserWidget, p_text: [*:0]const u8) void;
    pub const setDefaultText = gtk_app_chooser_widget_set_default_text;

    /// Sets whether the app chooser should show all applications
    /// in a flat list.
    extern fn gtk_app_chooser_widget_set_show_all(p_self: *AppChooserWidget, p_setting: c_int) void;
    pub const setShowAll = gtk_app_chooser_widget_set_show_all;

    /// Sets whether the app chooser should show the default handler
    /// for the content type in a separate section.
    extern fn gtk_app_chooser_widget_set_show_default(p_self: *AppChooserWidget, p_setting: c_int) void;
    pub const setShowDefault = gtk_app_chooser_widget_set_show_default;

    /// Sets whether the app chooser should show related applications
    /// for the content type in a separate section.
    extern fn gtk_app_chooser_widget_set_show_fallback(p_self: *AppChooserWidget, p_setting: c_int) void;
    pub const setShowFallback = gtk_app_chooser_widget_set_show_fallback;

    /// Sets whether the app chooser should show applications
    /// which are unrelated to the content type.
    extern fn gtk_app_chooser_widget_set_show_other(p_self: *AppChooserWidget, p_setting: c_int) void;
    pub const setShowOther = gtk_app_chooser_widget_set_show_other;

    /// Sets whether the app chooser should show recommended applications
    /// for the content type in a separate section.
    extern fn gtk_app_chooser_widget_set_show_recommended(p_self: *AppChooserWidget, p_setting: c_int) void;
    pub const setShowRecommended = gtk_app_chooser_widget_set_show_recommended;

    extern fn gtk_app_chooser_widget_get_type() usize;
    pub const getGObjectType = gtk_app_chooser_widget_get_type;

    extern fn g_object_ref(p_self: *gtk.AppChooserWidget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AppChooserWidget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AppChooserWidget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A high-level API for writing applications.
///
/// `GtkApplication` supports many aspects of writing a GTK application
/// in a convenient fashion, without enforcing a one-size-fits-all model.
///
/// Currently, it handles GTK initialization, application uniqueness, session
/// management, provides some basic scriptability and desktop shell integration
/// by exporting actions and menus and manages a list of toplevel windows whose
/// life-cycle is automatically tied to the life-cycle of your application.
///
/// While `GtkApplication` works fine with plain `gtk.Window`s,
/// it is recommended to use it together with `gtk.ApplicationWindow`.
///
/// ## Initialization
///
/// A typical `GtkApplication` will create a window in its
/// `gio.Application.signals.activate`, `gio.Application.signals.open`
/// or `gio.Application.signals.command_line` handlers. Note that all
/// of these signals may be emitted multiple times, so handlers must
/// be careful to take existing windows into account.
///
/// A typical ::activate handler should look like this:
///
/// ```
/// static void
/// activate (GApplication *gapp)
/// {
///   GtkApplication *app = GTK_APPLICATION (gapp);
///   GtkWindow *window;
///
///   window = gtk_application_get_active_window (app);
///   if (!window)
///     window = create_window (app);
///
///   gtk_window_present (window);
/// }
/// ```
///
/// ## Automatic resources
///
/// `GtkApplication` will automatically load menus from the `GtkBuilder`
/// resource located at "gtk/menus.ui", relative to the application's
/// resource base path (see `gio.Application.setResourceBasePath`).
/// The menu with the ID "menubar" is taken as the application's
/// menubar. Additional menus (most interesting submenus) can be named
/// and accessed via `gtk.Application.getMenuById` which allows for
/// dynamic population of a part of the menu structure.
///
/// Note that automatic resource loading uses the resource base path
/// that is set at construction time and will not work if the resource
/// base path is changed at a later time.
///
/// It is also possible to provide the menubar manually using
/// `gtk.Application.setMenubar`.
///
/// `GtkApplication` will also automatically setup an icon search path for
/// the default icon theme by appending "icons" to the resource base
/// path. This allows your application to easily store its icons as
/// resources. See `gtk.IconTheme.addResourcePath` for more
/// information.
///
/// If there is a resource located at `gtk/help-overlay.ui` which
/// defines a `gtk.ShortcutsWindow` with ID `help_overlay` then
/// `GtkApplication` associates an instance of this shortcuts window with
/// each `gtk.ApplicationWindow` and sets up the keyboard accelerator
/// <kbd>Control</kbd>+<kbd>?</kbd> to open it. To create a menu item that
/// displays the shortcuts window, associate the item with the action
/// `win.show-help-overlay`.
///
/// `GtkApplication` will also automatically set the application id as the
/// default window icon. Use `gtk.Window.setDefaultIconName` or
/// `gtk.Window.properties.icon_name` to override that behavior.
///
/// # Inhibiting
///
/// An application can block various ways to end the session with
/// the `gtk.Application.inhibit` function. Typical use cases for
/// this kind of inhibiting are long-running, uninterruptible operations,
/// such as burning a CD or performing a disk backup. The session
/// manager may not honor the inhibitor, but it can be expected to
/// inform the user about the negative consequences of ending the
/// session while inhibitors are present.
///
/// ## A simple application
///
/// [A simple example](https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/bp/bloatpad.c)
/// is available in the GTK source code repository
///
/// ## See Also
///
/// - [Using GtkApplication](https://developer.gnome.org/documentation/tutorials/application.html)
/// - [Getting Started with GTK: Basics](getting_started.html`basics`)
pub const Application = extern struct {
    pub const Parent = gio.Application;
    pub const Implements = [_]type{ gio.ActionGroup, gio.ActionMap };
    pub const Class = gtk.ApplicationClass;
    f_parent_instance: gio.Application,

    pub const virtual_methods = struct {
        /// Signal emitted when a `GtkWindow` is added to
        ///    application through `gtk.Application.addWindow`.
        pub const window_added = struct {
            pub fn call(p_class: anytype, p_application: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_window: *gtk.Window) void {
                return gobject.ext.as(Application.Class, p_class).f_window_added.?(gobject.ext.as(Application, p_application), p_window);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_application: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_window: *gtk.Window) callconv(.c) void) void {
                gobject.ext.as(Application.Class, p_class).f_window_added = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when a `GtkWindow` is removed from
        ///    application, either as a side-effect of being destroyed or
        ///    explicitly through `gtk.Application.removeWindow`.
        pub const window_removed = struct {
            pub fn call(p_class: anytype, p_application: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_window: *gtk.Window) void {
                return gobject.ext.as(Application.Class, p_class).f_window_removed.?(gobject.ext.as(Application, p_application), p_window);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_application: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_window: *gtk.Window) callconv(.c) void) void {
                gobject.ext.as(Application.Class, p_class).f_window_removed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The currently focused window of the application.
        pub const active_window = struct {
            pub const name = "active-window";

            pub const Type = ?*gtk.Window;
        };

        /// The menu model to be used for the application's menu bar.
        pub const menubar = struct {
            pub const name = "menubar";

            pub const Type = ?*gio.MenuModel;
        };

        /// Set this property to true to register with the session manager.
        ///
        /// This will make GTK track the session state (such as the
        /// `gtk.Application.properties.screensaver_active` property).
        pub const register_session = struct {
            pub const name = "register-session";

            pub const Type = c_int;
        };

        /// This property is true if GTK believes that the screensaver
        /// is currently active.
        ///
        /// Tracking the screensaver state is currently only supported on
        /// Linux.
        pub const screensaver_active = struct {
            pub const name = "screensaver-active";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the session manager is about to end the session.
        ///
        /// Applications can connect to this signal and call
        /// `gtk.Application.inhibit` with `gtk.@"ApplicationInhibitFlags.logout"`
        /// to delay the end of the session until state has been saved.
        pub const query_end = struct {
            pub const name = "query-end";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Application, p_instance))),
                    gobject.signalLookup("query-end", Application.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a window is added to an application.
        ///
        /// See `gtk.Application.addWindow`.
        pub const window_added = struct {
            pub const name = "window-added";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_window: *gtk.Window, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Application, p_instance))),
                    gobject.signalLookup("window-added", Application.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a window is removed from an application.
        ///
        /// This can happen as a side-effect of the window being destroyed
        /// or explicitly through `gtk.Application.removeWindow`.
        pub const window_removed = struct {
            pub const name = "window-removed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_window: *gtk.Window, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Application, p_instance))),
                    gobject.signalLookup("window-removed", Application.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new application instance.
    ///
    /// When using `GtkApplication`, it is not necessary to call `gtk.init`
    /// manually. It is called as soon as the application gets registered as
    /// the primary instance.
    ///
    /// Concretely, `gtk.init` is called in the default handler for the
    /// `GApplication::startup` signal. Therefore, `GtkApplication` subclasses
    /// should always chain up in their `gio.Application.virtual_methods.startup` handler
    /// before using any GTK API.
    ///
    /// Note that commandline arguments are not passed to `gtk.init`.
    ///
    /// If `application_id` is not `NULL`, then it must be valid. See
    /// `gio.Application.idIsValid`.
    ///
    /// If no application ID is given then some features (most notably application
    /// uniqueness) will be disabled.
    extern fn gtk_application_new(p_application_id: ?[*:0]const u8, p_flags: gio.ApplicationFlags) *gtk.Application;
    pub const new = gtk_application_new;

    /// Adds a window to the application.
    ///
    /// This call can only happen after the application has started;
    /// typically, you should add new application windows in response
    /// to the emission of the `gio.Application.signals.activate` signal.
    ///
    /// This call is equivalent to setting the `gtk.Window.properties.application`
    /// property of the window to `application`.
    ///
    /// Normally, the connection between the application and the window
    /// will remain until the window is destroyed, but you can explicitly
    /// remove it with `gtk.Application.removeWindow`.
    ///
    /// GTK will keep the application running as long as it has any windows.
    extern fn gtk_application_add_window(p_application: *Application, p_window: *gtk.Window) void;
    pub const addWindow = gtk_application_add_window;

    /// Gets the accelerators that are currently associated with
    /// the given action.
    extern fn gtk_application_get_accels_for_action(p_application: *Application, p_detailed_action_name: [*:0]const u8) [*][*:0]u8;
    pub const getAccelsForAction = gtk_application_get_accels_for_action;

    /// Returns the list of actions (possibly empty) that the accelerator maps to.
    ///
    /// Each item in the list is a detailed action name in the usual form.
    ///
    /// This might be useful to discover if an accel already exists in
    /// order to prevent installation of a conflicting accelerator (from
    /// an accelerator editor or a plugin system, for example). Note that
    /// having more than one action per accelerator may not be a bad thing
    /// and might make sense in cases where the actions never appear in the
    /// same context.
    ///
    /// In case there are no actions for a given accelerator, an empty array
    /// is returned. `NULL` is never returned.
    ///
    /// It is a programmer error to pass an invalid accelerator string.
    ///
    /// If you are unsure, check it with `gtk.acceleratorParse` first.
    extern fn gtk_application_get_actions_for_accel(p_application: *Application, p_accel: [*:0]const u8) [*][*:0]u8;
    pub const getActionsForAccel = gtk_application_get_actions_for_accel;

    /// Gets the “active” window for the application.
    ///
    /// The active window is the one that was most recently focused
    /// (within the application). This window may not have the focus
    /// at the moment if another application has it — this is just
    /// the most recently-focused window within this application.
    extern fn gtk_application_get_active_window(p_application: *Application) ?*gtk.Window;
    pub const getActiveWindow = gtk_application_get_active_window;

    /// Gets a menu from automatically loaded resources.
    ///
    /// See [the section on Automatic resources](class.Application.html`automatic`-resources)
    /// for more information.
    extern fn gtk_application_get_menu_by_id(p_application: *Application, p_id: [*:0]const u8) ?*gio.Menu;
    pub const getMenuById = gtk_application_get_menu_by_id;

    /// Returns the menu model for the menu bar of the application.
    extern fn gtk_application_get_menubar(p_application: *Application) ?*gio.MenuModel;
    pub const getMenubar = gtk_application_get_menubar;

    /// Returns the window with the given ID.
    ///
    /// The ID of a `GtkApplicationWindow` can be retrieved with
    /// `gtk.ApplicationWindow.getId`.
    extern fn gtk_application_get_window_by_id(p_application: *Application, p_id: c_uint) ?*gtk.Window;
    pub const getWindowById = gtk_application_get_window_by_id;

    /// Gets a list of the window associated with the application.
    ///
    /// The list is sorted by most recently focused window, such that the first
    /// element is the currently focused window. (Useful for choosing a parent
    /// for a transient window.)
    ///
    /// The list that is returned should not be modified in any way. It will
    /// only remain valid until the next focus change or window creation or
    /// deletion.
    extern fn gtk_application_get_windows(p_application: *Application) *glib.List;
    pub const getWindows = gtk_application_get_windows;

    /// Informs the session manager that certain types of actions should be
    /// inhibited.
    ///
    /// This is not guaranteed to work on all platforms and for all types of
    /// actions.
    ///
    /// Applications should invoke this method when they begin an operation
    /// that should not be interrupted, such as creating a CD or DVD. The
    /// types of actions that may be blocked are specified by the `flags`
    /// parameter. When the application completes the operation it should
    /// call `gtk.Application.uninhibit` to remove the inhibitor. Note
    /// that an application can have multiple inhibitors, and all of them must
    /// be individually removed. Inhibitors are also cleared when the
    /// application exits.
    ///
    /// Applications should not expect that they will always be able to block
    /// the action. In most cases, users will be given the option to force
    /// the action to take place.
    ///
    /// The `reason` message should be short and to the point.
    ///
    /// If a window is given, the session manager may point the user to
    /// this window to find out more about why the action is inhibited.
    ///
    /// The cookie that is returned by this function  should be used as an
    /// argument to `gtk.Application.uninhibit` in order to remove
    /// the request.
    extern fn gtk_application_inhibit(p_application: *Application, p_window: ?*gtk.Window, p_flags: gtk.ApplicationInhibitFlags, p_reason: ?[*:0]const u8) c_uint;
    pub const inhibit = gtk_application_inhibit;

    /// Lists the detailed action names which have associated accelerators.
    ///
    /// See `gtk.Application.setAccelsForAction`.
    extern fn gtk_application_list_action_descriptions(p_application: *Application) [*][*:0]u8;
    pub const listActionDescriptions = gtk_application_list_action_descriptions;

    /// Remove a window from the application.
    ///
    /// If the window belongs to the application then this call is
    /// equivalent to setting the `gtk.Window.properties.application`
    /// property of the window to `NULL`.
    ///
    /// The application may stop running as a result of a call to this
    /// function, if the window was the last window of the application.
    extern fn gtk_application_remove_window(p_application: *Application, p_window: *gtk.Window) void;
    pub const removeWindow = gtk_application_remove_window;

    /// Sets zero or more keyboard accelerators that will trigger the
    /// given action.
    ///
    /// The first item in `accels` will be the primary accelerator,
    /// which may be displayed in the UI.
    ///
    /// To remove all accelerators for an action, use an empty,
    /// zero-terminated array for `accels`.
    ///
    /// For the `detailed_action_name`, see `gio.Action.parseDetailedName`
    /// and [Gio.Action.print_detailed_name].
    extern fn gtk_application_set_accels_for_action(p_application: *Application, p_detailed_action_name: [*:0]const u8, p_accels: [*]const [*:0]const u8) void;
    pub const setAccelsForAction = gtk_application_set_accels_for_action;

    /// Sets or unsets the menubar for windows of the application.
    ///
    /// This is a menubar in the traditional sense.
    ///
    /// This can only be done in the primary instance of the application,
    /// after it has been registered. `gio.Application.virtual_methods.startup` is
    /// a good place to call this.
    ///
    /// Depending on the desktop environment, this may appear at the top of
    /// each window, or at the top of the screen. In some environments, if
    /// both the application menu and the menubar are set, the application
    /// menu will be presented as if it were the first item of the menubar.
    /// Other environments treat the two as completely separate — for example,
    /// the application menu may be rendered by the desktop shell while the
    /// menubar (if set) remains in each individual window.
    ///
    /// Use the base `GActionMap` interface to add actions, to respond to the
    /// user selecting these menu items.
    extern fn gtk_application_set_menubar(p_application: *Application, p_menubar: ?*gio.MenuModel) void;
    pub const setMenubar = gtk_application_set_menubar;

    /// Removes an inhibitor that has been previously established.
    ///
    /// See `gtk.Application.inhibit`.
    ///
    /// Inhibitors are also cleared when the application exits.
    extern fn gtk_application_uninhibit(p_application: *Application, p_cookie: c_uint) void;
    pub const uninhibit = gtk_application_uninhibit;

    extern fn gtk_application_get_type() usize;
    pub const getGObjectType = gtk_application_get_type;

    extern fn g_object_ref(p_self: *gtk.Application) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Application) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Application, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkWindow` subclass that integrates with `GtkApplication`.
///
/// Notably, `GtkApplicationWindow` can handle an application menubar.
///
/// This class implements the `gio.ActionGroup` and `gio.ActionMap`
/// interfaces, to let you add window-specific actions that will be exported
/// by the associated `gtk.Application`, together with its application-wide
/// actions. Window-specific actions are prefixed with the “win.”
/// prefix and application-wide actions are prefixed with the “app.”
/// prefix. Actions must be addressed with the prefixed name when
/// referring to them from a menu model.
///
/// Note that widgets that are placed inside a `GtkApplicationWindow`
/// can also activate these actions, if they implement the
/// `gtk.Actionable` interface.
///
/// The settings `gtk.Settings.properties.gtk_shell_shows_app_menu` and
/// `gtk.Settings.properties.gtk_shell_shows_menubar` tell GTK whether the
/// desktop environment is showing the application menu and menubar
/// models outside the application as part of the desktop shell.
/// For instance, on OS X, both menus will be displayed remotely;
/// on Windows neither will be.
///
/// If the desktop environment does not display the menubar, it can be shown in
/// the `GtkApplicationWindow` by setting the
/// `gtk.ApplicationWindow.properties.show_menubar` property to true. If the
/// desktop environment does not display the application menu, then it will
/// automatically be included in the menubar or in the window’s client-side
/// decorations.
///
/// See `gtk.PopoverMenu` for information about the XML language
/// used by `GtkBuilder` for menu models.
///
/// See also: `gtk.Application.setMenubar`.
///
/// ## A GtkApplicationWindow with a menubar
///
/// The code sample below shows how to set up a `GtkApplicationWindow`
/// with a menu bar defined on the `gtk.Application`:
///
/// ```c
/// GtkApplication *app = gtk_application_new ("org.gtk.test", 0);
///
/// GtkBuilder *builder = gtk_builder_new_from_string (
///     "<interface>"
///     "  <menu id='menubar'>"
///     "    <submenu>"
///     "      <attribute name='label' translatable='yes'>_Edit</attribute>"
///     "      <item>"
///     "        <attribute name='label' translatable='yes'>_Copy</attribute>"
///     "        <attribute name='action'>win.copy</attribute>"
///     "      </item>"
///     "      <item>"
///     "        <attribute name='label' translatable='yes'>_Paste</attribute>"
///     "        <attribute name='action'>win.paste</attribute>"
///     "      </item>"
///     "    </submenu>"
///     "  </menu>"
///     "</interface>",
///     -1);
///
/// GMenuModel *menubar = G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"));
/// gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
/// g_object_unref (builder);
///
/// // ...
///
/// GtkWidget *window = gtk_application_window_new (app);
/// ```
pub const ApplicationWindow = extern struct {
    pub const Parent = gtk.Window;
    pub const Implements = [_]type{ gio.ActionGroup, gio.ActionMap, gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = gtk.ApplicationWindowClass;
    f_parent_instance: gtk.Window,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If this property is true, the window will display a menubar
        /// unless it is shown by the desktop shell.
        ///
        /// See `gtk.Application.setMenubar`.
        ///
        /// If false, the window will not display a menubar, regardless
        /// of whether the desktop shell is showing it or not.
        pub const show_menubar = struct {
            pub const name = "show-menubar";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkApplicationWindow`.
    extern fn gtk_application_window_new(p_application: *gtk.Application) *gtk.ApplicationWindow;
    pub const new = gtk_application_window_new;

    /// Gets the `GtkShortcutsWindow` that is associated with `window`.
    ///
    /// See `gtk.ApplicationWindow.setHelpOverlay`.
    extern fn gtk_application_window_get_help_overlay(p_window: *ApplicationWindow) ?*gtk.ShortcutsWindow;
    pub const getHelpOverlay = gtk_application_window_get_help_overlay;

    /// Returns the unique ID of the window.
    ///
    ///  If the window has not yet been added to a `GtkApplication`, returns `0`.
    extern fn gtk_application_window_get_id(p_window: *ApplicationWindow) c_uint;
    pub const getId = gtk_application_window_get_id;

    /// Returns whether the window will display a menubar for the app menu
    /// and menubar as needed.
    extern fn gtk_application_window_get_show_menubar(p_window: *ApplicationWindow) c_int;
    pub const getShowMenubar = gtk_application_window_get_show_menubar;

    /// Associates a shortcuts window with the application window.
    ///
    /// Additionally, sets up an action with the name
    /// `win.show-help-overlay` to present it.
    ///
    /// The window takes responsibility for destroying the help overlay.
    extern fn gtk_application_window_set_help_overlay(p_window: *ApplicationWindow, p_help_overlay: ?*gtk.ShortcutsWindow) void;
    pub const setHelpOverlay = gtk_application_window_set_help_overlay;

    /// Sets whether the window will display a menubar for the app menu
    /// and menubar as needed.
    extern fn gtk_application_window_set_show_menubar(p_window: *ApplicationWindow, p_show_menubar: c_int) void;
    pub const setShowMenubar = gtk_application_window_set_show_menubar;

    extern fn gtk_application_window_get_type() usize;
    pub const getGObjectType = gtk_application_window_get_type;

    extern fn g_object_ref(p_self: *gtk.ApplicationWindow) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ApplicationWindow) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ApplicationWindow, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Preserves the aspect ratio of its child.
///
/// The frame can respect the aspect ratio of the child widget,
/// or use its own aspect ratio.
///
/// # CSS nodes
///
/// `GtkAspectFrame` uses a CSS node with name `aspectframe`.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkAspectFrame` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkAspectFrame` uses the `gtk.@"AccessibleRole.generic"` role.
pub const AspectFrame = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = AspectFrame;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the `GtkAspectFrame` should use the aspect ratio of its child.
        pub const obey_child = struct {
            pub const name = "obey-child";

            pub const Type = c_int;
        };

        /// The aspect ratio to be used by the `GtkAspectFrame`.
        ///
        /// This property is only used if
        /// `gtk.AspectFrame.properties.obey_child` is set to `FALSE`.
        pub const ratio = struct {
            pub const name = "ratio";

            pub const Type = f32;
        };

        /// The horizontal alignment of the child.
        pub const xalign = struct {
            pub const name = "xalign";

            pub const Type = f32;
        };

        /// The vertical alignment of the child.
        pub const yalign = struct {
            pub const name = "yalign";

            pub const Type = f32;
        };
    };

    pub const signals = struct {};

    /// Create a new `GtkAspectFrame`.
    extern fn gtk_aspect_frame_new(p_xalign: f32, p_yalign: f32, p_ratio: f32, p_obey_child: c_int) *gtk.AspectFrame;
    pub const new = gtk_aspect_frame_new;

    /// Gets the child widget of `self`.
    extern fn gtk_aspect_frame_get_child(p_self: *AspectFrame) ?*gtk.Widget;
    pub const getChild = gtk_aspect_frame_get_child;

    /// Returns whether the child's size request should override
    /// the set aspect ratio of the `GtkAspectFrame`.
    extern fn gtk_aspect_frame_get_obey_child(p_self: *AspectFrame) c_int;
    pub const getObeyChild = gtk_aspect_frame_get_obey_child;

    /// Returns the desired aspect ratio of the child.
    extern fn gtk_aspect_frame_get_ratio(p_self: *AspectFrame) f32;
    pub const getRatio = gtk_aspect_frame_get_ratio;

    /// Returns the horizontal alignment of the child within the
    /// allocation of the `GtkAspectFrame`.
    extern fn gtk_aspect_frame_get_xalign(p_self: *AspectFrame) f32;
    pub const getXalign = gtk_aspect_frame_get_xalign;

    /// Returns the vertical alignment of the child within the
    /// allocation of the `GtkAspectFrame`.
    extern fn gtk_aspect_frame_get_yalign(p_self: *AspectFrame) f32;
    pub const getYalign = gtk_aspect_frame_get_yalign;

    /// Sets the child widget of `self`.
    extern fn gtk_aspect_frame_set_child(p_self: *AspectFrame, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_aspect_frame_set_child;

    /// Sets whether the aspect ratio of the child's size
    /// request should override the set aspect ratio of
    /// the `GtkAspectFrame`.
    extern fn gtk_aspect_frame_set_obey_child(p_self: *AspectFrame, p_obey_child: c_int) void;
    pub const setObeyChild = gtk_aspect_frame_set_obey_child;

    /// Sets the desired aspect ratio of the child.
    extern fn gtk_aspect_frame_set_ratio(p_self: *AspectFrame, p_ratio: f32) void;
    pub const setRatio = gtk_aspect_frame_set_ratio;

    /// Sets the horizontal alignment of the child within the allocation
    /// of the `GtkAspectFrame`.
    extern fn gtk_aspect_frame_set_xalign(p_self: *AspectFrame, p_xalign: f32) void;
    pub const setXalign = gtk_aspect_frame_set_xalign;

    /// Sets the vertical alignment of the child within the allocation
    /// of the `GtkAspectFrame`.
    extern fn gtk_aspect_frame_set_yalign(p_self: *AspectFrame, p_yalign: f32) void;
    pub const setYalign = gtk_aspect_frame_set_yalign;

    extern fn gtk_aspect_frame_get_type() usize;
    pub const getGObjectType = gtk_aspect_frame_get_type;

    extern fn g_object_ref(p_self: *gtk.AspectFrame) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AspectFrame) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AspectFrame, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkAssistant` is used to represent a complex as a series of steps.
///
/// <picture>
///   <source srcset="assistant-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkAssistant" src="assistant.png">
/// </picture>
///
/// Each step consists of one or more pages. `GtkAssistant` guides the user
/// through the pages, and controls the page flow to collect the data needed
/// for the operation.
///
/// `GtkAssistant` handles which buttons to show and to make sensitive based
/// on page sequence knowledge and the `gtk.AssistantPageType` of each
/// page in addition to state information like the *completed* and *committed*
/// page statuses.
///
/// If you have a case that doesn’t quite fit in `GtkAssistant`s way of
/// handling buttons, you can use the `GTK_ASSISTANT_PAGE_CUSTOM` page
/// type and handle buttons yourself.
///
/// `GtkAssistant` maintains a `GtkAssistantPage` object for each added
/// child, which holds additional per-child properties. You
/// obtain the `GtkAssistantPage` for a child with `gtk.Assistant.getPage`.
///
/// # GtkAssistant as GtkBuildable
///
/// The `GtkAssistant` implementation of the `GtkBuildable` interface
/// exposes the `action_area` as internal children with the name
/// “action_area”.
///
/// To add pages to an assistant in `GtkBuilder`, simply add it as a
/// child to the `GtkAssistant` object. If you need to set per-object
/// properties, create a `GtkAssistantPage` object explicitly, and
/// set the child widget as a property on it.
///
/// # CSS nodes
///
/// `GtkAssistant` has a single CSS node with the name window and style
/// class .assistant.
pub const Assistant = opaque {
    pub const Parent = gtk.Window;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = Assistant;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// `GListModel` containing the pages.
        pub const pages = struct {
            pub const name = "pages";

            pub const Type = ?*gio.ListModel;
        };

        /// `TRUE` if the assistant uses a `GtkHeaderBar` for action buttons
        /// instead of the action-area.
        ///
        /// For technical reasons, this property is declared as an integer
        /// property, but you should only set it to `TRUE` or `FALSE`.
        pub const use_header_bar = struct {
            pub const name = "use-header-bar";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the apply button is clicked.
        ///
        /// The default behavior of the `GtkAssistant` is to switch to the page
        /// after the current page, unless the current page is the last one.
        ///
        /// A handler for the ::apply signal should carry out the actions for
        /// which the wizard has collected data. If the action takes a long time
        /// to complete, you might consider putting a page of type
        /// `GTK_ASSISTANT_PAGE_PROGRESS` after the confirmation page and handle
        /// this operation within the `gtk.Assistant.signals.prepare` signal of
        /// the progress page.
        pub const apply = struct {
            pub const name = "apply";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Assistant, p_instance))),
                    gobject.signalLookup("apply", Assistant.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when then the cancel button is clicked.
        pub const cancel = struct {
            pub const name = "cancel";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Assistant, p_instance))),
                    gobject.signalLookup("cancel", Assistant.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted either when the close button of a summary page is clicked,
        /// or when the apply button in the last page in the flow (of type
        /// `GTK_ASSISTANT_PAGE_CONFIRM`) is clicked.
        pub const close = struct {
            pub const name = "close";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Assistant, p_instance))),
                    gobject.signalLookup("close", Assistant.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The action signal for the Escape binding.
        pub const escape = struct {
            pub const name = "escape";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Assistant, p_instance))),
                    gobject.signalLookup("escape", Assistant.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a new page is set as the assistant's current page,
        /// before making the new page visible.
        ///
        /// A handler for this signal can do any preparations which are
        /// necessary before showing `page`.
        pub const prepare = struct {
            pub const name = "prepare";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_page: *gtk.Widget, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Assistant, p_instance))),
                    gobject.signalLookup("prepare", Assistant.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkAssistant`.
    extern fn gtk_assistant_new() *gtk.Assistant;
    pub const new = gtk_assistant_new;

    /// Adds a widget to the action area of a `GtkAssistant`.
    extern fn gtk_assistant_add_action_widget(p_assistant: *Assistant, p_child: *gtk.Widget) void;
    pub const addActionWidget = gtk_assistant_add_action_widget;

    /// Appends a page to the `assistant`.
    extern fn gtk_assistant_append_page(p_assistant: *Assistant, p_page: *gtk.Widget) c_int;
    pub const appendPage = gtk_assistant_append_page;

    /// Erases the visited page history.
    ///
    /// GTK will then hide the back button on the current page,
    /// and removes the cancel button from subsequent pages.
    ///
    /// Use this when the information provided up to the current
    /// page is hereafter deemed permanent and cannot be modified
    /// or undone. For example, showing a progress page to track
    /// a long-running, unreversible operation after the user has
    /// clicked apply on a confirmation page.
    extern fn gtk_assistant_commit(p_assistant: *Assistant) void;
    pub const commit = gtk_assistant_commit;

    /// Returns the page number of the current page.
    extern fn gtk_assistant_get_current_page(p_assistant: *Assistant) c_int;
    pub const getCurrentPage = gtk_assistant_get_current_page;

    /// Returns the number of pages in the `assistant`
    extern fn gtk_assistant_get_n_pages(p_assistant: *Assistant) c_int;
    pub const getNPages = gtk_assistant_get_n_pages;

    /// Returns the child widget contained in page number `page_num`.
    extern fn gtk_assistant_get_nth_page(p_assistant: *Assistant, p_page_num: c_int) ?*gtk.Widget;
    pub const getNthPage = gtk_assistant_get_nth_page;

    /// Returns the `GtkAssistantPage` object for `child`.
    extern fn gtk_assistant_get_page(p_assistant: *Assistant, p_child: *gtk.Widget) *gtk.AssistantPage;
    pub const getPage = gtk_assistant_get_page;

    /// Gets whether `page` is complete.
    extern fn gtk_assistant_get_page_complete(p_assistant: *Assistant, p_page: *gtk.Widget) c_int;
    pub const getPageComplete = gtk_assistant_get_page_complete;

    /// Gets the title for `page`.
    extern fn gtk_assistant_get_page_title(p_assistant: *Assistant, p_page: *gtk.Widget) [*:0]const u8;
    pub const getPageTitle = gtk_assistant_get_page_title;

    /// Gets the page type of `page`.
    extern fn gtk_assistant_get_page_type(p_assistant: *Assistant, p_page: *gtk.Widget) gtk.AssistantPageType;
    pub const getPageType = gtk_assistant_get_page_type;

    /// Gets a list model of the assistant pages.
    extern fn gtk_assistant_get_pages(p_assistant: *Assistant) *gio.ListModel;
    pub const getPages = gtk_assistant_get_pages;

    /// Inserts a page in the `assistant` at a given position.
    extern fn gtk_assistant_insert_page(p_assistant: *Assistant, p_page: *gtk.Widget, p_position: c_int) c_int;
    pub const insertPage = gtk_assistant_insert_page;

    /// Navigate to the next page.
    ///
    /// It is a programming error to call this function when
    /// there is no next page.
    ///
    /// This function is for use when creating pages of the
    /// `GTK_ASSISTANT_PAGE_CUSTOM` type.
    extern fn gtk_assistant_next_page(p_assistant: *Assistant) void;
    pub const nextPage = gtk_assistant_next_page;

    /// Prepends a page to the `assistant`.
    extern fn gtk_assistant_prepend_page(p_assistant: *Assistant, p_page: *gtk.Widget) c_int;
    pub const prependPage = gtk_assistant_prepend_page;

    /// Navigate to the previous visited page.
    ///
    /// It is a programming error to call this function when
    /// no previous page is available.
    ///
    /// This function is for use when creating pages of the
    /// `GTK_ASSISTANT_PAGE_CUSTOM` type.
    extern fn gtk_assistant_previous_page(p_assistant: *Assistant) void;
    pub const previousPage = gtk_assistant_previous_page;

    /// Removes a widget from the action area of a `GtkAssistant`.
    extern fn gtk_assistant_remove_action_widget(p_assistant: *Assistant, p_child: *gtk.Widget) void;
    pub const removeActionWidget = gtk_assistant_remove_action_widget;

    /// Removes the `page_num`’s page from `assistant`.
    extern fn gtk_assistant_remove_page(p_assistant: *Assistant, p_page_num: c_int) void;
    pub const removePage = gtk_assistant_remove_page;

    /// Switches the page to `page_num`.
    ///
    /// Note that this will only be necessary in custom buttons,
    /// as the `assistant` flow can be set with
    /// `gtk.Assistant.setForwardPageFunc`.
    extern fn gtk_assistant_set_current_page(p_assistant: *Assistant, p_page_num: c_int) void;
    pub const setCurrentPage = gtk_assistant_set_current_page;

    /// Sets the page forwarding function to be `page_func`.
    ///
    /// This function will be used to determine what will be
    /// the next page when the user presses the forward button.
    /// Setting `page_func` to `NULL` will make the assistant to
    /// use the default forward function, which just goes to the
    /// next visible page.
    extern fn gtk_assistant_set_forward_page_func(p_assistant: *Assistant, p_page_func: ?gtk.AssistantPageFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setForwardPageFunc = gtk_assistant_set_forward_page_func;

    /// Sets whether `page` contents are complete.
    ///
    /// This will make `assistant` update the buttons state
    /// to be able to continue the task.
    extern fn gtk_assistant_set_page_complete(p_assistant: *Assistant, p_page: *gtk.Widget, p_complete: c_int) void;
    pub const setPageComplete = gtk_assistant_set_page_complete;

    /// Sets a title for `page`.
    ///
    /// The title is displayed in the header area of the assistant
    /// when `page` is the current page.
    extern fn gtk_assistant_set_page_title(p_assistant: *Assistant, p_page: *gtk.Widget, p_title: [*:0]const u8) void;
    pub const setPageTitle = gtk_assistant_set_page_title;

    /// Sets the page type for `page`.
    ///
    /// The page type determines the page behavior in the `assistant`.
    extern fn gtk_assistant_set_page_type(p_assistant: *Assistant, p_page: *gtk.Widget, p_type: gtk.AssistantPageType) void;
    pub const setPageType = gtk_assistant_set_page_type;

    /// Forces `assistant` to recompute the buttons state.
    ///
    /// GTK automatically takes care of this in most situations,
    /// e.g. when the user goes to a different page, or when the
    /// visibility or completeness of a page changes.
    ///
    /// One situation where it can be necessary to call this
    /// function is when changing a value on the current page
    /// affects the future page flow of the assistant.
    extern fn gtk_assistant_update_buttons_state(p_assistant: *Assistant) void;
    pub const updateButtonsState = gtk_assistant_update_buttons_state;

    extern fn gtk_assistant_get_type() usize;
    pub const getGObjectType = gtk_assistant_get_type;

    extern fn g_object_ref(p_self: *gtk.Assistant) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Assistant) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Assistant, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkAssistantPage` is an auxiliary object used by `GtkAssistant`.
pub const AssistantPage = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = AssistantPage;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether all required fields are filled in.
        ///
        /// GTK uses this information to control the sensitivity
        /// of the navigation buttons.
        pub const complete = struct {
            pub const name = "complete";

            pub const Type = c_int;
        };

        /// The type of the assistant page.
        pub const page_type = struct {
            pub const name = "page-type";

            pub const Type = gtk.AssistantPageType;
        };

        /// The title of the page.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Returns the child to which `page` belongs.
    extern fn gtk_assistant_page_get_child(p_page: *AssistantPage) *gtk.Widget;
    pub const getChild = gtk_assistant_page_get_child;

    extern fn gtk_assistant_page_get_type() usize;
    pub const getGObjectType = gtk_assistant_page_get_type;

    extern fn g_object_ref(p_self: *gtk.AssistantPage) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AssistantPage) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AssistantPage, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A layout manager for widgets with a single child.
///
/// `GtkBinLayout` will stack each child of a widget on top of each other,
/// using the `gtk.Widget.properties.hexpand`, `gtk.Widget.properties.vexpand`,
/// `gtk.Widget.properties.halign`, and `gtk.Widget.properties.valign` properties
/// of each child to determine where they should be positioned.
pub const BinLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{};
    pub const Class = gtk.BinLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkBinLayout` instance.
    extern fn gtk_bin_layout_new() *gtk.BinLayout;
    pub const new = gtk_bin_layout_new;

    extern fn gtk_bin_layout_get_type() usize;
    pub const getGObjectType = gtk_bin_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.BinLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BinLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BinLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that wraps `GBookmarkFile`.
///
/// It presents a `GListModel` and fills it asynchronously with the
/// `GFileInfo`s returned from that function.
///
/// The `GFileInfo`s in the list have some attributes in the recent
/// namespace added: `recent::private` (boolean) and `recent:applications`
/// (stringv).
pub const BookmarkList = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gio.ListModel};
    pub const Class = gtk.BookmarkListClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The attributes to query.
        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?[*:0]u8;
        };

        /// The bookmark file to load.
        pub const filename = struct {
            pub const name = "filename";

            pub const Type = ?[*:0]u8;
        };

        /// Priority used when loading.
        pub const io_priority = struct {
            pub const name = "io-priority";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// `TRUE` if files are being loaded.
        pub const loading = struct {
            pub const name = "loading";

            pub const Type = c_int;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkBookmarkList` with the given `attributes`.
    extern fn gtk_bookmark_list_new(p_filename: ?[*:0]const u8, p_attributes: ?[*:0]const u8) *gtk.BookmarkList;
    pub const new = gtk_bookmark_list_new;

    /// Gets the attributes queried on the children.
    extern fn gtk_bookmark_list_get_attributes(p_self: *BookmarkList) ?[*:0]const u8;
    pub const getAttributes = gtk_bookmark_list_get_attributes;

    /// Returns the filename of the bookmark file that
    /// this list is loading.
    extern fn gtk_bookmark_list_get_filename(p_self: *BookmarkList) [*:0]const u8;
    pub const getFilename = gtk_bookmark_list_get_filename;

    /// Gets the IO priority to use while loading file.
    extern fn gtk_bookmark_list_get_io_priority(p_self: *BookmarkList) c_int;
    pub const getIoPriority = gtk_bookmark_list_get_io_priority;

    /// Returns `TRUE` if the files are currently being loaded.
    ///
    /// Files will be added to `self` from time to time while loading is
    /// going on. The order in which are added is undefined and may change
    /// in between runs.
    extern fn gtk_bookmark_list_is_loading(p_self: *BookmarkList) c_int;
    pub const isLoading = gtk_bookmark_list_is_loading;

    /// Sets the `attributes` to be enumerated and starts the enumeration.
    ///
    /// If `attributes` is `NULL`, no attributes will be queried, but a list
    /// of `GFileInfo`s will still be created.
    extern fn gtk_bookmark_list_set_attributes(p_self: *BookmarkList, p_attributes: ?[*:0]const u8) void;
    pub const setAttributes = gtk_bookmark_list_set_attributes;

    /// Sets the IO priority to use while loading files.
    ///
    /// The default IO priority is `G_PRIORITY_DEFAULT`.
    extern fn gtk_bookmark_list_set_io_priority(p_self: *BookmarkList, p_io_priority: c_int) void;
    pub const setIoPriority = gtk_bookmark_list_set_io_priority;

    extern fn gtk_bookmark_list_get_type() usize;
    pub const getGObjectType = gtk_bookmark_list_get_type;

    extern fn g_object_ref(p_self: *gtk.BookmarkList) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BookmarkList) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BookmarkList, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Evaluates a boolean expression to determine whether to include items.
pub const BoolFilter = opaque {
    pub const Parent = gtk.Filter;
    pub const Implements = [_]type{};
    pub const Class = gtk.BoolFilterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The boolean expression to evaluate on each item.
        pub const expression = struct {
            pub const name = "expression";

            pub const Type = ?*gtk.Expression;
        };

        /// If the expression result should be inverted.
        pub const invert = struct {
            pub const name = "invert";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new bool filter.
    extern fn gtk_bool_filter_new(p_expression: ?*gtk.Expression) *gtk.BoolFilter;
    pub const new = gtk_bool_filter_new;

    /// Gets the expression that the filter evaluates for
    /// each item.
    extern fn gtk_bool_filter_get_expression(p_self: *BoolFilter) ?*gtk.Expression;
    pub const getExpression = gtk_bool_filter_get_expression;

    /// Returns whether the filter inverts the expression.
    extern fn gtk_bool_filter_get_invert(p_self: *BoolFilter) c_int;
    pub const getInvert = gtk_bool_filter_get_invert;

    /// Sets the expression that the filter uses to check if items
    /// should be filtered.
    ///
    /// The expression must have a value type of `G_TYPE_BOOLEAN`.
    extern fn gtk_bool_filter_set_expression(p_self: *BoolFilter, p_expression: ?*gtk.Expression) void;
    pub const setExpression = gtk_bool_filter_set_expression;

    /// Sets whether the filter should invert the expression.
    extern fn gtk_bool_filter_set_invert(p_self: *BoolFilter, p_invert: c_int) void;
    pub const setInvert = gtk_bool_filter_set_invert;

    extern fn gtk_bool_filter_get_type() usize;
    pub const getGObjectType = gtk_bool_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.BoolFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BoolFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BoolFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Arranges child widgets into a single row or column.
///
/// <picture>
///   <source srcset="box-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkBox" src="box.png">
/// </picture>
///
/// Whether it is a row or column depends on the value of its
/// `gtk.Orientable.properties.orientation` property. Within the other
/// dimension, all children are allocated the same size. The
/// `gtk.Widget.properties.halign` and `gtk.Widget.properties.valign`
/// properties can be used on the children to influence their allocation.
///
/// Use repeated calls to `gtk.Box.append` to pack widgets into a
/// `GtkBox` from start to end. Use `gtk.Box.remove` to remove widgets
/// from the `GtkBox`. `gtk.Box.insertChildAfter` can be used to add
/// a child at a particular position.
///
/// Use `gtk.Box.setHomogeneous` to specify whether or not all children
/// of the `GtkBox` are forced to get the same amount of space.
///
/// Use `gtk.Box.setSpacing` to determine how much space will be minimally
/// placed between all children in the `GtkBox`. Note that spacing is added
/// *between* the children.
///
/// Use `gtk.Box.reorderChildAfter` to move a child to a different
/// place in the box.
///
/// # CSS nodes
///
/// `GtkBox` uses a single CSS node with name box.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkBox` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkBox` uses the `gtk.@"AccessibleRole.generic"` role.
pub const Box = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.BoxClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The position of the child that determines the baseline.
        ///
        /// This is only relevant if the box is in vertical orientation.
        pub const baseline_child = struct {
            pub const name = "baseline-child";

            pub const Type = c_int;
        };

        /// How to position baseline-aligned widgets if extra space is available.
        pub const baseline_position = struct {
            pub const name = "baseline-position";

            pub const Type = gtk.BaselinePosition;
        };

        /// Whether the children should all be the same size.
        pub const homogeneous = struct {
            pub const name = "homogeneous";

            pub const Type = c_int;
        };

        /// The amount of space between children.
        pub const spacing = struct {
            pub const name = "spacing";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new box.
    extern fn gtk_box_new(p_orientation: gtk.Orientation, p_spacing: c_int) *gtk.Box;
    pub const new = gtk_box_new;

    /// Adds a child at the end.
    extern fn gtk_box_append(p_box: *Box, p_child: *gtk.Widget) void;
    pub const append = gtk_box_append;

    /// Gets the value set by `gtk.Box.setBaselineChild`.
    extern fn gtk_box_get_baseline_child(p_box: *Box) c_int;
    pub const getBaselineChild = gtk_box_get_baseline_child;

    /// Gets the value set by `gtk.Box.setBaselinePosition`.
    extern fn gtk_box_get_baseline_position(p_box: *Box) gtk.BaselinePosition;
    pub const getBaselinePosition = gtk_box_get_baseline_position;

    /// Returns whether the box is homogeneous.
    ///
    /// In a homogeneous box all children are the same size.
    extern fn gtk_box_get_homogeneous(p_box: *Box) c_int;
    pub const getHomogeneous = gtk_box_get_homogeneous;

    /// Gets the value set by `gtk.Box.setSpacing`.
    extern fn gtk_box_get_spacing(p_box: *Box) c_int;
    pub const getSpacing = gtk_box_get_spacing;

    /// Inserts a child at a specific position.
    ///
    /// The child is added after `sibling` in the list of `box` children.
    ///
    /// If `sibling` is `NULL`, the `child` is placed at the beginning.
    extern fn gtk_box_insert_child_after(p_box: *Box, p_child: *gtk.Widget, p_sibling: ?*gtk.Widget) void;
    pub const insertChildAfter = gtk_box_insert_child_after;

    /// Adds a child at the beginning.
    extern fn gtk_box_prepend(p_box: *Box, p_child: *gtk.Widget) void;
    pub const prepend = gtk_box_prepend;

    /// Removes a child widget from the box.
    ///
    /// The child must have been added before with
    /// `gtk.Box.append`, `gtk.Box.prepend`, or
    /// `gtk.Box.insertChildAfter`.
    extern fn gtk_box_remove(p_box: *Box, p_child: *gtk.Widget) void;
    pub const remove = gtk_box_remove;

    /// Moves a child to a different position.
    ///
    /// The child is moved to the position after `sibling` in the list
    /// of `box` children.
    ///
    /// If `sibling` is `NULL`, the child is placed at the beginning.
    extern fn gtk_box_reorder_child_after(p_box: *Box, p_child: *gtk.Widget, p_sibling: ?*gtk.Widget) void;
    pub const reorderChildAfter = gtk_box_reorder_child_after;

    /// Sets the baseline child of a box.
    ///
    /// This affects only vertical boxes.
    extern fn gtk_box_set_baseline_child(p_box: *Box, p_child: c_int) void;
    pub const setBaselineChild = gtk_box_set_baseline_child;

    /// Sets the baseline position of a box.
    ///
    /// This affects only horizontal boxes with at least one baseline
    /// aligned child. If there is more vertical space available than
    /// requested, and the baseline is not allocated by the parent then
    /// `position` is used to allocate the baseline with respect to the
    /// extra space available.
    extern fn gtk_box_set_baseline_position(p_box: *Box, p_position: gtk.BaselinePosition) void;
    pub const setBaselinePosition = gtk_box_set_baseline_position;

    /// Sets whether or not all children are given equal space
    /// in the box.
    extern fn gtk_box_set_homogeneous(p_box: *Box, p_homogeneous: c_int) void;
    pub const setHomogeneous = gtk_box_set_homogeneous;

    /// Sets the number of pixels to place between children.
    extern fn gtk_box_set_spacing(p_box: *Box, p_spacing: c_int) void;
    pub const setSpacing = gtk_box_set_spacing;

    extern fn gtk_box_get_type() usize;
    pub const getGObjectType = gtk_box_get_type;

    extern fn g_object_ref(p_self: *gtk.Box) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Box) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Box, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Arranges children in a single row or column.
///
/// Whether it is a row or column depends on the value of its
/// `gtk.Orientable.properties.orientation` property. Within the other dimension
/// all children all allocated the same size. The `GtkBoxLayout` will respect
/// the `gtk.Widget.properties.halign` and `gtk.Widget.properties.valign`
/// properties of each child widget.
///
/// If you want all children to be assigned the same size, you can use
/// the `gtk.BoxLayout.properties.homogeneous` property.
///
/// If you want to specify the amount of space placed between each child,
/// you can use the `gtk.BoxLayout.properties.spacing` property.
pub const BoxLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{gtk.Orientable};
    pub const Class = gtk.BoxLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child that determines the baseline of the box
        /// in vertical layout.
        ///
        /// If the child does baseline positioning, then its baseline
        /// is lined up with the baseline of the box. If it doesn't, then
        /// the bottom edge of the child is used.
        pub const baseline_child = struct {
            pub const name = "baseline-child";

            pub const Type = c_int;
        };

        /// The position of the allocated baseline within the extra space
        /// allocated to each child.
        ///
        /// This property is only relevant for horizontal layouts containing
        /// at least one child with a baseline alignment.
        pub const baseline_position = struct {
            pub const name = "baseline-position";

            pub const Type = gtk.BaselinePosition;
        };

        /// Whether the box layout should distribute the available space
        /// equally among the children.
        pub const homogeneous = struct {
            pub const name = "homogeneous";

            pub const Type = c_int;
        };

        /// The space to put between the children.
        pub const spacing = struct {
            pub const name = "spacing";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkBoxLayout`.
    extern fn gtk_box_layout_new(p_orientation: gtk.Orientation) *gtk.BoxLayout;
    pub const new = gtk_box_layout_new;

    /// Gets the value set by `gtk.BoxLayout.setBaselineChild`.
    extern fn gtk_box_layout_get_baseline_child(p_box_layout: *BoxLayout) c_int;
    pub const getBaselineChild = gtk_box_layout_get_baseline_child;

    /// Gets the value set by `gtk.BoxLayout.setBaselinePosition`.
    extern fn gtk_box_layout_get_baseline_position(p_box_layout: *BoxLayout) gtk.BaselinePosition;
    pub const getBaselinePosition = gtk_box_layout_get_baseline_position;

    /// Returns whether the layout is set to be homogeneous.
    extern fn gtk_box_layout_get_homogeneous(p_box_layout: *BoxLayout) c_int;
    pub const getHomogeneous = gtk_box_layout_get_homogeneous;

    /// Returns the space that `box_layout` puts between children.
    extern fn gtk_box_layout_get_spacing(p_box_layout: *BoxLayout) c_uint;
    pub const getSpacing = gtk_box_layout_get_spacing;

    /// Sets the index of the child that determines the baseline
    /// in vertical layout.
    extern fn gtk_box_layout_set_baseline_child(p_box_layout: *BoxLayout, p_child: c_int) void;
    pub const setBaselineChild = gtk_box_layout_set_baseline_child;

    /// Sets the baseline position of a box layout.
    ///
    /// The baseline position affects only horizontal boxes with at least one
    /// baseline aligned child. If there is more vertical space available than
    /// requested, and the baseline is not allocated by the parent then the
    /// given `position` is used to allocate the baseline within the extra
    /// space available.
    extern fn gtk_box_layout_set_baseline_position(p_box_layout: *BoxLayout, p_position: gtk.BaselinePosition) void;
    pub const setBaselinePosition = gtk_box_layout_set_baseline_position;

    /// Sets whether the box layout will allocate the same
    /// size to all children.
    extern fn gtk_box_layout_set_homogeneous(p_box_layout: *BoxLayout, p_homogeneous: c_int) void;
    pub const setHomogeneous = gtk_box_layout_set_homogeneous;

    /// Sets how much spacing to put between children.
    extern fn gtk_box_layout_set_spacing(p_box_layout: *BoxLayout, p_spacing: c_uint) void;
    pub const setSpacing = gtk_box_layout_set_spacing;

    extern fn gtk_box_layout_get_type() usize;
    pub const getGObjectType = gtk_box_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.BoxLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BoxLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BoxLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Reads XML descriptions of a user interface and instantiates the described objects.
///
/// To create a `GtkBuilder` from a user interface description, call
/// `gtk.Builder.newFromFile`, `gtk.Builder.newFromResource`
/// or `gtk.Builder.newFromString`.
///
/// In the (unusual) case that you want to add user interface
/// descriptions from multiple sources to the same `GtkBuilder` you can
/// call `gtk.Builder.new` to get an empty builder and populate it by
/// (multiple) calls to `gtk.Builder.addFromFile`,
/// `gtk.Builder.addFromResource` or
/// `gtk.Builder.addFromString`.
///
/// A `GtkBuilder` holds a reference to all objects that it has constructed
/// and drops these references when it is finalized. This finalization can
/// cause the destruction of non-widget objects or widgets which are not
/// contained in a toplevel window. For toplevel windows constructed by a
/// builder, it is the responsibility of the user to call
/// `gtk.Window.destroy` to get rid of them and all the widgets
/// they contain.
///
/// The functions `gtk.Builder.getObject` and
/// `gtk.Builder.getObjects` can be used to access the widgets in
/// the interface by the names assigned to them inside the UI description.
/// Toplevel windows returned by these functions will stay around until the
/// user explicitly destroys them with `gtk.Window.destroy`. Other
/// widgets will either be part of a larger hierarchy constructed by the
/// builder (in which case you should not have to worry about their lifecycle),
/// or without a parent, in which case they have to be added to some container
/// to make use of them. Non-widget objects need to be reffed with
/// `gobject.Object.ref` to keep them beyond the lifespan of the builder.
///
/// ## GtkBuilder UI Definitions
///
/// `GtkBuilder` parses textual descriptions of user interfaces which are
/// specified in XML format. We refer to these descriptions as “GtkBuilder
/// UI definitions” or just “UI definitions” if the context is clear.
///
/// ### Structure of UI definitions
///
/// UI definition files are always encoded in UTF-8.
///
/// The toplevel element is `<interface>`. It optionally takes a “domain”
/// attribute, which will make the builder look for translated strings
/// using ``dgettext`` in the domain specified. This can also be done by
/// calling `gtk.Builder.setTranslationDomain` on the builder.
/// For example:
///
/// ```xml
/// <?xml version="1.0" encoding="UTF-8"?>
/// <interface domain="your-app">
///   ...
/// </interface>
/// ```
///
/// ### Requirements
///
/// The target toolkit version(s) are described by `<requires>` elements,
/// the “lib” attribute specifies the widget library in question (currently
/// the only supported value is “gtk”) and the “version” attribute specifies
/// the target version in the form “`<major>`.`<minor>`”. `GtkBuilder` will
/// error out if the version requirements are not met. For example:
///
/// ```xml
/// <?xml version="1.0" encoding="UTF-8"?>
/// <interface domain="your-app">
///   <requires lib="gtk" version="4.0" />
/// </interface>
/// ```
///
/// ### Objects
///
/// Objects are defined as children of the `<interface>` element.
///
/// Objects are described by `<object>` elements, which can contain
/// `<property>` elements to set properties, `<signal>` elements which
/// connect signals to handlers, and `<child>` elements, which describe
/// child objects.
///
/// Typically, the specific kind of object represented by an `<object>`
/// element is specified by the “class” attribute. If the type has not
/// been loaded yet, GTK tries to find the ``get_type`` function from the
/// class name by applying heuristics. This works in most cases, but if
/// necessary, it is possible to specify the name of the ``get_type``
/// function explicitly with the "type-func" attribute. If your UI definition
/// is referencing internal types, you should make sure to call
/// ``gobject.typeEnsure`` for each object type before parsing the UI definition.
///
/// Objects may be given a name with the “id” attribute, which allows the
/// application to retrieve them from the builder with
/// `gtk.Builder.getObject`. An id is also necessary to use the
/// object as property value in other parts of the UI definition. GTK
/// reserves ids starting and ending with `___` (three consecutive
/// underscores) for its own purposes.
///
/// ### Properties
///
/// Setting properties of objects is pretty straightforward with the
/// `<property>` element: the “name” attribute specifies the name of the
/// property, and the content of the element specifies the value:
///
/// ```xml
/// <object class="GtkButton">
///   <property name="label">Hello, world</property>
/// </object>
/// ```
///
/// If the “translatable” attribute is set to a true value, GTK uses
/// ``gettext`` (or ``dgettext`` if the builder has a translation domain set)
/// to find a translation for the value. This happens before the value
/// is parsed, so it can be used for properties of any type, but it is
/// probably most useful for string properties. It is also possible to
/// specify a context to disambiguate short strings, and comments which
/// may help the translators:
///
/// ```xml
/// <object class="GtkButton">
///   <property name="label"
///             translatable="yes"
///             context="button"
///             comments="A classic">Hello, world</property>
/// </object>
/// ```
///
/// The xgettext tool that is part of gettext can extract these strings,
/// but note that it only looks for translatable="yes".
///
/// `GtkBuilder` can parse textual representations for the most common
/// property types:
///
/// - characters
/// - strings
/// - integers
/// - floating-point numbers
/// - booleans (strings like “TRUE”, “t”, “yes”, “y”, “1” are interpreted
///   as true values, strings like “FALSE”, “f”, “no”, “n”, “0” are interpreted
///   as false values)
/// - string lists (separated by newlines)
/// - enumeration types (can be specified by their full C identifier their short
///   name used when registering the enumeration type, or their integer value)
/// - flag types (can be specified by their C identifier or short name,
///   optionally combined with “|” for bitwise OR, or a single integer value
///   e.g., “GTK_INPUT_HINT_EMOJI|GTK_INPUT_HINT_LOWERCASE”, or “emoji|lowercase” or 520).
/// - colors (in the format understood by `gdk.RGBA.parse`)
/// - transforms (in the format understood by `gsk.Transform.parse`)
/// - Pango attribute lists (in the format understood by `pango.AttrList.toString`)
/// - Pango tab arrays (in the format understood by `pango.TabArray.toString`)
/// - Pango font descriptions (in the format understood by `pango.FontDescription.fromString`)
/// - `GVariant` (in the format understood by `glib.Variant.parse`)
/// - textures (can be specified as an object id, a resource path or a filename of an image file to load relative to the Builder file or the CWD if `gtk.Builder.addFromString` was used)
/// - GFile (like textures, can be specified as an object id, a URI or a filename of a file to load relative to the Builder file or the CWD if `gtk.Builder.addFromString` was used)
///
/// Objects can be referred to by their name and by default refer to
/// objects declared in the local XML fragment and objects exposed via
/// `gtk.Builder.exposeObject`. In general, `GtkBuilder` allows
/// forward references to objects declared in the local XML; an object
/// doesn’t have to be constructed before it can be referred to. The
/// exception to this rule is that an object has to be constructed before
/// it can be used as the value of a construct-only property.
///
/// ### Child objects
///
/// Many widgets have properties for child widgets, such as
/// `gtk.Expander.properties.child`. In this case, the preferred way to
/// specify the child widget in a ui file is to simply set the property:
///
/// ```xml
/// <object class="GtkExpander">
///   <property name="child">
///     <object class="GtkLabel">
///     ...
///     </object>
///   </property>
/// </object>
/// ```
///
/// Generic containers that can contain an arbitrary number of children,
/// such as `gtk.Box` instead use the `<child>` element. A `<child>`
/// element contains an `<object>` element which describes the child object.
/// Most often, child objects are widgets inside a container, but they can
/// also be, e.g., actions in an action group, or columns in a tree model.
///
/// Any object type that implements the `gtk.Buildable` interface can
/// specify how children may be added to it. Since many objects and widgets that
/// are included with GTK already implement the `GtkBuildable` interface,
/// typically child objects can be added using the `<child>` element without
/// having to be concerned about the underlying implementation.
///
/// See the [`GtkWidget` documentation](class.Widget.html`gtkwidget`-as-gtkbuildable)
/// for many examples of using `GtkBuilder` with widgets, including setting
/// child objects using the `<child>` element.
///
/// A noteworthy special case to the general rule that only objects implementing
/// `GtkBuildable` may specify how to handle the `<child>` element is that
/// `GtkBuilder` provides special support for adding objects to a
/// `gio.ListStore` by using the `<child>` element. For instance:
///
/// ```xml
/// <object class="GListStore">
///   <property name="item-type">MyObject</property>
///   <child>
///     <object class="MyObject" />
///   </child>
///   ...
/// </object>
/// ```
///
/// ### Property bindings
///
/// It is also possible to bind a property value to another object's
/// property value using the attributes "bind-source" to specify the
/// source object of the binding, and optionally, "bind-property" and
/// "bind-flags" to specify the source property and source binding flags
/// respectively. Internally, `GtkBuilder` implements this using
/// `gobject.Binding` objects.
///
/// For instance, in the example below the “label” property of the
/// `bottom_label` widget is bound to the “label” property of the
/// `top_button` widget:
///
/// ```xml
/// <object class="GtkBox">
///   <property name="orientation">vertical</property>
///   <child>
///     <object class="GtkButton" id="top_button">
///       <property name="label">Hello, world</property>
///     </object>
///   </child>
///   <child>
///     <object class="GtkLabel" id="bottom_label">
///       <property name="label"
///                 bind-source="top_button"
///                 bind-property="label"
///                 bind-flags="sync-create" />
///     </object>
///   </child>
/// </object>
/// ```
///
/// For more information, see the documentation of the
/// `gobject.Object.bindProperty` method.
///
/// Please note that another way to set up bindings between objects in .ui files
/// is to use the `GtkExpression` methodology. See the
/// [`GtkExpression` documentation](class.Expression.html`gtkexpression`-in-ui-files)
/// for more information.
///
/// ### Internal children
///
/// Sometimes it is necessary to refer to widgets which have implicitly
/// been constructed by GTK as part of a composite widget, to set
/// properties on them or to add further children (e.g. the content area
/// of a `GtkDialog`). This can be achieved by setting the “internal-child”
/// property of the `<child>` element to a true value. Note that `GtkBuilder`
/// still requires an `<object>` element for the internal child, even if it
/// has already been constructed.
///
/// ### Specialized children
///
/// A number of widgets have different places where a child can be added
/// (e.g. tabs vs. page content in notebooks). This can be reflected in
/// a UI definition by specifying the “type” attribute on a `<child>`
/// The possible values for the “type” attribute are described in the
/// sections describing the widget-specific portions of UI definitions.
///
/// ### Signal handlers and function pointers
///
/// Signal handlers are set up with the `<signal>` element. The “name”
/// attribute specifies the name of the signal, and the “handler” attribute
/// specifies the function to connect to the signal.
///
/// ```xml
/// <object class="GtkButton" id="hello_button">
///   <signal name="clicked" handler="hello_button__clicked" />
/// </object>
/// ```
///
/// The remaining attributes, “after”, “swapped” and “object”, have the
/// same meaning as the corresponding parameters of the
/// `gobject.signalConnectObject` or `gobject.signalConnectData`
/// functions:
///
/// - “after” matches the `G_CONNECT_AFTER` flag, and will ensure that the
///   handler is called after the default class closure for the signal
/// - “swapped” matches the `G_CONNECT_SWAPPED` flag, and will swap the
///   instance and closure arguments when invoking the signal handler
/// - “object” will bind the signal handler to the lifetime of the object
///   referenced by the attribute
///
/// By default "swapped" will be set to "yes" if not specified otherwise, in
/// the case where "object" is set, for convenience. A “last_modification_time”
/// attribute is also allowed, but it does not have a meaning to the builder.
///
/// When compiling applications for Windows, you must declare signal callbacks
/// with the `G_MODULE_EXPORT` decorator, or they will not be put in the symbol
/// table:
///
/// ```c
/// G_MODULE_EXPORT void
/// hello_button__clicked (GtkButton *button,
///                        gpointer data)
/// {
///   // ...
/// }
/// ```
///
/// On Linux and Unix, this is not necessary; applications should instead
/// be compiled with the `-Wl,--export-dynamic` argument inside their compiler
/// flags, and linked against `gmodule-export-2.0`.
///
/// ## Example UI Definition
///
/// ```xml
/// <interface>
///   <object class="GtkDialog" id="dialog1">
///     <child internal-child="content_area">
///       <object class="GtkBox">
///         <child internal-child="action_area">
///           <object class="GtkBox">
///             <child>
///               <object class="GtkButton" id="ok_button">
///                 <property name="label" translatable="yes">_Ok</property>
///                 <property name="use-underline">True</property>
///                 <signal name="clicked" handler="ok_button_clicked"/>
///               </object>
///             </child>
///           </object>
///         </child>
///       </object>
///     </child>
///   </object>
/// </interface>
/// ```
///
/// ## Using GtkBuildable for extending UI definitions
///
/// Objects can implement the `gtk.Buildable` interface to add custom
/// elements and attributes to the XML. Typically, any extension will be
/// documented in each type that implements the interface.
///
/// ## Menus
///
/// In addition to objects with properties that are created with `<object>` and
/// `<property>` elements, `GtkBuilder` also allows to parse XML menu definitions
/// as used by `gio.Menu` when exporting menu models over D-Bus, and as
/// described in the `gtk.PopoverMenu` documentation. Menus can be defined
/// as toplevel elements, or as property values for properties of type `GMenuModel`.
///
/// ## Templates
///
/// When describing a `gtk.Widget`, you can use the `<template>` tag to
/// describe a UI bound to a specific widget type. GTK will automatically load
/// the UI definition when instantiating the type, and bind children and
/// signal handlers to instance fields and function symbols.
///
/// For more information, see the [`GtkWidget` documentation](class.Widget.html`building`-composite-widgets-from-template-xml)
/// for details.
pub const Builder = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.BuilderClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The object the builder is evaluating for.
        pub const current_object = struct {
            pub const name = "current-object";

            pub const Type = ?*gobject.Object;
        };

        /// The scope the builder is operating in
        pub const scope = struct {
            pub const name = "scope";

            pub const Type = ?*gtk.BuilderScope;
        };

        /// The translation domain used when translating property values that
        /// have been marked as translatable.
        ///
        /// If the translation domain is `NULL`, `GtkBuilder` uses `gettext`,
        /// otherwise `glib.dgettext`.
        pub const translation_domain = struct {
            pub const name = "translation-domain";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new empty builder object.
    ///
    /// This function is only useful if you intend to make multiple calls
    /// to `gtk.Builder.addFromFile`, `gtk.Builder.addFromResource`
    /// or `gtk.Builder.addFromString` in order to merge multiple UI
    /// descriptions into a single builder.
    extern fn gtk_builder_new() *gtk.Builder;
    pub const new = gtk_builder_new;

    /// Parses the UI definition in the file `filename`.
    ///
    /// If there is an error opening the file or parsing the description then
    /// the program will be aborted. You should only ever attempt to parse
    /// user interface descriptions that are shipped as part of your program.
    extern fn gtk_builder_new_from_file(p_filename: [*:0]const u8) *gtk.Builder;
    pub const newFromFile = gtk_builder_new_from_file;

    /// Parses the UI definition at `resource_path`.
    ///
    /// If there is an error locating the resource or parsing the
    /// description, then the program will be aborted.
    extern fn gtk_builder_new_from_resource(p_resource_path: [*:0]const u8) *gtk.Builder;
    pub const newFromResource = gtk_builder_new_from_resource;

    /// Parses the UI definition in `string`.
    ///
    /// If `string` is `NULL`-terminated, then `length` should be -1.
    /// If `length` is not -1, then it is the length of `string`.
    ///
    /// If there is an error parsing `string` then the program will be
    /// aborted. You should not attempt to parse user interface description
    /// from untrusted sources.
    extern fn gtk_builder_new_from_string(p_string: [*:0]const u8, p_length: isize) *gtk.Builder;
    pub const newFromString = gtk_builder_new_from_string;

    /// Parses a file containing a UI definition and merges it with
    /// the current contents of `builder`.
    ///
    /// This function is useful if you need to call
    /// `gtk.Builder.setCurrentObject`) to add user data to
    /// callbacks before loading GtkBuilder UI. Otherwise, you probably
    /// want `gtk.Builder.newFromFile` instead.
    ///
    /// If an error occurs, 0 will be returned and `error` will be assigned a
    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or `G_FILE_ERROR`
    /// domains.
    ///
    /// It’s not really reasonable to attempt to handle failures of this
    /// call. You should not use this function with untrusted files (ie:
    /// files that are not part of your application). Broken `GtkBuilder`
    /// files can easily crash your program, and it’s possible that memory
    /// was leaked leading up to the reported failure. The only reasonable
    /// thing to do when an error is detected is to call ``g_error``.
    extern fn gtk_builder_add_from_file(p_builder: *Builder, p_filename: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const addFromFile = gtk_builder_add_from_file;

    /// Parses a resource file containing a UI definition
    /// and merges it with the current contents of `builder`.
    ///
    /// This function is useful if you need to call
    /// `gtk.Builder.setCurrentObject` to add user data to
    /// callbacks before loading GtkBuilder UI. Otherwise, you probably
    /// want `gtk.Builder.newFromResource` instead.
    ///
    /// If an error occurs, 0 will be returned and `error` will be assigned a
    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or `G_RESOURCE_ERROR`
    /// domain.
    ///
    /// It’s not really reasonable to attempt to handle failures of this
    /// call.  The only reasonable thing to do when an error is detected is
    /// to call `g_error`.
    extern fn gtk_builder_add_from_resource(p_builder: *Builder, p_resource_path: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const addFromResource = gtk_builder_add_from_resource;

    /// Parses a string containing a UI definition and merges it
    /// with the current contents of `builder`.
    ///
    /// This function is useful if you need to call
    /// `gtk.Builder.setCurrentObject` to add user data to
    /// callbacks before loading `GtkBuilder` UI. Otherwise, you probably
    /// want `gtk.Builder.newFromString` instead.
    ///
    /// Upon errors `FALSE` will be returned and `error` will be assigned a
    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or
    /// `G_VARIANT_PARSE_ERROR` domain.
    ///
    /// It’s not really reasonable to attempt to handle failures of this
    /// call.  The only reasonable thing to do when an error is detected is
    /// to call `g_error`.
    extern fn gtk_builder_add_from_string(p_builder: *Builder, p_buffer: [*:0]const u8, p_length: isize, p_error: ?*?*glib.Error) c_int;
    pub const addFromString = gtk_builder_add_from_string;

    /// Parses a file containing a UI definition building only the
    /// requested objects and merges them with the current contents
    /// of `builder`.
    ///
    /// Upon errors, 0 will be returned and `error` will be assigned a
    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or `G_FILE_ERROR`
    /// domain.
    ///
    /// If you are adding an object that depends on an object that is not
    /// its child (for instance a `GtkTreeView` that depends on its
    /// `GtkTreeModel`), you have to explicitly list all of them in `object_ids`.
    extern fn gtk_builder_add_objects_from_file(p_builder: *Builder, p_filename: [*:0]const u8, p_object_ids: [*][*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const addObjectsFromFile = gtk_builder_add_objects_from_file;

    /// Parses a resource file containing a UI definition, building
    /// only the requested objects and merges them with the current
    /// contents of `builder`.
    ///
    /// Upon errors, 0 will be returned and `error` will be assigned a
    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or `G_RESOURCE_ERROR`
    /// domain.
    ///
    /// If you are adding an object that depends on an object that is not
    /// its child (for instance a `GtkTreeView` that depends on its
    /// `GtkTreeModel`), you have to explicitly list all of them in `object_ids`.
    extern fn gtk_builder_add_objects_from_resource(p_builder: *Builder, p_resource_path: [*:0]const u8, p_object_ids: [*][*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const addObjectsFromResource = gtk_builder_add_objects_from_resource;

    /// Parses a string containing a UI definition, building only the
    /// requested objects and merges them with the current contents of
    /// `builder`.
    ///
    /// Upon errors `FALSE` will be returned and `error` will be assigned a
    /// `GError` from the `GTK_BUILDER_ERROR` or `G_MARKUP_ERROR` domain.
    ///
    /// If you are adding an object that depends on an object that is not
    /// its child (for instance a `GtkTreeView` that depends on its
    /// `GtkTreeModel`), you have to explicitly list all of them in `object_ids`.
    extern fn gtk_builder_add_objects_from_string(p_builder: *Builder, p_buffer: [*:0]const u8, p_length: isize, p_object_ids: [*][*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const addObjectsFromString = gtk_builder_add_objects_from_string;

    /// Creates a closure to invoke the function called `function_name`.
    ///
    /// This is using the `create_closure` implementation of `builder`'s
    /// `gtk.BuilderScope`.
    ///
    /// If no closure could be created, `NULL` will be returned and `error`
    /// will be set.
    extern fn gtk_builder_create_closure(p_builder: *Builder, p_function_name: [*:0]const u8, p_flags: gtk.BuilderClosureFlags, p_object: ?*gobject.Object, p_error: ?*?*glib.Error) ?*gobject.Closure;
    pub const createClosure = gtk_builder_create_closure;

    /// Add `object` to the `builder` object pool so it can be
    /// referenced just like any other object built by builder.
    ///
    /// Only a single object may be added using `name`. However,
    /// it is not an error to expose the same object under multiple
    /// names. ``gtk.Builder.getObject`` may be used to determine
    /// if an object has already been added with `name`.
    extern fn gtk_builder_expose_object(p_builder: *Builder, p_name: [*:0]const u8, p_object: *gobject.Object) void;
    pub const exposeObject = gtk_builder_expose_object;

    /// Main private entry point for building composite components
    /// from template XML.
    ///
    /// Most likely you do not need to call this function in applications as
    /// templates are handled by `GtkWidget`.
    extern fn gtk_builder_extend_with_template(p_builder: *Builder, p_object: *gobject.Object, p_template_type: usize, p_buffer: [*:0]const u8, p_length: isize, p_error: ?*?*glib.Error) c_int;
    pub const extendWithTemplate = gtk_builder_extend_with_template;

    /// Gets the current object set via `gtk.Builder.setCurrentObject`.
    extern fn gtk_builder_get_current_object(p_builder: *Builder) ?*gobject.Object;
    pub const getCurrentObject = gtk_builder_get_current_object;

    /// Gets the object named `name`.
    ///
    /// Note that this function does not increment the reference count
    /// of the returned object.
    extern fn gtk_builder_get_object(p_builder: *Builder, p_name: [*:0]const u8) ?*gobject.Object;
    pub const getObject = gtk_builder_get_object;

    /// Gets all objects that have been constructed by `builder`.
    ///
    /// Note that this function does not increment the reference
    /// counts of the returned objects.
    extern fn gtk_builder_get_objects(p_builder: *Builder) *glib.SList;
    pub const getObjects = gtk_builder_get_objects;

    /// Gets the scope in use that was set via `gtk.Builder.setScope`.
    extern fn gtk_builder_get_scope(p_builder: *Builder) *gtk.BuilderScope;
    pub const getScope = gtk_builder_get_scope;

    /// Gets the translation domain of `builder`.
    extern fn gtk_builder_get_translation_domain(p_builder: *Builder) ?[*:0]const u8;
    pub const getTranslationDomain = gtk_builder_get_translation_domain;

    /// Looks up a type by name.
    ///
    /// This is using the virtual function that `GtkBuilder` has
    /// for that purpose. This is mainly used when implementing
    /// the `GtkBuildable` interface on a type.
    extern fn gtk_builder_get_type_from_name(p_builder: *Builder, p_type_name: [*:0]const u8) usize;
    pub const getTypeFromName = gtk_builder_get_type_from_name;

    /// Sets the current object for the `builder`.
    ///
    /// The current object can be thought of as the `this` object that the
    /// builder is working for and will often be used as the default object
    /// when an object is optional.
    ///
    /// `gtk.Widget.initTemplate` for example will set the current
    /// object to the widget the template is inited for. For functions like
    /// `gtk.Builder.newFromResource`, the current object will be `NULL`.
    extern fn gtk_builder_set_current_object(p_builder: *Builder, p_current_object: ?*gobject.Object) void;
    pub const setCurrentObject = gtk_builder_set_current_object;

    /// Sets the scope the builder should operate in.
    ///
    /// If `scope` is `NULL`, a new `gtk.BuilderCScope` will be created.
    extern fn gtk_builder_set_scope(p_builder: *Builder, p_scope: ?*gtk.BuilderScope) void;
    pub const setScope = gtk_builder_set_scope;

    /// Sets the translation domain of `builder`.
    extern fn gtk_builder_set_translation_domain(p_builder: *Builder, p_domain: ?[*:0]const u8) void;
    pub const setTranslationDomain = gtk_builder_set_translation_domain;

    /// Demarshals a value from a string.
    ///
    /// This function calls `gobject.Value.init` on the `value` argument,
    /// so it need not be initialised beforehand.
    ///
    /// Can handle char, uchar, boolean, int, uint, long,
    /// ulong, enum, flags, float, double, string, `GdkRGBA` and
    /// `GtkAdjustment` type values.
    ///
    /// Upon errors `FALSE` will be returned and `error` will be
    /// assigned a `GError` from the `GTK_BUILDER_ERROR` domain.
    extern fn gtk_builder_value_from_string(p_builder: *Builder, p_pspec: *gobject.ParamSpec, p_string: [*:0]const u8, p_value: *gobject.Value, p_error: ?*?*glib.Error) c_int;
    pub const valueFromString = gtk_builder_value_from_string;

    /// Demarshals a value from a string.
    ///
    /// Unlike `gtk.Builder.valueFromString`, this function
    /// takes a `GType` instead of `GParamSpec`.
    ///
    /// Calls `gobject.Value.init` on the `value` argument, so it
    /// need not be initialised beforehand.
    ///
    /// Upon errors `FALSE` will be returned and `error` will be
    /// assigned a `GError` from the `GTK_BUILDER_ERROR` domain.
    extern fn gtk_builder_value_from_string_type(p_builder: *Builder, p_type: usize, p_string: [*:0]const u8, p_value: *gobject.Value, p_error: ?*?*glib.Error) c_int;
    pub const valueFromStringType = gtk_builder_value_from_string_type;

    extern fn gtk_builder_get_type() usize;
    pub const getGObjectType = gtk_builder_get_type;

    extern fn g_object_ref(p_self: *gtk.Builder) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Builder) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Builder, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkBuilderScope` implementation for the C language.
///
/// `GtkBuilderCScope` instances use symbols explicitly added to `builder`
/// with prior calls to `gtk.BuilderCScope.addCallbackSymbol`.
/// If developers want to do that, they are encouraged to create their
/// own scopes for that purpose.
///
/// In the case that symbols are not explicitly added; GTK will uses
/// `GModule`’s introspective features (by opening the module `NULL`) to
/// look at the application’s symbol table. From here it tries to match
/// the signal function names given in the interface description with
/// symbols in the application.
///
/// Note that unless `gtk.BuilderCScope.addCallbackSymbol` is
/// called for all signal callbacks which are referenced by the loaded XML,
/// this functionality will require that `GModule` be supported on the platform.
pub const BuilderCScope = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.BuilderScope};
    pub const Class = gtk.BuilderCScopeClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkBuilderCScope` object to use with future
    /// `GtkBuilder` instances.
    ///
    /// Calling this function is only necessary if you want to add
    /// custom callbacks via `gtk.BuilderCScope.addCallbackSymbol`.
    extern fn gtk_builder_cscope_new() *gtk.BuilderCScope;
    pub const new = gtk_builder_cscope_new;

    /// Adds the `callback_symbol` to the scope of `builder` under the
    /// given `callback_name`.
    ///
    /// Using this function overrides the behavior of
    /// `gtk.Builder.createClosure` for any callback symbols that
    /// are added. Using this method allows for better encapsulation as it
    /// does not require that callback symbols be declared in the global
    /// namespace.
    extern fn gtk_builder_cscope_add_callback_symbol(p_self: *BuilderCScope, p_callback_name: [*:0]const u8, p_callback_symbol: gobject.Callback) void;
    pub const addCallbackSymbol = gtk_builder_cscope_add_callback_symbol;

    /// A convenience function to add many callbacks.
    ///
    /// This is equivalent to calling `gtk.BuilderCScope.addCallbackSymbol`
    /// for each symbol.
    extern fn gtk_builder_cscope_add_callback_symbols(p_self: *BuilderCScope, p_first_callback_name: [*:0]const u8, p_first_callback_symbol: gobject.Callback, ...) void;
    pub const addCallbackSymbols = gtk_builder_cscope_add_callback_symbols;

    /// Fetches a symbol previously added with
    /// `gtk.BuilderCScope.addCallbackSymbol`.
    extern fn gtk_builder_cscope_lookup_callback_symbol(p_self: *BuilderCScope, p_callback_name: [*:0]const u8) ?gobject.Callback;
    pub const lookupCallbackSymbol = gtk_builder_cscope_lookup_callback_symbol;

    extern fn gtk_builder_cscope_get_type() usize;
    pub const getGObjectType = gtk_builder_cscope_get_type;

    extern fn g_object_ref(p_self: *gtk.BuilderCScope) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BuilderCScope) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BuilderCScope, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Creates widgets by instantiating `GtkBuilder` UI templates.
///
/// The templates must extend the class that the parent widget expects.
/// For example, a factory provided to `gtk.ListView.properties.factory` must have
/// a template that extends `gtk.ListItem`.
///
/// Templates typically use `gtk.Expression` to obtain data from the items
/// in the model.
///
/// Example:
/// ```xml
///   <interface>
///     <template class="GtkListItem">
///       <property name="child">
///         <object class="GtkLabel">
///           <property name="xalign">0</property>
///           <binding name="label">
///             <lookup name="name" type="SettingsKey">
///               <lookup name="item">GtkListItem</lookup>
///             </lookup>
///           </binding>
///         </object>
///       </property>
///     </template>
///   </interface>
/// ```
///
/// A common approach is to embed such templates as CDATA marked sections into
/// a surrounding UI file. Note that if you use this approach, extracting
/// translatable strings with xgettext will not work for strings inside the
/// marked section.
pub const BuilderListItemFactory = opaque {
    pub const Parent = gtk.ListItemFactory;
    pub const Implements = [_]type{};
    pub const Class = gtk.BuilderListItemFactoryClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// `GBytes` containing the UI definition.
        pub const bytes = struct {
            pub const name = "bytes";

            pub const Type = ?*glib.Bytes;
        };

        /// Path of the resource containing the UI definition.
        pub const resource = struct {
            pub const name = "resource";

            pub const Type = ?[*:0]u8;
        };

        /// `GtkBuilderScope` to use when instantiating listitems
        pub const scope = struct {
            pub const name = "scope";

            pub const Type = ?*gtk.BuilderScope;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkBuilderListItemFactory` that instantiates widgets
    /// using `bytes` as the data to pass to `GtkBuilder`.
    extern fn gtk_builder_list_item_factory_new_from_bytes(p_scope: ?*gtk.BuilderScope, p_bytes: *glib.Bytes) *gtk.BuilderListItemFactory;
    pub const newFromBytes = gtk_builder_list_item_factory_new_from_bytes;

    /// Creates a new `GtkBuilderListItemFactory` that instantiates widgets
    /// using data read from the given `resource_path` to pass to `GtkBuilder`.
    extern fn gtk_builder_list_item_factory_new_from_resource(p_scope: ?*gtk.BuilderScope, p_resource_path: [*:0]const u8) *gtk.BuilderListItemFactory;
    pub const newFromResource = gtk_builder_list_item_factory_new_from_resource;

    /// Gets the data used as the `GtkBuilder` UI template for constructing
    /// listitems.
    extern fn gtk_builder_list_item_factory_get_bytes(p_self: *BuilderListItemFactory) *glib.Bytes;
    pub const getBytes = gtk_builder_list_item_factory_get_bytes;

    /// If the data references a resource, gets the path of that resource.
    extern fn gtk_builder_list_item_factory_get_resource(p_self: *BuilderListItemFactory) ?[*:0]const u8;
    pub const getResource = gtk_builder_list_item_factory_get_resource;

    /// Gets the scope used when constructing listitems.
    extern fn gtk_builder_list_item_factory_get_scope(p_self: *BuilderListItemFactory) ?*gtk.BuilderScope;
    pub const getScope = gtk_builder_list_item_factory_get_scope;

    extern fn gtk_builder_list_item_factory_get_type() usize;
    pub const getGObjectType = gtk_builder_list_item_factory_get_type;

    extern fn g_object_ref(p_self: *gtk.BuilderListItemFactory) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BuilderListItemFactory) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BuilderListItemFactory, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Calls a callback function when the button is clicked.
///
/// <picture>
///   <source srcset="button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkButton" src="button.png">
/// </picture>
///
/// The `GtkButton` widget can hold any valid child widget. That is, it can hold
/// almost any other standard `GtkWidget`. The most commonly used child is the
/// `GtkLabel`.
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.Button.signals.activate`
///
/// # CSS nodes
///
/// `GtkButton` has a single CSS node with name button. The node will get the
/// style classes .image-button or .text-button, if the content is just an
/// image or label, respectively. It may also receive the .flat style class.
/// When activating a button via the keyboard, the button will temporarily
/// gain the .keyboard-activating style class.
///
/// Other style classes that are commonly used with `GtkButton` include
/// .suggested-action and .destructive-action. In special cases, buttons
/// can be made round by adding the .circular style class.
///
/// Button-like widgets like `gtk.ToggleButton`, `gtk.MenuButton`,
/// `gtk.VolumeButton`, `gtk.LockButton`, `gtk.ColorButton`
/// or `gtk.FontButton` use style classes such as .toggle, .popup, .scale,
/// .lock, .color on the button node to differentiate themselves from a plain
/// `GtkButton`.
///
/// # Accessibility
///
/// `GtkButton` uses the `gtk.@"AccessibleRole.button"` role.
pub const Button = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.ButtonClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        /// Signal that causes the button to animate press then
        ///    release. Applications should never connect to this signal, but use
        ///    the `clicked` signal.
        pub const activate = struct {
            pub fn call(p_class: anytype, p_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Button.Class, p_class).f_activate.?(gobject.ext.as(Button, p_button));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Button.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when the button has been activated (pressed and released).
        pub const clicked = struct {
            pub fn call(p_class: anytype, p_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Button.Class, p_class).f_clicked.?(gobject.ext.as(Button, p_button));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Button.Class, p_class).f_clicked = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Whether the size of the button can be made smaller than the natural
        /// size of its contents.
        ///
        /// For text buttons, setting this property will allow ellipsizing the label.
        ///
        /// If the contents of a button are an icon or a custom widget, setting this
        /// property has no effect.
        pub const can_shrink = struct {
            pub const name = "can-shrink";

            pub const Type = c_int;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the button has a frame.
        pub const has_frame = struct {
            pub const name = "has-frame";

            pub const Type = c_int;
        };

        /// The name of the icon used to automatically populate the button.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// Text of the label inside the button, if the button contains a label widget.
        pub const label = struct {
            pub const name = "label";

            pub const Type = ?[*:0]u8;
        };

        /// If set, an underline in the text indicates that the following character is
        /// to be used as mnemonic.
        pub const use_underline = struct {
            pub const name = "use-underline";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to animate press then release.
        ///
        /// This is an action signal. Applications should never connect
        /// to this signal, but use the `gtk.Button.signals.clicked` signal.
        ///
        /// The default bindings for this signal are all forms of the
        /// <kbd>␣</kbd> and <kbd>Enter</kbd> keys.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Button, p_instance))),
                    gobject.signalLookup("activate", Button.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the button has been activated (pressed and released).
        pub const clicked = struct {
            pub const name = "clicked";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Button, p_instance))),
                    gobject.signalLookup("clicked", Button.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkButton` widget.
    ///
    /// To add a child widget to the button, use `gtk.Button.setChild`.
    extern fn gtk_button_new() *gtk.Button;
    pub const new = gtk_button_new;

    /// Creates a new button containing an icon from the current icon theme.
    ///
    /// If the icon name isn’t known, a “broken image” icon will be
    /// displayed instead. If the current icon theme is changed, the icon
    /// will be updated appropriately.
    extern fn gtk_button_new_from_icon_name(p_icon_name: [*:0]const u8) *gtk.Button;
    pub const newFromIconName = gtk_button_new_from_icon_name;

    /// Creates a `GtkButton` widget with a `GtkLabel` child.
    extern fn gtk_button_new_with_label(p_label: [*:0]const u8) *gtk.Button;
    pub const newWithLabel = gtk_button_new_with_label;

    /// Creates a new `GtkButton` containing a label.
    ///
    /// If characters in `label` are preceded by an underscore, they are underlined.
    /// If you need a literal underscore character in a label, use “__” (two
    /// underscores). The first underlined character represents a keyboard
    /// accelerator called a mnemonic. Pressing <kbd>Alt</kbd> and that key
    /// activates the button.
    extern fn gtk_button_new_with_mnemonic(p_label: [*:0]const u8) *gtk.Button;
    pub const newWithMnemonic = gtk_button_new_with_mnemonic;

    /// Retrieves whether the button can be smaller than the natural
    /// size of its contents.
    extern fn gtk_button_get_can_shrink(p_button: *Button) c_int;
    pub const getCanShrink = gtk_button_get_can_shrink;

    /// Gets the child widget of `button`.
    extern fn gtk_button_get_child(p_button: *Button) ?*gtk.Widget;
    pub const getChild = gtk_button_get_child;

    /// Returns whether the button has a frame.
    extern fn gtk_button_get_has_frame(p_button: *Button) c_int;
    pub const getHasFrame = gtk_button_get_has_frame;

    /// Returns the icon name of the button.
    ///
    /// If the icon name has not been set with `gtk.Button.setIconName`
    /// the return value will be `NULL`. This will be the case if you create
    /// an empty button with `gtk.Button.new` to use as a container.
    extern fn gtk_button_get_icon_name(p_button: *Button) ?[*:0]const u8;
    pub const getIconName = gtk_button_get_icon_name;

    /// Fetches the text from the label of the button.
    ///
    /// If the label text has not been set with `gtk.Button.setLabel`
    /// the return value will be `NULL`. This will be the case if you create
    /// an empty button with `gtk.Button.new` to use as a container.
    extern fn gtk_button_get_label(p_button: *Button) ?[*:0]const u8;
    pub const getLabel = gtk_button_get_label;

    /// gets whether underlines are interpreted as mnemonics.
    ///
    /// See `gtk.Button.setUseUnderline`.
    extern fn gtk_button_get_use_underline(p_button: *Button) c_int;
    pub const getUseUnderline = gtk_button_get_use_underline;

    /// Sets whether the button size can be smaller than the natural size of
    /// its contents.
    ///
    /// For text buttons, setting `can_shrink` to true will ellipsize the label.
    ///
    /// For icons and custom children, this function has no effect.
    extern fn gtk_button_set_can_shrink(p_button: *Button, p_can_shrink: c_int) void;
    pub const setCanShrink = gtk_button_set_can_shrink;

    /// Sets the child widget of `button`.
    ///
    /// Note that by using this API, you take full responsibility for setting
    /// up the proper accessibility label and description information for `button`.
    /// Most likely, you'll either set the accessibility label or description
    /// for `button` explicitly, or you'll set a labelled-by or described-by
    /// relations from `child` to `button`.
    extern fn gtk_button_set_child(p_button: *Button, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_button_set_child;

    /// Sets the style of the button.
    ///
    /// Buttons can have a flat appearance or have a frame drawn around them.
    extern fn gtk_button_set_has_frame(p_button: *Button, p_has_frame: c_int) void;
    pub const setHasFrame = gtk_button_set_has_frame;

    /// Adds a `GtkImage` with the given icon name as a child.
    ///
    /// If `button` already contains a child widget, that child widget will
    /// be removed and replaced with the image.
    extern fn gtk_button_set_icon_name(p_button: *Button, p_icon_name: [*:0]const u8) void;
    pub const setIconName = gtk_button_set_icon_name;

    /// Sets the text of the label of the button to `label`.
    ///
    /// This will also clear any previously set labels.
    extern fn gtk_button_set_label(p_button: *Button, p_label: [*:0]const u8) void;
    pub const setLabel = gtk_button_set_label;

    /// Sets whether to use underlines as mnemonics.
    ///
    /// If true, an underline in the text of the button label indicates
    /// the next character should be used for the mnemonic accelerator key.
    extern fn gtk_button_set_use_underline(p_button: *Button, p_use_underline: c_int) void;
    pub const setUseUnderline = gtk_button_set_use_underline;

    extern fn gtk_button_get_type() usize;
    pub const getGObjectType = gtk_button_get_type;

    extern fn g_object_ref(p_self: *gtk.Button) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Button) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Button, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A variant of `GtkClosureExpression` using a C closure.
pub const CClosureExpression = opaque {
    pub const Parent = gtk.Expression;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CClosureExpression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a `GtkExpression` that calls `callback_func` when it is evaluated.
    ///
    /// This function is a variant of `gtk.ClosureExpression.new` that
    /// creates a `GClosure` by calling `gobject.cclosureNew` with the given
    /// `callback_func`, `user_data` and `user_destroy`.
    extern fn gtk_cclosure_expression_new(p_value_type: usize, p_marshal: ?gobject.ClosureMarshal, p_n_params: c_uint, p_params: [*]*gtk.Expression, p_callback_func: gobject.Callback, p_user_data: ?*anyopaque, p_user_destroy: ?gobject.ClosureNotify) *gtk.CClosureExpression;
    pub const new = gtk_cclosure_expression_new;

    extern fn gtk_cclosure_expression_get_type() usize;
    pub const getGObjectType = gtk_cclosure_expression_get_type;

    pub fn as(p_instance: *CClosureExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays a Gregorian calendar, one month at a time.
///
/// <picture>
///   <source srcset="calendar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkCalendar" src="calendar.png">
/// </picture>
///
/// A `GtkCalendar` can be created with `gtk.Calendar.new`.
///
/// The selected date can be retrieved from a `GtkCalendar` using
/// `gtk.Calendar.getDate`.
/// It can be altered with `gtk.Calendar.setDate`.
///
/// To place a visual marker on a particular day, use
/// `gtk.Calendar.markDay` and to remove the marker,
/// `gtk.Calendar.unmarkDay`. Alternative, all
/// marks can be cleared with `gtk.Calendar.clearMarks`.
///
/// Users should be aware that, although the Gregorian calendar is the
/// legal calendar in most countries, it was adopted progressively
/// between 1582 and 1929. Display before these dates is likely to be
/// historically incorrect.
///
/// # Shortcuts and Gestures
///
/// `GtkCalendar` supports the following gestures:
///
/// - Scrolling up or down will switch to the previous or next month.
/// - Date strings can be dropped for setting the current day.
///
/// # CSS nodes
///
/// ```
/// calendar.view
/// ├── header
/// │   ├── button
/// │   ├── stack.month
/// │   ├── button
/// │   ├── button
/// │   ├── label.year
/// │   ╰── button
/// ╰── grid
///     ╰── label[.day-name][.week-number][.day-number][.other-month][.today]
/// ```
///
/// `GtkCalendar` has a main node with name calendar. It contains a subnode
/// called header containing the widgets for switching between years and months.
///
/// The grid subnode contains all day labels, including week numbers on the left
/// (marked with the .week-number css class) and day names on top (marked with the
/// .day-name css class).
///
/// Day labels that belong to the previous or next month get the .other-month
/// style class. The label of the current day get the .today style class.
///
/// Marked day labels get the :selected state assigned.
pub const Calendar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Calendar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The selected date.
        ///
        /// This property gets initially set to the current date.
        pub const date = struct {
            pub const name = "date";

            pub const Type = ?*glib.DateTime;
        };

        /// The selected day (as a number between 1 and 31).
        pub const day = struct {
            pub const name = "day";

            pub const Type = c_int;
        };

        /// The selected month (as a number between 0 and 11).
        ///
        /// This property gets initially set to the current month.
        pub const month = struct {
            pub const name = "month";

            pub const Type = c_int;
        };

        /// Determines whether day names are displayed.
        pub const show_day_names = struct {
            pub const name = "show-day-names";

            pub const Type = c_int;
        };

        /// Determines whether a heading is displayed.
        pub const show_heading = struct {
            pub const name = "show-heading";

            pub const Type = c_int;
        };

        /// Determines whether week numbers are displayed.
        pub const show_week_numbers = struct {
            pub const name = "show-week-numbers";

            pub const Type = c_int;
        };

        /// The selected year.
        ///
        /// This property gets initially set to the current year.
        pub const year = struct {
            pub const name = "year";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the user selects a day.
        pub const day_selected = struct {
            pub const name = "day-selected";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Calendar, p_instance))),
                    gobject.signalLookup("day-selected", Calendar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user switches to the next month.
        pub const next_month = struct {
            pub const name = "next-month";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Calendar, p_instance))),
                    gobject.signalLookup("next-month", Calendar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when user switches to the next year.
        pub const next_year = struct {
            pub const name = "next-year";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Calendar, p_instance))),
                    gobject.signalLookup("next-year", Calendar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user switches to the previous month.
        pub const prev_month = struct {
            pub const name = "prev-month";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Calendar, p_instance))),
                    gobject.signalLookup("prev-month", Calendar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when user switches to the previous year.
        pub const prev_year = struct {
            pub const name = "prev-year";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Calendar, p_instance))),
                    gobject.signalLookup("prev-year", Calendar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new calendar, with the current date being selected.
    extern fn gtk_calendar_new() *gtk.Calendar;
    pub const new = gtk_calendar_new;

    /// Remove all visual markers.
    extern fn gtk_calendar_clear_marks(p_calendar: *Calendar) void;
    pub const clearMarks = gtk_calendar_clear_marks;

    /// Returns a `GDateTime` representing the shown
    /// year, month and the selected day.
    ///
    /// The returned date is in the local time zone.
    extern fn gtk_calendar_get_date(p_self: *Calendar) *glib.DateTime;
    pub const getDate = gtk_calendar_get_date;

    /// Gets the day of the selected date.
    extern fn gtk_calendar_get_day(p_self: *Calendar) c_int;
    pub const getDay = gtk_calendar_get_day;

    /// Returns if the `day` of the `calendar` is already marked.
    extern fn gtk_calendar_get_day_is_marked(p_calendar: *Calendar, p_day: c_uint) c_int;
    pub const getDayIsMarked = gtk_calendar_get_day_is_marked;

    /// Gets the month of the selected date.
    extern fn gtk_calendar_get_month(p_self: *Calendar) c_int;
    pub const getMonth = gtk_calendar_get_month;

    /// Returns whether `self` is currently showing the names
    /// of the week days.
    ///
    /// This is the value of the `gtk.Calendar.properties.show_day_names`
    /// property.
    extern fn gtk_calendar_get_show_day_names(p_self: *Calendar) c_int;
    pub const getShowDayNames = gtk_calendar_get_show_day_names;

    /// Returns whether `self` is currently showing the heading.
    ///
    /// This is the value of the `gtk.Calendar.properties.show_heading`
    /// property.
    extern fn gtk_calendar_get_show_heading(p_self: *Calendar) c_int;
    pub const getShowHeading = gtk_calendar_get_show_heading;

    /// Returns whether `self` is showing week numbers right
    /// now.
    ///
    /// This is the value of the `gtk.Calendar.properties.show_week_numbers`
    /// property.
    extern fn gtk_calendar_get_show_week_numbers(p_self: *Calendar) c_int;
    pub const getShowWeekNumbers = gtk_calendar_get_show_week_numbers;

    /// Gets the year of the selected date.
    extern fn gtk_calendar_get_year(p_self: *Calendar) c_int;
    pub const getYear = gtk_calendar_get_year;

    /// Places a visual marker on a particular day of the current month.
    extern fn gtk_calendar_mark_day(p_calendar: *Calendar, p_day: c_uint) void;
    pub const markDay = gtk_calendar_mark_day;

    /// Switches to `date`'s year and month and select its day.
    extern fn gtk_calendar_select_day(p_self: *Calendar, p_date: *glib.DateTime) void;
    pub const selectDay = gtk_calendar_select_day;

    /// Switches to `date`'s year and month and selects its day.
    extern fn gtk_calendar_set_date(p_self: *Calendar, p_date: *glib.DateTime) void;
    pub const setDate = gtk_calendar_set_date;

    /// Sets the day for the selected date.
    ///
    /// The new date must be valid. For example, setting the day to 31 when the
    /// month is February will fail.
    extern fn gtk_calendar_set_day(p_self: *Calendar, p_day: c_int) void;
    pub const setDay = gtk_calendar_set_day;

    /// Sets the month for the selected date.
    ///
    /// The new date must be valid. For example, setting the month to 1 (February)
    /// when the day is 31 will fail.
    extern fn gtk_calendar_set_month(p_self: *Calendar, p_month: c_int) void;
    pub const setMonth = gtk_calendar_set_month;

    /// Sets whether the calendar shows day names.
    extern fn gtk_calendar_set_show_day_names(p_self: *Calendar, p_value: c_int) void;
    pub const setShowDayNames = gtk_calendar_set_show_day_names;

    /// Sets whether the calendar should show a heading.
    ///
    /// The heading contains the current year and month as well as
    /// buttons for changing both.
    extern fn gtk_calendar_set_show_heading(p_self: *Calendar, p_value: c_int) void;
    pub const setShowHeading = gtk_calendar_set_show_heading;

    /// Sets whether week numbers are shown in the calendar.
    extern fn gtk_calendar_set_show_week_numbers(p_self: *Calendar, p_value: c_int) void;
    pub const setShowWeekNumbers = gtk_calendar_set_show_week_numbers;

    /// Sets the year for the selected date.
    ///
    /// The new date must be valid. For example, setting the year to 2023 when the
    /// date is February 29 will fail.
    extern fn gtk_calendar_set_year(p_self: *Calendar, p_year: c_int) void;
    pub const setYear = gtk_calendar_set_year;

    /// Removes the visual marker from a particular day.
    extern fn gtk_calendar_unmark_day(p_calendar: *Calendar, p_day: c_uint) void;
    pub const unmarkDay = gtk_calendar_unmark_day;

    extern fn gtk_calendar_get_type() usize;
    pub const getGObjectType = gtk_calendar_get_type;

    extern fn g_object_ref(p_self: *gtk.Calendar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Calendar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Calendar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Invokes a callback.
pub const CallbackAction = opaque {
    pub const Parent = gtk.ShortcutAction;
    pub const Implements = [_]type{};
    pub const Class = gtk.CallbackActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Create a custom action that calls the given `callback` when
    /// activated.
    extern fn gtk_callback_action_new(p_callback: gtk.ShortcutFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) *gtk.CallbackAction;
    pub const new = gtk_callback_action_new;

    extern fn gtk_callback_action_get_type() usize;
    pub const getGObjectType = gtk_callback_action_get_type;

    extern fn g_object_ref(p_self: *gtk.CallbackAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CallbackAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CallbackAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An abstract class for laying out `GtkCellRenderer`s
///
/// The `GtkCellArea` is an abstract class for `gtk.CellLayout`
/// widgets (also referred to as "layouting widgets") to interface with
/// an arbitrary number of `gtk.CellRenderer`s and interact with the user
/// for a given `gtk.TreeModel` row.
///
/// The cell area handles events, focus navigation, drawing and
/// size requests and allocations for a given row of data.
///
/// Usually users dont have to interact with the `GtkCellArea` directly
/// unless they are implementing a cell-layouting widget themselves.
///
/// ## Requesting area sizes
///
/// As outlined in
/// [GtkWidget’s geometry management section](class.Widget.html`height`-for-width-geometry-management),
/// GTK uses a height-for-width
/// geometry management system to compute the sizes of widgets and user
/// interfaces. `GtkCellArea` uses the same semantics to calculate the
/// size of an area for an arbitrary number of `GtkTreeModel` rows.
///
/// When requesting the size of a cell area one needs to calculate
/// the size for a handful of rows, and this will be done differently by
/// different layouting widgets. For instance a `gtk.TreeViewColumn`
/// always lines up the areas from top to bottom while a `gtk.IconView`
/// on the other hand might enforce that all areas received the same
/// width and wrap the areas around, requesting height for more cell
/// areas when allocated less width.
///
/// It’s also important for areas to maintain some cell
/// alignments with areas rendered for adjacent rows (cells can
/// appear “columnized” inside an area even when the size of
/// cells are different in each row). For this reason the `GtkCellArea`
/// uses a `gtk.CellAreaContext` object to store the alignments
/// and sizes along the way (as well as the overall largest minimum
/// and natural size for all the rows which have been calculated
/// with the said context).
///
/// The `gtk.CellAreaContext` is an opaque object specific to the
/// `GtkCellArea` which created it (see `gtk.CellArea.createContext`).
///
/// The owning cell-layouting widget can create as many contexts as
/// it wishes to calculate sizes of rows which should receive the
/// same size in at least one orientation (horizontally or vertically),
/// However, it’s important that the same `gtk.CellAreaContext` which
/// was used to request the sizes for a given `GtkTreeModel` row be
/// used when rendering or processing events for that row.
///
/// In order to request the width of all the rows at the root level
/// of a `GtkTreeModel` one would do the following:
///
/// ```c
/// GtkTreeIter iter;
/// int minimum_width;
/// int natural_width;
///
/// valid = gtk_tree_model_get_iter_first (model, &iter);
/// while (valid)
///   {
///     gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
///     gtk_cell_area_get_preferred_width (area, context, widget, NULL, NULL);
///
///     valid = gtk_tree_model_iter_next (model, &iter);
///   }
///
/// gtk_cell_area_context_get_preferred_width (context, &minimum_width, &natural_width);
/// ```
///
/// Note that in this example it’s not important to observe the
/// returned minimum and natural width of the area for each row
/// unless the cell-layouting object is actually interested in the
/// widths of individual rows. The overall width is however stored
/// in the accompanying `GtkCellAreaContext` object and can be consulted
/// at any time.
///
/// This can be useful since `GtkCellLayout` widgets usually have to
/// support requesting and rendering rows in treemodels with an
/// exceedingly large amount of rows. The `GtkCellLayout` widget in
/// that case would calculate the required width of the rows in an
/// idle or timeout source (see `glib.timeoutAdd`) and when the widget
/// is requested its actual width in `gtk.Widget.virtual_methods.measure`
/// it can simply consult the width accumulated so far in the
/// `GtkCellAreaContext` object.
///
/// A simple example where rows are rendered from top to bottom and
/// take up the full width of the layouting widget would look like:
///
/// ```c
/// static void
/// foo_get_preferred_width (GtkWidget *widget,
///                          int       *minimum_size,
///                          int       *natural_size)
/// {
///   Foo *self = FOO (widget);
///   FooPrivate *priv = foo_get_instance_private (self);
///
///   foo_ensure_at_least_one_handfull_of_rows_have_been_requested (self);
///
///   gtk_cell_area_context_get_preferred_width (priv->context, minimum_size, natural_size);
/// }
/// ```
///
/// In the above example the `Foo` widget has to make sure that some
/// row sizes have been calculated (the amount of rows that `Foo` judged
/// was appropriate to request space for in a single timeout iteration)
/// before simply returning the amount of space required by the area via
/// the `GtkCellAreaContext`.
///
/// Requesting the height for width (or width for height) of an area is
/// a similar task except in this case the `GtkCellAreaContext` does not
/// store the data (actually, it does not know how much space the layouting
/// widget plans to allocate it for every row. It’s up to the layouting
/// widget to render each row of data with the appropriate height and
/// width which was requested by the `GtkCellArea`).
///
/// In order to request the height for width of all the rows at the
/// root level of a `GtkTreeModel` one would do the following:
///
/// ```c
/// GtkTreeIter iter;
/// int minimum_height;
/// int natural_height;
/// int full_minimum_height = 0;
/// int full_natural_height = 0;
///
/// valid = gtk_tree_model_get_iter_first (model, &iter);
/// while (valid)
///   {
///     gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
///     gtk_cell_area_get_preferred_height_for_width (area, context, widget,
///                                                   width, &minimum_height, &natural_height);
///
///     if (width_is_for_allocation)
///        cache_row_height (&iter, minimum_height, natural_height);
///
///     full_minimum_height += minimum_height;
///     full_natural_height += natural_height;
///
///     valid = gtk_tree_model_iter_next (model, &iter);
///   }
/// ```
///
/// Note that in the above example we would need to cache the heights
/// returned for each row so that we would know what sizes to render the
/// areas for each row. However we would only want to really cache the
/// heights if the request is intended for the layouting widgets real
/// allocation.
///
/// In some cases the layouting widget is requested the height for an
/// arbitrary for_width, this is a special case for layouting widgets
/// who need to request size for tens of thousands  of rows. For this
/// case it’s only important that the layouting widget calculate
/// one reasonably sized chunk of rows and return that height
/// synchronously. The reasoning here is that any layouting widget is
/// at least capable of synchronously calculating enough height to fill
/// the screen height (or scrolled window height) in response to a single
/// call to `gtk.Widget.virtual_methods.measure`. Returning
/// a perfect height for width that is larger than the screen area is
/// inconsequential since after the layouting receives an allocation
/// from a scrolled window it simply continues to drive the scrollbar
/// values while more and more height is required for the row heights
/// that are calculated in the background.
///
/// ## Rendering Areas
///
/// Once area sizes have been acquired at least for the rows in the
/// visible area of the layouting widget they can be rendered at
/// `gtk.Widget.virtual_methods.snapshot` time.
///
/// A crude example of how to render all the rows at the root level
/// runs as follows:
///
/// ```c
/// GtkAllocation allocation;
/// GdkRectangle cell_area = { 0, };
/// GtkTreeIter iter;
/// int minimum_width;
/// int natural_width;
///
/// gtk_widget_get_allocation (widget, &allocation);
/// cell_area.width = allocation.width;
///
/// valid = gtk_tree_model_get_iter_first (model, &iter);
/// while (valid)
///   {
///     cell_area.height = get_cached_height_for_row (&iter);
///
///     gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE);
///     gtk_cell_area_render (area, context, widget, cr,
///                           &cell_area, &cell_area, state_flags, FALSE);
///
///     cell_area.y += cell_area.height;
///
///     valid = gtk_tree_model_iter_next (model, &iter);
///   }
/// ```
///
/// Note that the cached height in this example really depends on how
/// the layouting widget works. The layouting widget might decide to
/// give every row its minimum or natural height or, if the model content
/// is expected to fit inside the layouting widget without scrolling, it
/// would make sense to calculate the allocation for each row at
/// the time the widget is allocated using `gtk.distributeNaturalAllocation`.
///
/// ## Handling Events and Driving Keyboard Focus
///
/// Passing events to the area is as simple as handling events on any
/// normal widget and then passing them to the `gtk.CellArea.event`
/// API as they come in. Usually `GtkCellArea` is only interested in
/// button events, however some customized derived areas can be implemented
/// who are interested in handling other events. Handling an event can
/// trigger the `gtk.CellArea.signals.focus_changed` signal to fire; as well
/// as `gtk.CellArea.signals.add_editable` in the case that an editable cell
/// was clicked and needs to start editing. You can call
/// `gtk.CellArea.stopEditing` at any time to cancel any cell editing
/// that is currently in progress.
///
/// The `GtkCellArea` drives keyboard focus from cell to cell in a way
/// similar to `GtkWidget`. For layouting widgets that support giving
/// focus to cells it’s important to remember to pass `GTK_CELL_RENDERER_FOCUSED`
/// to the area functions for the row that has focus and to tell the
/// area to paint the focus at render time.
///
/// Layouting widgets that accept focus on cells should implement the
/// `gtk.Widget.virtual_methods.focus` virtual method. The layouting widget is always
/// responsible for knowing where `GtkTreeModel` rows are rendered inside
/// the widget, so at `gtk.Widget.virtual_methods.focus` time the layouting widget
/// should use the `GtkCellArea` methods to navigate focus inside the area
/// and then observe the `gtk.DirectionType` to pass the focus to adjacent
/// rows and areas.
///
/// A basic example of how the `gtk.Widget.virtual_methods.focus` virtual method
/// should be implemented:
///
/// ```
/// static gboolean
/// foo_focus (GtkWidget       *widget,
///            GtkDirectionType direction)
/// {
///   Foo *self = FOO (widget);
///   FooPrivate *priv = foo_get_instance_private (self);
///   int focus_row = priv->focus_row;
///   gboolean have_focus = FALSE;
///
///   if (!gtk_widget_has_focus (widget))
///     gtk_widget_grab_focus (widget);
///
///   valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, priv->focus_row);
///   while (valid)
///     {
///       gtk_cell_area_apply_attributes (priv->area, priv->model, &iter, FALSE, FALSE);
///
///       if (gtk_cell_area_focus (priv->area, direction))
///         {
///            priv->focus_row = focus_row;
///            have_focus = TRUE;
///            break;
///         }
///       else
///         {
///           if (direction == GTK_DIR_RIGHT ||
///               direction == GTK_DIR_LEFT)
///             break;
///           else if (direction == GTK_DIR_UP ||
///                    direction == GTK_DIR_TAB_BACKWARD)
///            {
///               if (focus_row == 0)
///                 break;
///               else
///                {
///                   focus_row--;
///                   valid = gtk_tree_model_iter_nth_child (priv->model, &iter, NULL, focus_row);
///                }
///             }
///           else
///             {
///               if (focus_row == last_row)
///                 break;
///               else
///                 {
///                   focus_row++;
///                   valid = gtk_tree_model_iter_next (priv->model, &iter);
///                 }
///             }
///         }
///     }
///     return have_focus;
/// }
/// ```
///
/// Note that the layouting widget is responsible for matching the
/// `GtkDirectionType` values to the way it lays out its cells.
///
/// ## Cell Properties
///
/// The `GtkCellArea` introduces cell properties for `GtkCellRenderer`s.
/// This provides some general interfaces for defining the relationship
/// cell areas have with their cells. For instance in a `gtk.CellAreaBox`
/// a cell might “expand” and receive extra space when the area is allocated
/// more than its full natural request, or a cell might be configured to “align”
/// with adjacent rows which were requested and rendered with the same
/// `GtkCellAreaContext`.
///
/// Use `gtk.CellAreaClass.installCellProperty` to install cell
/// properties for a cell area class and `gtk.CellAreaClass.findCellProperty`
/// or `gtk.CellAreaClass.listCellProperties` to get information about
/// existing cell properties.
///
/// To set the value of a cell property, use `gtk.CellArea.cellSetProperty`,
/// `gtk.CellArea.cellSet` or `gtk.CellArea.cellSetValist`. To obtain
/// the value of a cell property, use `gtk.CellArea.cellGetProperty`
/// `gtk.CellArea.cellGet` or `gtk.CellArea.cellGetValist`.
pub const CellArea = extern struct {
    pub const Parent = gobject.InitiallyUnowned;
    pub const Implements = [_]type{ gtk.Buildable, gtk.CellLayout };
    pub const Class = gtk.CellAreaClass;
    f_parent_instance: gobject.InitiallyUnowned,

    pub const virtual_methods = struct {
        /// Activates `area`, usually by activating the currently focused
        /// cell, however some subclasses which embed widgets in the area
        /// can also activate a widget if it currently has the focus.
        pub const activate = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_edit_only: c_int) c_int {
                return gobject.ext.as(CellArea.Class, p_class).f_activate.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_cell_area, p_flags, p_edit_only);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_edit_only: c_int) callconv(.c) c_int) void {
                gobject.ext.as(CellArea.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };

        /// Adds `renderer` to `area` with the default child cell properties.
        pub const add = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer) void {
                return gobject.ext.as(CellArea.Class, p_class).f_add.?(gobject.ext.as(CellArea, p_area), p_renderer);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_add = @ptrCast(p_implementation);
            }
        };

        /// Applies any connected attributes to the renderers in
        /// `area` by pulling the values from `tree_model`.
        pub const apply_attributes = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_is_expander: c_int, p_is_expanded: c_int) void {
                return gobject.ext.as(CellArea.Class, p_class).f_apply_attributes.?(gobject.ext.as(CellArea, p_area), p_tree_model, p_iter, p_is_expander, p_is_expanded);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_is_expander: c_int, p_is_expanded: c_int) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_apply_attributes = @ptrCast(p_implementation);
            }
        };

        /// This is sometimes needed for cases where rows need to share
        /// alignments in one orientation but may be separately grouped
        /// in the opposing orientation.
        ///
        /// For instance, `GtkIconView` creates all icons (rows) to have
        /// the same width and the cells theirin to have the same
        /// horizontal alignments. However each row of icons may have
        /// a separate collective height. `GtkIconView` uses this to
        /// request the heights of each row based on a context which
        /// was already used to request all the row widths that are
        /// to be displayed.
        pub const copy_context = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext) *gtk.CellAreaContext {
                return gobject.ext.as(CellArea.Class, p_class).f_copy_context.?(gobject.ext.as(CellArea, p_area), p_context);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext) callconv(.c) *gtk.CellAreaContext) void {
                gobject.ext.as(CellArea.Class, p_class).f_copy_context = @ptrCast(p_implementation);
            }
        };

        /// Creates a `GtkCellArea`Context to be used with `area` for
        /// all purposes. `GtkCellArea`Context stores geometry information
        /// for rows for which it was operated on, it is important to use
        /// the same context for the same row of data at all times (i.e.
        /// one should render and handle events with the same `GtkCellArea`Context
        /// which was used to request the size of those rows of data).
        pub const create_context = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) *gtk.CellAreaContext {
                return gobject.ext.as(CellArea.Class, p_class).f_create_context.?(gobject.ext.as(CellArea, p_area));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) *gtk.CellAreaContext) void {
                gobject.ext.as(CellArea.Class, p_class).f_create_context = @ptrCast(p_implementation);
            }
        };

        /// Delegates event handling to a `GtkCellArea`.
        pub const event = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_event: *gdk.Event, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) c_int {
                return gobject.ext.as(CellArea.Class, p_class).f_event.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_event, p_cell_area, p_flags);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_event: *gdk.Event, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) c_int) void {
                gobject.ext.as(CellArea.Class, p_class).f_event = @ptrCast(p_implementation);
            }
        };

        /// This should be called by the `area`’s owning layout widget
        /// when focus is to be passed to `area`, or moved within `area`
        /// for a given `direction` and row data.
        ///
        /// Implementing `GtkCellArea` classes should implement this
        /// method to receive and navigate focus in its own way particular
        /// to how it lays out cells.
        pub const focus = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) c_int {
                return gobject.ext.as(CellArea.Class, p_class).f_focus.?(gobject.ext.as(CellArea, p_area), p_direction);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) callconv(.c) c_int) void {
                gobject.ext.as(CellArea.Class, p_class).f_focus = @ptrCast(p_implementation);
            }
        };

        /// Calls `callback` for every `GtkCellRenderer` in `area`.
        pub const foreach = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_callback: gtk.CellCallback, p_callback_data: ?*anyopaque) void {
                return gobject.ext.as(CellArea.Class, p_class).f_foreach.?(gobject.ext.as(CellArea, p_area), p_callback, p_callback_data);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_callback: gtk.CellCallback, p_callback_data: ?*anyopaque) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_foreach = @ptrCast(p_implementation);
            }
        };

        /// Calls `callback` for every `GtkCellRenderer` in `area` with the
        /// allocated rectangle inside `cell_area`.
        pub const foreach_alloc = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_background_area: *const gdk.Rectangle, p_callback: gtk.CellAllocCallback, p_callback_data: ?*anyopaque) void {
                return gobject.ext.as(CellArea.Class, p_class).f_foreach_alloc.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_cell_area, p_background_area, p_callback, p_callback_data);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_background_area: *const gdk.Rectangle, p_callback: gtk.CellAllocCallback, p_callback_data: ?*anyopaque) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_foreach_alloc = @ptrCast(p_implementation);
            }
        };

        /// This should be implemented to report the values of
        ///   child cell properties for a given child `GtkCellRenderer`.
        pub const get_cell_property = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer, p_property_id: c_uint, p_value: *gobject.Value, p_pspec: *gobject.ParamSpec) void {
                return gobject.ext.as(CellArea.Class, p_class).f_get_cell_property.?(gobject.ext.as(CellArea, p_area), p_renderer, p_property_id, p_value, p_pspec);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer, p_property_id: c_uint, p_value: *gobject.Value, p_pspec: *gobject.ParamSpec) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_get_cell_property = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a cell area’s initial minimum and natural height.
        ///
        /// `area` will store some geometrical information in `context` along the way;
        /// when requesting sizes over an arbitrary number of rows, it’s not important
        /// to check the `minimum_height` and `natural_height` of this call but rather to
        /// consult `gtk.CellAreaContext.getPreferredHeight` after a series of
        /// requests.
        pub const get_preferred_height = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void {
                return gobject.ext.as(CellArea.Class, p_class).f_get_preferred_height.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_minimum_height, p_natural_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_get_preferred_height = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a cell area’s minimum and natural height if it would be given
        /// the specified `width`.
        ///
        /// `area` stores some geometrical information in `context` along the way
        /// while calling `gtk.CellArea.getPreferredWidth`. It’s important to
        /// perform a series of `gtk.CellArea.getPreferredWidth` requests with
        /// `context` first and then call `gtk.CellArea.getPreferredHeightForWidth`
        /// on each cell area individually to get the height for width of each
        /// fully requested row.
        ///
        /// If at some point, the width of a single row changes, it should be
        /// requested with `gtk.CellArea.getPreferredWidth` again and then
        /// the full width of the requested rows checked again with
        /// `gtk.CellAreaContext.getPreferredWidth`.
        pub const get_preferred_height_for_width = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void {
                return gobject.ext.as(CellArea.Class, p_class).f_get_preferred_height_for_width.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_width, p_minimum_height, p_natural_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_get_preferred_height_for_width = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a cell area’s initial minimum and natural width.
        ///
        /// `area` will store some geometrical information in `context` along the way;
        /// when requesting sizes over an arbitrary number of rows, it’s not important
        /// to check the `minimum_width` and `natural_width` of this call but rather to
        /// consult `gtk.CellAreaContext.getPreferredWidth` after a series of
        /// requests.
        pub const get_preferred_width = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void {
                return gobject.ext.as(CellArea.Class, p_class).f_get_preferred_width.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_minimum_width, p_natural_width);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_get_preferred_width = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a cell area’s minimum and natural width if it would be given
        /// the specified `height`.
        ///
        /// `area` stores some geometrical information in `context` along the way
        /// while calling `gtk.CellArea.getPreferredHeight`. It’s important to
        /// perform a series of `gtk.CellArea.getPreferredHeight` requests with
        /// `context` first and then call `gtk.CellArea.getPreferredWidthForHeight`
        /// on each cell area individually to get the height for width of each
        /// fully requested row.
        ///
        /// If at some point, the height of a single row changes, it should be
        /// requested with `gtk.CellArea.getPreferredHeight` again and then
        /// the full height of the requested rows checked again with
        /// `gtk.CellAreaContext.getPreferredHeight`.
        pub const get_preferred_width_for_height = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void {
                return gobject.ext.as(CellArea.Class, p_class).f_get_preferred_width_for_height.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_height, p_minimum_width, p_natural_width);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_get_preferred_width_for_height = @ptrCast(p_implementation);
            }
        };

        /// Gets whether the area prefers a height-for-width layout
        /// or a width-for-height layout.
        pub const get_request_mode = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) gtk.SizeRequestMode {
                return gobject.ext.as(CellArea.Class, p_class).f_get_request_mode.?(gobject.ext.as(CellArea, p_area));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) gtk.SizeRequestMode) void {
                gobject.ext.as(CellArea.Class, p_class).f_get_request_mode = @ptrCast(p_implementation);
            }
        };

        /// Returns whether the area can do anything when activated,
        /// after applying new attributes to `area`.
        pub const is_activatable = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(CellArea.Class, p_class).f_is_activatable.?(gobject.ext.as(CellArea, p_area));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(CellArea.Class, p_class).f_is_activatable = @ptrCast(p_implementation);
            }
        };

        /// Removes `renderer` from `area`.
        pub const remove = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer) void {
                return gobject.ext.as(CellArea.Class, p_class).f_remove.?(gobject.ext.as(CellArea, p_area), p_renderer);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_remove = @ptrCast(p_implementation);
            }
        };

        /// This should be implemented to handle changes in child
        ///   cell properties for a given `GtkCellRenderer` that were previously
        ///   installed on the `GtkCellAreaClass` with `gtk.CellAreaClass.installCellProperty`.
        pub const set_cell_property = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer, p_property_id: c_uint, p_value: *const gobject.Value, p_pspec: *gobject.ParamSpec) void {
                return gobject.ext.as(CellArea.Class, p_class).f_set_cell_property.?(gobject.ext.as(CellArea, p_area), p_renderer, p_property_id, p_value, p_pspec);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_renderer: *gtk.CellRenderer, p_property_id: c_uint, p_value: *const gobject.Value, p_pspec: *gobject.ParamSpec) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_set_cell_property = @ptrCast(p_implementation);
            }
        };

        /// Snapshots `area`’s cells according to `area`’s layout onto at
        /// the given coordinates.
        pub const snapshot = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_snapshot: *gtk.Snapshot, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_paint_focus: c_int) void {
                return gobject.ext.as(CellArea.Class, p_class).f_snapshot.?(gobject.ext.as(CellArea, p_area), p_context, p_widget, p_snapshot, p_background_area, p_cell_area, p_flags, p_paint_focus);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_snapshot: *gtk.Snapshot, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_paint_focus: c_int) callconv(.c) void) void {
                gobject.ext.as(CellArea.Class, p_class).f_snapshot = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The widget currently editing the edited cell
        ///
        /// This property is read-only and only changes as
        /// a result of a call `gtk.CellArea.activateCell`.
        pub const edit_widget = struct {
            pub const name = "edit-widget";

            pub const Type = ?*gtk.CellEditable;
        };

        /// The cell in the area that is currently edited
        ///
        /// This property is read-only and only changes as
        /// a result of a call `gtk.CellArea.activateCell`.
        pub const edited_cell = struct {
            pub const name = "edited-cell";

            pub const Type = ?*gtk.CellRenderer;
        };

        /// The cell in the area that currently has focus
        pub const focus_cell = struct {
            pub const name = "focus-cell";

            pub const Type = ?*gtk.CellRenderer;
        };
    };

    pub const signals = struct {
        /// Indicates that editing has started on `renderer` and that `editable`
        /// should be added to the owning cell-layouting widget at `cell_area`.
        pub const add_editable = struct {
            pub const name = "add-editable";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_renderer: *gtk.CellRenderer, p_editable: *gtk.CellEditable, p_cell_area: *gdk.Rectangle, p_path: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellArea, p_instance))),
                    gobject.signalLookup("add-editable", CellArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is emitted whenever applying attributes to `area` from `model`
        pub const apply_attributes = struct {
            pub const name = "apply-attributes";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_is_expander: c_int, p_is_expanded: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellArea, p_instance))),
                    gobject.signalLookup("apply-attributes", CellArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Indicates that focus changed on this `area`. This signal
        /// is emitted either as a result of focus handling or event
        /// handling.
        ///
        /// It's possible that the signal is emitted even if the
        /// currently focused renderer did not change, this is
        /// because focus may change to the same renderer in the
        /// same cell area for a different row of data.
        pub const focus_changed = struct {
            pub const name = "focus-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_renderer: *gtk.CellRenderer, p_path: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellArea, p_instance))),
                    gobject.signalLookup("focus-changed", CellArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Indicates that editing finished on `renderer` and that `editable`
        /// should be removed from the owning cell-layouting widget.
        pub const remove_editable = struct {
            pub const name = "remove-editable";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_renderer: *gtk.CellRenderer, p_editable: *gtk.CellEditable, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellArea, p_instance))),
                    gobject.signalLookup("remove-editable", CellArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Activates `area`, usually by activating the currently focused
    /// cell, however some subclasses which embed widgets in the area
    /// can also activate a widget if it currently has the focus.
    extern fn gtk_cell_area_activate(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_edit_only: c_int) c_int;
    pub const activate = gtk_cell_area_activate;

    /// This is used by `GtkCellArea` subclasses when handling events
    /// to activate cells, the base `GtkCellArea` class activates cells
    /// for keyboard events for free in its own GtkCellArea->`activate`
    /// implementation.
    extern fn gtk_cell_area_activate_cell(p_area: *CellArea, p_widget: *gtk.Widget, p_renderer: *gtk.CellRenderer, p_event: *gdk.Event, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) c_int;
    pub const activateCell = gtk_cell_area_activate_cell;

    /// Adds `renderer` to `area` with the default child cell properties.
    extern fn gtk_cell_area_add(p_area: *CellArea, p_renderer: *gtk.CellRenderer) void;
    pub const add = gtk_cell_area_add;

    /// Adds `sibling` to `renderer`’s focusable area, focus will be drawn
    /// around `renderer` and all of its siblings if `renderer` can
    /// focus for a given row.
    ///
    /// Events handled by focus siblings can also activate the given
    /// focusable `renderer`.
    extern fn gtk_cell_area_add_focus_sibling(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_sibling: *gtk.CellRenderer) void;
    pub const addFocusSibling = gtk_cell_area_add_focus_sibling;

    /// Adds `renderer` to `area`, setting cell properties at the same time.
    /// See `gtk.CellArea.add` and `gtk.CellArea.cellSet` for more details.
    extern fn gtk_cell_area_add_with_properties(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_first_prop_name: [*:0]const u8, ...) void;
    pub const addWithProperties = gtk_cell_area_add_with_properties;

    /// Applies any connected attributes to the renderers in
    /// `area` by pulling the values from `tree_model`.
    extern fn gtk_cell_area_apply_attributes(p_area: *CellArea, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_is_expander: c_int, p_is_expanded: c_int) void;
    pub const applyAttributes = gtk_cell_area_apply_attributes;

    /// Connects an `attribute` to apply values from `column` for the
    /// `GtkTreeModel` in use.
    extern fn gtk_cell_area_attribute_connect(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_attribute: [*:0]const u8, p_column: c_int) void;
    pub const attributeConnect = gtk_cell_area_attribute_connect;

    /// Disconnects `attribute` for the `renderer` in `area` so that
    /// attribute will no longer be updated with values from the
    /// model.
    extern fn gtk_cell_area_attribute_disconnect(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_attribute: [*:0]const u8) void;
    pub const attributeDisconnect = gtk_cell_area_attribute_disconnect;

    /// Returns the model column that an attribute has been mapped to,
    /// or -1 if the attribute is not mapped.
    extern fn gtk_cell_area_attribute_get_column(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_attribute: [*:0]const u8) c_int;
    pub const attributeGetColumn = gtk_cell_area_attribute_get_column;

    /// Gets the values of one or more cell properties for `renderer` in `area`.
    extern fn gtk_cell_area_cell_get(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_first_prop_name: [*:0]const u8, ...) void;
    pub const cellGet = gtk_cell_area_cell_get;

    /// Gets the value of a cell property for `renderer` in `area`.
    extern fn gtk_cell_area_cell_get_property(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_property_name: [*:0]const u8, p_value: *gobject.Value) void;
    pub const cellGetProperty = gtk_cell_area_cell_get_property;

    /// Gets the values of one or more cell properties for `renderer` in `area`.
    extern fn gtk_cell_area_cell_get_valist(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_first_property_name: [*:0]const u8, p_var_args: std.builtin.VaList) void;
    pub const cellGetValist = gtk_cell_area_cell_get_valist;

    /// Sets one or more cell properties for `cell` in `area`.
    extern fn gtk_cell_area_cell_set(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_first_prop_name: [*:0]const u8, ...) void;
    pub const cellSet = gtk_cell_area_cell_set;

    /// Sets a cell property for `renderer` in `area`.
    extern fn gtk_cell_area_cell_set_property(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_property_name: [*:0]const u8, p_value: *const gobject.Value) void;
    pub const cellSetProperty = gtk_cell_area_cell_set_property;

    /// Sets one or more cell properties for `renderer` in `area`.
    extern fn gtk_cell_area_cell_set_valist(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_first_property_name: [*:0]const u8, p_var_args: std.builtin.VaList) void;
    pub const cellSetValist = gtk_cell_area_cell_set_valist;

    /// This is sometimes needed for cases where rows need to share
    /// alignments in one orientation but may be separately grouped
    /// in the opposing orientation.
    ///
    /// For instance, `GtkIconView` creates all icons (rows) to have
    /// the same width and the cells theirin to have the same
    /// horizontal alignments. However each row of icons may have
    /// a separate collective height. `GtkIconView` uses this to
    /// request the heights of each row based on a context which
    /// was already used to request all the row widths that are
    /// to be displayed.
    extern fn gtk_cell_area_copy_context(p_area: *CellArea, p_context: *gtk.CellAreaContext) *gtk.CellAreaContext;
    pub const copyContext = gtk_cell_area_copy_context;

    /// Creates a `GtkCellArea`Context to be used with `area` for
    /// all purposes. `GtkCellArea`Context stores geometry information
    /// for rows for which it was operated on, it is important to use
    /// the same context for the same row of data at all times (i.e.
    /// one should render and handle events with the same `GtkCellArea`Context
    /// which was used to request the size of those rows of data).
    extern fn gtk_cell_area_create_context(p_area: *CellArea) *gtk.CellAreaContext;
    pub const createContext = gtk_cell_area_create_context;

    /// Delegates event handling to a `GtkCellArea`.
    extern fn gtk_cell_area_event(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_event: *gdk.Event, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) c_int;
    pub const event = gtk_cell_area_event;

    /// This should be called by the `area`’s owning layout widget
    /// when focus is to be passed to `area`, or moved within `area`
    /// for a given `direction` and row data.
    ///
    /// Implementing `GtkCellArea` classes should implement this
    /// method to receive and navigate focus in its own way particular
    /// to how it lays out cells.
    extern fn gtk_cell_area_focus(p_area: *CellArea, p_direction: gtk.DirectionType) c_int;
    pub const focus = gtk_cell_area_focus;

    /// Calls `callback` for every `GtkCellRenderer` in `area`.
    extern fn gtk_cell_area_foreach(p_area: *CellArea, p_callback: gtk.CellCallback, p_callback_data: ?*anyopaque) void;
    pub const foreach = gtk_cell_area_foreach;

    /// Calls `callback` for every `GtkCellRenderer` in `area` with the
    /// allocated rectangle inside `cell_area`.
    extern fn gtk_cell_area_foreach_alloc(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_background_area: *const gdk.Rectangle, p_callback: gtk.CellAllocCallback, p_callback_data: ?*anyopaque) void;
    pub const foreachAlloc = gtk_cell_area_foreach_alloc;

    /// Derives the allocation of `renderer` inside `area` if `area`
    /// were to be rendered in `cell_area`.
    extern fn gtk_cell_area_get_cell_allocation(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_renderer: *gtk.CellRenderer, p_cell_area: *const gdk.Rectangle, p_allocation: *gdk.Rectangle) void;
    pub const getCellAllocation = gtk_cell_area_get_cell_allocation;

    /// Gets the `GtkCellRenderer` at `x` and `y` coordinates inside `area` and optionally
    /// returns the full cell allocation for it inside `cell_area`.
    extern fn gtk_cell_area_get_cell_at_position(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_x: c_int, p_y: c_int, p_alloc_area: ?*gdk.Rectangle) *gtk.CellRenderer;
    pub const getCellAtPosition = gtk_cell_area_get_cell_at_position;

    /// Gets the current `GtkTreePath` string for the currently
    /// applied `GtkTreeIter`, this is implicitly updated when
    /// `gtk.CellArea.applyAttributes` is called and can be
    /// used to interact with renderers from `GtkCellArea`
    /// subclasses.
    extern fn gtk_cell_area_get_current_path_string(p_area: *CellArea) [*:0]const u8;
    pub const getCurrentPathString = gtk_cell_area_get_current_path_string;

    /// Gets the `GtkCellEditable` widget currently used
    /// to edit the currently edited cell.
    extern fn gtk_cell_area_get_edit_widget(p_area: *CellArea) ?*gtk.CellEditable;
    pub const getEditWidget = gtk_cell_area_get_edit_widget;

    /// Gets the `GtkCellRenderer` in `area` that is currently
    /// being edited.
    extern fn gtk_cell_area_get_edited_cell(p_area: *CellArea) ?*gtk.CellRenderer;
    pub const getEditedCell = gtk_cell_area_get_edited_cell;

    /// Retrieves the currently focused cell for `area`
    extern fn gtk_cell_area_get_focus_cell(p_area: *CellArea) ?*gtk.CellRenderer;
    pub const getFocusCell = gtk_cell_area_get_focus_cell;

    /// Gets the `GtkCellRenderer` which is expected to be focusable
    /// for which `renderer` is, or may be a sibling.
    ///
    /// This is handy for `GtkCellArea` subclasses when handling events,
    /// after determining the renderer at the event location it can
    /// then chose to activate the focus cell for which the event
    /// cell may have been a sibling.
    extern fn gtk_cell_area_get_focus_from_sibling(p_area: *CellArea, p_renderer: *gtk.CellRenderer) ?*gtk.CellRenderer;
    pub const getFocusFromSibling = gtk_cell_area_get_focus_from_sibling;

    /// Gets the focus sibling cell renderers for `renderer`.
    extern fn gtk_cell_area_get_focus_siblings(p_area: *CellArea, p_renderer: *gtk.CellRenderer) *const glib.List;
    pub const getFocusSiblings = gtk_cell_area_get_focus_siblings;

    /// Retrieves a cell area’s initial minimum and natural height.
    ///
    /// `area` will store some geometrical information in `context` along the way;
    /// when requesting sizes over an arbitrary number of rows, it’s not important
    /// to check the `minimum_height` and `natural_height` of this call but rather to
    /// consult `gtk.CellAreaContext.getPreferredHeight` after a series of
    /// requests.
    extern fn gtk_cell_area_get_preferred_height(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void;
    pub const getPreferredHeight = gtk_cell_area_get_preferred_height;

    /// Retrieves a cell area’s minimum and natural height if it would be given
    /// the specified `width`.
    ///
    /// `area` stores some geometrical information in `context` along the way
    /// while calling `gtk.CellArea.getPreferredWidth`. It’s important to
    /// perform a series of `gtk.CellArea.getPreferredWidth` requests with
    /// `context` first and then call `gtk.CellArea.getPreferredHeightForWidth`
    /// on each cell area individually to get the height for width of each
    /// fully requested row.
    ///
    /// If at some point, the width of a single row changes, it should be
    /// requested with `gtk.CellArea.getPreferredWidth` again and then
    /// the full width of the requested rows checked again with
    /// `gtk.CellAreaContext.getPreferredWidth`.
    extern fn gtk_cell_area_get_preferred_height_for_width(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void;
    pub const getPreferredHeightForWidth = gtk_cell_area_get_preferred_height_for_width;

    /// Retrieves a cell area’s initial minimum and natural width.
    ///
    /// `area` will store some geometrical information in `context` along the way;
    /// when requesting sizes over an arbitrary number of rows, it’s not important
    /// to check the `minimum_width` and `natural_width` of this call but rather to
    /// consult `gtk.CellAreaContext.getPreferredWidth` after a series of
    /// requests.
    extern fn gtk_cell_area_get_preferred_width(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void;
    pub const getPreferredWidth = gtk_cell_area_get_preferred_width;

    /// Retrieves a cell area’s minimum and natural width if it would be given
    /// the specified `height`.
    ///
    /// `area` stores some geometrical information in `context` along the way
    /// while calling `gtk.CellArea.getPreferredHeight`. It’s important to
    /// perform a series of `gtk.CellArea.getPreferredHeight` requests with
    /// `context` first and then call `gtk.CellArea.getPreferredWidthForHeight`
    /// on each cell area individually to get the height for width of each
    /// fully requested row.
    ///
    /// If at some point, the height of a single row changes, it should be
    /// requested with `gtk.CellArea.getPreferredHeight` again and then
    /// the full height of the requested rows checked again with
    /// `gtk.CellAreaContext.getPreferredHeight`.
    extern fn gtk_cell_area_get_preferred_width_for_height(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void;
    pub const getPreferredWidthForHeight = gtk_cell_area_get_preferred_width_for_height;

    /// Gets whether the area prefers a height-for-width layout
    /// or a width-for-height layout.
    extern fn gtk_cell_area_get_request_mode(p_area: *CellArea) gtk.SizeRequestMode;
    pub const getRequestMode = gtk_cell_area_get_request_mode;

    /// Checks if `area` contains `renderer`.
    extern fn gtk_cell_area_has_renderer(p_area: *CellArea, p_renderer: *gtk.CellRenderer) c_int;
    pub const hasRenderer = gtk_cell_area_has_renderer;

    /// This is a convenience function for `GtkCellArea` implementations
    /// to get the inner area where a given `GtkCellRenderer` will be
    /// rendered. It removes any padding previously added by `gtk.CellArea.requestRenderer`.
    extern fn gtk_cell_area_inner_cell_area(p_area: *CellArea, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_inner_area: *gdk.Rectangle) void;
    pub const innerCellArea = gtk_cell_area_inner_cell_area;

    /// Returns whether the area can do anything when activated,
    /// after applying new attributes to `area`.
    extern fn gtk_cell_area_is_activatable(p_area: *CellArea) c_int;
    pub const isActivatable = gtk_cell_area_is_activatable;

    /// Returns whether `sibling` is one of `renderer`’s focus siblings
    /// (see `gtk.CellArea.addFocusSibling`).
    extern fn gtk_cell_area_is_focus_sibling(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_sibling: *gtk.CellRenderer) c_int;
    pub const isFocusSibling = gtk_cell_area_is_focus_sibling;

    /// Removes `renderer` from `area`.
    extern fn gtk_cell_area_remove(p_area: *CellArea, p_renderer: *gtk.CellRenderer) void;
    pub const remove = gtk_cell_area_remove;

    /// Removes `sibling` from `renderer`’s focus sibling list
    /// (see `gtk.CellArea.addFocusSibling`).
    extern fn gtk_cell_area_remove_focus_sibling(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_sibling: *gtk.CellRenderer) void;
    pub const removeFocusSibling = gtk_cell_area_remove_focus_sibling;

    /// This is a convenience function for `GtkCellArea` implementations
    /// to request size for cell renderers. It’s important to use this
    /// function to request size and then use `gtk.CellArea.innerCellArea`
    /// at render and event time since this function will add padding
    /// around the cell for focus painting.
    extern fn gtk_cell_area_request_renderer(p_area: *CellArea, p_renderer: *gtk.CellRenderer, p_orientation: gtk.Orientation, p_widget: *gtk.Widget, p_for_size: c_int, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) void;
    pub const requestRenderer = gtk_cell_area_request_renderer;

    /// Explicitly sets the currently focused cell to `renderer`.
    ///
    /// This is generally called by implementations of
    /// `GtkCellAreaClass.`focus`` or `GtkCellAreaClass.`event``,
    /// however it can also be used to implement functions such
    /// as `gtk.TreeView.setCursorOnCell`.
    extern fn gtk_cell_area_set_focus_cell(p_area: *CellArea, p_renderer: ?*gtk.CellRenderer) void;
    pub const setFocusCell = gtk_cell_area_set_focus_cell;

    /// Snapshots `area`’s cells according to `area`’s layout onto at
    /// the given coordinates.
    extern fn gtk_cell_area_snapshot(p_area: *CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_snapshot: *gtk.Snapshot, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_paint_focus: c_int) void;
    pub const snapshot = gtk_cell_area_snapshot;

    /// Explicitly stops the editing of the currently edited cell.
    ///
    /// If `canceled` is `TRUE`, the currently edited cell renderer
    /// will emit the ::editing-canceled signal, otherwise the
    /// the ::editing-done signal will be emitted on the current
    /// edit widget.
    ///
    /// See `gtk.CellArea.getEditedCell` and `gtk.CellArea.getEditWidget`.
    extern fn gtk_cell_area_stop_editing(p_area: *CellArea, p_canceled: c_int) void;
    pub const stopEditing = gtk_cell_area_stop_editing;

    extern fn gtk_cell_area_get_type() usize;
    pub const getGObjectType = gtk_cell_area_get_type;

    extern fn g_object_ref(p_self: *gtk.CellArea) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellArea) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellArea, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A cell area that renders GtkCellRenderers into a row or a column
///
/// The `GtkCellAreaBox` renders cell renderers into a row or a column
/// depending on its `GtkOrientation`.
///
/// GtkCellAreaBox uses a notion of packing. Packing
/// refers to adding cell renderers with reference to a particular position
/// in a `GtkCellAreaBox`. There are two reference positions: the
/// start and the end of the box.
/// When the `GtkCellAreaBox` is oriented in the `GTK_ORIENTATION_VERTICAL`
/// orientation, the start is defined as the top of the box and the end is
/// defined as the bottom. In the `GTK_ORIENTATION_HORIZONTAL` orientation
/// start is defined as the left side and the end is defined as the right
/// side.
///
/// Alignments of `GtkCellRenderer`s rendered in adjacent rows can be
/// configured by configuring the `GtkCellAreaBox` align child cell property
/// with `gtk.CellArea.cellSetProperty` or by specifying the "align"
/// argument to `gtk.CellAreaBox.packStart` and `gtk.CellAreaBox.packEnd`.
pub const CellAreaBox = opaque {
    pub const Parent = gtk.CellArea;
    pub const Implements = [_]type{ gtk.Buildable, gtk.CellLayout, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = CellAreaBox;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The amount of space to reserve between cells.
        pub const spacing = struct {
            pub const name = "spacing";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCellAreaBox`.
    extern fn gtk_cell_area_box_new() *gtk.CellAreaBox;
    pub const new = gtk_cell_area_box_new;

    /// Gets the spacing added between cell renderers.
    extern fn gtk_cell_area_box_get_spacing(p_box: *CellAreaBox) c_int;
    pub const getSpacing = gtk_cell_area_box_get_spacing;

    /// Adds `renderer` to `box`, packed with reference to the end of `box`.
    ///
    /// The `renderer` is packed after (away from end of) any other
    /// `GtkCellRenderer` packed with reference to the end of `box`.
    extern fn gtk_cell_area_box_pack_end(p_box: *CellAreaBox, p_renderer: *gtk.CellRenderer, p_expand: c_int, p_align: c_int, p_fixed: c_int) void;
    pub const packEnd = gtk_cell_area_box_pack_end;

    /// Adds `renderer` to `box`, packed with reference to the start of `box`.
    ///
    /// The `renderer` is packed after any other `GtkCellRenderer` packed
    /// with reference to the start of `box`.
    extern fn gtk_cell_area_box_pack_start(p_box: *CellAreaBox, p_renderer: *gtk.CellRenderer, p_expand: c_int, p_align: c_int, p_fixed: c_int) void;
    pub const packStart = gtk_cell_area_box_pack_start;

    /// Sets the spacing to add between cell renderers in `box`.
    extern fn gtk_cell_area_box_set_spacing(p_box: *CellAreaBox, p_spacing: c_int) void;
    pub const setSpacing = gtk_cell_area_box_set_spacing;

    extern fn gtk_cell_area_box_get_type() usize;
    pub const getGObjectType = gtk_cell_area_box_get_type;

    extern fn g_object_ref(p_self: *gtk.CellAreaBox) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellAreaBox) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellAreaBox, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Stores geometrical information for a series of rows in a GtkCellArea
///
/// The `GtkCellAreaContext` object is created by a given `GtkCellArea`
/// implementation via its `GtkCellAreaClass.`create_context`` virtual
/// method and is used to store cell sizes and alignments for a series of
/// `GtkTreeModel` rows that are requested and rendered in the same context.
///
/// `GtkCellLayout` widgets can create any number of contexts in which to
/// request and render groups of data rows. However, it’s important that the
/// same context which was used to request sizes for a given `GtkTreeModel`
/// row also be used for the same row when calling other `GtkCellArea` APIs
/// such as `gtk_cell_area_render` and `gtk.CellArea.event`.
pub const CellAreaContext = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.CellAreaContextClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Allocates a width and/or a height for all rows which are to be
        /// rendered with `context`.
        ///
        /// Usually allocation is performed only horizontally or sometimes
        /// vertically since a group of rows are usually rendered side by
        /// side vertically or horizontally and share either the same width
        /// or the same height. Sometimes they are allocated in both horizontal
        /// and vertical orientations producing a homogeneous effect of the
        /// rows. This is generally the case for `GtkTreeView` when
        /// `GtkTreeView:fixed-height-mode` is enabled.
        pub const allocate = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int) void {
                return gobject.ext.as(CellAreaContext.Class, p_class).f_allocate.?(gobject.ext.as(CellAreaContext, p_context), p_width, p_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int) callconv(.c) void) void {
                gobject.ext.as(CellAreaContext.Class, p_class).f_allocate = @ptrCast(p_implementation);
            }
        };

        /// Gets the accumulative preferred height for `width` for all rows
        /// which have been requested for the same said `width` with this context.
        ///
        /// After `gtk.CellAreaContext.reset` is called and/or before ever
        /// requesting the size of a `GtkCellArea`, the returned values are -1.
        pub const get_preferred_height_for_width = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void {
                return gobject.ext.as(CellAreaContext.Class, p_class).f_get_preferred_height_for_width.?(gobject.ext.as(CellAreaContext, p_context), p_width, p_minimum_height, p_natural_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellAreaContext.Class, p_class).f_get_preferred_height_for_width = @ptrCast(p_implementation);
            }
        };

        /// Gets the accumulative preferred width for `height` for all rows which
        /// have been requested for the same said `height` with this context.
        ///
        /// After `gtk.CellAreaContext.reset` is called and/or before ever
        /// requesting the size of a `GtkCellArea`, the returned values are -1.
        pub const get_preferred_width_for_height = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void {
                return gobject.ext.as(CellAreaContext.Class, p_class).f_get_preferred_width_for_height.?(gobject.ext.as(CellAreaContext, p_context), p_height, p_minimum_width, p_natural_width);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellAreaContext.Class, p_class).f_get_preferred_width_for_height = @ptrCast(p_implementation);
            }
        };

        /// Resets any previously cached request and allocation
        /// data.
        ///
        /// When underlying `GtkTreeModel` data changes its
        /// important to reset the context if the content
        /// size is allowed to shrink. If the content size
        /// is only allowed to grow (this is usually an option
        /// for views rendering large data stores as a measure
        /// of optimization), then only the row that changed
        /// or was inserted needs to be (re)requested with
        /// `gtk.CellArea.getPreferredWidth`.
        ///
        /// When the new overall size of the context requires
        /// that the allocated size changes (or whenever this
        /// allocation changes at all), the variable row
        /// sizes need to be re-requested for every row.
        ///
        /// For instance, if the rows are displayed all with
        /// the same width from top to bottom then a change
        /// in the allocated width necessitates a recalculation
        /// of all the displayed row heights using
        /// `gtk.CellArea.getPreferredHeightForWidth`.
        pub const reset = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CellAreaContext.Class, p_class).f_reset.?(gobject.ext.as(CellAreaContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CellAreaContext.Class, p_class).f_reset = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The `GtkCellArea` this context was created by
        pub const area = struct {
            pub const name = "area";

            pub const Type = ?*gtk.CellArea;
        };

        /// The minimum height for the `GtkCellArea` in this context
        /// for all `GtkTreeModel` rows that this context was requested
        /// for using `gtk.CellArea.getPreferredHeight`.
        pub const minimum_height = struct {
            pub const name = "minimum-height";

            pub const Type = c_int;
        };

        /// The minimum width for the `GtkCellArea` in this context
        /// for all `GtkTreeModel` rows that this context was requested
        /// for using `gtk.CellArea.getPreferredWidth`.
        pub const minimum_width = struct {
            pub const name = "minimum-width";

            pub const Type = c_int;
        };

        /// The natural height for the `GtkCellArea` in this context
        /// for all `GtkTreeModel` rows that this context was requested
        /// for using `gtk.CellArea.getPreferredHeight`.
        pub const natural_height = struct {
            pub const name = "natural-height";

            pub const Type = c_int;
        };

        /// The natural width for the `GtkCellArea` in this context
        /// for all `GtkTreeModel` rows that this context was requested
        /// for using `gtk.CellArea.getPreferredWidth`.
        pub const natural_width = struct {
            pub const name = "natural-width";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Allocates a width and/or a height for all rows which are to be
    /// rendered with `context`.
    ///
    /// Usually allocation is performed only horizontally or sometimes
    /// vertically since a group of rows are usually rendered side by
    /// side vertically or horizontally and share either the same width
    /// or the same height. Sometimes they are allocated in both horizontal
    /// and vertical orientations producing a homogeneous effect of the
    /// rows. This is generally the case for `GtkTreeView` when
    /// `GtkTreeView:fixed-height-mode` is enabled.
    extern fn gtk_cell_area_context_allocate(p_context: *CellAreaContext, p_width: c_int, p_height: c_int) void;
    pub const allocate = gtk_cell_area_context_allocate;

    /// Fetches the current allocation size for `context`.
    ///
    /// If the context was not allocated in width or height, or if the
    /// context was recently reset with `gtk.CellAreaContext.reset`,
    /// the returned value will be -1.
    extern fn gtk_cell_area_context_get_allocation(p_context: *CellAreaContext, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getAllocation = gtk_cell_area_context_get_allocation;

    /// Fetches the `GtkCellArea` this `context` was created by.
    ///
    /// This is generally unneeded by layouting widgets; however,
    /// it is important for the context implementation itself to
    /// fetch information about the area it is being used for.
    ///
    /// For instance at `GtkCellAreaContextClass.`allocate`` time
    /// it’s important to know details about any cell spacing
    /// that the `GtkCellArea` is configured with in order to
    /// compute a proper allocation.
    extern fn gtk_cell_area_context_get_area(p_context: *CellAreaContext) *gtk.CellArea;
    pub const getArea = gtk_cell_area_context_get_area;

    /// Gets the accumulative preferred height for all rows which have been
    /// requested with this context.
    ///
    /// After `gtk.CellAreaContext.reset` is called and/or before ever
    /// requesting the size of a `GtkCellArea`, the returned values are 0.
    extern fn gtk_cell_area_context_get_preferred_height(p_context: *CellAreaContext, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void;
    pub const getPreferredHeight = gtk_cell_area_context_get_preferred_height;

    /// Gets the accumulative preferred height for `width` for all rows
    /// which have been requested for the same said `width` with this context.
    ///
    /// After `gtk.CellAreaContext.reset` is called and/or before ever
    /// requesting the size of a `GtkCellArea`, the returned values are -1.
    extern fn gtk_cell_area_context_get_preferred_height_for_width(p_context: *CellAreaContext, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void;
    pub const getPreferredHeightForWidth = gtk_cell_area_context_get_preferred_height_for_width;

    /// Gets the accumulative preferred width for all rows which have been
    /// requested with this context.
    ///
    /// After `gtk.CellAreaContext.reset` is called and/or before ever
    /// requesting the size of a `GtkCellArea`, the returned values are 0.
    extern fn gtk_cell_area_context_get_preferred_width(p_context: *CellAreaContext, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void;
    pub const getPreferredWidth = gtk_cell_area_context_get_preferred_width;

    /// Gets the accumulative preferred width for `height` for all rows which
    /// have been requested for the same said `height` with this context.
    ///
    /// After `gtk.CellAreaContext.reset` is called and/or before ever
    /// requesting the size of a `GtkCellArea`, the returned values are -1.
    extern fn gtk_cell_area_context_get_preferred_width_for_height(p_context: *CellAreaContext, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void;
    pub const getPreferredWidthForHeight = gtk_cell_area_context_get_preferred_width_for_height;

    /// Causes the minimum and/or natural height to grow if the new
    /// proposed sizes exceed the current minimum and natural height.
    ///
    /// This is used by `GtkCellAreaContext` implementations during
    /// the request process over a series of `GtkTreeModel` rows to
    /// progressively push the requested height over a series of
    /// `gtk.CellArea.getPreferredHeight` requests.
    extern fn gtk_cell_area_context_push_preferred_height(p_context: *CellAreaContext, p_minimum_height: c_int, p_natural_height: c_int) void;
    pub const pushPreferredHeight = gtk_cell_area_context_push_preferred_height;

    /// Causes the minimum and/or natural width to grow if the new
    /// proposed sizes exceed the current minimum and natural width.
    ///
    /// This is used by `GtkCellAreaContext` implementations during
    /// the request process over a series of `GtkTreeModel` rows to
    /// progressively push the requested width over a series of
    /// `gtk.CellArea.getPreferredWidth` requests.
    extern fn gtk_cell_area_context_push_preferred_width(p_context: *CellAreaContext, p_minimum_width: c_int, p_natural_width: c_int) void;
    pub const pushPreferredWidth = gtk_cell_area_context_push_preferred_width;

    /// Resets any previously cached request and allocation
    /// data.
    ///
    /// When underlying `GtkTreeModel` data changes its
    /// important to reset the context if the content
    /// size is allowed to shrink. If the content size
    /// is only allowed to grow (this is usually an option
    /// for views rendering large data stores as a measure
    /// of optimization), then only the row that changed
    /// or was inserted needs to be (re)requested with
    /// `gtk.CellArea.getPreferredWidth`.
    ///
    /// When the new overall size of the context requires
    /// that the allocated size changes (or whenever this
    /// allocation changes at all), the variable row
    /// sizes need to be re-requested for every row.
    ///
    /// For instance, if the rows are displayed all with
    /// the same width from top to bottom then a change
    /// in the allocated width necessitates a recalculation
    /// of all the displayed row heights using
    /// `gtk.CellArea.getPreferredHeightForWidth`.
    extern fn gtk_cell_area_context_reset(p_context: *CellAreaContext) void;
    pub const reset = gtk_cell_area_context_reset;

    extern fn gtk_cell_area_context_get_type() usize;
    pub const getGObjectType = gtk_cell_area_context_get_type;

    extern fn g_object_ref(p_self: *gtk.CellAreaContext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellAreaContext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellAreaContext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An object for rendering a single cell
///
/// The `GtkCellRenderer` is a base class of a set of objects used for
/// rendering a cell to a `cairo_t`.  These objects are used primarily by
/// the `GtkTreeView` widget, though they aren’t tied to them in any
/// specific way.  It is worth noting that `GtkCellRenderer` is not a
/// `GtkWidget` and cannot be treated as such.
///
/// The primary use of a `GtkCellRenderer` is for drawing a certain graphical
/// elements on a `cairo_t`. Typically, one cell renderer is used to
/// draw many cells on the screen.  To this extent, it isn’t expected that a
/// CellRenderer keep any permanent state around.  Instead, any state is set
/// just prior to use using `GObject`s property system.  Then, the
/// cell is measured using `gtk.CellRenderer.getPreferredSize`. Finally, the cell
/// is rendered in the correct location using `gtk.CellRenderer.snapshot`.
///
/// There are a number of rules that must be followed when writing a new
/// `GtkCellRenderer`.  First and foremost, it’s important that a certain set
/// of properties will always yield a cell renderer of the same size,
/// barring a style change. The `GtkCellRenderer` also has a number of
/// generic properties that are expected to be honored by all children.
///
/// Beyond merely rendering a cell, cell renderers can optionally
/// provide active user interface elements. A cell renderer can be
/// “activatable” like `GtkCellRenderer`Toggle,
/// which toggles when it gets activated by a mouse click, or it can be
/// “editable” like `GtkCellRenderer`Text, which
/// allows the user to edit the text using a widget implementing the
/// `GtkCellEditable` interface, e.g. `GtkEntry`.
/// To make a cell renderer activatable or editable, you have to
/// implement the `GtkCellRenderer`Class.activate or
/// `GtkCellRenderer`Class.start_editing virtual functions, respectively.
///
/// Many properties of `GtkCellRenderer` and its subclasses have a
/// corresponding “set” property, e.g. “cell-background-set” corresponds
/// to “cell-background”. These “set” properties reflect whether a property
/// has been set or not. You should not set them independently.
pub const CellRenderer = extern struct {
    pub const Parent = gobject.InitiallyUnowned;
    pub const Implements = [_]type{};
    pub const Class = gtk.CellRendererClass;
    f_parent_instance: gobject.InitiallyUnowned,
    f_priv: ?*gtk.CellRendererPrivate,

    pub const virtual_methods = struct {
        /// Passes an activate event to the cell renderer for possible processing.
        /// Some cell renderers may use events; for example, `GtkCellRendererToggle`
        /// toggles when it gets a mouse click.
        pub const activate = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: *gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) c_int {
                return gobject.ext.as(CellRenderer.Class, p_class).f_activate.?(gobject.ext.as(CellRenderer, p_cell), p_event, p_widget, p_path, p_background_area, p_cell_area, p_flags);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: *gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) c_int) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };

        /// Signal gets emitted when the user cancels the process of editing a cell.
        pub const editing_canceled = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_editing_canceled.?(gobject.ext.as(CellRenderer, p_cell));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_editing_canceled = @ptrCast(p_implementation);
            }
        };

        /// Signal gets emitted when a cell starts to be edited.
        pub const editing_started = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_editable: *gtk.CellEditable, p_path: [*:0]const u8) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_editing_started.?(gobject.ext.as(CellRenderer, p_cell), p_editable, p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_editable: *gtk.CellEditable, p_path: [*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_editing_started = @ptrCast(p_implementation);
            }
        };

        /// Gets the aligned area used by `cell` inside `cell_area`. Used for finding
        /// the appropriate edit and focus rectangle.
        pub const get_aligned_area = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_flags: gtk.CellRendererState, p_cell_area: *const gdk.Rectangle, p_aligned_area: *gdk.Rectangle) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_get_aligned_area.?(gobject.ext.as(CellRenderer, p_cell), p_widget, p_flags, p_cell_area, p_aligned_area);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_flags: gtk.CellRendererState, p_cell_area: *const gdk.Rectangle, p_aligned_area: *gdk.Rectangle) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_get_aligned_area = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a renderer’s natural size when rendered to `widget`.
        pub const get_preferred_height = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_height.?(gobject.ext.as(CellRenderer, p_cell), p_widget, p_minimum_size, p_natural_size);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_height = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a cell renderers’s minimum and natural height if it were rendered to
        /// `widget` with the specified `width`.
        pub const get_preferred_height_for_width = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_height_for_width.?(gobject.ext.as(CellRenderer, p_cell), p_widget, p_width, p_minimum_height, p_natural_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_height_for_width = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a renderer’s natural size when rendered to `widget`.
        pub const get_preferred_width = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_width.?(gobject.ext.as(CellRenderer, p_cell), p_widget, p_minimum_size, p_natural_size);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_width = @ptrCast(p_implementation);
            }
        };

        /// Retrieves a cell renderers’s minimum and natural width if it were rendered to
        /// `widget` with the specified `height`.
        pub const get_preferred_width_for_height = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_width_for_height.?(gobject.ext.as(CellRenderer, p_cell), p_widget, p_height, p_minimum_width, p_natural_width);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_get_preferred_width_for_height = @ptrCast(p_implementation);
            }
        };

        /// Gets whether the cell renderer prefers a height-for-width layout
        /// or a width-for-height layout.
        pub const get_request_mode = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) gtk.SizeRequestMode {
                return gobject.ext.as(CellRenderer.Class, p_class).f_get_request_mode.?(gobject.ext.as(CellRenderer, p_cell));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) gtk.SizeRequestMode) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_get_request_mode = @ptrCast(p_implementation);
            }
        };

        /// Invokes the virtual render function of the `GtkCellRenderer`. The three
        /// passed-in rectangles are areas in `cr`. Most renderers will draw within
        /// `cell_area`; the xalign, yalign, xpad, and ypad fields of the `GtkCellRenderer`
        /// should be honored with respect to `cell_area`. `background_area` includes the
        /// blank space around the cell, and also the area containing the tree expander;
        /// so the `background_area` rectangles for all cells tile to cover the entire
        /// `window`.
        pub const snapshot = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gtk.Snapshot, p_widget: *gtk.Widget, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) void {
                return gobject.ext.as(CellRenderer.Class, p_class).f_snapshot.?(gobject.ext.as(CellRenderer, p_cell), p_snapshot, p_widget, p_background_area, p_cell_area, p_flags);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gtk.Snapshot, p_widget: *gtk.Widget, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) void) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_snapshot = @ptrCast(p_implementation);
            }
        };

        /// Starts editing the contents of this `cell`, through a new `GtkCellEditable`
        /// widget created by the `GtkCellRenderer`Class.start_editing virtual function.
        pub const start_editing = struct {
            pub fn call(p_class: anytype, p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: ?*gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) ?*gtk.CellEditable {
                return gobject.ext.as(CellRenderer.Class, p_class).f_start_editing.?(gobject.ext.as(CellRenderer, p_cell), p_event, p_widget, p_path, p_background_area, p_cell_area, p_flags);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: ?*gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) ?*gtk.CellEditable) void {
                gobject.ext.as(CellRenderer.Class, p_class).f_start_editing = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        pub const cell_background = struct {
            pub const name = "cell-background";

            pub const Type = ?[*:0]u8;
        };

        /// Cell background as a `GdkRGBA`
        pub const cell_background_rgba = struct {
            pub const name = "cell-background-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        pub const cell_background_set = struct {
            pub const name = "cell-background-set";

            pub const Type = c_int;
        };

        pub const editing = struct {
            pub const name = "editing";

            pub const Type = c_int;
        };

        pub const height = struct {
            pub const name = "height";

            pub const Type = c_int;
        };

        pub const is_expanded = struct {
            pub const name = "is-expanded";

            pub const Type = c_int;
        };

        pub const is_expander = struct {
            pub const name = "is-expander";

            pub const Type = c_int;
        };

        pub const mode = struct {
            pub const name = "mode";

            pub const Type = gtk.CellRendererMode;
        };

        pub const sensitive = struct {
            pub const name = "sensitive";

            pub const Type = c_int;
        };

        pub const visible = struct {
            pub const name = "visible";

            pub const Type = c_int;
        };

        pub const width = struct {
            pub const name = "width";

            pub const Type = c_int;
        };

        pub const xalign = struct {
            pub const name = "xalign";

            pub const Type = f32;
        };

        pub const xpad = struct {
            pub const name = "xpad";

            pub const Type = c_uint;
        };

        pub const yalign = struct {
            pub const name = "yalign";

            pub const Type = f32;
        };

        pub const ypad = struct {
            pub const name = "ypad";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {
        /// This signal gets emitted when the user cancels the process of editing a
        /// cell.  For example, an editable cell renderer could be written to cancel
        /// editing when the user presses Escape.
        ///
        /// See also: `gtk.CellRenderer.stopEditing`.
        pub const editing_canceled = struct {
            pub const name = "editing-canceled";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRenderer, p_instance))),
                    gobject.signalLookup("editing-canceled", CellRenderer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal gets emitted when a cell starts to be edited.
        /// The intended use of this signal is to do special setup
        /// on `editable`, e.g. adding a `GtkEntryCompletion` or setting
        /// up additional columns in a `GtkComboBox`.
        ///
        /// See `gtk.CellEditable.startEditing` for information on the lifecycle of
        /// the `editable` and a way to do setup that doesn’t depend on the `renderer`.
        ///
        /// Note that GTK doesn't guarantee that cell renderers will
        /// continue to use the same kind of widget for editing in future
        /// releases, therefore you should check the type of `editable`
        /// before doing any specific setup, as in the following example:
        ///
        /// ```c
        /// static void
        /// text_editing_started (GtkCellRenderer *cell,
        ///                       GtkCellEditable *editable,
        ///                       const char      *path,
        ///                       gpointer         data)
        /// {
        ///   if (GTK_IS_ENTRY (editable))
        ///     {
        ///       GtkEntry *entry = GTK_ENTRY (editable);
        ///
        ///       // ... create a GtkEntryCompletion
        ///
        ///       gtk_entry_set_completion (entry, completion);
        ///     }
        /// }
        /// ```
        pub const editing_started = struct {
            pub const name = "editing-started";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_editable: *gtk.CellEditable, p_path: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRenderer, p_instance))),
                    gobject.signalLookup("editing-started", CellRenderer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Passes an activate event to the cell renderer for possible processing.
    /// Some cell renderers may use events; for example, `GtkCellRendererToggle`
    /// toggles when it gets a mouse click.
    extern fn gtk_cell_renderer_activate(p_cell: *CellRenderer, p_event: *gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) c_int;
    pub const activate = gtk_cell_renderer_activate;

    /// Gets the aligned area used by `cell` inside `cell_area`. Used for finding
    /// the appropriate edit and focus rectangle.
    extern fn gtk_cell_renderer_get_aligned_area(p_cell: *CellRenderer, p_widget: *gtk.Widget, p_flags: gtk.CellRendererState, p_cell_area: *const gdk.Rectangle, p_aligned_area: *gdk.Rectangle) void;
    pub const getAlignedArea = gtk_cell_renderer_get_aligned_area;

    /// Fills in `xalign` and `yalign` with the appropriate values of `cell`.
    extern fn gtk_cell_renderer_get_alignment(p_cell: *CellRenderer, p_xalign: ?*f32, p_yalign: ?*f32) void;
    pub const getAlignment = gtk_cell_renderer_get_alignment;

    /// Fills in `width` and `height` with the appropriate size of `cell`.
    extern fn gtk_cell_renderer_get_fixed_size(p_cell: *CellRenderer, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getFixedSize = gtk_cell_renderer_get_fixed_size;

    /// Checks whether the given `GtkCellRenderer` is expanded.
    extern fn gtk_cell_renderer_get_is_expanded(p_cell: *CellRenderer) c_int;
    pub const getIsExpanded = gtk_cell_renderer_get_is_expanded;

    /// Checks whether the given `GtkCellRenderer` is an expander.
    extern fn gtk_cell_renderer_get_is_expander(p_cell: *CellRenderer) c_int;
    pub const getIsExpander = gtk_cell_renderer_get_is_expander;

    /// Fills in `xpad` and `ypad` with the appropriate values of `cell`.
    extern fn gtk_cell_renderer_get_padding(p_cell: *CellRenderer, p_xpad: ?*c_int, p_ypad: ?*c_int) void;
    pub const getPadding = gtk_cell_renderer_get_padding;

    /// Retrieves a renderer’s natural size when rendered to `widget`.
    extern fn gtk_cell_renderer_get_preferred_height(p_cell: *CellRenderer, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) void;
    pub const getPreferredHeight = gtk_cell_renderer_get_preferred_height;

    /// Retrieves a cell renderers’s minimum and natural height if it were rendered to
    /// `widget` with the specified `width`.
    extern fn gtk_cell_renderer_get_preferred_height_for_width(p_cell: *CellRenderer, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) void;
    pub const getPreferredHeightForWidth = gtk_cell_renderer_get_preferred_height_for_width;

    /// Retrieves the minimum and natural size of a cell taking
    /// into account the widget’s preference for height-for-width management.
    extern fn gtk_cell_renderer_get_preferred_size(p_cell: *CellRenderer, p_widget: *gtk.Widget, p_minimum_size: ?*gtk.Requisition, p_natural_size: ?*gtk.Requisition) void;
    pub const getPreferredSize = gtk_cell_renderer_get_preferred_size;

    /// Retrieves a renderer’s natural size when rendered to `widget`.
    extern fn gtk_cell_renderer_get_preferred_width(p_cell: *CellRenderer, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) void;
    pub const getPreferredWidth = gtk_cell_renderer_get_preferred_width;

    /// Retrieves a cell renderers’s minimum and natural width if it were rendered to
    /// `widget` with the specified `height`.
    extern fn gtk_cell_renderer_get_preferred_width_for_height(p_cell: *CellRenderer, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) void;
    pub const getPreferredWidthForHeight = gtk_cell_renderer_get_preferred_width_for_height;

    /// Gets whether the cell renderer prefers a height-for-width layout
    /// or a width-for-height layout.
    extern fn gtk_cell_renderer_get_request_mode(p_cell: *CellRenderer) gtk.SizeRequestMode;
    pub const getRequestMode = gtk_cell_renderer_get_request_mode;

    /// Returns the cell renderer’s sensitivity.
    extern fn gtk_cell_renderer_get_sensitive(p_cell: *CellRenderer) c_int;
    pub const getSensitive = gtk_cell_renderer_get_sensitive;

    /// Translates the cell renderer state to `GtkStateFlags`,
    /// based on the cell renderer and widget sensitivity, and
    /// the given `GtkCellRenderer`State.
    extern fn gtk_cell_renderer_get_state(p_cell: ?*CellRenderer, p_widget: ?*gtk.Widget, p_cell_state: gtk.CellRendererState) gtk.StateFlags;
    pub const getState = gtk_cell_renderer_get_state;

    /// Returns the cell renderer’s visibility.
    extern fn gtk_cell_renderer_get_visible(p_cell: *CellRenderer) c_int;
    pub const getVisible = gtk_cell_renderer_get_visible;

    /// Checks whether the cell renderer can do something when activated.
    extern fn gtk_cell_renderer_is_activatable(p_cell: *CellRenderer) c_int;
    pub const isActivatable = gtk_cell_renderer_is_activatable;

    /// Sets the renderer’s alignment within its available space.
    extern fn gtk_cell_renderer_set_alignment(p_cell: *CellRenderer, p_xalign: f32, p_yalign: f32) void;
    pub const setAlignment = gtk_cell_renderer_set_alignment;

    /// Sets the renderer size to be explicit, independent of the properties set.
    extern fn gtk_cell_renderer_set_fixed_size(p_cell: *CellRenderer, p_width: c_int, p_height: c_int) void;
    pub const setFixedSize = gtk_cell_renderer_set_fixed_size;

    /// Sets whether the given `GtkCellRenderer` is expanded.
    extern fn gtk_cell_renderer_set_is_expanded(p_cell: *CellRenderer, p_is_expanded: c_int) void;
    pub const setIsExpanded = gtk_cell_renderer_set_is_expanded;

    /// Sets whether the given `GtkCellRenderer` is an expander.
    extern fn gtk_cell_renderer_set_is_expander(p_cell: *CellRenderer, p_is_expander: c_int) void;
    pub const setIsExpander = gtk_cell_renderer_set_is_expander;

    /// Sets the renderer’s padding.
    extern fn gtk_cell_renderer_set_padding(p_cell: *CellRenderer, p_xpad: c_int, p_ypad: c_int) void;
    pub const setPadding = gtk_cell_renderer_set_padding;

    /// Sets the cell renderer’s sensitivity.
    extern fn gtk_cell_renderer_set_sensitive(p_cell: *CellRenderer, p_sensitive: c_int) void;
    pub const setSensitive = gtk_cell_renderer_set_sensitive;

    /// Sets the cell renderer’s visibility.
    extern fn gtk_cell_renderer_set_visible(p_cell: *CellRenderer, p_visible: c_int) void;
    pub const setVisible = gtk_cell_renderer_set_visible;

    /// Invokes the virtual render function of the `GtkCellRenderer`. The three
    /// passed-in rectangles are areas in `cr`. Most renderers will draw within
    /// `cell_area`; the xalign, yalign, xpad, and ypad fields of the `GtkCellRenderer`
    /// should be honored with respect to `cell_area`. `background_area` includes the
    /// blank space around the cell, and also the area containing the tree expander;
    /// so the `background_area` rectangles for all cells tile to cover the entire
    /// `window`.
    extern fn gtk_cell_renderer_snapshot(p_cell: *CellRenderer, p_snapshot: *gtk.Snapshot, p_widget: *gtk.Widget, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) void;
    pub const snapshot = gtk_cell_renderer_snapshot;

    /// Starts editing the contents of this `cell`, through a new `GtkCellEditable`
    /// widget created by the `GtkCellRenderer`Class.start_editing virtual function.
    extern fn gtk_cell_renderer_start_editing(p_cell: *CellRenderer, p_event: ?*gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) ?*gtk.CellEditable;
    pub const startEditing = gtk_cell_renderer_start_editing;

    /// Informs the cell renderer that the editing is stopped.
    /// If `canceled` is `TRUE`, the cell renderer will emit the
    /// `GtkCellRenderer`::editing-canceled signal.
    ///
    /// This function should be called by cell renderer implementations
    /// in response to the `GtkCellEditable::editing-done` signal of
    /// `GtkCellEditable`.
    extern fn gtk_cell_renderer_stop_editing(p_cell: *CellRenderer, p_canceled: c_int) void;
    pub const stopEditing = gtk_cell_renderer_stop_editing;

    extern fn gtk_cell_renderer_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRenderer) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRenderer) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRenderer, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders a keyboard accelerator in a cell
///
/// `GtkCellRendererAccel` displays a keyboard accelerator (i.e. a key
/// combination like `Control + a`). If the cell renderer is editable,
/// the accelerator can be changed by simply typing the new combination.
pub const CellRendererAccel = opaque {
    pub const Parent = gtk.CellRendererText;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CellRendererAccel;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The keyval of the accelerator.
        pub const accel_key = struct {
            pub const name = "accel-key";

            pub const Type = c_uint;
        };

        /// Determines if the edited accelerators are GTK accelerators. If
        /// they are, consumed modifiers are suppressed, only accelerators
        /// accepted by GTK are allowed, and the accelerators are rendered
        /// in the same way as they are in menus.
        pub const accel_mode = struct {
            pub const name = "accel-mode";

            pub const Type = gtk.CellRendererAccelMode;
        };

        /// The modifier mask of the accelerator.
        pub const accel_mods = struct {
            pub const name = "accel-mods";

            pub const Type = gdk.ModifierType;
        };

        /// The hardware keycode of the accelerator. Note that the hardware keycode is
        /// only relevant if the key does not have a keyval. Normally, the keyboard
        /// configuration should assign keyvals to all keys.
        pub const keycode = struct {
            pub const name = "keycode";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {
        /// Gets emitted when the user has removed the accelerator.
        pub const accel_cleared = struct {
            pub const name = "accel-cleared";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path_string: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRendererAccel, p_instance))),
                    gobject.signalLookup("accel-cleared", CellRendererAccel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when the user has selected a new accelerator.
        pub const accel_edited = struct {
            pub const name = "accel-edited";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path_string: [*:0]u8, p_accel_key: c_uint, p_accel_mods: gdk.ModifierType, p_hardware_keycode: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRendererAccel, p_instance))),
                    gobject.signalLookup("accel-edited", CellRendererAccel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkCellRendererAccel`.
    extern fn gtk_cell_renderer_accel_new() *gtk.CellRendererAccel;
    pub const new = gtk_cell_renderer_accel_new;

    extern fn gtk_cell_renderer_accel_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_accel_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererAccel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererAccel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererAccel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders a combobox in a cell
///
/// `GtkCellRendererCombo` renders text in a cell like `GtkCellRendererText` from
/// which it is derived. But while `GtkCellRendererText` offers a simple entry to
/// edit the text, `GtkCellRendererCombo` offers a `GtkComboBox`
/// widget to edit the text. The values to display in the combo box are taken from
/// the tree model specified in the `GtkCellRendererCombo`:model property.
///
/// The combo cell renderer takes care of adding a text cell renderer to the combo
/// box and sets it to display the column specified by its
/// `GtkCellRendererCombo`:text-column property. Further properties of the combo box
/// can be set in a handler for the `GtkCellRenderer::editing-started` signal.
pub const CellRendererCombo = opaque {
    pub const Parent = gtk.CellRendererText;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CellRendererCombo;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If `TRUE`, the cell renderer will include an entry and allow to enter
        /// values other than the ones in the popup list.
        pub const has_entry = struct {
            pub const name = "has-entry";

            pub const Type = c_int;
        };

        /// Holds a tree model containing the possible values for the combo box.
        /// Use the text_column property to specify the column holding the values.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };

        /// Specifies the model column which holds the possible values for the
        /// combo box.
        ///
        /// Note that this refers to the model specified in the model property,
        /// not the model backing the tree view to which
        /// this cell renderer is attached.
        ///
        /// `GtkCellRendererCombo` automatically adds a text cell renderer for
        /// this column to its combo box.
        pub const text_column = struct {
            pub const name = "text-column";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// This signal is emitted each time after the user selected an item in
        /// the combo box, either by using the mouse or the arrow keys.  Contrary
        /// to GtkComboBox, GtkCellRendererCombo::changed is not emitted for
        /// changes made to a selected item in the entry.  The argument `new_iter`
        /// corresponds to the newly selected item in the combo box and it is relative
        /// to the GtkTreeModel set via the model property on GtkCellRendererCombo.
        ///
        /// Note that as soon as you change the model displayed in the tree view,
        /// the tree view will immediately cease the editing operating.  This
        /// means that you most probably want to refrain from changing the model
        /// until the combo cell renderer emits the edited or editing_canceled signal.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path_string: [*:0]u8, p_new_iter: *gtk.TreeIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRendererCombo, p_instance))),
                    gobject.signalLookup("changed", CellRendererCombo.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkCellRendererCombo`.
    /// Adjust how text is drawn using object properties.
    /// Object properties can be set globally (with `gobject.Object.set`).
    /// Also, with `GtkTreeViewColumn`, you can bind a property to a value
    /// in a `GtkTreeModel`. For example, you can bind the “text” property
    /// on the cell renderer to a string value in the model, thus rendering
    /// a different string in each row of the `GtkTreeView`.
    extern fn gtk_cell_renderer_combo_new() *gtk.CellRendererCombo;
    pub const new = gtk_cell_renderer_combo_new;

    extern fn gtk_cell_renderer_combo_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_combo_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererCombo) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererCombo) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererCombo, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders a pixbuf in a cell
///
/// A `GtkCellRendererPixbuf` can be used to render an image in a cell. It allows
/// to render either a given `GdkPixbuf` (set via the
/// `GtkCellRendererPixbuf:pixbuf` property) or a named icon (set via the
/// `GtkCellRendererPixbuf:icon-name` property).
///
/// To support the tree view, `GtkCellRendererPixbuf` also supports rendering two
/// alternative pixbufs, when the `GtkCellRenderer:is-expander` property is `TRUE`.
/// If the `GtkCellRenderer:is-expanded property` is `TRUE` and the
/// `GtkCellRendererPixbuf:pixbuf-expander-open` property is set to a pixbuf, it
/// renders that pixbuf, if the `GtkCellRenderer:is-expanded` property is `FALSE`
/// and the `GtkCellRendererPixbuf:pixbuf-expander-closed` property is set to a
/// pixbuf, it renders that one.
pub const CellRendererPixbuf = opaque {
    pub const Parent = gtk.CellRenderer;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CellRendererPixbuf;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The GIcon representing the icon to display.
        /// If the icon theme is changed, the image will be updated
        /// automatically.
        pub const gicon = struct {
            pub const name = "gicon";

            pub const Type = ?*gio.Icon;
        };

        /// The name of the themed icon to display.
        /// This property only has an effect if not overridden by the "pixbuf" property.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// The `GtkIconSize` value that specifies the size of the rendered icon.
        pub const icon_size = struct {
            pub const name = "icon-size";

            pub const Type = gtk.IconSize;
        };

        pub const pixbuf = struct {
            pub const name = "pixbuf";

            pub const Type = ?*gdkpixbuf.Pixbuf;
        };

        pub const pixbuf_expander_closed = struct {
            pub const name = "pixbuf-expander-closed";

            pub const Type = ?*gdkpixbuf.Pixbuf;
        };

        pub const pixbuf_expander_open = struct {
            pub const name = "pixbuf-expander-open";

            pub const Type = ?*gdkpixbuf.Pixbuf;
        };

        pub const texture = struct {
            pub const name = "texture";

            pub const Type = ?*gdk.Texture;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCellRendererPixbuf`. Adjust rendering
    /// parameters using object properties. Object properties can be set
    /// globally (with `gobject.Object.set`). Also, with `GtkTreeViewColumn`, you
    /// can bind a property to a value in a `GtkTreeModel`. For example, you
    /// can bind the “pixbuf” property on the cell renderer to a pixbuf value
    /// in the model, thus rendering a different image in each row of the
    /// `GtkTreeView`.
    extern fn gtk_cell_renderer_pixbuf_new() *gtk.CellRendererPixbuf;
    pub const new = gtk_cell_renderer_pixbuf_new;

    extern fn gtk_cell_renderer_pixbuf_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_pixbuf_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererPixbuf) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererPixbuf) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererPixbuf, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders numbers as progress bars
///
/// `GtkCellRendererProgress` renders a numeric value as a progress par in a cell.
/// Additionally, it can display a text on top of the progress bar.
pub const CellRendererProgress = opaque {
    pub const Parent = gtk.CellRenderer;
    pub const Implements = [_]type{gtk.Orientable};
    pub const Class = opaque {
        pub const Instance = CellRendererProgress;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether progess is inverted.
        pub const inverted = struct {
            pub const name = "inverted";

            pub const Type = c_int;
        };

        /// Setting this to a non-negative value causes the cell renderer to
        /// enter "activity mode", where a block bounces back and forth to
        /// indicate that some progress is made, without specifying exactly how
        /// much.
        ///
        /// Each increment of the property causes the block to move by a little
        /// bit.
        ///
        /// To indicate that the activity has not started yet, set the property
        /// to zero. To indicate completion, set the property to `G_MAXINT`.
        pub const pulse = struct {
            pub const name = "pulse";

            pub const Type = c_int;
        };

        /// The "text" property determines the label which will be drawn
        /// over the progress bar. Setting this property to `NULL` causes the default
        /// label to be displayed. Setting this property to an empty string causes
        /// no label to be displayed.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };

        /// The "text-xalign" property controls the horizontal alignment of the
        /// text in the progress bar.  Valid values range from 0 (left) to 1
        /// (right).  Reserved for RTL layouts.
        pub const text_xalign = struct {
            pub const name = "text-xalign";

            pub const Type = f32;
        };

        /// The "text-yalign" property controls the vertical alignment of the
        /// text in the progress bar.  Valid values range from 0 (top) to 1
        /// (bottom).
        pub const text_yalign = struct {
            pub const name = "text-yalign";

            pub const Type = f32;
        };

        /// The "value" property determines the percentage to which the
        /// progress bar will be "filled in".
        pub const value = struct {
            pub const name = "value";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCellRendererProgress`.
    extern fn gtk_cell_renderer_progress_new() *gtk.CellRendererProgress;
    pub const new = gtk_cell_renderer_progress_new;

    extern fn gtk_cell_renderer_progress_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_progress_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererProgress) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererProgress) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererProgress, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders a spin button in a cell
///
/// `GtkCellRendererSpin` renders text in a cell like `GtkCellRendererText` from
/// which it is derived. But while `GtkCellRendererText` offers a simple entry to
/// edit the text, `GtkCellRendererSpin` offers a `GtkSpinButton` widget. Of course,
/// that means that the text has to be parseable as a floating point number.
///
/// The range of the spinbutton is taken from the adjustment property of the
/// cell renderer, which can be set explicitly or mapped to a column in the
/// tree model, like all properties of cell renders. `GtkCellRendererSpin`
/// also has properties for the `GtkCellRendererSpin:climb-rate` and the number
/// of `GtkCellRendererSpin:digits` to display. Other `GtkSpinButton` properties
/// can be set in a handler for the `GtkCellRenderer::editing-started` signal.
pub const CellRendererSpin = opaque {
    pub const Parent = gtk.CellRendererText;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CellRendererSpin;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The adjustment that holds the value of the spinbutton.
        /// This must be non-`NULL` for the cell renderer to be editable.
        pub const adjustment = struct {
            pub const name = "adjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// The acceleration rate when you hold down a button.
        pub const climb_rate = struct {
            pub const name = "climb-rate";

            pub const Type = f64;
        };

        /// The number of decimal places to display.
        pub const digits = struct {
            pub const name = "digits";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCellRendererSpin`.
    extern fn gtk_cell_renderer_spin_new() *gtk.CellRendererSpin;
    pub const new = gtk_cell_renderer_spin_new;

    extern fn gtk_cell_renderer_spin_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_spin_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererSpin) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererSpin) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererSpin, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders a spinning animation in a cell
///
/// `GtkCellRendererSpinner` renders a spinning animation in a cell, very
/// similar to `GtkSpinner`. It can often be used as an alternative
/// to a `GtkCellRendererProgress` for displaying indefinite activity,
/// instead of actual progress.
///
/// To start the animation in a cell, set the `GtkCellRendererSpinner:active`
/// property to `TRUE` and increment the `GtkCellRendererSpinner:pulse` property
/// at regular intervals. The usual way to set the cell renderer properties
/// for each cell is to bind them to columns in your tree model using e.g.
/// `gtk.TreeViewColumn.addAttribute`.
pub const CellRendererSpinner = opaque {
    pub const Parent = gtk.CellRenderer;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CellRendererSpinner;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the spinner is active (ie. shown) in the cell
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// Pulse of the spinner. Increment this value to draw the next frame of the
        /// spinner animation. Usually, you would update this value in a timeout.
        ///
        /// By default, the `GtkSpinner` widget draws one full cycle of the animation,
        /// consisting of 12 frames, in 750 milliseconds.
        pub const pulse = struct {
            pub const name = "pulse";

            pub const Type = c_uint;
        };

        /// The `GtkIconSize` value that specifies the size of the rendered spinner.
        pub const size = struct {
            pub const name = "size";

            pub const Type = gtk.IconSize;
        };
    };

    pub const signals = struct {};

    /// Returns a new cell renderer which will show a spinner to indicate
    /// activity.
    extern fn gtk_cell_renderer_spinner_new() *gtk.CellRendererSpinner;
    pub const new = gtk_cell_renderer_spinner_new;

    extern fn gtk_cell_renderer_spinner_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_spinner_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererSpinner) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererSpinner) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererSpinner, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders text in a cell
///
/// A `GtkCellRendererText` renders a given text in its cell, using the font, color and
/// style information provided by its properties. The text will be ellipsized if it is
/// too long and the `GtkCellRendererText:ellipsize` property allows it.
///
/// If the `GtkCellRenderer:mode` is `GTK_CELL_RENDERER_MODE_EDITABLE`,
/// the `GtkCellRendererText` allows to edit its text using an entry.
pub const CellRendererText = extern struct {
    pub const Parent = gtk.CellRenderer;
    pub const Implements = [_]type{};
    pub const Class = gtk.CellRendererTextClass;
    f_parent: gtk.CellRenderer,

    pub const virtual_methods = struct {
        pub const edited = struct {
            pub fn call(p_class: anytype, p_cell_renderer_text: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: [*:0]const u8, p_new_text: [*:0]const u8) void {
                return gobject.ext.as(CellRendererText.Class, p_class).f_edited.?(gobject.ext.as(CellRendererText, p_cell_renderer_text), p_path, p_new_text);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_renderer_text: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: [*:0]const u8, p_new_text: [*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(CellRendererText.Class, p_class).f_edited = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        pub const align_set = struct {
            pub const name = "align-set";

            pub const Type = c_int;
        };

        /// Specifies how to align the lines of text with respect to each other.
        ///
        /// Note that this property describes how to align the lines of text in
        /// case there are several of them. The "xalign" property of `GtkCellRenderer`,
        /// on the other hand, sets the horizontal alignment of the whole text.
        pub const alignment = struct {
            pub const name = "alignment";

            pub const Type = pango.Alignment;
        };

        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?*pango.AttrList;
        };

        pub const background = struct {
            pub const name = "background";

            pub const Type = ?[*:0]u8;
        };

        /// Background color as a `GdkRGBA`
        pub const background_rgba = struct {
            pub const name = "background-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        pub const background_set = struct {
            pub const name = "background-set";

            pub const Type = c_int;
        };

        pub const editable = struct {
            pub const name = "editable";

            pub const Type = c_int;
        };

        pub const editable_set = struct {
            pub const name = "editable-set";

            pub const Type = c_int;
        };

        /// Specifies the preferred place to ellipsize the string, if the cell renderer
        /// does not have enough room to display the entire string. Setting it to
        /// `PANGO_ELLIPSIZE_NONE` turns off ellipsizing. See the wrap-width property
        /// for another way of making the text fit into a given width.
        pub const ellipsize = struct {
            pub const name = "ellipsize";

            pub const Type = pango.EllipsizeMode;
        };

        pub const ellipsize_set = struct {
            pub const name = "ellipsize-set";

            pub const Type = c_int;
        };

        pub const family = struct {
            pub const name = "family";

            pub const Type = ?[*:0]u8;
        };

        pub const family_set = struct {
            pub const name = "family-set";

            pub const Type = c_int;
        };

        pub const font = struct {
            pub const name = "font";

            pub const Type = ?[*:0]u8;
        };

        pub const font_desc = struct {
            pub const name = "font-desc";

            pub const Type = ?*pango.FontDescription;
        };

        pub const foreground = struct {
            pub const name = "foreground";

            pub const Type = ?[*:0]u8;
        };

        /// Foreground color as a `GdkRGBA`
        pub const foreground_rgba = struct {
            pub const name = "foreground-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        pub const foreground_set = struct {
            pub const name = "foreground-set";

            pub const Type = c_int;
        };

        pub const language = struct {
            pub const name = "language";

            pub const Type = ?[*:0]u8;
        };

        pub const language_set = struct {
            pub const name = "language-set";

            pub const Type = c_int;
        };

        pub const markup = struct {
            pub const name = "markup";

            pub const Type = ?[*:0]u8;
        };

        /// The desired maximum width of the cell, in characters. If this property
        /// is set to -1, the width will be calculated automatically.
        ///
        /// For cell renderers that ellipsize or wrap text; this property
        /// controls the maximum reported width of the cell. The
        /// cell should not receive any greater allocation unless it is
        /// set to expand in its `GtkCellLayout` and all of the cell's siblings
        /// have received their natural width.
        pub const max_width_chars = struct {
            pub const name = "max-width-chars";

            pub const Type = c_int;
        };

        /// The text that will be displayed in the `GtkCellRenderer` if
        /// `GtkCellRendererText:editable` is `TRUE` and the cell is empty.
        pub const placeholder_text = struct {
            pub const name = "placeholder-text";

            pub const Type = ?[*:0]u8;
        };

        pub const rise = struct {
            pub const name = "rise";

            pub const Type = c_int;
        };

        pub const rise_set = struct {
            pub const name = "rise-set";

            pub const Type = c_int;
        };

        pub const scale = struct {
            pub const name = "scale";

            pub const Type = f64;
        };

        pub const scale_set = struct {
            pub const name = "scale-set";

            pub const Type = c_int;
        };

        pub const single_paragraph_mode = struct {
            pub const name = "single-paragraph-mode";

            pub const Type = c_int;
        };

        pub const size = struct {
            pub const name = "size";

            pub const Type = c_int;
        };

        pub const size_points = struct {
            pub const name = "size-points";

            pub const Type = f64;
        };

        pub const size_set = struct {
            pub const name = "size-set";

            pub const Type = c_int;
        };

        pub const stretch = struct {
            pub const name = "stretch";

            pub const Type = pango.Stretch;
        };

        pub const stretch_set = struct {
            pub const name = "stretch-set";

            pub const Type = c_int;
        };

        pub const strikethrough = struct {
            pub const name = "strikethrough";

            pub const Type = c_int;
        };

        pub const strikethrough_set = struct {
            pub const name = "strikethrough-set";

            pub const Type = c_int;
        };

        pub const style = struct {
            pub const name = "style";

            pub const Type = pango.Style;
        };

        pub const style_set = struct {
            pub const name = "style-set";

            pub const Type = c_int;
        };

        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };

        pub const underline = struct {
            pub const name = "underline";

            pub const Type = pango.Underline;
        };

        pub const underline_set = struct {
            pub const name = "underline-set";

            pub const Type = c_int;
        };

        pub const variant = struct {
            pub const name = "variant";

            pub const Type = pango.Variant;
        };

        pub const variant_set = struct {
            pub const name = "variant-set";

            pub const Type = c_int;
        };

        pub const weight = struct {
            pub const name = "weight";

            pub const Type = c_int;
        };

        pub const weight_set = struct {
            pub const name = "weight-set";

            pub const Type = c_int;
        };

        /// The desired width of the cell, in characters. If this property is set to
        /// -1, the width will be calculated automatically, otherwise the cell will
        /// request either 3 characters or the property value, whichever is greater.
        pub const width_chars = struct {
            pub const name = "width-chars";

            pub const Type = c_int;
        };

        /// Specifies how to break the string into multiple lines, if the cell
        /// renderer does not have enough room to display the entire string.
        /// This property has no effect unless the wrap-width property is set.
        pub const wrap_mode = struct {
            pub const name = "wrap-mode";

            pub const Type = pango.WrapMode;
        };

        /// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
        /// be used to influence at what character positions the line breaks can be placed.
        /// Setting wrap-width to -1 turns wrapping off.
        pub const wrap_width = struct {
            pub const name = "wrap-width";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// This signal is emitted after `renderer` has been edited.
        ///
        /// It is the responsibility of the application to update the model
        /// and store `new_text` at the position indicated by `path`.
        pub const edited = struct {
            pub const name = "edited";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: [*:0]u8, p_new_text: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRendererText, p_instance))),
                    gobject.signalLookup("edited", CellRendererText.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkCellRendererText`. Adjust how text is drawn using
    /// object properties. Object properties can be
    /// set globally (with `gobject.Object.set`). Also, with `GtkTreeViewColumn`,
    /// you can bind a property to a value in a `GtkTreeModel`. For example,
    /// you can bind the “text” property on the cell renderer to a string
    /// value in the model, thus rendering a different string in each row
    /// of the `GtkTreeView`.
    extern fn gtk_cell_renderer_text_new() *gtk.CellRendererText;
    pub const new = gtk_cell_renderer_text_new;

    /// Sets the height of a renderer to explicitly be determined by the “font” and
    /// “y_pad” property set on it.  Further changes in these properties do not
    /// affect the height, so they must be accompanied by a subsequent call to this
    /// function.  Using this function is inflexible, and should really only be used
    /// if calculating the size of a cell is too slow (ie, a massive number of cells
    /// displayed).  If `number_of_rows` is -1, then the fixed height is unset, and
    /// the height is determined by the properties again.
    extern fn gtk_cell_renderer_text_set_fixed_height_from_font(p_renderer: *CellRendererText, p_number_of_rows: c_int) void;
    pub const setFixedHeightFromFont = gtk_cell_renderer_text_set_fixed_height_from_font;

    extern fn gtk_cell_renderer_text_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_text_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererText) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererText) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererText, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Renders a toggle button in a cell
///
/// `GtkCellRendererToggle` renders a toggle button in a cell. The
/// button is drawn as a radio or a checkbutton, depending on the
/// `GtkCellRendererToggle:radio` property.
/// When activated, it emits the `GtkCellRendererToggle::toggled` signal.
pub const CellRendererToggle = opaque {
    pub const Parent = gtk.CellRenderer;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = CellRendererToggle;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        pub const activatable = struct {
            pub const name = "activatable";

            pub const Type = c_int;
        };

        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        pub const inconsistent = struct {
            pub const name = "inconsistent";

            pub const Type = c_int;
        };

        pub const radio = struct {
            pub const name = "radio";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// The ::toggled signal is emitted when the cell is toggled.
        ///
        /// It is the responsibility of the application to update the model
        /// with the correct value to store at `path`.  Often this is simply the
        /// opposite of the value currently stored at `path`.
        pub const toggled = struct {
            pub const name = "toggled";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellRendererToggle, p_instance))),
                    gobject.signalLookup("toggled", CellRendererToggle.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkCellRendererToggle`. Adjust rendering
    /// parameters using object properties. Object properties can be set
    /// globally (with `gobject.Object.set`). Also, with `GtkTreeViewColumn`, you
    /// can bind a property to a value in a `GtkTreeModel`. For example, you
    /// can bind the “active” property on the cell renderer to a boolean value
    /// in the model, thus causing the check button to reflect the state of
    /// the model.
    extern fn gtk_cell_renderer_toggle_new() *gtk.CellRendererToggle;
    pub const new = gtk_cell_renderer_toggle_new;

    /// Returns whether the cell renderer is activatable. See
    /// `gtk.CellRendererToggle.setActivatable`.
    extern fn gtk_cell_renderer_toggle_get_activatable(p_toggle: *CellRendererToggle) c_int;
    pub const getActivatable = gtk_cell_renderer_toggle_get_activatable;

    /// Returns whether the cell renderer is active. See
    /// `gtk.CellRendererToggle.setActive`.
    extern fn gtk_cell_renderer_toggle_get_active(p_toggle: *CellRendererToggle) c_int;
    pub const getActive = gtk_cell_renderer_toggle_get_active;

    /// Returns whether we’re rendering radio toggles rather than checkboxes.
    extern fn gtk_cell_renderer_toggle_get_radio(p_toggle: *CellRendererToggle) c_int;
    pub const getRadio = gtk_cell_renderer_toggle_get_radio;

    /// Makes the cell renderer activatable.
    extern fn gtk_cell_renderer_toggle_set_activatable(p_toggle: *CellRendererToggle, p_setting: c_int) void;
    pub const setActivatable = gtk_cell_renderer_toggle_set_activatable;

    /// Activates or deactivates a cell renderer.
    extern fn gtk_cell_renderer_toggle_set_active(p_toggle: *CellRendererToggle, p_setting: c_int) void;
    pub const setActive = gtk_cell_renderer_toggle_set_active;

    /// If `radio` is `TRUE`, the cell renderer renders a radio toggle
    /// (i.e. a toggle in a group of mutually-exclusive toggles).
    /// If `FALSE`, it renders a check toggle (a standalone boolean option).
    /// This can be set globally for the cell renderer, or changed just
    /// before rendering each cell in the model (for `GtkTreeView`, you set
    /// up a per-row setting using `GtkTreeViewColumn` to associate model
    /// columns with cell renderer properties).
    extern fn gtk_cell_renderer_toggle_set_radio(p_toggle: *CellRendererToggle, p_radio: c_int) void;
    pub const setRadio = gtk_cell_renderer_toggle_set_radio;

    extern fn gtk_cell_renderer_toggle_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_toggle_get_type;

    extern fn g_object_ref(p_self: *gtk.CellRendererToggle) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellRendererToggle) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellRendererToggle, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A widget displaying a single row of a GtkTreeModel
///
/// A `GtkCellView` displays a single row of a `GtkTreeModel` using a `GtkCellArea`
/// and `GtkCellAreaContext`. A `GtkCellAreaContext` can be provided to the
/// `GtkCellView` at construction time in order to keep the cellview in context
/// of a group of cell views, this ensures that the renderers displayed will
/// be properly aligned with each other (like the aligned cells in the menus
/// of `GtkComboBox`).
///
/// `GtkCellView` is `GtkOrientable` in order to decide in which orientation
/// the underlying `GtkCellAreaContext` should be allocated. Taking the `GtkComboBox`
/// menu as an example, cellviews should be oriented horizontally if the menus are
/// listed top-to-bottom and thus all share the same width but may have separate
/// individual heights (left-to-right menus should be allocated vertically since
/// they all share the same height but may have variable widths).
///
/// ## CSS nodes
///
/// GtkCellView has a single CSS node with name cellview.
pub const CellView = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.CellLayout, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = CellView;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkCellArea` rendering cells
        ///
        /// If no area is specified when creating the cell view with `gtk.CellView.newWithContext`
        /// a horizontally oriented `GtkCellArea`Box will be used.
        ///
        /// since 3.0
        pub const cell_area = struct {
            pub const name = "cell-area";

            pub const Type = ?*gtk.CellArea;
        };

        /// The `GtkCellAreaContext` used to compute the geometry of the cell view.
        ///
        /// A group of cell views can be assigned the same context in order to
        /// ensure the sizes and cell alignments match across all the views with
        /// the same context.
        ///
        /// `GtkComboBox` menus uses this to assign the same context to all cell views
        /// in the menu items for a single menu (each submenu creates its own
        /// context since the size of each submenu does not depend on parent
        /// or sibling menus).
        ///
        /// since 3.0
        pub const cell_area_context = struct {
            pub const name = "cell-area-context";

            pub const Type = ?*gtk.CellAreaContext;
        };

        /// Whether all cells should be draw as sensitive for this view regardless
        /// of the actual cell properties (used to make menus with submenus appear
        /// sensitive when the items in submenus might be insensitive).
        ///
        /// since 3.0
        pub const draw_sensitive = struct {
            pub const name = "draw-sensitive";

            pub const Type = c_int;
        };

        /// Whether the view should request enough space to always fit
        /// the size of every row in the model (used by the combo box to
        /// ensure the combo box size doesn't change when different items
        /// are selected).
        ///
        /// since 3.0
        pub const fit_model = struct {
            pub const name = "fit-model";

            pub const Type = c_int;
        };

        /// The model for cell view
        ///
        /// since 2.10
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCellView` widget.
    extern fn gtk_cell_view_new() *gtk.CellView;
    pub const new = gtk_cell_view_new;

    /// Creates a new `GtkCellView` widget with a specific `GtkCellArea`
    /// to layout cells and a specific `GtkCellAreaContext`.
    ///
    /// Specifying the same context for a handful of cells lets
    /// the underlying area synchronize the geometry for those cells,
    /// in this way alignments with cellviews for other rows are
    /// possible.
    extern fn gtk_cell_view_new_with_context(p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext) *gtk.CellView;
    pub const newWithContext = gtk_cell_view_new_with_context;

    /// Creates a new `GtkCellView` widget, adds a `GtkCellRendererText`
    /// to it, and makes it show `markup`. The text can be marked up with
    /// the [Pango text markup language](https://docs.gtk.org/Pango/pango_markup.html).
    extern fn gtk_cell_view_new_with_markup(p_markup: [*:0]const u8) *gtk.CellView;
    pub const newWithMarkup = gtk_cell_view_new_with_markup;

    /// Creates a new `GtkCellView` widget, adds a `GtkCellRendererText`
    /// to it, and makes it show `text`.
    extern fn gtk_cell_view_new_with_text(p_text: [*:0]const u8) *gtk.CellView;
    pub const newWithText = gtk_cell_view_new_with_text;

    /// Creates a new `GtkCellView` widget, adds a `GtkCellRendererPixbuf`
    /// to it, and makes it show `texture`.
    extern fn gtk_cell_view_new_with_texture(p_texture: *gdk.Texture) *gtk.CellView;
    pub const newWithTexture = gtk_cell_view_new_with_texture;

    /// Returns a `GtkTreePath` referring to the currently
    /// displayed row. If no row is currently displayed,
    /// `NULL` is returned.
    extern fn gtk_cell_view_get_displayed_row(p_cell_view: *CellView) ?*gtk.TreePath;
    pub const getDisplayedRow = gtk_cell_view_get_displayed_row;

    /// Gets whether `cell_view` is configured to draw all of its
    /// cells in a sensitive state.
    extern fn gtk_cell_view_get_draw_sensitive(p_cell_view: *CellView) c_int;
    pub const getDrawSensitive = gtk_cell_view_get_draw_sensitive;

    /// Gets whether `cell_view` is configured to request space
    /// to fit the entire `GtkTreeModel`.
    extern fn gtk_cell_view_get_fit_model(p_cell_view: *CellView) c_int;
    pub const getFitModel = gtk_cell_view_get_fit_model;

    /// Returns the model for `cell_view`. If no model is used `NULL` is
    /// returned.
    extern fn gtk_cell_view_get_model(p_cell_view: *CellView) ?*gtk.TreeModel;
    pub const getModel = gtk_cell_view_get_model;

    /// Sets the row of the model that is currently displayed
    /// by the `GtkCellView`. If the path is unset, then the
    /// contents of the cellview “stick” at their last value;
    /// this is not normally a desired result, but may be
    /// a needed intermediate state if say, the model for
    /// the `GtkCellView` becomes temporarily empty.
    extern fn gtk_cell_view_set_displayed_row(p_cell_view: *CellView, p_path: ?*gtk.TreePath) void;
    pub const setDisplayedRow = gtk_cell_view_set_displayed_row;

    /// Sets whether `cell_view` should draw all of its
    /// cells in a sensitive state, this is used by `GtkComboBox` menus
    /// to ensure that rows with insensitive cells that contain
    /// children appear sensitive in the parent menu item.
    extern fn gtk_cell_view_set_draw_sensitive(p_cell_view: *CellView, p_draw_sensitive: c_int) void;
    pub const setDrawSensitive = gtk_cell_view_set_draw_sensitive;

    /// Sets whether `cell_view` should request space to fit the entire `GtkTreeModel`.
    ///
    /// This is used by `GtkComboBox` to ensure that the cell view displayed on
    /// the combo box’s button always gets enough space and does not resize
    /// when selection changes.
    extern fn gtk_cell_view_set_fit_model(p_cell_view: *CellView, p_fit_model: c_int) void;
    pub const setFitModel = gtk_cell_view_set_fit_model;

    /// Sets the model for `cell_view`.  If `cell_view` already has a model
    /// set, it will remove it before setting the new model.  If `model` is
    /// `NULL`, then it will unset the old model.
    extern fn gtk_cell_view_set_model(p_cell_view: *CellView, p_model: ?*gtk.TreeModel) void;
    pub const setModel = gtk_cell_view_set_model;

    extern fn gtk_cell_view_get_type() usize;
    pub const getGObjectType = gtk_cell_view_get_type;

    extern fn g_object_ref(p_self: *gtk.CellView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Arranges three children in a row, keeping the middle child
/// centered as well as possible.
///
/// <picture>
///   <source srcset="centerbox-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkCenterBox" src="centerbox.png">
/// </picture>
///
/// To add children to `GtkCenterBox`, use `gtk.CenterBox.setStartWidget`,
/// `gtk.CenterBox.setCenterWidget` and
/// `gtk.CenterBox.setEndWidget`.
///
/// The sizing and positioning of children can be influenced with the
/// align and expand properties of the children.
///
/// # GtkCenterBox as GtkBuildable
///
/// The `GtkCenterBox` implementation of the `GtkBuildable` interface
/// supports placing children in the 3 positions by specifying “start”, “center”
/// or “end” as the “type” attribute of a `<child>` element.
///
/// # CSS nodes
///
/// `GtkCenterBox` uses a single CSS node with the name “box”,
///
/// The first child of the `GtkCenterBox` will be allocated depending on the
/// text direction, i.e. in left-to-right layouts it will be allocated on the
/// left and in right-to-left layouts on the right.
///
/// In vertical orientation, the nodes of the children are arranged from top to
/// bottom.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkCenterBox` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkCenterBox` uses the `gtk.@"AccessibleRole.generic"`
/// role.
pub const CenterBox = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.CenterBoxClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The position of the baseline aligned widget if extra space is available.
        pub const baseline_position = struct {
            pub const name = "baseline-position";

            pub const Type = gtk.BaselinePosition;
        };

        /// The widget that is placed at the center position.
        pub const center_widget = struct {
            pub const name = "center-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// The widget that is placed at the end position.
        ///
        /// In vertical orientation, the end position is at the bottom.
        /// In horizontal orientation, the end position is at the trailing
        /// edge with respect to the text direction.
        pub const end_widget = struct {
            pub const name = "end-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether to shrink the center widget after other children.
        ///
        /// By default, when there's no space to give all three children their
        /// natural widths, the start and end widgets start shrinking and the
        /// center child keeps natural width until they reach minimum width.
        ///
        /// If false, start and end widgets keep natural width and the
        /// center widget starts shrinking instead.
        pub const shrink_center_last = struct {
            pub const name = "shrink-center-last";

            pub const Type = c_int;
        };

        /// The widget that is placed at the start position.
        ///
        /// In vertical orientation, the start position is at the top.
        /// In horizontal orientation, the start position is at the leading
        /// edge with respect to the text direction.
        pub const start_widget = struct {
            pub const name = "start-widget";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCenterBox`.
    extern fn gtk_center_box_new() *gtk.CenterBox;
    pub const new = gtk_center_box_new;

    /// Gets the baseline position of the center box.
    ///
    /// See `gtk.CenterBox.setBaselinePosition`.
    extern fn gtk_center_box_get_baseline_position(p_self: *CenterBox) gtk.BaselinePosition;
    pub const getBaselinePosition = gtk_center_box_get_baseline_position;

    /// Gets the center widget.
    extern fn gtk_center_box_get_center_widget(p_self: *CenterBox) ?*gtk.Widget;
    pub const getCenterWidget = gtk_center_box_get_center_widget;

    /// Gets the end widget.
    extern fn gtk_center_box_get_end_widget(p_self: *CenterBox) ?*gtk.Widget;
    pub const getEndWidget = gtk_center_box_get_end_widget;

    /// Gets whether the center widget shrinks after other children.
    extern fn gtk_center_box_get_shrink_center_last(p_self: *CenterBox) c_int;
    pub const getShrinkCenterLast = gtk_center_box_get_shrink_center_last;

    /// Gets the start widget.
    extern fn gtk_center_box_get_start_widget(p_self: *CenterBox) ?*gtk.Widget;
    pub const getStartWidget = gtk_center_box_get_start_widget;

    /// Sets the baseline position of a center box.
    ///
    /// This affects only horizontal boxes with at least one baseline
    /// aligned child. If there is more vertical space available than
    /// requested, and the baseline is not allocated by the parent then
    /// `position` is used to allocate the baseline with respect to the
    /// extra space available.
    extern fn gtk_center_box_set_baseline_position(p_self: *CenterBox, p_position: gtk.BaselinePosition) void;
    pub const setBaselinePosition = gtk_center_box_set_baseline_position;

    /// Sets the center widget.
    ///
    /// To remove the existing center widget, pass `NULL`.
    extern fn gtk_center_box_set_center_widget(p_self: *CenterBox, p_child: ?*gtk.Widget) void;
    pub const setCenterWidget = gtk_center_box_set_center_widget;

    /// Sets the end widget.
    ///
    /// To remove the existing end widget, pass `NULL`.
    extern fn gtk_center_box_set_end_widget(p_self: *CenterBox, p_child: ?*gtk.Widget) void;
    pub const setEndWidget = gtk_center_box_set_end_widget;

    /// Sets whether to shrink the center widget after other children.
    ///
    /// By default, when there's no space to give all three children their
    /// natural widths, the start and end widgets start shrinking and the
    /// center child keeps natural width until they reach minimum width.
    ///
    /// If `shrink_center_last` is false, start and end widgets keep natural
    /// width and the center widget starts shrinking instead.
    extern fn gtk_center_box_set_shrink_center_last(p_self: *CenterBox, p_shrink_center_last: c_int) void;
    pub const setShrinkCenterLast = gtk_center_box_set_shrink_center_last;

    /// Sets the start widget.
    ///
    /// To remove the existing start widget, pass `NULL`.
    extern fn gtk_center_box_set_start_widget(p_self: *CenterBox, p_child: ?*gtk.Widget) void;
    pub const setStartWidget = gtk_center_box_set_start_widget;

    extern fn gtk_center_box_get_type() usize;
    pub const getGObjectType = gtk_center_box_get_type;

    extern fn g_object_ref(p_self: *gtk.CenterBox) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CenterBox) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CenterBox, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Manages up to three children.
///
/// The start widget is allocated at the start of the layout (left in
/// left-to-right locales and right in right-to-left ones), and the end
/// widget at the end.
///
/// The center widget is centered regarding the full width of the layout's.
pub const CenterLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{};
    pub const Class = gtk.CenterLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to shrink the center widget after other children.
        ///
        /// By default, when there's no space to give all three children their
        /// natural widths, the start and end widgets start shrinking and the
        /// center child keeps natural width until they reach minimum width.
        ///
        /// If set to `FALSE`, start and end widgets keep natural width and the
        /// center widget starts shrinking instead.
        pub const shrink_center_last = struct {
            pub const name = "shrink-center-last";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkCenterLayout`.
    extern fn gtk_center_layout_new() *gtk.CenterLayout;
    pub const new = gtk_center_layout_new;

    /// Returns the baseline position of the layout.
    extern fn gtk_center_layout_get_baseline_position(p_self: *CenterLayout) gtk.BaselinePosition;
    pub const getBaselinePosition = gtk_center_layout_get_baseline_position;

    /// Returns the center widget of the layout.
    extern fn gtk_center_layout_get_center_widget(p_self: *CenterLayout) ?*gtk.Widget;
    pub const getCenterWidget = gtk_center_layout_get_center_widget;

    /// Returns the end widget of the layout.
    extern fn gtk_center_layout_get_end_widget(p_self: *CenterLayout) ?*gtk.Widget;
    pub const getEndWidget = gtk_center_layout_get_end_widget;

    /// Gets the current orienration of the layout manager.
    extern fn gtk_center_layout_get_orientation(p_self: *CenterLayout) gtk.Orientation;
    pub const getOrientation = gtk_center_layout_get_orientation;

    /// Gets whether `self` shrinks the center widget after other children.
    extern fn gtk_center_layout_get_shrink_center_last(p_self: *CenterLayout) c_int;
    pub const getShrinkCenterLast = gtk_center_layout_get_shrink_center_last;

    /// Returns the start widget of the layout.
    extern fn gtk_center_layout_get_start_widget(p_self: *CenterLayout) ?*gtk.Widget;
    pub const getStartWidget = gtk_center_layout_get_start_widget;

    /// Sets the new baseline position of `self`
    extern fn gtk_center_layout_set_baseline_position(p_self: *CenterLayout, p_baseline_position: gtk.BaselinePosition) void;
    pub const setBaselinePosition = gtk_center_layout_set_baseline_position;

    /// Sets the new center widget of `self`.
    ///
    /// To remove the existing center widget, pass `NULL`.
    extern fn gtk_center_layout_set_center_widget(p_self: *CenterLayout, p_widget: ?*gtk.Widget) void;
    pub const setCenterWidget = gtk_center_layout_set_center_widget;

    /// Sets the new end widget of `self`.
    ///
    /// To remove the existing center widget, pass `NULL`.
    extern fn gtk_center_layout_set_end_widget(p_self: *CenterLayout, p_widget: ?*gtk.Widget) void;
    pub const setEndWidget = gtk_center_layout_set_end_widget;

    /// Sets the orientation of `self`.
    extern fn gtk_center_layout_set_orientation(p_self: *CenterLayout, p_orientation: gtk.Orientation) void;
    pub const setOrientation = gtk_center_layout_set_orientation;

    /// Sets whether to shrink the center widget after other children.
    ///
    /// By default, when there's no space to give all three children their
    /// natural widths, the start and end widgets start shrinking and the
    /// center child keeps natural width until they reach minimum width.
    ///
    /// If set to `FALSE`, start and end widgets keep natural width and the
    /// center widget starts shrinking instead.
    extern fn gtk_center_layout_set_shrink_center_last(p_self: *CenterLayout, p_shrink_center_last: c_int) void;
    pub const setShrinkCenterLast = gtk_center_layout_set_shrink_center_last;

    /// Sets the new start widget of `self`.
    ///
    /// To remove the existing start widget, pass `NULL`.
    extern fn gtk_center_layout_set_start_widget(p_self: *CenterLayout, p_widget: ?*gtk.Widget) void;
    pub const setStartWidget = gtk_center_layout_set_start_widget;

    extern fn gtk_center_layout_get_type() usize;
    pub const getGObjectType = gtk_center_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.CenterLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CenterLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CenterLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Places a label next to an indicator.
///
/// <picture>
///   <source srcset="check-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="Example GtkCheckButtons" src="check-button.png">
/// </picture>
///
/// A `GtkCheckButton` is created by calling either `gtk.CheckButton.new`
/// or `gtk.CheckButton.newWithLabel`.
///
/// The state of a `GtkCheckButton` can be set specifically using
/// `gtk.CheckButton.setActive`, and retrieved using
/// `gtk.CheckButton.getActive`.
///
/// # Inconsistent state
///
/// In addition to "on" and "off", check buttons can be an
/// "in between" state that is neither on nor off. This can be used
/// e.g. when the user has selected a range of elements (such as some
/// text or spreadsheet cells) that are affected by a check button,
/// and the current values in that range are inconsistent.
///
/// To set a `GtkCheckButton` to inconsistent state, use
/// `gtk.CheckButton.setInconsistent`.
///
/// # Grouping
///
/// Check buttons can be grouped together, to form mutually exclusive
/// groups - only one of the buttons can be toggled at a time, and toggling
/// another one will switch the currently toggled one off.
///
/// Grouped check buttons use a different indicator, and are commonly referred
/// to as *radio buttons*.
///
/// <picture>
///   <source srcset="radio-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="Example GtkRadioButtons" src="radio-button.png">
/// </picture>
///
/// To add a `GtkCheckButton` to a group, use `gtk.CheckButton.setGroup`.
///
/// When the code must keep track of the state of a group of radio buttons, it
/// is recommended to keep track of such state through a stateful
/// `GAction` with a target for each button. Using the `toggled` signals to keep
/// track of the group changes and state is discouraged.
///
/// # Shortcuts and Gestures
///
/// `GtkCheckButton` supports the following keyboard shortcuts:
///
/// - <kbd>␣</kbd> or <kbd>Enter</kbd> activates the button.
///
/// # CSS nodes
///
/// ```
/// checkbutton[.text-button][.grouped]
/// ├── check
/// ╰── [label]
/// ```
///
/// A `GtkCheckButton` has a main node with name checkbutton. If the
/// `gtk.CheckButton.properties.label` or `gtk.CheckButton.properties.child`
/// properties are set, it contains a child widget. The indicator node
/// is named check when no group is set, and radio if the checkbutton
/// is grouped together with other checkbuttons.
///
/// # Accessibility
///
/// `GtkCheckButton` uses the `gtk.@"AccessibleRole.checkbox"` role.
pub const CheckButton = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.CheckButtonClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const activate = struct {
            pub fn call(p_class: anytype, p_check_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CheckButton.Class, p_class).f_activate.?(gobject.ext.as(CheckButton, p_check_button));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_check_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CheckButton.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };

        pub const toggled = struct {
            pub fn call(p_class: anytype, p_check_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CheckButton.Class, p_class).f_toggled.?(gobject.ext.as(CheckButton, p_check_button));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_check_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CheckButton.Class, p_class).f_toggled = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// If the check button is active.
        ///
        /// Setting `active` to `TRUE` will add the `:checked:` state to both
        /// the check button and the indicator CSS node.
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The check button whose group this widget belongs to.
        pub const group = struct {
            pub const name = "group";

            pub const Type = ?*gtk.CheckButton;
        };

        /// If the check button is in an “in between” state.
        ///
        /// The inconsistent state only affects visual appearance,
        /// not the semantics of the button.
        pub const inconsistent = struct {
            pub const name = "inconsistent";

            pub const Type = c_int;
        };

        /// Text of the label inside the check button, if it contains a label widget.
        pub const label = struct {
            pub const name = "label";

            pub const Type = ?[*:0]u8;
        };

        /// If set, an underline in the text indicates that the following
        /// character is to be used as mnemonic.
        pub const use_underline = struct {
            pub const name = "use-underline";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to when the check button is activated.
        ///
        /// The `::activate` signal on `GtkCheckButton` is an action signal and
        /// emitting it causes the button to animate press then release.
        ///
        /// Applications should never connect to this signal, but use the
        /// `gtk.CheckButton.signals.toggled` signal.
        ///
        /// The default bindings for this signal are all forms of the
        /// <kbd>␣</kbd> and <kbd>Enter</kbd> keys.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CheckButton, p_instance))),
                    gobject.signalLookup("activate", CheckButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the buttons's `gtk.CheckButton.properties.active`
        /// property changes.
        pub const toggled = struct {
            pub const name = "toggled";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CheckButton, p_instance))),
                    gobject.signalLookup("toggled", CheckButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkCheckButton`.
    extern fn gtk_check_button_new() *gtk.CheckButton;
    pub const new = gtk_check_button_new;

    /// Creates a new `GtkCheckButton` with the given text.
    extern fn gtk_check_button_new_with_label(p_label: ?[*:0]const u8) *gtk.CheckButton;
    pub const newWithLabel = gtk_check_button_new_with_label;

    /// Creates a new `GtkCheckButton` with the given text and a mnemonic.
    extern fn gtk_check_button_new_with_mnemonic(p_label: ?[*:0]const u8) *gtk.CheckButton;
    pub const newWithMnemonic = gtk_check_button_new_with_mnemonic;

    /// Returns whether the check button is active.
    extern fn gtk_check_button_get_active(p_self: *CheckButton) c_int;
    pub const getActive = gtk_check_button_get_active;

    /// Gets the child widget of `button` or `NULL` if `CheckButton.properties.label` is set.
    extern fn gtk_check_button_get_child(p_button: *CheckButton) ?*gtk.Widget;
    pub const getChild = gtk_check_button_get_child;

    /// Returns whether the check button is in an inconsistent state.
    extern fn gtk_check_button_get_inconsistent(p_check_button: *CheckButton) c_int;
    pub const getInconsistent = gtk_check_button_get_inconsistent;

    /// Returns the label of the check button or `NULL` if `CheckButton.properties.child` is set.
    extern fn gtk_check_button_get_label(p_self: *CheckButton) ?[*:0]const u8;
    pub const getLabel = gtk_check_button_get_label;

    /// Returns whether underlines in the label indicate mnemonics.
    extern fn gtk_check_button_get_use_underline(p_self: *CheckButton) c_int;
    pub const getUseUnderline = gtk_check_button_get_use_underline;

    /// Changes the check buttons active state.
    extern fn gtk_check_button_set_active(p_self: *CheckButton, p_setting: c_int) void;
    pub const setActive = gtk_check_button_set_active;

    /// Sets the child widget of `button`.
    ///
    /// Note that by using this API, you take full responsibility for setting
    /// up the proper accessibility label and description information for `button`.
    /// Most likely, you'll either set the accessibility label or description
    /// for `button` explicitly, or you'll set a labelled-by or described-by
    /// relations from `child` to `button`.
    extern fn gtk_check_button_set_child(p_button: *CheckButton, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_check_button_set_child;

    /// Adds `self` to the group of `group`.
    ///
    /// In a group of multiple check buttons, only one button can be active
    /// at a time. The behavior of a checkbutton in a group is also commonly
    /// known as a *radio button*.
    ///
    /// Setting the group of a check button also changes the css name of the
    /// indicator widget's CSS node to 'radio'.
    ///
    /// Setting up groups in a cycle leads to undefined behavior.
    ///
    /// Note that the same effect can be achieved via the `gtk.Actionable`
    /// API, by using the same action with parameter type and state type 's'
    /// for all buttons in the group, and giving each button its own target
    /// value.
    extern fn gtk_check_button_set_group(p_self: *CheckButton, p_group: ?*gtk.CheckButton) void;
    pub const setGroup = gtk_check_button_set_group;

    /// Sets the `GtkCheckButton` to inconsistent state.
    ///
    /// You should turn off the inconsistent state again if the user checks
    /// the check button. This has to be done manually.
    extern fn gtk_check_button_set_inconsistent(p_check_button: *CheckButton, p_inconsistent: c_int) void;
    pub const setInconsistent = gtk_check_button_set_inconsistent;

    /// Sets the text of `self`.
    ///
    /// If `gtk.CheckButton.properties.use_underline` is `TRUE`, an underscore
    /// in `label` is interpreted as mnemonic indicator, see
    /// `gtk.CheckButton.setUseUnderline` for details on this behavior.
    extern fn gtk_check_button_set_label(p_self: *CheckButton, p_label: ?[*:0]const u8) void;
    pub const setLabel = gtk_check_button_set_label;

    /// Sets whether underlines in the label indicate mnemonics.
    ///
    /// If `setting` is `TRUE`, an underscore character in `self`'s label
    /// indicates a mnemonic accelerator key. This behavior is similar
    /// to `gtk.Label.properties.use_underline`.
    extern fn gtk_check_button_set_use_underline(p_self: *CheckButton, p_setting: c_int) void;
    pub const setUseUnderline = gtk_check_button_set_use_underline;

    extern fn gtk_check_button_get_type() usize;
    pub const getGObjectType = gtk_check_button_get_type;

    extern fn g_object_ref(p_self: *gtk.CheckButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CheckButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CheckButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An expression using a custom `GClosure` to compute the value from
/// its parameters.
pub const ClosureExpression = opaque {
    pub const Parent = gtk.Expression;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = ClosureExpression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a `GtkExpression` that calls `closure` when it is evaluated.
    ///
    /// `closure` is called with the `this` object and the results of evaluating
    /// the `params` expressions.
    extern fn gtk_closure_expression_new(p_value_type: usize, p_closure: *gobject.Closure, p_n_params: c_uint, p_params: ?[*]*gtk.Expression) *gtk.ClosureExpression;
    pub const new = gtk_closure_expression_new;

    extern fn gtk_closure_expression_get_type() usize;
    pub const getGObjectType = gtk_closure_expression_get_type;

    pub fn as(p_instance: *ClosureExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkColorButton` allows to open a color chooser dialog to change
/// the color.
///
/// <picture>
///   <source srcset="color-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkColorButton" src="color-button.png">
/// </picture>
///
/// It is suitable widget for selecting a color in a preference dialog.
///
/// # CSS nodes
///
/// ```
/// colorbutton
/// ╰── button.color
///     ╰── [content]
/// ```
///
/// `GtkColorButton` has a single CSS node with name colorbutton which
/// contains a button node. To differentiate it from a plain `GtkButton`,
/// it gets the .color style class.
pub const ColorButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ColorChooser, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = ColorButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the color chooser dialog should be modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// Whether the color chooser should open in editor mode.
        ///
        /// This property should be used in cases where the palette
        /// in the editor would be redundant, such as when the color
        /// button is already part of a palette.
        pub const show_editor = struct {
            pub const name = "show-editor";

            pub const Type = c_int;
        };

        /// The title of the color chooser dialog
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted to when the color button is activated.
        ///
        /// The `::activate` signal on `GtkMenuButton` is an action signal and
        /// emitting it causes the button to pop up its dialog.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ColorButton, p_instance))),
                    gobject.signalLookup("activate", ColorButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user selects a color.
        ///
        /// When handling this signal, use `gtk.ColorChooser.getRgba`
        /// to find out which color was just selected.
        ///
        /// Note that this signal is only emitted when the user changes the color.
        /// If you need to react to programmatic color changes as well, use
        /// the notify::rgba signal.
        pub const color_set = struct {
            pub const name = "color-set";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ColorButton, p_instance))),
                    gobject.signalLookup("color-set", ColorButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new color button.
    ///
    /// This returns a widget in the form of a small button containing
    /// a swatch representing the current selected color. When the button
    /// is clicked, a color chooser dialog will open, allowing the user
    /// to select a color. The swatch will be updated to reflect the new
    /// color when the user finishes.
    extern fn gtk_color_button_new() *gtk.ColorButton;
    pub const new = gtk_color_button_new;

    /// Creates a new color button showing the given color.
    extern fn gtk_color_button_new_with_rgba(p_rgba: *const gdk.RGBA) *gtk.ColorButton;
    pub const newWithRgba = gtk_color_button_new_with_rgba;

    /// Gets whether the dialog is modal.
    extern fn gtk_color_button_get_modal(p_button: *ColorButton) c_int;
    pub const getModal = gtk_color_button_get_modal;

    /// Gets the title of the color chooser dialog.
    extern fn gtk_color_button_get_title(p_button: *ColorButton) [*:0]const u8;
    pub const getTitle = gtk_color_button_get_title;

    /// Sets whether the dialog should be modal.
    extern fn gtk_color_button_set_modal(p_button: *ColorButton, p_modal: c_int) void;
    pub const setModal = gtk_color_button_set_modal;

    /// Sets the title for the color chooser dialog.
    extern fn gtk_color_button_set_title(p_button: *ColorButton, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_color_button_set_title;

    extern fn gtk_color_button_get_type() usize;
    pub const getGObjectType = gtk_color_button_get_type;

    extern fn g_object_ref(p_self: *gtk.ColorButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColorButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColorButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A dialog for choosing a color.
///
/// <picture>
///   <source srcset="colorchooser-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkColorChooserDialog" src="colorchooser.png">
/// </picture>
///
/// `GtkColorChooserDialog` implements the `gtk.ColorChooser` interface
/// and does not provide much API of its own.
///
/// To create a `GtkColorChooserDialog`, use `gtk.ColorChooserDialog.new`.
///
/// To change the initially selected color, use
/// `gtk.ColorChooser.setRgba`. To get the selected color use
/// `gtk.ColorChooser.getRgba`.
///
/// `GtkColorChooserDialog` has been deprecated in favor of `gtk.ColorDialog`.
///
/// ## CSS nodes
///
/// `GtkColorChooserDialog` has a single CSS node with the name `window` and style
/// class `.colorchooser`.
pub const ColorChooserDialog = opaque {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ColorChooser, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = ColorChooserDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the color chooser dialog is showing the single-color editor.
        ///
        /// It can be set to switch the color chooser into single-color editing mode.
        pub const show_editor = struct {
            pub const name = "show-editor";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkColorChooserDialog`.
    extern fn gtk_color_chooser_dialog_new(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window) *gtk.ColorChooserDialog;
    pub const new = gtk_color_chooser_dialog_new;

    extern fn gtk_color_chooser_dialog_get_type() usize;
    pub const getGObjectType = gtk_color_chooser_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.ColorChooserDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColorChooserDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColorChooserDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkColorChooserWidget` widget lets the user select a color.
///
/// By default, the chooser presents a predefined palette of colors,
/// plus a small number of settable custom colors. It is also possible
/// to select a different color with the single-color editor.
///
/// To enter the single-color editing mode, use the context menu of any
/// color of the palette, or use the '+' button to add a new custom color.
///
/// The chooser automatically remembers the last selection, as well
/// as custom colors.
///
/// To create a `GtkColorChooserWidget`, use `gtk.ColorChooserWidget.new`.
///
/// To change the initially selected color, use
/// `gtk.ColorChooser.setRgba`. To get the selected color use
/// `gtk.ColorChooser.getRgba`.
///
/// The `GtkColorChooserWidget` is used in the `gtk.ColorChooserDialog`
/// to provide a dialog for selecting colors.
///
/// # Actions
///
/// `GtkColorChooserWidget` defines a set of built-in actions:
///
/// - `color.customize` activates the color editor for the given color.
/// - `color.select` emits the `gtk.ColorChooser.signals.color_activated` signal
///   for the given color.
///
/// # CSS names
///
/// `GtkColorChooserWidget` has a single CSS node with name colorchooser.
pub const ColorChooserWidget = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ColorChooser, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = ColorChooserWidget;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// `TRUE` when the color chooser is showing the single-color editor.
        ///
        /// It can be set to switch the color chooser into single-color editing mode.
        pub const show_editor = struct {
            pub const name = "show-editor";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkColorChooserWidget`.
    extern fn gtk_color_chooser_widget_new() *gtk.ColorChooserWidget;
    pub const new = gtk_color_chooser_widget_new;

    extern fn gtk_color_chooser_widget_get_type() usize;
    pub const getGObjectType = gtk_color_chooser_widget_get_type;

    extern fn g_object_ref(p_self: *gtk.ColorChooserWidget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColorChooserWidget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColorChooserWidget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asynchronous API to present a color chooser dialog.
///
/// `GtkColorDialog` collects the arguments that are needed to present
/// the dialog to the user, such as a title for the dialog and whether
/// it should be modal.
///
/// The dialog is shown with the `gtk.ColorDialog.chooseRgba`
/// function.
///
/// See `gtk.ColorDialogButton` for a convenient control
/// that uses `GtkColorDialog` and presents the results.
pub const ColorDialog = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ColorDialogClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the color chooser dialog is modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// A title that may be shown on the color chooser dialog.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// Whether colors may have alpha (translucency).
        ///
        /// When with-alpha is false, the color that is selected
        /// will be forced to have alpha == 1.
        pub const with_alpha = struct {
            pub const name = "with-alpha";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkColorDialog` object.
    extern fn gtk_color_dialog_new() *gtk.ColorDialog;
    pub const new = gtk_color_dialog_new;

    /// Presents a color chooser dialog to the user.
    extern fn gtk_color_dialog_choose_rgba(p_self: *ColorDialog, p_parent: ?*gtk.Window, p_initial_color: ?*const gdk.RGBA, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const chooseRgba = gtk_color_dialog_choose_rgba;

    /// Finishes the `gtk.ColorDialog.chooseRgba` call
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_color_dialog_choose_rgba_finish(p_self: *ColorDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gdk.RGBA;
    pub const chooseRgbaFinish = gtk_color_dialog_choose_rgba_finish;

    /// Returns whether the color chooser dialog
    /// blocks interaction with the parent window
    /// while it is presented.
    extern fn gtk_color_dialog_get_modal(p_self: *ColorDialog) c_int;
    pub const getModal = gtk_color_dialog_get_modal;

    /// Returns the title that will be shown on the
    /// color chooser dialog.
    extern fn gtk_color_dialog_get_title(p_self: *ColorDialog) [*:0]const u8;
    pub const getTitle = gtk_color_dialog_get_title;

    /// Returns whether colors may have alpha.
    extern fn gtk_color_dialog_get_with_alpha(p_self: *ColorDialog) c_int;
    pub const getWithAlpha = gtk_color_dialog_get_with_alpha;

    /// Sets whether the color chooser dialog
    /// blocks interaction with the parent window
    /// while it is presented.
    extern fn gtk_color_dialog_set_modal(p_self: *ColorDialog, p_modal: c_int) void;
    pub const setModal = gtk_color_dialog_set_modal;

    /// Sets the title that will be shown on the
    /// color chooser dialog.
    extern fn gtk_color_dialog_set_title(p_self: *ColorDialog, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_color_dialog_set_title;

    /// Sets whether colors may have alpha.
    extern fn gtk_color_dialog_set_with_alpha(p_self: *ColorDialog, p_with_alpha: c_int) void;
    pub const setWithAlpha = gtk_color_dialog_set_with_alpha;

    extern fn gtk_color_dialog_get_type() usize;
    pub const getGObjectType = gtk_color_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.ColorDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColorDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColorDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Opens a color chooser dialog to select a color.
///
/// <picture>
///   <source srcset="color-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkColorDialogButton" src="color-button.png">
/// </picture>
///
/// It is suitable widget for selecting a color in a preference dialog.
///
/// # CSS nodes
///
/// ```
/// colorbutton
/// ╰── button.color
///     ╰── [content]
/// ```
///
/// `GtkColorDialogButton` has a single CSS node with name colorbutton which
/// contains a button node. To differentiate it from a plain `GtkButton`,
/// it gets the .color style class.
pub const ColorDialogButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.ColorDialogButtonClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkColorDialog` that contains parameters for
        /// the color chooser dialog.
        pub const dialog = struct {
            pub const name = "dialog";

            pub const Type = ?*gtk.ColorDialog;
        };

        /// The selected color.
        ///
        /// This property can be set to give the button its initial
        /// color, and it will be updated to reflect the users choice
        /// in the color chooser dialog.
        ///
        /// Listen to `notify::rgba` to get informed about changes
        /// to the buttons color.
        pub const rgba = struct {
            pub const name = "rgba";

            pub const Type = ?*gdk.RGBA;
        };
    };

    pub const signals = struct {
        /// Emitted when the color dialog button is activated.
        ///
        /// The `::activate` signal on `GtkColorDialogButton` is an action signal
        /// and emitting it causes the button to pop up its dialog.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ColorDialogButton, p_instance))),
                    gobject.signalLookup("activate", ColorDialogButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkColorDialogButton` with the
    /// given `GtkColorDialog`.
    ///
    /// You can pass `NULL` to this function and set a `GtkColorDialog`
    /// later. The button will be insensitive until that happens.
    extern fn gtk_color_dialog_button_new(p_dialog: ?*gtk.ColorDialog) *gtk.ColorDialogButton;
    pub const new = gtk_color_dialog_button_new;

    /// Returns the `GtkColorDialog` of `self`.
    extern fn gtk_color_dialog_button_get_dialog(p_self: *ColorDialogButton) ?*gtk.ColorDialog;
    pub const getDialog = gtk_color_dialog_button_get_dialog;

    /// Returns the color of the button.
    ///
    /// This function is what should be used to obtain
    /// the color that was chosen by the user. To get
    /// informed about changes, listen to "notify::rgba".
    extern fn gtk_color_dialog_button_get_rgba(p_self: *ColorDialogButton) *const gdk.RGBA;
    pub const getRgba = gtk_color_dialog_button_get_rgba;

    /// Sets a `GtkColorDialog` object to use for
    /// creating the color chooser dialog that is
    /// presented when the user clicks the button.
    extern fn gtk_color_dialog_button_set_dialog(p_self: *ColorDialogButton, p_dialog: *gtk.ColorDialog) void;
    pub const setDialog = gtk_color_dialog_button_set_dialog;

    /// Sets the color of the button.
    extern fn gtk_color_dialog_button_set_rgba(p_self: *ColorDialogButton, p_color: *const gdk.RGBA) void;
    pub const setRgba = gtk_color_dialog_button_set_rgba;

    extern fn gtk_color_dialog_button_get_type() usize;
    pub const getGObjectType = gtk_color_dialog_button_get_type;

    extern fn g_object_ref(p_self: *gtk.ColorDialogButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColorDialogButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColorDialogButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents a large dynamic list of items using multiple columns with headers.
///
/// `GtkColumnView` uses the factories of its columns to generate a cell widget for
/// each column, for each visible item and displays them together as the row for
/// this item.
///
/// The `gtk.ColumnView.properties.show_row_separators` and
/// `gtk.ColumnView.properties.show_column_separators` properties offer a simple way
/// to display separators between the rows or columns.
///
/// `GtkColumnView` allows the user to select items according to the selection
/// characteristics of the model. For models that allow multiple selected items,
/// it is possible to turn on *rubberband selection*, using
/// `gtk.ColumnView.properties.enable_rubberband`.
///
/// The column view supports sorting that can be customized by the user by
/// clicking on column headers. To set this up, the `GtkSorter` returned by
/// `gtk.ColumnView.getSorter` must be attached to a sort model for the
/// data that the view is showing, and the columns must have sorters attached to
/// them by calling `gtk.ColumnViewColumn.setSorter`. The initial sort
/// order can be set with `gtk.ColumnView.sortByColumn`.
///
/// The column view also supports interactive resizing and reordering of
/// columns, via Drag-and-Drop of the column headers. This can be enabled or
/// disabled with the `gtk.ColumnView.properties.reorderable` and
/// `gtk.ColumnViewColumn.properties.resizable` properties.
///
/// To learn more about the list widget framework, see the
/// [overview](section-list-widget.html).
///
/// # CSS nodes
///
/// ```
/// columnview[.column-separators][.rich-list][.navigation-sidebar][.data-table]
/// ├── header
/// │   ├── <column header>
/// ┊   ┊
/// │   ╰── <column header>
/// │
/// ├── listview
/// │
/// ┊
/// ╰── [rubberband]
/// ```
///
/// `GtkColumnView` uses a single CSS node named columnview. It may carry the
/// .column-separators style class, when `gtk.ColumnView.properties.show_column_separators`
/// property is set. Header widgets appear below a node with name header.
/// The rows are contained in a `GtkListView` widget, so there is a listview
/// node with the same structure as for a standalone `GtkListView` widget.
/// If `gtk.ColumnView.properties.show_row_separators` is set, it will be passed
/// on to the list view, causing its CSS node to carry the .separators style class.
/// For rubberband selection, a node with name rubberband is used.
///
/// The main columnview node may also carry style classes to select
/// the style of [list presentation](section-list-widget.html`list`-styles):
/// .rich-list, .navigation-sidebar or .data-table.
///
/// # Accessibility
///
/// `GtkColumnView` uses the `gtk.@"AccessibleRole.tree_grid"` role, header title
/// widgets are using the `gtk.@"AccessibleRole.column_header"` role. The row widgets
/// are using the `gtk.@"AccessibleRole.row"` role, and individual cells are using
/// the `gtk.@"AccessibleRole.grid_cell"` role
pub const ColumnView = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Scrollable };
    pub const Class = gtk.ColumnViewClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The list of columns.
        pub const columns = struct {
            pub const name = "columns";

            pub const Type = ?*gio.ListModel;
        };

        /// Allow rubberband selection.
        pub const enable_rubberband = struct {
            pub const name = "enable-rubberband";

            pub const Type = c_int;
        };

        /// Factory for creating header widgets.
        ///
        /// The factory must be for configuring `gtk.ListHeader` objects.
        pub const header_factory = struct {
            pub const name = "header-factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// Model for the items displayed.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.SelectionModel;
        };

        /// Whether columns are reorderable.
        pub const reorderable = struct {
            pub const name = "reorderable";

            pub const Type = c_int;
        };

        /// The factory used for configuring rows.
        ///
        /// The factory must be for configuring `gtk.ColumnViewRow` objects.
        pub const row_factory = struct {
            pub const name = "row-factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// Show separators between columns.
        pub const show_column_separators = struct {
            pub const name = "show-column-separators";

            pub const Type = c_int;
        };

        /// Show separators between rows.
        pub const show_row_separators = struct {
            pub const name = "show-row-separators";

            pub const Type = c_int;
        };

        /// Activate rows on single click and select them on hover.
        pub const single_click_activate = struct {
            pub const name = "single-click-activate";

            pub const Type = c_int;
        };

        /// Sorter with the sorting choices of the user.
        pub const sorter = struct {
            pub const name = "sorter";

            pub const Type = ?*gtk.Sorter;
        };

        /// Behavior of the <kbd>Tab</kbd> key
        pub const tab_behavior = struct {
            pub const name = "tab-behavior";

            pub const Type = gtk.ListTabBehavior;
        };
    };

    pub const signals = struct {
        /// Emitted when a row has been activated by the user, usually via activating
        /// the GtkListBase|list.activate-item action.
        ///
        /// This allows for a convenient way to handle activation in a columnview.
        /// See `gtk.ListItem.setActivatable` for details on how to use this
        /// signal.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ColumnView, p_instance))),
                    gobject.signalLookup("activate", ColumnView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkColumnView`.
    ///
    /// You most likely want to call `gtk.ColumnView.appendColumn`
    /// to add columns next.
    extern fn gtk_column_view_new(p_model: ?*gtk.SelectionModel) *gtk.ColumnView;
    pub const new = gtk_column_view_new;

    /// Appends the `column` to the end of the columns in `self`.
    extern fn gtk_column_view_append_column(p_self: *ColumnView, p_column: *gtk.ColumnViewColumn) void;
    pub const appendColumn = gtk_column_view_append_column;

    /// Gets the list of columns in this column view.
    ///
    /// This list is constant over the lifetime of `self` and can be used to
    /// monitor changes to the columns of `self` by connecting to the
    /// `gio.ListModel.signals.items_changed` signal.
    extern fn gtk_column_view_get_columns(p_self: *ColumnView) *gio.ListModel;
    pub const getColumns = gtk_column_view_get_columns;

    /// Returns whether rows can be selected by dragging with the mouse.
    extern fn gtk_column_view_get_enable_rubberband(p_self: *ColumnView) c_int;
    pub const getEnableRubberband = gtk_column_view_get_enable_rubberband;

    /// Gets the factory that's currently used to populate section headers.
    extern fn gtk_column_view_get_header_factory(p_self: *ColumnView) ?*gtk.ListItemFactory;
    pub const getHeaderFactory = gtk_column_view_get_header_factory;

    /// Gets the model that's currently used to read the items displayed.
    extern fn gtk_column_view_get_model(p_self: *ColumnView) ?*gtk.SelectionModel;
    pub const getModel = gtk_column_view_get_model;

    /// Returns whether columns are reorderable.
    extern fn gtk_column_view_get_reorderable(p_self: *ColumnView) c_int;
    pub const getReorderable = gtk_column_view_get_reorderable;

    /// Gets the factory set via `gtk.ColumnView.setRowFactory`.
    extern fn gtk_column_view_get_row_factory(p_self: *ColumnView) ?*gtk.ListItemFactory;
    pub const getRowFactory = gtk_column_view_get_row_factory;

    /// Returns whether the list should show separators between columns.
    extern fn gtk_column_view_get_show_column_separators(p_self: *ColumnView) c_int;
    pub const getShowColumnSeparators = gtk_column_view_get_show_column_separators;

    /// Returns whether the list should show separators between rows.
    extern fn gtk_column_view_get_show_row_separators(p_self: *ColumnView) c_int;
    pub const getShowRowSeparators = gtk_column_view_get_show_row_separators;

    /// Returns whether rows will be activated on single click and
    /// selected on hover.
    extern fn gtk_column_view_get_single_click_activate(p_self: *ColumnView) c_int;
    pub const getSingleClickActivate = gtk_column_view_get_single_click_activate;

    /// Returns a special sorter that reflects the users sorting
    /// choices in the column view.
    ///
    /// To allow users to customizable sorting by clicking on column
    /// headers, this sorter needs to be set on the sort model underneath
    /// the model that is displayed by the view.
    ///
    /// See `gtk.ColumnViewColumn.setSorter` for setting up
    /// per-column sorting.
    ///
    /// Here is an example:
    /// ```c
    /// gtk_column_view_column_set_sorter (column, sorter);
    /// gtk_column_view_append_column (view, column);
    /// sorter = g_object_ref (gtk_column_view_get_sorter (view)));
    /// model = gtk_sort_list_model_new (store, sorter);
    /// selection = gtk_no_selection_new (model);
    /// gtk_column_view_set_model (view, selection);
    /// ```
    extern fn gtk_column_view_get_sorter(p_self: *ColumnView) ?*gtk.Sorter;
    pub const getSorter = gtk_column_view_get_sorter;

    /// Gets the behavior set for the <kbd>Tab</kbd> key.
    extern fn gtk_column_view_get_tab_behavior(p_self: *ColumnView) gtk.ListTabBehavior;
    pub const getTabBehavior = gtk_column_view_get_tab_behavior;

    /// Inserts a column at the given position in the columns of `self`.
    ///
    /// If `column` is already a column of `self`, it will be repositioned.
    extern fn gtk_column_view_insert_column(p_self: *ColumnView, p_position: c_uint, p_column: *gtk.ColumnViewColumn) void;
    pub const insertColumn = gtk_column_view_insert_column;

    /// Removes the `column` from the list of columns of `self`.
    extern fn gtk_column_view_remove_column(p_self: *ColumnView, p_column: *gtk.ColumnViewColumn) void;
    pub const removeColumn = gtk_column_view_remove_column;

    /// Scroll to the row at the given position - or cell if a column is
    /// given - and performs the actions specified in `flags`.
    ///
    /// This function works no matter if the columnview is shown or focused.
    /// If it isn't, then the changes will take effect once that happens.
    extern fn gtk_column_view_scroll_to(p_self: *ColumnView, p_pos: c_uint, p_column: ?*gtk.ColumnViewColumn, p_flags: gtk.ListScrollFlags, p_scroll: ?*gtk.ScrollInfo) void;
    pub const scrollTo = gtk_column_view_scroll_to;

    /// Sets whether selections can be changed by dragging with the mouse.
    extern fn gtk_column_view_set_enable_rubberband(p_self: *ColumnView, p_enable_rubberband: c_int) void;
    pub const setEnableRubberband = gtk_column_view_set_enable_rubberband;

    /// Sets the factory to use for populating the
    /// `gtk.ListHeader` objects used in section headers.
    ///
    /// If this factory is set to `NULL`, the list will not show
    /// section headers.
    extern fn gtk_column_view_set_header_factory(p_self: *ColumnView, p_factory: ?*gtk.ListItemFactory) void;
    pub const setHeaderFactory = gtk_column_view_set_header_factory;

    /// Sets the model to use.
    ///
    /// This must be a `gtk.SelectionModel`.
    extern fn gtk_column_view_set_model(p_self: *ColumnView, p_model: ?*gtk.SelectionModel) void;
    pub const setModel = gtk_column_view_set_model;

    /// Sets whether columns should be reorderable by dragging.
    extern fn gtk_column_view_set_reorderable(p_self: *ColumnView, p_reorderable: c_int) void;
    pub const setReorderable = gtk_column_view_set_reorderable;

    /// Sets the factory used for configuring rows.
    ///
    /// The factory must be for configuring `gtk.ColumnViewRow` objects.
    ///
    /// If this factory is not set - which is the default - then the defaults
    /// will be used.
    ///
    /// This factory is not used to set the widgets displayed in the individual
    /// cells. For that see `GtkColumnViewColumn.setFactory` and
    /// `GtkColumnViewCell`.
    extern fn gtk_column_view_set_row_factory(p_self: *ColumnView, p_factory: ?*gtk.ListItemFactory) void;
    pub const setRowFactory = gtk_column_view_set_row_factory;

    /// Sets whether the list should show separators between columns.
    extern fn gtk_column_view_set_show_column_separators(p_self: *ColumnView, p_show_column_separators: c_int) void;
    pub const setShowColumnSeparators = gtk_column_view_set_show_column_separators;

    /// Sets whether the list should show separators between rows.
    extern fn gtk_column_view_set_show_row_separators(p_self: *ColumnView, p_show_row_separators: c_int) void;
    pub const setShowRowSeparators = gtk_column_view_set_show_row_separators;

    /// Sets whether rows should be activated on single click and
    /// selected on hover.
    extern fn gtk_column_view_set_single_click_activate(p_self: *ColumnView, p_single_click_activate: c_int) void;
    pub const setSingleClickActivate = gtk_column_view_set_single_click_activate;

    /// Sets the <kbd>Tab</kbd> key behavior.
    ///
    /// This influences how the <kbd>Tab</kbd> and
    /// <kbd>Shift</kbd>+<kbd>Tab</kbd> keys move the
    /// focus in the columnview.
    extern fn gtk_column_view_set_tab_behavior(p_self: *ColumnView, p_tab_behavior: gtk.ListTabBehavior) void;
    pub const setTabBehavior = gtk_column_view_set_tab_behavior;

    /// Sets the sorting of the view.
    ///
    /// This function should be used to set up the initial sorting.
    /// At runtime, users can change the sorting of a column view
    /// by clicking on the list headers.
    ///
    /// This call only has an effect if the sorter returned by
    /// `gtk.ColumnView.getSorter` is set on a sort model,
    /// and `gtk.ColumnViewColumn.setSorter` has been called
    /// on `column` to associate a sorter with the column.
    ///
    /// If `column` is unset, the view will be unsorted.
    extern fn gtk_column_view_sort_by_column(p_self: *ColumnView, p_column: ?*gtk.ColumnViewColumn, p_direction: gtk.SortType) void;
    pub const sortByColumn = gtk_column_view_sort_by_column;

    extern fn gtk_column_view_get_type() usize;
    pub const getGObjectType = gtk_column_view_get_type;

    extern fn g_object_ref(p_self: *gtk.ColumnView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColumnView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColumnView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents items in a cell in `gtk.ColumnView`.
///
/// The `GtkColumnViewCell`s are managed by the `gtk.ColumnView`
/// widget (with its factory) and cannot be created by applications, but
/// they need to be populated by application code. This is done by calling
/// `gtk.ColumnViewCell.setChild`.
///
/// `GtkColumnViewCell`s exist in 2 stages:
///
/// 1. The unbound stage where the listitem is not currently connected to
///    an item in the list. In that case, the `gtk.ColumnViewCell.properties.item`
///    property is set to `NULL`.
///
/// 2. The bound stage where the listitem references an item from the list.
///    The `gtk.ColumnViewCell.properties.item` property is not `NULL`.
pub const ColumnViewCell = opaque {
    pub const Parent = gtk.ListItem;
    pub const Implements = [_]type{};
    pub const Class = gtk.ColumnViewCellClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Widget used for display.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// If the item can be focused with the keyboard.
        pub const focusable = struct {
            pub const name = "focusable";

            pub const Type = c_int;
        };

        /// Displayed item.
        pub const item = struct {
            pub const name = "item";

            pub const Type = ?*gobject.Object;
        };

        /// Position of the item.
        pub const position = struct {
            pub const name = "position";

            pub const Type = c_uint;
        };

        /// If the item is currently selected.
        pub const selected = struct {
            pub const name = "selected";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Gets the child previously set via `gtk.ColumnViewCell.setChild` or
    /// `NULL` if none was set.
    extern fn gtk_column_view_cell_get_child(p_self: *ColumnViewCell) ?*gtk.Widget;
    pub const getChild = gtk_column_view_cell_get_child;

    /// Checks if a list item has been set to be focusable via
    /// `gtk.ColumnViewCell.setFocusable`.
    extern fn gtk_column_view_cell_get_focusable(p_self: *ColumnViewCell) c_int;
    pub const getFocusable = gtk_column_view_cell_get_focusable;

    /// Gets the model item that associated with `self`.
    ///
    /// If `self` is unbound, this function returns `NULL`.
    extern fn gtk_column_view_cell_get_item(p_self: *ColumnViewCell) ?*gobject.Object;
    pub const getItem = gtk_column_view_cell_get_item;

    /// Gets the position in the model that `self` currently displays.
    ///
    /// If `self` is unbound, `GTK_INVALID_LIST_POSITION` is returned.
    extern fn gtk_column_view_cell_get_position(p_self: *ColumnViewCell) c_uint;
    pub const getPosition = gtk_column_view_cell_get_position;

    /// Checks if the item is displayed as selected.
    ///
    /// The selected state is maintained by the list widget and its model
    /// and cannot be set otherwise.
    extern fn gtk_column_view_cell_get_selected(p_self: *ColumnViewCell) c_int;
    pub const getSelected = gtk_column_view_cell_get_selected;

    /// Sets the child to be used for this listitem.
    ///
    /// This function is typically called by applications when
    /// setting up a listitem so that the widget can be reused when
    /// binding it multiple times.
    extern fn gtk_column_view_cell_set_child(p_self: *ColumnViewCell, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_column_view_cell_set_child;

    /// Sets `self` to be focusable.
    ///
    /// If an item is focusable, it can be focused using the keyboard.
    /// This works similar to `gtk.Widget.setFocusable`.
    ///
    /// Note that if items are not focusable, the keyboard cannot be used to activate
    /// them and selecting only works if one of the listitem's children is focusable.
    ///
    /// By default, list items are focusable.
    extern fn gtk_column_view_cell_set_focusable(p_self: *ColumnViewCell, p_focusable: c_int) void;
    pub const setFocusable = gtk_column_view_cell_set_focusable;

    extern fn gtk_column_view_cell_get_type() usize;
    pub const getGObjectType = gtk_column_view_cell_get_type;

    extern fn g_object_ref(p_self: *gtk.ColumnViewCell) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColumnViewCell) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColumnViewCell, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents the columns in a `GtkColumnView`.
///
/// The main ingredient for a `GtkColumnViewColumn` is the `GtkListItemFactory`
/// that tells the columnview how to create cells for this column from items in
/// the model.
///
/// Columns have a title, and can optionally have a header menu set
/// with `gtk.ColumnViewColumn.setHeaderMenu`.
///
/// A sorter can be associated with a column using
/// `gtk.ColumnViewColumn.setSorter`, to let users influence sorting
/// by clicking on the column header.
pub const ColumnViewColumn = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ColumnViewColumnClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkColumnView` this column is a part of.
        pub const column_view = struct {
            pub const name = "column-view";

            pub const Type = ?*gtk.ColumnView;
        };

        /// Column gets share of extra width allocated to the view.
        pub const expand = struct {
            pub const name = "expand";

            pub const Type = c_int;
        };

        /// Factory for populating list items.
        ///
        /// The factory must be for configuring `gtk.ColumnViewCell` objects.
        pub const factory = struct {
            pub const name = "factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// If not -1, this is the width that the column is allocated,
        /// regardless of the size of its content.
        pub const fixed_width = struct {
            pub const name = "fixed-width";

            pub const Type = c_int;
        };

        /// Menu model used to create the context menu for the column header.
        pub const header_menu = struct {
            pub const name = "header-menu";

            pub const Type = ?*gio.MenuModel;
        };

        /// An ID for the column.
        ///
        /// GTK is not currently using the ID for anything, but
        /// it can be used by applications when saving column view
        /// configurations.
        ///
        /// It is up to applications to ensure uniqueness of IDs.
        pub const id = struct {
            pub const name = "id";

            pub const Type = ?[*:0]u8;
        };

        /// Whether this column is resizable.
        pub const resizable = struct {
            pub const name = "resizable";

            pub const Type = c_int;
        };

        /// Sorter for sorting items according to this column.
        pub const sorter = struct {
            pub const name = "sorter";

            pub const Type = ?*gtk.Sorter;
        };

        /// Title displayed in the header.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// Whether this column is visible.
        pub const visible = struct {
            pub const name = "visible";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkColumnViewColumn` that uses the given `factory` for
    /// mapping items to widgets.
    ///
    /// You most likely want to call `gtk.ColumnView.appendColumn` next.
    ///
    /// The function takes ownership of the argument, so you can write code like:
    ///
    /// ```c
    /// column = gtk_column_view_column_new (_("Name"),
    ///   gtk_builder_list_item_factory_new_from_resource ("/name.ui"));
    /// ```
    extern fn gtk_column_view_column_new(p_title: ?[*:0]const u8, p_factory: ?*gtk.ListItemFactory) *gtk.ColumnViewColumn;
    pub const new = gtk_column_view_column_new;

    /// Gets the column view that's currently displaying this column.
    ///
    /// If `self` has not been added to a column view yet, `NULL` is returned.
    extern fn gtk_column_view_column_get_column_view(p_self: *ColumnViewColumn) ?*gtk.ColumnView;
    pub const getColumnView = gtk_column_view_column_get_column_view;

    /// Returns whether this column should expand.
    extern fn gtk_column_view_column_get_expand(p_self: *ColumnViewColumn) c_int;
    pub const getExpand = gtk_column_view_column_get_expand;

    /// Gets the factory that's currently used to populate list items
    /// for this column.
    extern fn gtk_column_view_column_get_factory(p_self: *ColumnViewColumn) ?*gtk.ListItemFactory;
    pub const getFactory = gtk_column_view_column_get_factory;

    /// Gets the fixed width of the column.
    extern fn gtk_column_view_column_get_fixed_width(p_self: *ColumnViewColumn) c_int;
    pub const getFixedWidth = gtk_column_view_column_get_fixed_width;

    /// Gets the menu model that is used to create the context menu
    /// for the column header.
    extern fn gtk_column_view_column_get_header_menu(p_self: *ColumnViewColumn) ?*gio.MenuModel;
    pub const getHeaderMenu = gtk_column_view_column_get_header_menu;

    /// Returns the ID set with `gtk.ColumnViewColumn.setId`.
    extern fn gtk_column_view_column_get_id(p_self: *ColumnViewColumn) ?[*:0]const u8;
    pub const getId = gtk_column_view_column_get_id;

    /// Returns whether this column is resizable.
    extern fn gtk_column_view_column_get_resizable(p_self: *ColumnViewColumn) c_int;
    pub const getResizable = gtk_column_view_column_get_resizable;

    /// Returns the sorter that is associated with the column.
    extern fn gtk_column_view_column_get_sorter(p_self: *ColumnViewColumn) ?*gtk.Sorter;
    pub const getSorter = gtk_column_view_column_get_sorter;

    /// Returns the title set with `gtk.ColumnViewColumn.setTitle`.
    extern fn gtk_column_view_column_get_title(p_self: *ColumnViewColumn) ?[*:0]const u8;
    pub const getTitle = gtk_column_view_column_get_title;

    /// Returns whether this column is visible.
    extern fn gtk_column_view_column_get_visible(p_self: *ColumnViewColumn) c_int;
    pub const getVisible = gtk_column_view_column_get_visible;

    /// Sets the column to take available extra space.
    ///
    /// The extra space is shared equally amongst all columns that
    /// have are set to expand.
    extern fn gtk_column_view_column_set_expand(p_self: *ColumnViewColumn, p_expand: c_int) void;
    pub const setExpand = gtk_column_view_column_set_expand;

    /// Sets the `GtkListItemFactory` to use for populating list items
    /// for this column.
    extern fn gtk_column_view_column_set_factory(p_self: *ColumnViewColumn, p_factory: ?*gtk.ListItemFactory) void;
    pub const setFactory = gtk_column_view_column_set_factory;

    /// Sets the fixed width of the column.
    ///
    /// If `fixed_width` is -1, the fixed width of the column is unset.
    ///
    /// Setting a fixed width overrides the automatically calculated
    /// width. Interactive resizing also sets the “fixed-width” property.
    extern fn gtk_column_view_column_set_fixed_width(p_self: *ColumnViewColumn, p_fixed_width: c_int) void;
    pub const setFixedWidth = gtk_column_view_column_set_fixed_width;

    /// Sets the menu model that is used to create the context menu
    /// for the column header.
    extern fn gtk_column_view_column_set_header_menu(p_self: *ColumnViewColumn, p_menu: ?*gio.MenuModel) void;
    pub const setHeaderMenu = gtk_column_view_column_set_header_menu;

    /// Sets the id of this column.
    ///
    /// GTK makes no use of this, but applications can use it when
    /// storing column view configuration.
    ///
    /// It is up to callers to ensure uniqueness of IDs.
    extern fn gtk_column_view_column_set_id(p_self: *ColumnViewColumn, p_id: ?[*:0]const u8) void;
    pub const setId = gtk_column_view_column_set_id;

    /// Sets whether this column should be resizable by dragging.
    extern fn gtk_column_view_column_set_resizable(p_self: *ColumnViewColumn, p_resizable: c_int) void;
    pub const setResizable = gtk_column_view_column_set_resizable;

    /// Associates a sorter with the column.
    ///
    /// If `sorter` is unset, the column will not let users change
    /// the sorting by clicking on its header.
    ///
    /// This sorter can be made active by clicking on the column
    /// header, or by calling `gtk.ColumnView.sortByColumn`.
    ///
    /// See `gtk.ColumnView.getSorter` for the necessary steps
    /// for setting up customizable sorting for `gtk.ColumnView`.
    extern fn gtk_column_view_column_set_sorter(p_self: *ColumnViewColumn, p_sorter: ?*gtk.Sorter) void;
    pub const setSorter = gtk_column_view_column_set_sorter;

    /// Sets the title of this column.
    ///
    /// The title is displayed in the header of a `GtkColumnView`
    /// for this column and is therefore user-facing text that should
    /// be translated.
    extern fn gtk_column_view_column_set_title(p_self: *ColumnViewColumn, p_title: ?[*:0]const u8) void;
    pub const setTitle = gtk_column_view_column_set_title;

    /// Sets whether this column should be visible in views.
    extern fn gtk_column_view_column_set_visible(p_self: *ColumnViewColumn, p_visible: c_int) void;
    pub const setVisible = gtk_column_view_column_set_visible;

    extern fn gtk_column_view_column_get_type() usize;
    pub const getGObjectType = gtk_column_view_column_get_type;

    extern fn g_object_ref(p_self: *gtk.ColumnViewColumn) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColumnViewColumn) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColumnViewColumn, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Configures how rows are displayed in a `gtk.ColumnView`.
///
/// It is not used to set the widgets displayed in the individual cells. For that
/// see `GtkColumnViewColumn.setFactory` and `GtkColumnViewCell`.
pub const ColumnViewRow = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ColumnViewRowClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The accessible description to set on the row.
        pub const accessible_description = struct {
            pub const name = "accessible-description";

            pub const Type = ?[*:0]u8;
        };

        /// The accessible label to set on the row.
        pub const accessible_label = struct {
            pub const name = "accessible-label";

            pub const Type = ?[*:0]u8;
        };

        /// If the row can be activated by the user.
        pub const activatable = struct {
            pub const name = "activatable";

            pub const Type = c_int;
        };

        /// If the row can be focused with the keyboard.
        pub const focusable = struct {
            pub const name = "focusable";

            pub const Type = c_int;
        };

        /// The item for this row.
        pub const item = struct {
            pub const name = "item";

            pub const Type = ?*gobject.Object;
        };

        /// Position of the row.
        pub const position = struct {
            pub const name = "position";

            pub const Type = c_uint;
        };

        /// If the row can be selected by the user.
        pub const selectable = struct {
            pub const name = "selectable";

            pub const Type = c_int;
        };

        /// If the item in the row is currently selected.
        pub const selected = struct {
            pub const name = "selected";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Gets the accessible description of `self`.
    extern fn gtk_column_view_row_get_accessible_description(p_self: *ColumnViewRow) [*:0]const u8;
    pub const getAccessibleDescription = gtk_column_view_row_get_accessible_description;

    /// Gets the accessible label of `self`.
    extern fn gtk_column_view_row_get_accessible_label(p_self: *ColumnViewRow) [*:0]const u8;
    pub const getAccessibleLabel = gtk_column_view_row_get_accessible_label;

    /// Checks if the row has been set to be activatable via
    /// `gtk.ColumnViewRow.setActivatable`.
    extern fn gtk_column_view_row_get_activatable(p_self: *ColumnViewRow) c_int;
    pub const getActivatable = gtk_column_view_row_get_activatable;

    /// Checks if a row item has been set to be focusable via
    /// `gtk.ColumnViewRow.setFocusable`.
    extern fn gtk_column_view_row_get_focusable(p_self: *ColumnViewRow) c_int;
    pub const getFocusable = gtk_column_view_row_get_focusable;

    /// Gets the model item that associated with `self`.
    ///
    /// If `self` is unbound, this function returns `NULL`.
    extern fn gtk_column_view_row_get_item(p_self: *ColumnViewRow) ?*gobject.Object;
    pub const getItem = gtk_column_view_row_get_item;

    /// Gets the position in the model that `self` currently displays.
    ///
    /// If `self` is unbound, `GTK_INVALID_LIST_POSITION` is returned.
    extern fn gtk_column_view_row_get_position(p_self: *ColumnViewRow) c_uint;
    pub const getPosition = gtk_column_view_row_get_position;

    /// Checks if the row has been set to be selectable via
    /// `gtk.ColumnViewRow.setSelectable`.
    ///
    /// Do not confuse this function with `gtk.ColumnViewRow.getSelected`.
    extern fn gtk_column_view_row_get_selectable(p_self: *ColumnViewRow) c_int;
    pub const getSelectable = gtk_column_view_row_get_selectable;

    /// Checks if the item is selected that this row corresponds to.
    ///
    /// The selected state is maintained by the list widget and its model
    /// and cannot be set otherwise.
    extern fn gtk_column_view_row_get_selected(p_self: *ColumnViewRow) c_int;
    pub const getSelected = gtk_column_view_row_get_selected;

    /// Sets the accessible description for the row,
    /// which may be used by e.g. screen readers.
    extern fn gtk_column_view_row_set_accessible_description(p_self: *ColumnViewRow, p_description: [*:0]const u8) void;
    pub const setAccessibleDescription = gtk_column_view_row_set_accessible_description;

    /// Sets the accessible label for the row,
    /// which may be used by e.g. screen readers.
    extern fn gtk_column_view_row_set_accessible_label(p_self: *ColumnViewRow, p_label: [*:0]const u8) void;
    pub const setAccessibleLabel = gtk_column_view_row_set_accessible_label;

    /// Sets `self` to be activatable.
    ///
    /// If a row is activatable, double-clicking on the row, using
    /// the Return key or calling `gtk.Widget.activate` will activate
    /// the row. Activating instructs the containing columnview to
    /// emit the `gtk.ColumnView.signals.activate` signal.
    ///
    /// By default, row are activatable.
    extern fn gtk_column_view_row_set_activatable(p_self: *ColumnViewRow, p_activatable: c_int) void;
    pub const setActivatable = gtk_column_view_row_set_activatable;

    /// Sets `self` to be focusable.
    ///
    /// If a row is focusable, it can be focused using the keyboard.
    /// This works similar to `gtk.Widget.setFocusable`.
    ///
    /// Note that if row are not focusable, the contents of cells can still be focused if
    /// they are focusable.
    ///
    /// By default, rows are focusable.
    extern fn gtk_column_view_row_set_focusable(p_self: *ColumnViewRow, p_focusable: c_int) void;
    pub const setFocusable = gtk_column_view_row_set_focusable;

    /// Sets `self` to be selectable.
    ///
    /// If a row is selectable, clicking on the row or using the keyboard
    /// will try to select or unselect the row. Whether this succeeds is up to
    /// the model to determine, as it is managing the selected state.
    ///
    /// Note that this means that making a row non-selectable has no
    /// influence on the selected state at all. A non-selectable row
    /// may still be selected.
    ///
    /// By default, rows are selectable.
    extern fn gtk_column_view_row_set_selectable(p_self: *ColumnViewRow, p_selectable: c_int) void;
    pub const setSelectable = gtk_column_view_row_set_selectable;

    extern fn gtk_column_view_row_get_type() usize;
    pub const getGObjectType = gtk_column_view_row_get_type;

    extern fn g_object_ref(p_self: *gtk.ColumnViewRow) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColumnViewRow) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColumnViewRow, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Sorts `gtk.ColumnView` columns.
///
/// The sorter returned by `gtk.ColumnView.getSorter` is
/// a `GtkColumnViewSorter`.
///
/// In column views, sorting can be configured by associating
/// sorters with columns, and users can invert sort order by clicking
/// on column headers. The API of `GtkColumnViewSorter` is designed
/// to allow saving and restoring this configuration.
///
/// If you are only interested in the primary sort column (i.e. the
/// column where a sort indicator is shown in the header), then
/// you can just look at `gtk.ColumnViewSorter.properties.primary_sort_column`
/// and `gtk.ColumnViewSorter.properties.primary_sort_order`.
///
/// If you want to store the full sort configuration, including
/// secondary sort columns that are used for tie breaking, then
/// you can use `gtk.ColumnViewSorter.getNthSortColumn`.
/// To get notified about changes, use `gtk.Sorter.signals.changed`.
///
/// To restore a saved sort configuration on a `GtkColumnView`,
/// use code like:
///
/// ```
/// sorter = gtk_column_view_get_sorter (view);
/// for (i = gtk_column_view_sorter_get_n_sort_columns (sorter) - 1; i >= 0; i--)
///   {
///     column = gtk_column_view_sorter_get_nth_sort_column (sorter, i, &order);
///     gtk_column_view_sort_by_column (view, column, order);
///   }
/// ```
pub const ColumnViewSorter = opaque {
    pub const Parent = gtk.Sorter;
    pub const Implements = [_]type{};
    pub const Class = gtk.ColumnViewSorterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The primary sort column.
        ///
        /// The primary sort column is the one that displays the triangle
        /// in a column view header.
        pub const primary_sort_column = struct {
            pub const name = "primary-sort-column";

            pub const Type = ?*gtk.ColumnViewColumn;
        };

        /// The primary sort order.
        ///
        /// The primary sort order determines whether the triangle displayed
        /// in the column view header of the primary sort column points upwards
        /// or downwards.
        pub const primary_sort_order = struct {
            pub const name = "primary-sort-order";

            pub const Type = gtk.SortType;
        };
    };

    pub const signals = struct {};

    /// Returns the number of columns by which the sorter sorts.
    ///
    /// If the sorter of the primary sort column does not determine
    /// a total order, then the secondary sorters are consulted to
    /// break the ties.
    ///
    /// Use the `gtk.Sorter.signals.changed` signal to get notified
    /// when the number of sort columns changes.
    extern fn gtk_column_view_sorter_get_n_sort_columns(p_self: *ColumnViewSorter) c_uint;
    pub const getNSortColumns = gtk_column_view_sorter_get_n_sort_columns;

    /// Gets the `position`'th sort column and its associated sort order.
    ///
    /// Use the `gtk.Sorter.signals.changed` signal to get notified
    /// when sort columns change.
    extern fn gtk_column_view_sorter_get_nth_sort_column(p_self: *ColumnViewSorter, p_position: c_uint, p_sort_order: *gtk.SortType) ?*gtk.ColumnViewColumn;
    pub const getNthSortColumn = gtk_column_view_sorter_get_nth_sort_column;

    /// Returns the primary sort column.
    ///
    /// The primary sort column is the one that displays the triangle
    /// in a column view header.
    extern fn gtk_column_view_sorter_get_primary_sort_column(p_self: *ColumnViewSorter) ?*gtk.ColumnViewColumn;
    pub const getPrimarySortColumn = gtk_column_view_sorter_get_primary_sort_column;

    /// Returns the primary sort order.
    ///
    /// The primary sort order determines whether the triangle displayed
    /// in the column view header of the primary sort column points upwards
    /// or downwards.
    ///
    /// If there is no primary sort column, then this function returns
    /// `GTK_SORT_ASCENDING`.
    extern fn gtk_column_view_sorter_get_primary_sort_order(p_self: *ColumnViewSorter) gtk.SortType;
    pub const getPrimarySortOrder = gtk_column_view_sorter_get_primary_sort_order;

    extern fn gtk_column_view_sorter_get_type() usize;
    pub const getGObjectType = gtk_column_view_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.ColumnViewSorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColumnViewSorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColumnViewSorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkComboBox` is a widget that allows the user to choose from a list of
/// valid choices.
///
/// <picture>
///   <source srcset="combo-box-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkComboBox" src="combo-box.png">
/// </picture>
///
/// The `GtkComboBox` displays the selected choice; when activated, the
/// `GtkComboBox` displays a popup which allows the user to make a new choice.
///
/// The `GtkComboBox` uses the model-view pattern; the list of valid choices
/// is specified in the form of a tree model, and the display of the choices
/// can be adapted to the data in the model by using cell renderers, as you
/// would in a tree view. This is possible since `GtkComboBox` implements the
/// `gtk.CellLayout` interface. The tree model holding the valid
/// choices is not restricted to a flat list, it can be a real tree, and the
/// popup will reflect the tree structure.
///
/// To allow the user to enter values not in the model, the
/// `gtk.ComboBox.properties.has_entry` property allows the `GtkComboBox` to
/// contain a `gtk.Entry`. This entry can be accessed by calling
/// `gtk.ComboBox.getChild` on the combo box.
///
/// For a simple list of textual choices, the model-view API of `GtkComboBox`
/// can be a bit overwhelming. In this case, `gtk.ComboBoxText` offers
/// a simple alternative. Both `GtkComboBox` and `GtkComboBoxText` can contain
/// an entry.
///
/// ## CSS nodes
///
/// ```
/// combobox
/// ├── box.linked
/// │   ╰── button.combo
/// │       ╰── box
/// │           ├── cellview
/// │           ╰── arrow
/// ╰── window.popup
/// ```
///
/// A normal combobox contains a box with the .linked class, a button
/// with the .combo class and inside those buttons, there are a cellview and
/// an arrow.
///
/// ```
/// combobox
/// ├── box.linked
/// │   ├── entry.combo
/// │   ╰── button.combo
/// │       ╰── box
/// │           ╰── arrow
/// ╰── window.popup
/// ```
///
/// A `GtkComboBox` with an entry has a single CSS node with name combobox.
/// It contains a box with the .linked class. That box contains an entry and
/// a button, both with the .combo class added. The button also contains another
/// node with name arrow.
///
/// ## Accessibility
///
/// `GtkComboBox` uses the `gtk.@"AccessibleRole.combo_box"` role.
pub const ComboBox = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.CellEditable, gtk.CellLayout, gtk.ConstraintTarget };
    pub const Class = gtk.ComboBoxClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const activate = struct {
            pub fn call(p_class: anytype, p_combo_box: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(ComboBox.Class, p_class).f_activate.?(gobject.ext.as(ComboBox, p_combo_box));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_combo_box: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(ComboBox.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };

        /// Signal is emitted when the active item is changed.
        pub const changed = struct {
            pub fn call(p_class: anytype, p_combo_box: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(ComboBox.Class, p_class).f_changed.?(gobject.ext.as(ComboBox, p_combo_box));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_combo_box: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(ComboBox.Class, p_class).f_changed = @ptrCast(p_implementation);
            }
        };

        /// Signal which allows you to change how the text
        ///    displayed in a combo box’s entry is displayed.
        pub const format_entry_text = struct {
            pub fn call(p_class: anytype, p_combo_box: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: [*:0]const u8) [*:0]u8 {
                return gobject.ext.as(ComboBox.Class, p_class).f_format_entry_text.?(gobject.ext.as(ComboBox, p_combo_box), p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_combo_box: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: [*:0]const u8) callconv(.c) [*:0]u8) void {
                gobject.ext.as(ComboBox.Class, p_class).f_format_entry_text = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The item which is currently active.
        ///
        /// If the model is a non-flat treemodel, and the active item is not an
        /// immediate child of the root of the tree, this property has the value
        /// `gtk_tree_path_get_indices (path)[0]`, where `path` is the
        /// `gtk.TreePath` of the active item.
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// The value of the ID column of the active row.
        pub const active_id = struct {
            pub const name = "active-id";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the dropdown button is sensitive when
        /// the model is empty.
        pub const button_sensitivity = struct {
            pub const name = "button-sensitivity";

            pub const Type = gtk.SensitivityType;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The model column to associate with strings from the entry.
        ///
        /// This is property only relevant if the combo was created with
        /// `gtk.ComboBox.properties.has_entry` is `TRUE`.
        pub const entry_text_column = struct {
            pub const name = "entry-text-column";

            pub const Type = c_int;
        };

        /// Whether the combo box has an entry.
        pub const has_entry = struct {
            pub const name = "has-entry";

            pub const Type = c_int;
        };

        /// The `has-frame` property controls whether a frame is drawn around the entry.
        pub const has_frame = struct {
            pub const name = "has-frame";

            pub const Type = c_int;
        };

        /// The model column that provides string IDs for the values
        /// in the model, if != -1.
        pub const id_column = struct {
            pub const name = "id-column";

            pub const Type = c_int;
        };

        /// The model from which the combo box takes its values.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };

        /// Whether the popup's width should be a fixed width matching the
        /// allocated width of the combo box.
        pub const popup_fixed_width = struct {
            pub const name = "popup-fixed-width";

            pub const Type = c_int;
        };

        /// Whether the combo boxes dropdown is popped up.
        ///
        /// Note that this property is mainly useful, because
        /// it allows you to connect to notify::popup-shown.
        pub const popup_shown = struct {
            pub const name = "popup-shown";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to when the combo box is activated.
        ///
        /// The `::activate` signal on `GtkComboBox` is an action signal and
        /// emitting it causes the combo box to pop up its dropdown.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ComboBox, p_instance))),
                    gobject.signalLookup("activate", ComboBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the active item is changed.
        ///
        /// The can be due to the user selecting a different item from the list,
        /// or due to a call to `gtk.ComboBox.setActiveIter`. It will
        /// also be emitted while typing into the entry of a combo box with an entry.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ComboBox, p_instance))),
                    gobject.signalLookup("changed", ComboBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to allow changing how the text in a combo box's entry is displayed.
        ///
        /// See `gtk.ComboBox.properties.has_entry`.
        ///
        /// Connect a signal handler which returns an allocated string representing
        /// `path`. That string will then be used to set the text in the combo box's
        /// entry. The default signal handler uses the text from the
        /// `gtk.ComboBox.properties.entry_text_column` model column.
        ///
        /// Here's an example signal handler which fetches data from the model and
        /// displays it in the entry.
        /// ```c
        /// static char *
        /// format_entry_text_callback (GtkComboBox *combo,
        ///                             const char *path,
        ///                             gpointer     user_data)
        /// {
        ///   GtkTreeIter iter;
        ///   GtkTreeModel model;
        ///   double       value;
        ///
        ///   model = gtk_combo_box_get_model (combo);
        ///
        ///   gtk_tree_model_get_iter_from_string (model, &iter, path);
        ///   gtk_tree_model_get (model, &iter,
        ///                       THE_DOUBLE_VALUE_COLUMN, &value,
        ///                       -1);
        ///
        ///   return g_strdup_printf ("`g`", value);
        /// }
        /// ```
        pub const format_entry_text = struct {
            pub const name = "format-entry-text";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: [*:0]u8, P_Data) callconv(.c) [*:0]u8, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ComboBox, p_instance))),
                    gobject.signalLookup("format-entry-text", ComboBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to move the active selection.
        ///
        /// This is an [keybinding signal](class.SignalAction.html).
        pub const move_active = struct {
            pub const name = "move-active";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_scroll_type: gtk.ScrollType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ComboBox, p_instance))),
                    gobject.signalLookup("move-active", ComboBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to popdown the combo box list.
        ///
        /// This is an [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are Alt+Up and Escape.
        pub const popdown = struct {
            pub const name = "popdown";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ComboBox, p_instance))),
                    gobject.signalLookup("popdown", ComboBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to popup the combo box list.
        ///
        /// This is an [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is Alt+Down.
        pub const popup = struct {
            pub const name = "popup";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ComboBox, p_instance))),
                    gobject.signalLookup("popup", ComboBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new empty `GtkComboBox`.
    extern fn gtk_combo_box_new() *gtk.ComboBox;
    pub const new = gtk_combo_box_new;

    /// Creates a new empty `GtkComboBox` with an entry.
    ///
    /// In order to use a combo box with entry, you need to tell it
    /// which column of the model contains the text for the entry
    /// by calling `gtk.ComboBox.setEntryTextColumn`.
    extern fn gtk_combo_box_new_with_entry() *gtk.ComboBox;
    pub const newWithEntry = gtk_combo_box_new_with_entry;

    /// Creates a new `GtkComboBox` with a model.
    extern fn gtk_combo_box_new_with_model(p_model: *gtk.TreeModel) *gtk.ComboBox;
    pub const newWithModel = gtk_combo_box_new_with_model;

    /// Creates a new empty `GtkComboBox` with an entry and a model.
    ///
    /// See also `gtk.ComboBox.newWithEntry`.
    extern fn gtk_combo_box_new_with_model_and_entry(p_model: *gtk.TreeModel) *gtk.ComboBox;
    pub const newWithModelAndEntry = gtk_combo_box_new_with_model_and_entry;

    /// Returns the index of the currently active item.
    ///
    /// If the model is a non-flat treemodel, and the active item is not
    /// an immediate child of the root of the tree, this function returns
    /// `gtk_tree_path_get_indices (path)[0]`, where `path` is the
    /// `gtk.TreePath` of the active item.
    extern fn gtk_combo_box_get_active(p_combo_box: *ComboBox) c_int;
    pub const getActive = gtk_combo_box_get_active;

    /// Returns the ID of the active row of `combo_box`.
    ///
    /// This value is taken from the active row and the column specified
    /// by the `gtk.ComboBox.properties.id_column` property of `combo_box`
    /// (see `gtk.ComboBox.setIdColumn`).
    ///
    /// The returned value is an interned string which means that you can
    /// compare the pointer by value to other interned strings and that you
    /// must not free it.
    ///
    /// If the `gtk.ComboBox.properties.id_column` property of `combo_box` is
    /// not set, or if no row is active, or if the active row has a `NULL`
    /// ID value, then `NULL` is returned.
    extern fn gtk_combo_box_get_active_id(p_combo_box: *ComboBox) ?[*:0]const u8;
    pub const getActiveId = gtk_combo_box_get_active_id;

    /// Sets `iter` to point to the currently active item.
    ///
    /// If no item is active, `iter` is left unchanged.
    extern fn gtk_combo_box_get_active_iter(p_combo_box: *ComboBox, p_iter: *gtk.TreeIter) c_int;
    pub const getActiveIter = gtk_combo_box_get_active_iter;

    /// Returns whether the combo box sets the dropdown button
    /// sensitive or not when there are no items in the model.
    extern fn gtk_combo_box_get_button_sensitivity(p_combo_box: *ComboBox) gtk.SensitivityType;
    pub const getButtonSensitivity = gtk_combo_box_get_button_sensitivity;

    /// Gets the child widget of `combo_box`.
    extern fn gtk_combo_box_get_child(p_combo_box: *ComboBox) ?*gtk.Widget;
    pub const getChild = gtk_combo_box_get_child;

    /// Returns the column which `combo_box` is using to get the strings
    /// from to display in the internal entry.
    extern fn gtk_combo_box_get_entry_text_column(p_combo_box: *ComboBox) c_int;
    pub const getEntryTextColumn = gtk_combo_box_get_entry_text_column;

    /// Returns whether the combo box has an entry.
    extern fn gtk_combo_box_get_has_entry(p_combo_box: *ComboBox) c_int;
    pub const getHasEntry = gtk_combo_box_get_has_entry;

    /// Returns the column which `combo_box` is using to get string IDs
    /// for values from.
    extern fn gtk_combo_box_get_id_column(p_combo_box: *ComboBox) c_int;
    pub const getIdColumn = gtk_combo_box_get_id_column;

    /// Returns the `GtkTreeModel` of `combo_box`.
    extern fn gtk_combo_box_get_model(p_combo_box: *ComboBox) ?*gtk.TreeModel;
    pub const getModel = gtk_combo_box_get_model;

    /// Gets whether the popup uses a fixed width.
    extern fn gtk_combo_box_get_popup_fixed_width(p_combo_box: *ComboBox) c_int;
    pub const getPopupFixedWidth = gtk_combo_box_get_popup_fixed_width;

    /// Returns the current row separator function.
    extern fn gtk_combo_box_get_row_separator_func(p_combo_box: *ComboBox) ?gtk.TreeViewRowSeparatorFunc;
    pub const getRowSeparatorFunc = gtk_combo_box_get_row_separator_func;

    /// Hides the menu or dropdown list of `combo_box`.
    ///
    /// This function is mostly intended for use by accessibility technologies;
    /// applications should have little use for it.
    extern fn gtk_combo_box_popdown(p_combo_box: *ComboBox) void;
    pub const popdown = gtk_combo_box_popdown;

    /// Pops up the menu or dropdown list of `combo_box`.
    ///
    /// This function is mostly intended for use by accessibility technologies;
    /// applications should have little use for it.
    ///
    /// Before calling this, `combo_box` must be mapped, or nothing will happen.
    extern fn gtk_combo_box_popup(p_combo_box: *ComboBox) void;
    pub const popup = gtk_combo_box_popup;

    /// Pops up the menu of `combo_box`.
    ///
    /// Note that currently this does not do anything with the device, as it was
    /// previously only used for list-mode combo boxes, and those were removed
    /// in GTK 4. However, it is retained in case similar functionality is added
    /// back later.
    extern fn gtk_combo_box_popup_for_device(p_combo_box: *ComboBox, p_device: *gdk.Device) void;
    pub const popupForDevice = gtk_combo_box_popup_for_device;

    /// Sets the active item of `combo_box` to be the item at `index`.
    extern fn gtk_combo_box_set_active(p_combo_box: *ComboBox, p_index_: c_int) void;
    pub const setActive = gtk_combo_box_set_active;

    /// Changes the active row of `combo_box` to the one that has an ID equal to
    /// `active_id`.
    ///
    /// If `active_id` is `NULL`, the active row is unset. Rows having
    /// a `NULL` ID string cannot be made active by this function.
    ///
    /// If the `gtk.ComboBox.properties.id_column` property of `combo_box` is
    /// unset or if no row has the given ID then the function does nothing
    /// and returns `FALSE`.
    extern fn gtk_combo_box_set_active_id(p_combo_box: *ComboBox, p_active_id: ?[*:0]const u8) c_int;
    pub const setActiveId = gtk_combo_box_set_active_id;

    /// Sets the current active item to be the one referenced by `iter`.
    ///
    /// If `iter` is `NULL`, the active item is unset.
    extern fn gtk_combo_box_set_active_iter(p_combo_box: *ComboBox, p_iter: ?*gtk.TreeIter) void;
    pub const setActiveIter = gtk_combo_box_set_active_iter;

    /// Sets whether the dropdown button of the combo box should update
    /// its sensitivity depending on the model contents.
    extern fn gtk_combo_box_set_button_sensitivity(p_combo_box: *ComboBox, p_sensitivity: gtk.SensitivityType) void;
    pub const setButtonSensitivity = gtk_combo_box_set_button_sensitivity;

    /// Sets the child widget of `combo_box`.
    extern fn gtk_combo_box_set_child(p_combo_box: *ComboBox, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_combo_box_set_child;

    /// Sets the model column which `combo_box` should use to get strings
    /// from to be `text_column`.
    ///
    /// For this column no separate
    /// `gtk.CellRenderer` is needed.
    ///
    /// The column `text_column` in the model of `combo_box` must be of
    /// type `G_TYPE_STRING`.
    ///
    /// This is only relevant if `combo_box` has been created with
    /// `gtk.ComboBox.properties.has_entry` as `TRUE`.
    extern fn gtk_combo_box_set_entry_text_column(p_combo_box: *ComboBox, p_text_column: c_int) void;
    pub const setEntryTextColumn = gtk_combo_box_set_entry_text_column;

    /// Sets the model column which `combo_box` should use to get string IDs
    /// for values from.
    ///
    /// The column `id_column` in the model of `combo_box` must be of type
    /// `G_TYPE_STRING`.
    extern fn gtk_combo_box_set_id_column(p_combo_box: *ComboBox, p_id_column: c_int) void;
    pub const setIdColumn = gtk_combo_box_set_id_column;

    /// Sets the model used by `combo_box` to be `model`.
    ///
    /// Will unset a previously set model (if applicable). If model is `NULL`,
    /// then it will unset the model.
    ///
    /// Note that this function does not clear the cell renderers, you have to
    /// call `gtk.CellLayout.clear` yourself if you need to set up different
    /// cell renderers for the new model.
    extern fn gtk_combo_box_set_model(p_combo_box: *ComboBox, p_model: ?*gtk.TreeModel) void;
    pub const setModel = gtk_combo_box_set_model;

    /// Specifies whether the popup’s width should be a fixed width.
    ///
    /// If `fixed` is `TRUE`, the popup's width is set to match the
    /// allocated width of the combo box.
    extern fn gtk_combo_box_set_popup_fixed_width(p_combo_box: *ComboBox, p_fixed: c_int) void;
    pub const setPopupFixedWidth = gtk_combo_box_set_popup_fixed_width;

    /// Sets the row separator function, which is used to determine
    /// whether a row should be drawn as a separator.
    ///
    /// If the row separator function is `NULL`, no separators are drawn.
    /// This is the default value.
    extern fn gtk_combo_box_set_row_separator_func(p_combo_box: *ComboBox, p_func: ?gtk.TreeViewRowSeparatorFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setRowSeparatorFunc = gtk_combo_box_set_row_separator_func;

    extern fn gtk_combo_box_get_type() usize;
    pub const getGObjectType = gtk_combo_box_get_type;

    extern fn g_object_ref(p_self: *gtk.ComboBox) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ComboBox) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ComboBox, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkComboBoxText` is a simple variant of `GtkComboBox` for text-only
/// use cases.
///
/// <picture>
///   <source srcset="combo-box-text-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkComboBoxText" src="combo-box-text.png">
/// </picture>
///
/// `GtkComboBoxText` hides the model-view complexity of `GtkComboBox`.
///
/// To create a `GtkComboBoxText`, use `gtk.ComboBoxText.new` or
/// `gtk.ComboBoxText.newWithEntry`.
///
/// You can add items to a `GtkComboBoxText` with
/// `gtk.ComboBoxText.appendText`,
/// `gtk.ComboBoxText.insertText` or
/// `gtk.ComboBoxText.prependText` and remove options with
/// `gtk.ComboBoxText.remove`.
///
/// If the `GtkComboBoxText` contains an entry (via the
/// `gtk.ComboBox.properties.has_entry` property), its contents can be retrieved
/// using `gtk.ComboBoxText.getActiveText`.
///
/// You should not call `gtk.ComboBox.setModel` or attempt to pack more
/// cells into this combo box via its `gtk.CellLayout` interface.
///
/// ## GtkComboBoxText as GtkBuildable
///
/// The `GtkComboBoxText` implementation of the `GtkBuildable` interface supports
/// adding items directly using the `<items>` element and specifying `<item>`
/// elements for each item. Each `<item>` element can specify the “id”
/// corresponding to the appended text and also supports the regular
/// translation attributes “translatable”, “context” and “comments”.
///
/// Here is a UI definition fragment specifying `GtkComboBoxText` items:
/// ```xml
/// <object class="GtkComboBoxText">
///   <items>
///     <item translatable="yes" id="factory">Factory</item>
///     <item translatable="yes" id="home">Home</item>
///     <item translatable="yes" id="subway">Subway</item>
///   </items>
/// </object>
/// ```
///
/// ## CSS nodes
///
/// ```
/// combobox
/// ╰── box.linked
///     ├── entry.combo
///     ├── button.combo
///     ╰── window.popup
/// ```
///
/// `GtkComboBoxText` has a single CSS node with name combobox. It adds
/// the style class .combo to the main CSS nodes of its entry and button
/// children, and the .linked class to the node of its internal box.
pub const ComboBoxText = opaque {
    pub const Parent = gtk.ComboBox;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.CellEditable, gtk.CellLayout, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = ComboBoxText;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkComboBoxText`.
    extern fn gtk_combo_box_text_new() *gtk.ComboBoxText;
    pub const new = gtk_combo_box_text_new;

    /// Creates a new `GtkComboBoxText` with an entry.
    extern fn gtk_combo_box_text_new_with_entry() *gtk.ComboBoxText;
    pub const newWithEntry = gtk_combo_box_text_new_with_entry;

    /// Appends `text` to the list of strings stored in `combo_box`.
    ///
    /// If `id` is non-`NULL` then it is used as the ID of the row.
    ///
    /// This is the same as calling `gtk.ComboBoxText.insert`
    /// with a position of -1.
    extern fn gtk_combo_box_text_append(p_combo_box: *ComboBoxText, p_id: ?[*:0]const u8, p_text: [*:0]const u8) void;
    pub const append = gtk_combo_box_text_append;

    /// Appends `text` to the list of strings stored in `combo_box`.
    ///
    /// This is the same as calling `gtk.ComboBoxText.insertText`
    /// with a position of -1.
    extern fn gtk_combo_box_text_append_text(p_combo_box: *ComboBoxText, p_text: [*:0]const u8) void;
    pub const appendText = gtk_combo_box_text_append_text;

    /// Returns the currently active string in `combo_box`.
    ///
    /// If no row is currently selected, `NULL` is returned.
    /// If `combo_box` contains an entry, this function will
    /// return its contents (which will not necessarily
    /// be an item from the list).
    extern fn gtk_combo_box_text_get_active_text(p_combo_box: *ComboBoxText) ?[*:0]u8;
    pub const getActiveText = gtk_combo_box_text_get_active_text;

    /// Inserts `text` at `position` in the list of strings stored in `combo_box`.
    ///
    /// If `id` is non-`NULL` then it is used as the ID of the row.
    /// See `gtk.ComboBox.properties.id_column`.
    ///
    /// If `position` is negative then `text` is appended.
    extern fn gtk_combo_box_text_insert(p_combo_box: *ComboBoxText, p_position: c_int, p_id: ?[*:0]const u8, p_text: [*:0]const u8) void;
    pub const insert = gtk_combo_box_text_insert;

    /// Inserts `text` at `position` in the list of strings stored in `combo_box`.
    ///
    /// If `position` is negative then `text` is appended.
    ///
    /// This is the same as calling `gtk.ComboBoxText.insert`
    /// with a `NULL` ID string.
    extern fn gtk_combo_box_text_insert_text(p_combo_box: *ComboBoxText, p_position: c_int, p_text: [*:0]const u8) void;
    pub const insertText = gtk_combo_box_text_insert_text;

    /// Prepends `text` to the list of strings stored in `combo_box`.
    ///
    /// If `id` is non-`NULL` then it is used as the ID of the row.
    ///
    /// This is the same as calling `gtk.ComboBoxText.insert`
    /// with a position of 0.
    extern fn gtk_combo_box_text_prepend(p_combo_box: *ComboBoxText, p_id: ?[*:0]const u8, p_text: [*:0]const u8) void;
    pub const prepend = gtk_combo_box_text_prepend;

    /// Prepends `text` to the list of strings stored in `combo_box`.
    ///
    /// This is the same as calling `gtk.ComboBoxText.insertText`
    /// with a position of 0.
    extern fn gtk_combo_box_text_prepend_text(p_combo_box: *ComboBoxText, p_text: [*:0]const u8) void;
    pub const prependText = gtk_combo_box_text_prepend_text;

    /// Removes the string at `position` from `combo_box`.
    extern fn gtk_combo_box_text_remove(p_combo_box: *ComboBoxText, p_position: c_int) void;
    pub const remove = gtk_combo_box_text_remove;

    /// Removes all the text entries from the combo box.
    extern fn gtk_combo_box_text_remove_all(p_combo_box: *ComboBoxText) void;
    pub const removeAll = gtk_combo_box_text_remove_all;

    extern fn gtk_combo_box_text_get_type() usize;
    pub const getGObjectType = gtk_combo_box_text_get_type;

    extern fn g_object_ref(p_self: *gtk.ComboBoxText) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ComboBoxText) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ComboBoxText, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A constant value in a `GtkExpression`.
pub const ConstantExpression = opaque {
    pub const Parent = gtk.Expression;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = ConstantExpression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a `GtkExpression` that evaluates to the
    /// object given by the arguments.
    extern fn gtk_constant_expression_new(p_value_type: usize, ...) *gtk.ConstantExpression;
    pub const new = gtk_constant_expression_new;

    /// Creates an expression that always evaluates to the given `value`.
    extern fn gtk_constant_expression_new_for_value(p_value: *const gobject.Value) *gtk.ConstantExpression;
    pub const newForValue = gtk_constant_expression_new_for_value;

    /// Gets the value that a constant expression evaluates to.
    extern fn gtk_constant_expression_get_value(p_expression: *ConstantExpression) *const gobject.Value;
    pub const getValue = gtk_constant_expression_get_value;

    extern fn gtk_constant_expression_get_type() usize;
    pub const getGObjectType = gtk_constant_expression_get_type;

    pub fn as(p_instance: *ConstantExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes a constraint between attributes of two widgets,
///  expressed as a linear equation.
///
/// The typical equation for a constraint is:
///
/// ```
///   target.target_attr = source.source_attr × multiplier + constant
/// ```
///
/// Each `GtkConstraint` is part of a system that will be solved by a
/// `gtk.ConstraintLayout` in order to allocate and position each
/// child widget or guide.
///
/// The source and target, as well as their attributes, of a `GtkConstraint`
/// instance are immutable after creation.
pub const Constraint = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ConstraintClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The constant value to be added to the `gtk.Constraint.properties.source_attribute`.
        pub const constant = struct {
            pub const name = "constant";

            pub const Type = f64;
        };

        /// The multiplication factor to be applied to
        /// the `gtk.Constraint.properties.source_attribute`.
        pub const multiplier = struct {
            pub const name = "multiplier";

            pub const Type = f64;
        };

        /// The order relation between the terms of the constraint.
        pub const relation = struct {
            pub const name = "relation";

            pub const Type = gtk.ConstraintRelation;
        };

        /// The source of the constraint.
        ///
        /// The constraint will set the `gtk.Constraint.properties.target_attribute`
        /// property of the target using the `gtk.Constraint.properties.source_attribute`
        /// property of the source.
        pub const source = struct {
            pub const name = "source";

            pub const Type = ?*gtk.ConstraintTarget;
        };

        /// The attribute of the `gtk.Constraint.properties.source` read by the
        /// constraint.
        pub const source_attribute = struct {
            pub const name = "source-attribute";

            pub const Type = gtk.ConstraintAttribute;
        };

        /// The strength of the constraint.
        ///
        /// The strength can be expressed either using one of the symbolic values
        /// of the `gtk.ConstraintStrength` enumeration, or any positive integer
        /// value.
        pub const strength = struct {
            pub const name = "strength";

            pub const Type = c_int;
        };

        /// The target of the constraint.
        ///
        /// The constraint will set the `gtk.Constraint.properties.target_attribute`
        /// property of the target using the `gtk.Constraint.properties.source_attribute`
        /// property of the source widget.
        pub const target = struct {
            pub const name = "target";

            pub const Type = ?*gtk.ConstraintTarget;
        };

        /// The attribute of the `gtk.Constraint.properties.target` set by the constraint.
        pub const target_attribute = struct {
            pub const name = "target-attribute";

            pub const Type = gtk.ConstraintAttribute;
        };
    };

    pub const signals = struct {};

    /// Creates a new constraint representing a relation between a layout
    /// attribute on a source and a layout attribute on a target.
    extern fn gtk_constraint_new(p_target: ?*gtk.ConstraintTarget, p_target_attribute: gtk.ConstraintAttribute, p_relation: gtk.ConstraintRelation, p_source: ?*gtk.ConstraintTarget, p_source_attribute: gtk.ConstraintAttribute, p_multiplier: f64, p_constant: f64, p_strength: c_int) *gtk.Constraint;
    pub const new = gtk_constraint_new;

    /// Creates a new constraint representing a relation between a layout
    /// attribute on a target and a constant value.
    extern fn gtk_constraint_new_constant(p_target: ?*gtk.ConstraintTarget, p_target_attribute: gtk.ConstraintAttribute, p_relation: gtk.ConstraintRelation, p_constant: f64, p_strength: c_int) *gtk.Constraint;
    pub const newConstant = gtk_constraint_new_constant;

    /// Retrieves the constant factor added to the source attributes' value.
    extern fn gtk_constraint_get_constant(p_constraint: *Constraint) f64;
    pub const getConstant = gtk_constraint_get_constant;

    /// Retrieves the multiplication factor applied to the source
    /// attribute's value.
    extern fn gtk_constraint_get_multiplier(p_constraint: *Constraint) f64;
    pub const getMultiplier = gtk_constraint_get_multiplier;

    /// The order relation between the terms of the constraint.
    extern fn gtk_constraint_get_relation(p_constraint: *Constraint) gtk.ConstraintRelation;
    pub const getRelation = gtk_constraint_get_relation;

    /// Retrieves the `gtk.ConstraintTarget` used as the source for the
    /// constraint.
    ///
    /// If the source is set to `NULL` at creation, the constraint will use
    /// the widget using the `gtk.ConstraintLayout` as the source.
    extern fn gtk_constraint_get_source(p_constraint: *Constraint) ?*gtk.ConstraintTarget;
    pub const getSource = gtk_constraint_get_source;

    /// Retrieves the attribute of the source to be read by the constraint.
    extern fn gtk_constraint_get_source_attribute(p_constraint: *Constraint) gtk.ConstraintAttribute;
    pub const getSourceAttribute = gtk_constraint_get_source_attribute;

    /// Retrieves the strength of the constraint.
    extern fn gtk_constraint_get_strength(p_constraint: *Constraint) c_int;
    pub const getStrength = gtk_constraint_get_strength;

    /// Retrieves the `gtk.ConstraintTarget` used as the target for
    /// the constraint.
    ///
    /// If the targe is set to `NULL` at creation, the constraint will use
    /// the widget using the `gtk.ConstraintLayout` as the target.
    extern fn gtk_constraint_get_target(p_constraint: *Constraint) ?*gtk.ConstraintTarget;
    pub const getTarget = gtk_constraint_get_target;

    /// Retrieves the attribute of the target to be set by the constraint.
    extern fn gtk_constraint_get_target_attribute(p_constraint: *Constraint) gtk.ConstraintAttribute;
    pub const getTargetAttribute = gtk_constraint_get_target_attribute;

    /// Checks whether the constraint is attached to a `gtk.ConstraintLayout`,
    /// and it is contributing to the layout.
    extern fn gtk_constraint_is_attached(p_constraint: *Constraint) c_int;
    pub const isAttached = gtk_constraint_is_attached;

    /// Checks whether the constraint describes a relation between an attribute
    /// on the `gtk.Constraint.properties.target` and a constant value.
    extern fn gtk_constraint_is_constant(p_constraint: *Constraint) c_int;
    pub const isConstant = gtk_constraint_is_constant;

    /// Checks whether the constraint is a required relation for solving the
    /// constraint layout.
    extern fn gtk_constraint_is_required(p_constraint: *Constraint) c_int;
    pub const isRequired = gtk_constraint_is_required;

    extern fn gtk_constraint_get_type() usize;
    pub const getGObjectType = gtk_constraint_get_type;

    extern fn g_object_ref(p_self: *gtk.Constraint) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Constraint) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Constraint, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An invisible layout element in a `GtkConstraintLayout`.
///
/// The `GtkConstraintLayout` treats guides like widgets. They
/// can be used as the source or target of a `GtkConstraint`.
///
/// Guides have a minimum, maximum and natural size. Depending
/// on the constraints that are applied, they can act like a
/// guideline that widgets can be aligned to, or like *flexible
/// space*.
///
/// Unlike a `GtkWidget`, a `GtkConstraintGuide` will not be drawn.
pub const ConstraintGuide = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.ConstraintTarget};
    pub const Class = gtk.ConstraintGuideClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The maximum height of the guide.
        pub const max_height = struct {
            pub const name = "max-height";

            pub const Type = c_int;
        };

        /// The maximum width of the guide.
        pub const max_width = struct {
            pub const name = "max-width";

            pub const Type = c_int;
        };

        /// The minimum height of the guide.
        pub const min_height = struct {
            pub const name = "min-height";

            pub const Type = c_int;
        };

        /// The minimum width of the guide.
        pub const min_width = struct {
            pub const name = "min-width";

            pub const Type = c_int;
        };

        /// A name that identifies the `GtkConstraintGuide`, for debugging.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// The preferred, or natural, height of the guide.
        pub const nat_height = struct {
            pub const name = "nat-height";

            pub const Type = c_int;
        };

        /// The preferred, or natural, width of the guide.
        pub const nat_width = struct {
            pub const name = "nat-width";

            pub const Type = c_int;
        };

        /// The `GtkConstraintStrength` to be used for the constraint on
        /// the natural size of the guide.
        pub const strength = struct {
            pub const name = "strength";

            pub const Type = gtk.ConstraintStrength;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkConstraintGuide` object.
    extern fn gtk_constraint_guide_new() *gtk.ConstraintGuide;
    pub const new = gtk_constraint_guide_new;

    /// Gets the maximum size of `guide`.
    extern fn gtk_constraint_guide_get_max_size(p_guide: *ConstraintGuide, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getMaxSize = gtk_constraint_guide_get_max_size;

    /// Gets the minimum size of `guide`.
    extern fn gtk_constraint_guide_get_min_size(p_guide: *ConstraintGuide, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getMinSize = gtk_constraint_guide_get_min_size;

    /// Retrieves the name set using `gtk.ConstraintGuide.setName`.
    extern fn gtk_constraint_guide_get_name(p_guide: *ConstraintGuide) ?[*:0]const u8;
    pub const getName = gtk_constraint_guide_get_name;

    /// Gets the natural size of `guide`.
    extern fn gtk_constraint_guide_get_nat_size(p_guide: *ConstraintGuide, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getNatSize = gtk_constraint_guide_get_nat_size;

    /// Retrieves the strength set using `gtk.ConstraintGuide.setStrength`.
    extern fn gtk_constraint_guide_get_strength(p_guide: *ConstraintGuide) gtk.ConstraintStrength;
    pub const getStrength = gtk_constraint_guide_get_strength;

    /// Sets the maximum size of `guide`.
    ///
    /// If `guide` is attached to a `GtkConstraintLayout`,
    /// the constraints will be updated to reflect the new size.
    extern fn gtk_constraint_guide_set_max_size(p_guide: *ConstraintGuide, p_width: c_int, p_height: c_int) void;
    pub const setMaxSize = gtk_constraint_guide_set_max_size;

    /// Sets the minimum size of `guide`.
    ///
    /// If `guide` is attached to a `GtkConstraintLayout`,
    /// the constraints will be updated to reflect the new size.
    extern fn gtk_constraint_guide_set_min_size(p_guide: *ConstraintGuide, p_width: c_int, p_height: c_int) void;
    pub const setMinSize = gtk_constraint_guide_set_min_size;

    /// Sets a name for the given `GtkConstraintGuide`.
    ///
    /// The name is useful for debugging purposes.
    extern fn gtk_constraint_guide_set_name(p_guide: *ConstraintGuide, p_name: ?[*:0]const u8) void;
    pub const setName = gtk_constraint_guide_set_name;

    /// Sets the natural size of `guide`.
    ///
    /// If `guide` is attached to a `GtkConstraintLayout`,
    /// the constraints will be updated to reflect the new size.
    extern fn gtk_constraint_guide_set_nat_size(p_guide: *ConstraintGuide, p_width: c_int, p_height: c_int) void;
    pub const setNatSize = gtk_constraint_guide_set_nat_size;

    /// Sets the strength of the constraint on the natural size of the
    /// given `GtkConstraintGuide`.
    extern fn gtk_constraint_guide_set_strength(p_guide: *ConstraintGuide, p_strength: gtk.ConstraintStrength) void;
    pub const setStrength = gtk_constraint_guide_set_strength;

    extern fn gtk_constraint_guide_get_type() usize;
    pub const getGObjectType = gtk_constraint_guide_get_type;

    extern fn g_object_ref(p_self: *gtk.ConstraintGuide) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ConstraintGuide) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ConstraintGuide, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Uses constraints to describe relations between widgets.
///
/// `GtkConstraintLayout` is a layout manager that uses relations between
/// widget attributes, expressed via `gtk.Constraint` instances, to
/// measure and allocate widgets.
///
/// ### How do constraints work
///
/// Constraints are objects defining the relationship between attributes
/// of a widget; you can read the description of the `gtk.Constraint`
/// class to have a more in depth definition.
///
/// By taking multiple constraints and applying them to the children of
/// a widget using `GtkConstraintLayout`, it's possible to describe
/// complex layout policies; each constraint applied to a child or to the parent
/// widgets contributes to the full description of the layout, in terms of
/// parameters for resolving the value of each attribute.
///
/// It is important to note that a layout is defined by the totality of
/// constraints; removing a child, or a constraint, from an existing layout
/// without changing the remaining constraints may result in an unstable
/// or unsolvable layout.
///
/// Constraints have an implicit "reading order"; you should start describing
/// each edge of each child, as well as their relationship with the parent
/// container, from the top left (or top right, in RTL languages), horizontally
/// first, and then vertically.
///
/// A constraint-based layout with too few constraints can become "unstable",
/// that is: have more than one solution. The behavior of an unstable layout
/// is undefined.
///
/// A constraint-based layout with conflicting constraints may be unsolvable,
/// and lead to an unstable layout. You can use the `gtk.Constraint.properties.strength`
/// property of `gtk.Constraint` to "nudge" the layout towards a solution.
///
/// ### GtkConstraintLayout as GtkBuildable
///
/// `GtkConstraintLayout` implements the `gtk.Buildable` interface and
/// has a custom "constraints" element which allows describing constraints in
/// a `gtk.Builder` UI file.
///
/// An example of a UI definition fragment specifying a constraint:
///
/// ```xml
///   <object class="GtkConstraintLayout">
///     <constraints>
///       <constraint target="button" target-attribute="start"
///                   relation="eq"
///                   source="super" source-attribute="start"
///                   constant="12"
///                   strength="required" />
///       <constraint target="button" target-attribute="width"
///                   relation="ge"
///                   constant="250"
///                   strength="strong" />
///     </constraints>
///   </object>
/// ```
///
/// The definition above will add two constraints to the GtkConstraintLayout:
///
///  - a required constraint between the leading edge of "button" and
///    the leading edge of the widget using the constraint layout, plus
///    12 pixels
///  - a strong, constant constraint making the width of "button" greater
///    than, or equal to 250 pixels
///
/// The "target" and "target-attribute" attributes are required.
///
/// The "source" and "source-attribute" attributes of the "constraint"
/// element are optional; if they are not specified, the constraint is
/// assumed to be a constant.
///
/// The "relation" attribute is optional; if not specified, the constraint
/// is assumed to be an equality.
///
/// The "strength" attribute is optional; if not specified, the constraint
/// is assumed to be required.
///
/// The "source" and "target" attributes can be set to "super" to indicate
/// that the constraint target is the widget using the GtkConstraintLayout.
///
/// There can be "constant" and "multiplier" attributes.
///
/// Additionally, the "constraints" element can also contain a description
/// of the `GtkConstraintGuides` used by the layout:
///
/// ```xml
///   <constraints>
///     <guide min-width="100" max-width="500" name="hspace"/>
///     <guide min-height="64" nat-height="128" name="vspace" strength="strong"/>
///   </constraints>
/// ```
///
/// The "guide" element has the following optional attributes:
///
///   - "min-width", "nat-width", and "max-width", describe the minimum,
///     natural, and maximum width of the guide, respectively
///   - "min-height", "nat-height", and "max-height", describe the minimum,
///     natural, and maximum height of the guide, respectively
///   - "strength" describes the strength of the constraint on the natural
///     size of the guide; if not specified, the constraint is assumed to
///     have a medium strength
///   - "name" describes a name for the guide, useful when debugging
///
/// ### Using the Visual Format Language
///
/// Complex constraints can be described using a compact syntax called VFL,
/// or *Visual Format Language*.
///
/// The Visual Format Language describes all the constraints on a row or
/// column, typically starting from the leading edge towards the trailing
/// one. Each element of the layout is composed by "views", which identify
/// a `gtk.ConstraintTarget`.
///
/// For instance:
///
/// ```
///   [button]-[textField]
/// ```
///
/// Describes a constraint that binds the trailing edge of "button" to the
/// leading edge of "textField", leaving a default space between the two.
///
/// Using VFL is also possible to specify predicates that describe constraints
/// on attributes like width and height:
///
/// ```
///   // Width must be greater than, or equal to 50
///   [button(>=50)]
///
///   // Width of button1 must be equal to width of button2
///   [button1(==button2)]
/// ```
///
/// The default orientation for a VFL description is horizontal, unless
/// otherwise specified:
///
/// ```
///   // horizontal orientation, default attribute: width
///   H:[button(>=150)]
///
///   // vertical orientation, default attribute: height
///   V:[button1(==button2)]
/// ```
///
/// It's also possible to specify multiple predicates, as well as their
/// strength:
///
/// ```
///   // minimum width of button must be 150
///   // natural width of button can be 250
///   [button(>=150`required`, ==250`medium`)]
/// ```
///
/// Finally, it's also possible to use simple arithmetic operators:
///
/// ```
///   // width of button1 must be equal to width of button2
///   // divided by 2 plus 12
///   [button1(button2 / 2 + 12)]
/// ```
pub const ConstraintLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{gtk.Buildable};
    pub const Class = gtk.ConstraintLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkConstraintLayout` layout manager.
    extern fn gtk_constraint_layout_new() *gtk.ConstraintLayout;
    pub const new = gtk_constraint_layout_new;

    /// Adds a constraint to the layout manager.
    ///
    /// The `gtk.Constraint.properties.source` and `gtk.Constraint.properties.target`
    /// properties of `constraint` can be:
    ///
    ///  - set to `NULL` to indicate that the constraint refers to the
    ///    widget using `layout`
    ///  - set to the `gtk.Widget` using `layout`
    ///  - set to a child of the `gtk.Widget` using `layout`
    ///  - set to a `gtk.ConstraintGuide` that is part of `layout`
    ///
    /// The `layout` acquires the ownership of `constraint` after calling
    /// this function.
    extern fn gtk_constraint_layout_add_constraint(p_layout: *ConstraintLayout, p_constraint: *gtk.Constraint) void;
    pub const addConstraint = gtk_constraint_layout_add_constraint;

    /// Creates a list of constraints from a VFL description.
    ///
    /// This function is a convenience wrapper around
    /// `gtk.ConstraintLayout.addConstraintsFromDescriptionv`, using
    /// variadic arguments to populate the view/target map.
    extern fn gtk_constraint_layout_add_constraints_from_description(p_layout: *ConstraintLayout, p_lines: [*]const [*:0]const u8, p_n_lines: usize, p_hspacing: c_int, p_vspacing: c_int, p_error: **glib.Error, p_first_view: [*:0]const u8, ...) *glib.List;
    pub const addConstraintsFromDescription = gtk_constraint_layout_add_constraints_from_description;

    /// Creates a list of constraints from a VFL description.
    ///
    /// The Visual Format Language, VFL, is based on Apple's AutoLayout [VFL](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html).
    ///
    /// The `views` dictionary is used to match `gtk.ConstraintTarget`
    /// instances to the symbolic view name inside the VFL.
    ///
    /// The VFL grammar is:
    ///
    /// ```
    ///        <visualFormatString> = (<orientation>)?
    ///                               (<superview><connection>)?
    ///                               <view>(<connection><view>)*
    ///                               (<connection><superview>)?
    ///               <orientation> = 'H' | 'V'
    ///                 <superview> = '|'
    ///                <connection> = '' | '-' <predicateList> '-' | '-'
    ///             <predicateList> = <simplePredicate> | <predicateListWithParens>
    ///           <simplePredicate> = <metricName> | <positiveNumber>
    ///   <predicateListWithParens> = '(' <predicate> (',' <predicate>)* ')'
    ///                 <predicate> = (<relation>)? <objectOfPredicate> (<operatorList>)? ('@' <priority>)?
    ///                  <relation> = '==' | '<=' | '>='
    ///         <objectOfPredicate> = <constant> | <viewName> | ('.' <attributeName>)?
    ///                  <priority> = <positiveNumber> | 'required' | 'strong' | 'medium' | 'weak'
    ///                  <constant> = <number>
    ///              <operatorList> = (<multiplyOperator>)? (<addOperator>)?
    ///          <multiplyOperator> = [ '*' | '/' ] <positiveNumber>
    ///               <addOperator> = [ '+' | '-' ] <positiveNumber>
    ///                  <viewName> = [A-Za-z_]([A-Za-z0-9_]*) // A C identifier
    ///                <metricName> = [A-Za-z_]([A-Za-z0-9_]*) // A C identifier
    ///             <attributeName> = 'top' | 'bottom' | 'left' | 'right' | 'width' | 'height' |
    ///                               'start' | 'end' | 'centerX' | 'centerY' | 'baseline'
    ///            <positiveNumber> // A positive real number parseable by `glib.asciiStrtod`
    ///                    <number> // A real number parseable by `glib.asciiStrtod`
    /// ```
    ///
    /// **Note**: The VFL grammar used by GTK is slightly different than the one
    /// defined by Apple, as it can use symbolic values for the constraint's
    /// strength instead of numeric values; additionally, GTK allows adding
    /// simple arithmetic operations inside predicates.
    ///
    /// Examples of VFL descriptions are:
    ///
    /// ```
    ///   // Default spacing
    ///   [button]-[textField]
    ///
    ///   // Width constraint
    ///   [button(>=50)]
    ///
    ///   // Connection to super view
    ///   |-50-[purpleBox]-50-|
    ///
    ///   // Vertical layout
    ///   V:[topField]-10-[bottomField]
    ///
    ///   // Flush views
    ///   [maroonView][blueView]
    ///
    ///   // Priority
    ///   [button(100`strong`)]
    ///
    ///   // Equal widths
    ///   [button1(==button2)]
    ///
    ///   // Multiple predicates
    ///   [flexibleButton(>=70,<=100)]
    ///
    ///   // A complete line of layout
    ///   |-[find]-[findNext]-[findField(>=20)]-|
    ///
    ///   // Operators
    ///   [button1(button2 / 3 + 50)]
    ///
    ///   // Named attributes
    ///   [button1(==button2.height)]
    /// ```
    extern fn gtk_constraint_layout_add_constraints_from_descriptionv(p_layout: *ConstraintLayout, p_lines: [*]const [*:0]const u8, p_n_lines: usize, p_hspacing: c_int, p_vspacing: c_int, p_views: *glib.HashTable, p_error: ?*?*glib.Error) ?*glib.List;
    pub const addConstraintsFromDescriptionv = gtk_constraint_layout_add_constraints_from_descriptionv;

    /// Adds a guide to `layout`.
    ///
    /// A guide can be used as the source or target of constraints,
    /// like a widget, but it is not visible.
    ///
    /// The `layout` acquires the ownership of `guide` after calling
    /// this function.
    extern fn gtk_constraint_layout_add_guide(p_layout: *ConstraintLayout, p_guide: *gtk.ConstraintGuide) void;
    pub const addGuide = gtk_constraint_layout_add_guide;

    /// Returns a `GListModel` to track the constraints that are
    /// part of the layout.
    ///
    /// Calling this function will enable extra internal bookkeeping
    /// to track constraints 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.
    extern fn gtk_constraint_layout_observe_constraints(p_layout: *ConstraintLayout) *gio.ListModel;
    pub const observeConstraints = gtk_constraint_layout_observe_constraints;

    /// Returns a `GListModel` to track the guides that are
    /// part of the layout.
    ///
    /// Calling this function will enable extra internal bookkeeping
    /// to track guides 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.
    extern fn gtk_constraint_layout_observe_guides(p_layout: *ConstraintLayout) *gio.ListModel;
    pub const observeGuides = gtk_constraint_layout_observe_guides;

    /// Removes all constraints from the layout manager.
    extern fn gtk_constraint_layout_remove_all_constraints(p_layout: *ConstraintLayout) void;
    pub const removeAllConstraints = gtk_constraint_layout_remove_all_constraints;

    /// Removes `constraint` from the layout manager,
    /// so that it no longer influences the layout.
    extern fn gtk_constraint_layout_remove_constraint(p_layout: *ConstraintLayout, p_constraint: *gtk.Constraint) void;
    pub const removeConstraint = gtk_constraint_layout_remove_constraint;

    /// Removes `guide` from the layout manager,
    /// so that it no longer influences the layout.
    extern fn gtk_constraint_layout_remove_guide(p_layout: *ConstraintLayout, p_guide: *gtk.ConstraintGuide) void;
    pub const removeGuide = gtk_constraint_layout_remove_guide;

    extern fn gtk_constraint_layout_get_type() usize;
    pub const getGObjectType = gtk_constraint_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.ConstraintLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ConstraintLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ConstraintLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkLayoutChild` subclass for children in a `GtkConstraintLayout`.
pub const ConstraintLayoutChild = opaque {
    pub const Parent = gtk.LayoutChild;
    pub const Implements = [_]type{};
    pub const Class = gtk.ConstraintLayoutChildClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_constraint_layout_child_get_type() usize;
    pub const getGObjectType = gtk_constraint_layout_child_get_type;

    extern fn g_object_ref(p_self: *gtk.ConstraintLayoutChild) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ConstraintLayoutChild) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ConstraintLayoutChild, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A style provider for CSS.
///
/// It is able to parse CSS-like input in order to style widgets.
///
/// An application can make GTK parse a specific CSS style sheet by calling
/// `gtk.CssProvider.loadFromFile` or
/// `gtk.CssProvider.loadFromResource`
/// and adding the provider with `gtk.StyleContext.addProvider` or
/// `gtk.StyleContext.addProviderForDisplay`.
///
/// In addition, certain files will be read when GTK is initialized.
/// First, the file `$XDG_CONFIG_HOME/gtk-4.0/gtk.css` is loaded if it
/// exists. Then, GTK loads the first existing file among
/// `XDG_DATA_HOME/themes/THEME/gtk-VERSION/gtk-VARIANT.css`,
/// `$HOME/.themes/THEME/gtk-VERSION/gtk-VARIANT.css`,
/// `$XDG_DATA_DIRS/themes/THEME/gtk-VERSION/gtk-VARIANT.css` and
/// `DATADIR/share/themes/THEME/gtk-VERSION/gtk-VARIANT.css`,
/// where `THEME` is the name of the current theme (see the
/// `gtk.Settings.properties.gtk_theme_name` setting), `VARIANT` is the
/// variant to load (see the
/// `gtk.Settings.properties.gtk_application_prefer_dark_theme` setting),
/// `DATADIR` is the prefix configured when GTK was compiled (unless
/// overridden by the `GTK_DATA_PREFIX` environment variable), and
/// `VERSION` is the GTK version number. If no file is found for the
/// current version, GTK tries older versions all the way back to 4.0.
///
/// To track errors while loading CSS, connect to the
/// `gtk.CssProvider.signals.parsing_error` signal.
pub const CssProvider = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.StyleProvider};
    pub const Class = gtk.CssProviderClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Define the color scheme used for rendering the user interface.
        ///
        /// The UI can be set to either `gtk.@"InterfaceColorScheme.LIGHT"`,
        /// or `gtk.@"InterfaceColorScheme.DARK"` mode. Other values will
        /// be interpreted the same as `gtk.@"InterfaceColorScheme.LIGHT"`.
        ///
        /// This setting is be available for media queries in CSS:
        ///
        /// ```css
        /// `media` (prefers-color-scheme: dark) {
        ///   // some dark mode styling
        /// }
        /// ```
        ///
        /// Changing this setting will reload the style sheet.
        pub const prefers_color_scheme = struct {
            pub const name = "prefers-color-scheme";

            pub const Type = gtk.InterfaceColorScheme;
        };

        /// Define the contrast mode to use for the user interface.
        ///
        /// When set to `gtk.@"InterfaceContrast.MORE"` or
        /// `gtk.@"InterfaceContrast.LESS"`, the UI is rendered in
        /// high or low contrast.
        ///
        /// When set to `gtk.@"InterfaceContrast.NO_PREFERENCE"` (the default),
        /// the user interface will be rendered in default mode.
        ///
        /// This setting is be available for media queries in CSS:
        ///
        /// ```css
        /// `media` (prefers-contrast: more) {
        ///   // some style with high contrast
        /// }
        /// ```
        ///
        /// Changing this setting will reload the style sheet.
        pub const prefers_contrast = struct {
            pub const name = "prefers-contrast";

            pub const Type = gtk.InterfaceContrast;
        };

        /// Define the type of reduced motion to use for the user interface.
        ///
        /// When set to `gtk.@"ReducedMotion.REDUCE"` the UI is rendered in
        /// with reduced motion animations.
        ///
        /// When set to `gtk.@"ReducedMotion.NO_PREFERENCE"` (the default),
        /// the user interface will be rendered in default mode.
        ///
        /// This setting is be available for media queries in CSS:
        ///
        /// ```css
        /// `media` (prefers-reduced-motion: reduce) {
        ///   // some style with reduced motion
        /// }
        /// ```
        ///
        /// Changing this setting will reload the style sheet.
        pub const prefers_reduced_motion = struct {
            pub const name = "prefers-reduced-motion";

            pub const Type = gtk.ReducedMotion;
        };
    };

    pub const signals = struct {
        /// Signals that a parsing error occurred.
        ///
        /// The expected error values are in the `gtk.CssParserError`
        /// and `gtk.CssParserWarning` enumerations.
        ///
        /// The `path`, `line` and `position` describe the actual location of
        /// the error as accurately as possible.
        ///
        /// Parsing errors are never fatal, so the parsing will resume after
        /// the error. Errors may however cause parts of the given data or
        /// even all of it to not be parsed at all. So it is a useful idea
        /// to check that the parsing succeeds by connecting to this signal.
        ///
        /// Errors in the `gtk.CssParserWarning` enumeration should not
        /// be treated as fatal errors.
        ///
        /// Note that this signal may be emitted at any time as the css provider
        /// may opt to defer parsing parts or all of the input to a later time
        /// than when a loading function was called.
        pub const parsing_error = struct {
            pub const name = "parsing-error";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_section: *gtk.CssSection, p_error: *glib.Error, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CssProvider, p_instance))),
                    gobject.signalLookup("parsing-error", CssProvider.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkCssProvider`.
    extern fn gtk_css_provider_new() *gtk.CssProvider;
    pub const new = gtk_css_provider_new;

    /// Loads `data` into `css_provider`.
    ///
    /// This clears any previously loaded information.
    extern fn gtk_css_provider_load_from_bytes(p_css_provider: *CssProvider, p_data: *glib.Bytes) void;
    pub const loadFromBytes = gtk_css_provider_load_from_bytes;

    /// Loads `data` into `css_provider`.
    ///
    /// This clears any previously loaded information.
    extern fn gtk_css_provider_load_from_data(p_css_provider: *CssProvider, p_data: [*:0]const u8, p_length: isize) void;
    pub const loadFromData = gtk_css_provider_load_from_data;

    /// Loads the data contained in `file` into `css_provider`.
    ///
    /// This clears any previously loaded information.
    extern fn gtk_css_provider_load_from_file(p_css_provider: *CssProvider, p_file: *gio.File) void;
    pub const loadFromFile = gtk_css_provider_load_from_file;

    /// Loads the data contained in `path` into `css_provider`.
    ///
    /// This clears any previously loaded information.
    extern fn gtk_css_provider_load_from_path(p_css_provider: *CssProvider, p_path: [*:0]const u8) void;
    pub const loadFromPath = gtk_css_provider_load_from_path;

    /// Loads the data contained in the resource at `resource_path` into
    /// the `css_provider`.
    ///
    /// This clears any previously loaded information.
    extern fn gtk_css_provider_load_from_resource(p_css_provider: *CssProvider, p_resource_path: [*:0]const u8) void;
    pub const loadFromResource = gtk_css_provider_load_from_resource;

    /// Loads `string` into `css_provider`.
    ///
    /// This clears any previously loaded information.
    extern fn gtk_css_provider_load_from_string(p_css_provider: *CssProvider, p_string: [*:0]const u8) void;
    pub const loadFromString = gtk_css_provider_load_from_string;

    /// Loads a theme from the usual theme paths.
    ///
    /// The actual process of finding the theme might change between
    /// releases, but it is guaranteed that this function uses the same
    /// mechanism to load the theme that GTK uses for loading its own theme.
    extern fn gtk_css_provider_load_named(p_provider: *CssProvider, p_name: [*:0]const u8, p_variant: ?[*:0]const u8) void;
    pub const loadNamed = gtk_css_provider_load_named;

    /// Converts the `provider` into a string representation in CSS
    /// format.
    ///
    /// Using `gtk.CssProvider.loadFromString` with the return
    /// value from this function on a new provider created with
    /// `gtk.CssProvider.new` will basically create a duplicate
    /// of this `provider`.
    extern fn gtk_css_provider_to_string(p_provider: *CssProvider) [*:0]u8;
    pub const toString = gtk_css_provider_to_string;

    extern fn gtk_css_provider_get_type() usize;
    pub const getGObjectType = gtk_css_provider_get_type;

    extern fn g_object_ref(p_self: *gtk.CssProvider) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CssProvider) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CssProvider, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines whether to include items with a callback.
pub const CustomFilter = opaque {
    pub const Parent = gtk.Filter;
    pub const Implements = [_]type{};
    pub const Class = gtk.CustomFilterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new filter using the given function to filter items.
    ///
    /// If `match_func` is `NULL`, the filter matches all items.
    ///
    /// If the filter func changes its filtering behavior,
    /// `gtk.Filter.changed` needs to be called.
    extern fn gtk_custom_filter_new(p_match_func: ?gtk.CustomFilterFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) *gtk.CustomFilter;
    pub const new = gtk_custom_filter_new;

    /// Sets the function used for filtering items.
    ///
    /// If `match_func` is `NULL`, the filter matches all items.
    ///
    /// If the filter func changes its filtering behavior,
    /// `gtk.Filter.changed` needs to be called.
    ///
    /// If a previous function was set, its `user_destroy`
    /// will be called.
    extern fn gtk_custom_filter_set_filter_func(p_self: *CustomFilter, p_match_func: ?gtk.CustomFilterFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) void;
    pub const setFilterFunc = gtk_custom_filter_set_filter_func;

    extern fn gtk_custom_filter_get_type() usize;
    pub const getGObjectType = gtk_custom_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.CustomFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CustomFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CustomFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Uses closures for size negotiation.
///
/// A `GtkCustomLayout` uses closures matching to the old `GtkWidget`
/// virtual functions for size negotiation, as a convenience API to
/// ease the porting towards the corresponding `GtkLayoutManager`
/// virtual functions.
pub const CustomLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{};
    pub const Class = gtk.CustomLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new legacy layout manager.
    ///
    /// Legacy layout managers map to the old `GtkWidget` size negotiation
    /// virtual functions, and are meant to be used during the transition
    /// from layout containers to layout manager delegates.
    extern fn gtk_custom_layout_new(p_request_mode: ?gtk.CustomRequestModeFunc, p_measure: gtk.CustomMeasureFunc, p_allocate: gtk.CustomAllocateFunc) *gtk.CustomLayout;
    pub const new = gtk_custom_layout_new;

    extern fn gtk_custom_layout_get_type() usize;
    pub const getGObjectType = gtk_custom_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.CustomLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CustomLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CustomLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Sorts items via a callback function.
pub const CustomSorter = opaque {
    pub const Parent = gtk.Sorter;
    pub const Implements = [_]type{};
    pub const Class = gtk.CustomSorterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkSorter` that works by calling
    /// `sort_func` to compare items.
    ///
    /// If `sort_func` is `NULL`, all items are considered equal.
    extern fn gtk_custom_sorter_new(p_sort_func: ?glib.CompareDataFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) *gtk.CustomSorter;
    pub const new = gtk_custom_sorter_new;

    /// Sets (or unsets) the function used for sorting items.
    ///
    /// If `sort_func` is `NULL`, all items are considered equal.
    ///
    /// If the sort func changes its sorting behavior,
    /// `gtk.Sorter.changed` needs to be called.
    ///
    /// If a previous function was set, its `user_destroy` will be
    /// called now.
    extern fn gtk_custom_sorter_set_sort_func(p_self: *CustomSorter, p_sort_func: ?glib.CompareDataFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) void;
    pub const setSortFunc = gtk_custom_sorter_set_sort_func;

    extern fn gtk_custom_sorter_get_type() usize;
    pub const getGObjectType = gtk_custom_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.CustomSorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CustomSorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CustomSorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Dialogs are a convenient way to prompt the user for a small amount
/// of input.
///
/// <picture>
///   <source srcset="dialog-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkDialog" src="dialog.png">
/// </picture>
///
/// Typical uses are to display a message, ask a question, or anything else
/// that does not require extensive effort on the user’s part.
///
/// The main area of a `GtkDialog` is called the "content area", and is yours
/// to populate with widgets such a `GtkLabel` or `GtkEntry`, to present
/// your information, questions, or tasks to the user.
///
/// In addition, dialogs allow you to add "action widgets". Most commonly,
/// action widgets are buttons. Depending on the platform, action widgets may
/// be presented in the header bar at the top of the window, or at the bottom
/// of the window. To add action widgets, create your `GtkDialog` using
/// `gtk.Dialog.newWithButtons`, or use
/// `gtk.Dialog.addButton`, `gtk.Dialog.addButtons`,
/// or `gtk.Dialog.addActionWidget`.
///
/// `GtkDialogs` uses some heuristics to decide whether to add a close
/// button to the window decorations. If any of the action buttons use
/// the response ID `GTK_RESPONSE_CLOSE` or `GTK_RESPONSE_CANCEL`, the
/// close button is omitted.
///
/// Clicking a button that was added as an action widget will emit the
/// `gtk.Dialog.signals.response` signal with a response ID that you specified.
/// GTK will never assign a meaning to positive response IDs; these are
/// entirely user-defined. But for convenience, you can use the response
/// IDs in the `gtk.ResponseType` enumeration (these all have values
/// less than zero). If a dialog receives a delete event, the
/// `gtk.Dialog.signals.response` signal will be emitted with the
/// `GTK_RESPONSE_DELETE_EVENT` response ID.
///
/// Dialogs are created with a call to `gtk.Dialog.new` or
/// `gtk.Dialog.newWithButtons`. The latter is recommended; it allows
/// you to set the dialog title, some convenient flags, and add buttons.
///
/// A “modal” dialog (that is, one which freezes the rest of the application
/// from user input), can be created by calling `gtk.Window.setModal`
/// on the dialog. When using `gtk.Dialog.newWithButtons`, you can also
/// pass the `GTK_DIALOG_MODAL` flag to make a dialog modal.
///
/// For the simple dialog in the following example, a `gtk.MessageDialog`
/// would save some effort. But you’d need to create the dialog contents manually
/// if you had more than a simple message in the dialog.
///
/// An example for simple `GtkDialog` usage:
///
/// ```c
/// // Function to open a dialog box with a message
/// void
/// quick_message (GtkWindow *parent, char *message)
/// {
///  GtkWidget *dialog, *label, *content_area;
///  GtkDialogFlags flags;
///
///  // Create the widgets
///  flags = GTK_DIALOG_DESTROY_WITH_PARENT;
///  dialog = gtk_dialog_new_with_buttons ("Message",
///                                        parent,
///                                        flags,
///                                        _("_OK"),
///                                        GTK_RESPONSE_NONE,
///                                        NULL);
///  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
///  label = gtk_label_new (message);
///
///  // Ensure that the dialog box is destroyed when the user responds
///
///  g_signal_connect_swapped (dialog,
///                            "response",
///                            G_CALLBACK (gtk_window_destroy),
///                            dialog);
///
///  // Add the label, and show everything we’ve added
///
///  gtk_box_append (GTK_BOX (content_area), label);
///  gtk_widget_show (dialog);
/// }
/// ```
///
/// # GtkDialog as GtkBuildable
///
/// The `GtkDialog` implementation of the `GtkBuildable` interface exposes the
/// `content_area` as an internal child with the name “content_area”.
///
/// `GtkDialog` supports a custom `<action-widgets>` element, which can contain
/// multiple `<action-widget>` elements. The “response” attribute specifies a
/// numeric response, and the content of the element is the id of widget
/// (which should be a child of the dialogs `action_area`). To mark a response
/// as default, set the “default” attribute of the `<action-widget>` element
/// to true.
///
/// `GtkDialog` supports adding action widgets by specifying “action” as
/// the “type” attribute of a `<child>` element. The widget will be added
/// either to the action area or the headerbar of the dialog, depending
/// on the “use-header-bar” property. The response id has to be associated
/// with the action widget using the `<action-widgets>` element.
///
/// An example of a `GtkDialog` UI definition fragment:
///
/// ```xml
/// <object class="GtkDialog" id="dialog1">
///   <child type="action">
///     <object class="GtkButton" id="button_cancel"/>
///   </child>
///   <child type="action">
///     <object class="GtkButton" id="button_ok">
///     </object>
///   </child>
///   <action-widgets>
///     <action-widget response="cancel">button_cancel</action-widget>
///     <action-widget response="ok" default="true">button_ok</action-widget>
///   </action-widgets>
/// </object>
/// ```
///
/// # Accessibility
///
/// `GtkDialog` uses the `GTK_ACCESSIBLE_ROLE_DIALOG` role.
pub const Dialog = extern struct {
    pub const Parent = gtk.Window;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = gtk.DialogClass;
    f_parent_instance: gtk.Window,

    pub const virtual_methods = struct {
        /// Signal emitted when the user uses a keybinding to close the dialog.
        pub const close = struct {
            pub fn call(p_class: anytype, p_dialog: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Dialog.Class, p_class).f_close.?(gobject.ext.as(Dialog, p_dialog));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_dialog: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Dialog.Class, p_class).f_close = @ptrCast(p_implementation);
            }
        };

        /// Emits the ::response signal with the given response ID.
        ///
        /// Used to indicate that the user has responded to the dialog in some way.
        pub const response = struct {
            pub fn call(p_class: anytype, p_dialog: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_response_id: c_int) void {
                return gobject.ext.as(Dialog.Class, p_class).f_response.?(gobject.ext.as(Dialog, p_dialog), p_response_id);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_dialog: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_response_id: c_int) callconv(.c) void) void {
                gobject.ext.as(Dialog.Class, p_class).f_response = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// `TRUE` if the dialog uses a headerbar for action buttons
        /// instead of the action-area.
        ///
        /// For technical reasons, this property is declared as an integer
        /// property, but you should only set it to `TRUE` or `FALSE`.
        ///
        /// ## Creating a dialog with headerbar
        ///
        /// Builtin `GtkDialog` subclasses such as `gtk.ColorChooserDialog`
        /// set this property according to platform conventions (using the
        /// `gtk.Settings.properties.gtk_dialogs_use_header` setting).
        ///
        /// Here is how you can achieve the same:
        ///
        /// ```c
        /// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
        /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
        /// ```
        pub const use_header_bar = struct {
            pub const name = "use-header-bar";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the user uses a keybinding to close the dialog.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is the Escape key.
        pub const close = struct {
            pub const name = "close";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Dialog, p_instance))),
                    gobject.signalLookup("close", Dialog.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when an action widget is clicked.
        ///
        /// The signal is also emitted when the dialog receives a
        /// delete event, and when `gtk.Dialog.response` is called.
        /// On a delete event, the response ID is `GTK_RESPONSE_DELETE_EVENT`.
        /// Otherwise, it depends on which action widget was clicked.
        pub const response = struct {
            pub const name = "response";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_response_id: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Dialog, p_instance))),
                    gobject.signalLookup("response", Dialog.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new dialog box.
    ///
    /// Widgets should not be packed into the `GtkWindow`
    /// directly, but into the `content_area` and `action_area`,
    /// as described above.
    extern fn gtk_dialog_new() *gtk.Dialog;
    pub const new = gtk_dialog_new;

    /// Creates a new `GtkDialog` with the given title and transient parent.
    ///
    /// The `flags` argument can be used to make the dialog modal, have it
    /// destroyed along with its transient parent, or make it use a headerbar.
    ///
    /// Button text/response ID pairs should be listed in pairs, with a `NULL`
    /// pointer ending the list. Button text can be arbitrary text. A response
    /// ID can be any positive number, or one of the values in the
    /// `gtk.ResponseType` enumeration. If the user clicks one of these
    /// buttons, `GtkDialog` will emit the `gtk.Dialog.signals.response` signal
    /// with the corresponding response ID.
    ///
    /// If a `GtkDialog` receives a delete event, it will emit ::response with a
    /// response ID of `GTK_RESPONSE_DELETE_EVENT`.
    ///
    /// However, destroying a dialog does not emit the ::response signal;
    /// so be careful relying on ::response when using the
    /// `GTK_DIALOG_DESTROY_WITH_PARENT` flag.
    ///
    /// Here’s a simple example:
    /// ```c
    /// GtkWindow *main_app_window; // Window the dialog should show up on
    /// GtkWidget *dialog;
    /// GtkDialogFlags flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
    /// dialog = gtk_dialog_new_with_buttons ("My dialog",
    ///                                       main_app_window,
    ///                                       flags,
    ///                                       _("_OK"),
    ///                                       GTK_RESPONSE_ACCEPT,
    ///                                       _("_Cancel"),
    ///                                       GTK_RESPONSE_REJECT,
    ///                                       NULL);
    /// ```
    extern fn gtk_dialog_new_with_buttons(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window, p_flags: gtk.DialogFlags, p_first_button_text: ?[*:0]const u8, ...) *gtk.Dialog;
    pub const newWithButtons = gtk_dialog_new_with_buttons;

    /// Adds an activatable widget to the action area of a `GtkDialog`.
    ///
    /// GTK connects a signal handler that will emit the
    /// `gtk.Dialog.signals.response` signal on the dialog when the widget
    /// is activated. The widget is appended to the end of the dialog’s action
    /// area.
    ///
    /// If you want to add a non-activatable widget, simply pack it into
    /// the `action_area` field of the `GtkDialog` struct.
    extern fn gtk_dialog_add_action_widget(p_dialog: *Dialog, p_child: *gtk.Widget, p_response_id: c_int) void;
    pub const addActionWidget = gtk_dialog_add_action_widget;

    /// Adds a button with the given text.
    ///
    /// GTK arranges things so that clicking the button will emit the
    /// `gtk.Dialog.signals.response` signal with the given `response_id`.
    /// The button is appended to the end of the dialog’s action area.
    /// The button widget is returned, but usually you don’t need it.
    extern fn gtk_dialog_add_button(p_dialog: *Dialog, p_button_text: [*:0]const u8, p_response_id: c_int) *gtk.Widget;
    pub const addButton = gtk_dialog_add_button;

    /// Adds multiple buttons.
    ///
    /// This is the same as calling `gtk.Dialog.addButton`
    /// repeatedly. The variable argument list should be `NULL`-terminated
    /// as with `gtk.Dialog.newWithButtons`. Each button must have both
    /// text and response ID.
    extern fn gtk_dialog_add_buttons(p_dialog: *Dialog, p_first_button_text: [*:0]const u8, ...) void;
    pub const addButtons = gtk_dialog_add_buttons;

    /// Returns the content area of `dialog`.
    extern fn gtk_dialog_get_content_area(p_dialog: *Dialog) *gtk.Box;
    pub const getContentArea = gtk_dialog_get_content_area;

    /// Returns the header bar of `dialog`.
    ///
    /// Note that the headerbar is only used by the dialog if the
    /// `gtk.Dialog.properties.use_header_bar` property is `TRUE`.
    extern fn gtk_dialog_get_header_bar(p_dialog: *Dialog) *gtk.HeaderBar;
    pub const getHeaderBar = gtk_dialog_get_header_bar;

    /// Gets the response id of a widget in the action area
    /// of a dialog.
    extern fn gtk_dialog_get_response_for_widget(p_dialog: *Dialog, p_widget: *gtk.Widget) c_int;
    pub const getResponseForWidget = gtk_dialog_get_response_for_widget;

    /// Gets the widget button that uses the given response ID in the action area
    /// of a dialog.
    extern fn gtk_dialog_get_widget_for_response(p_dialog: *Dialog, p_response_id: c_int) ?*gtk.Widget;
    pub const getWidgetForResponse = gtk_dialog_get_widget_for_response;

    /// Emits the ::response signal with the given response ID.
    ///
    /// Used to indicate that the user has responded to the dialog in some way.
    extern fn gtk_dialog_response(p_dialog: *Dialog, p_response_id: c_int) void;
    pub const response = gtk_dialog_response;

    /// Sets the default widget for the dialog based on the response ID.
    ///
    /// Pressing “Enter” normally activates the default widget.
    extern fn gtk_dialog_set_default_response(p_dialog: *Dialog, p_response_id: c_int) void;
    pub const setDefaultResponse = gtk_dialog_set_default_response;

    /// A convenient way to sensitize/desensitize dialog buttons.
    ///
    /// Calls `gtk_widget_set_sensitive (widget, `setting`)`
    /// for each widget in the dialog’s action area with the given `response_id`.
    extern fn gtk_dialog_set_response_sensitive(p_dialog: *Dialog, p_response_id: c_int, p_setting: c_int) void;
    pub const setResponseSensitive = gtk_dialog_set_response_sensitive;

    extern fn gtk_dialog_get_type() usize;
    pub const getGObjectType = gtk_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.Dialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Dialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Dialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that wraps `gio.File.enumerateChildrenAsync`.
///
/// It presents a `GListModel` and fills it asynchronously with the `GFileInfo`s
/// returned from that function.
///
/// Enumeration will start automatically when the
/// `gtk.DirectoryList.properties.file` property is set.
///
/// While the `GtkDirectoryList` is being filled, the
/// `gtk.DirectoryList.properties.loading` property will be set to `TRUE`. You can
/// listen to that property if you want to show information like a `GtkSpinner`
/// or a "Loading..." text.
///
/// If loading fails at any point, the `gtk.DirectoryList.properties.@"error"`
/// property will be set to give more indication about the failure.
///
/// The `GFileInfo`s returned from a `GtkDirectoryList` have the "standard::file"
/// attribute set to the `GFile` they refer to. This way you can get at the file
/// that is referred to in the same way you would via `gio.FileEnumerator.getChild`.
/// This means you do not need access to the `GtkDirectoryList`, but can access
/// the `GFile` directly from the `GFileInfo` when operating with a `GtkListView`
/// or similar.
pub const DirectoryList = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gio.ListModel};
    pub const Class = gtk.DirectoryListClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The attributes to query.
        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?[*:0]u8;
        };

        /// Error encountered while loading files.
        pub const @"error" = struct {
            pub const name = "error";

            pub const Type = ?*glib.Error;
        };

        /// File to query.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?*gio.File;
        };

        /// Priority used when loading.
        pub const io_priority = struct {
            pub const name = "io-priority";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// `TRUE` if files are being loaded.
        pub const loading = struct {
            pub const name = "loading";

            pub const Type = c_int;
        };

        /// `TRUE` if the directory is monitored for changed.
        pub const monitored = struct {
            pub const name = "monitored";

            pub const Type = c_int;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkDirectoryList`.
    ///
    /// The `GtkDirectoryList` is querying the given `file`
    /// with the given `attributes`.
    extern fn gtk_directory_list_new(p_attributes: ?[*:0]const u8, p_file: ?*gio.File) *gtk.DirectoryList;
    pub const new = gtk_directory_list_new;

    /// Gets the attributes queried on the children.
    extern fn gtk_directory_list_get_attributes(p_self: *DirectoryList) ?[*:0]const u8;
    pub const getAttributes = gtk_directory_list_get_attributes;

    /// Gets the loading error, if any.
    ///
    /// If an error occurs during the loading process, the loading process
    /// will finish and this property allows querying the error that happened.
    /// This error will persist until a file is loaded again.
    ///
    /// An error being set does not mean that no files were loaded, and all
    /// successfully queried files will remain in the list.
    extern fn gtk_directory_list_get_error(p_self: *DirectoryList) ?*const glib.Error;
    pub const getError = gtk_directory_list_get_error;

    /// Gets the file whose children are currently enumerated.
    extern fn gtk_directory_list_get_file(p_self: *DirectoryList) ?*gio.File;
    pub const getFile = gtk_directory_list_get_file;

    /// Gets the IO priority set via `gtk.DirectoryList.setIoPriority`.
    extern fn gtk_directory_list_get_io_priority(p_self: *DirectoryList) c_int;
    pub const getIoPriority = gtk_directory_list_get_io_priority;

    /// Returns whether the directory list is monitoring
    /// the directory for changes.
    extern fn gtk_directory_list_get_monitored(p_self: *DirectoryList) c_int;
    pub const getMonitored = gtk_directory_list_get_monitored;

    /// Returns `TRUE` if the children enumeration is currently in
    /// progress.
    ///
    /// Files will be added to `self` from time to time while loading is
    /// going on. The order in which are added is undefined and may change
    /// in between runs.
    extern fn gtk_directory_list_is_loading(p_self: *DirectoryList) c_int;
    pub const isLoading = gtk_directory_list_is_loading;

    /// Sets the `attributes` to be enumerated and starts the enumeration.
    ///
    /// If `attributes` is `NULL`, the list of file infos will still be created, it will just
    /// not contain any extra attributes.
    extern fn gtk_directory_list_set_attributes(p_self: *DirectoryList, p_attributes: ?[*:0]const u8) void;
    pub const setAttributes = gtk_directory_list_set_attributes;

    /// Sets the `file` to be enumerated and starts the enumeration.
    ///
    /// If `file` is `NULL`, the result will be an empty list.
    extern fn gtk_directory_list_set_file(p_self: *DirectoryList, p_file: ?*gio.File) void;
    pub const setFile = gtk_directory_list_set_file;

    /// Sets the IO priority to use while loading directories.
    ///
    /// Setting the priority while `self` is loading will reprioritize the
    /// ongoing load as soon as possible.
    ///
    /// The default IO priority is `G_PRIORITY_DEFAULT`, which is higher than
    /// the GTK redraw priority. If you are loading a lot of directories in
    /// parallel, lowering it to something like `G_PRIORITY_DEFAULT_IDLE`
    /// may increase responsiveness.
    extern fn gtk_directory_list_set_io_priority(p_self: *DirectoryList, p_io_priority: c_int) void;
    pub const setIoPriority = gtk_directory_list_set_io_priority;

    /// Sets whether the directory list will monitor the directory
    /// for changes.
    ///
    /// If monitoring is enabled, the ::items-changed signal will
    /// be emitted when the directory contents change.
    ///
    ///
    /// When monitoring is turned on after the initial creation
    /// of the directory list, the directory is reloaded to avoid
    /// missing files that appeared between the initial loading
    /// and when monitoring was turned on.
    extern fn gtk_directory_list_set_monitored(p_self: *DirectoryList, p_monitored: c_int) void;
    pub const setMonitored = gtk_directory_list_set_monitored;

    extern fn gtk_directory_list_get_type() usize;
    pub const getGObjectType = gtk_directory_list_get_type;

    extern fn g_object_ref(p_self: *gtk.DirectoryList) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DirectoryList) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DirectoryList, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkRoot` implementation for drag icons.
///
/// A drag icon moves with the pointer during a Drag-and-Drop operation
/// and is destroyed when the drag ends.
///
/// To set up a drag icon and associate it with an ongoing drag operation,
/// use `gtk.DragIcon.getForDrag` to get the icon for a drag. You can
/// then use it like any other widget and use `gtk.DragIcon.setChild`
/// to set whatever widget should be used for the drag icon.
///
/// Keep in mind that drag icons do not allow user input.
pub const DragIcon = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root };
    pub const Class = gtk.DragIconClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The widget to display as drag icon.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {};

    /// Creates a widget that can be used as a drag icon for the given
    /// `value`.
    ///
    /// Supported types include strings, `GdkRGBA` and `GtkTextBuffer`.
    /// If GTK does not know how to create a widget for a given value,
    /// it will return `NULL`.
    ///
    /// This method is used to set the default drag icon on drag-and-drop
    /// operations started by `GtkDragSource`, so you don't need to set
    /// a drag icon using this function there.
    extern fn gtk_drag_icon_create_widget_for_value(p_value: *const gobject.Value) ?*gtk.Widget;
    pub const createWidgetForValue = gtk_drag_icon_create_widget_for_value;

    /// Creates a `GtkDragIcon` that shows `paintable`, and associates
    /// it with the drag operation.
    ///
    /// The hotspot position on the paintable is aligned with the
    /// hotspot of the cursor.
    extern fn gtk_drag_icon_set_from_paintable(p_drag: *gdk.Drag, p_paintable: *gdk.Paintable, p_hot_x: c_int, p_hot_y: c_int) void;
    pub const setFromPaintable = gtk_drag_icon_set_from_paintable;

    /// Gets the `GtkDragIcon` in use with `drag`.
    ///
    /// If no drag icon exists yet, a new one will be created
    /// and shown.
    extern fn gtk_drag_icon_get_for_drag(p_drag: *gdk.Drag) *gtk.DragIcon;
    pub const getForDrag = gtk_drag_icon_get_for_drag;

    /// Gets the widget currently used as drag icon.
    extern fn gtk_drag_icon_get_child(p_self: *DragIcon) ?*gtk.Widget;
    pub const getChild = gtk_drag_icon_get_child;

    /// Sets the widget to display as the drag icon.
    extern fn gtk_drag_icon_set_child(p_self: *DragIcon, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_drag_icon_set_child;

    extern fn gtk_drag_icon_get_type() usize;
    pub const getGObjectType = gtk_drag_icon_get_type;

    extern fn g_object_ref(p_self: *gtk.DragIcon) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DragIcon) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DragIcon, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An event controller to initiate Drag-And-Drop operations.
///
/// `GtkDragSource` can be set up with the necessary
/// ingredients for a DND operation ahead of time. This includes
/// the source for the data that is being transferred, in the form
/// of a `gdk.ContentProvider`, the desired action, and the icon to
/// use during the drag operation. After setting it up, the drag
/// source must be added to a widget as an event controller, using
/// `gtk.Widget.addController`.
///
/// ```c
/// static void
/// my_widget_init (MyWidget *self)
/// {
///   GtkDragSource *drag_source = gtk_drag_source_new ();
///
///   g_signal_connect (drag_source, "prepare", G_CALLBACK (on_drag_prepare), self);
///   g_signal_connect (drag_source, "drag-begin", G_CALLBACK (on_drag_begin), self);
///
///   gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag_source));
/// }
/// ```
///
/// Setting up the content provider and icon ahead of time only makes
/// sense when the data does not change. More commonly, you will want
/// to set them up just in time. To do so, `GtkDragSource` has
/// `gtk.DragSource.signals.prepare` and `gtk.DragSource.signals.drag_begin`
/// signals.
///
/// The ::prepare signal is emitted before a drag is started, and
/// can be used to set the content provider and actions that the
/// drag should be started with.
///
/// ```c
/// static GdkContentProvider *
/// on_drag_prepare (GtkDragSource *source,
///                  double         x,
///                  double         y,
///                  MyWidget      *self)
/// {
///   // This widget supports two types of content: GFile objects
///   // and GdkPixbuf objects; GTK will handle the serialization
///   // of these types automatically
///   GFile *file = my_widget_get_file (self);
///   GdkPixbuf *pixbuf = my_widget_get_pixbuf (self);
///
///   return gdk_content_provider_new_union ((GdkContentProvider *[2]) {
///       gdk_content_provider_new_typed (G_TYPE_FILE, file),
///       gdk_content_provider_new_typed (GDK_TYPE_PIXBUF, pixbuf),
///     }, 2);
/// }
/// ```
///
/// The ::drag-begin signal is emitted after the `GdkDrag` object has
/// been created, and can be used to set up the drag icon.
///
/// ```c
/// static void
/// on_drag_begin (GtkDragSource *source,
///                GdkDrag       *drag,
///                MyWidget      *self)
/// {
///   // Set the widget as the drag icon
///   GdkPaintable *paintable = gtk_widget_paintable_new (GTK_WIDGET (self));
///   gtk_drag_source_set_icon (source, paintable, 0, 0);
///   g_object_unref (paintable);
/// }
/// ```
///
/// During the DND operation, `GtkDragSource` emits signals that
/// can be used to obtain updates about the status of the operation,
/// but it is not normally necessary to connect to any signals,
/// except for one case: when the supported actions include
/// `GDK_ACTION_MOVE`, you need to listen for the
/// `gtk.DragSource.signals.drag_end` signal and delete the
/// data after it has been transferred.
pub const DragSource = opaque {
    pub const Parent = gtk.GestureSingle;
    pub const Implements = [_]type{};
    pub const Class = gtk.DragSourceClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The actions that are supported by drag operations from the source.
        ///
        /// Note that you must handle the `gtk.DragSource.signals.drag_end` signal
        /// if the actions include `GDK_ACTION_MOVE`.
        pub const actions = struct {
            pub const name = "actions";

            pub const Type = gdk.DragAction;
        };

        /// The data that is offered by drag operations from this source.
        pub const content = struct {
            pub const name = "content";

            pub const Type = ?*gdk.ContentProvider;
        };
    };

    pub const signals = struct {
        /// Emitted on the drag source when a drag is started.
        ///
        /// It can be used to e.g. set a custom drag icon with
        /// `gtk.DragSource.setIcon`.
        pub const drag_begin = struct {
            pub const name = "drag-begin";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drag: *gdk.Drag, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DragSource, p_instance))),
                    gobject.signalLookup("drag-begin", DragSource.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drag source when a drag has failed.
        ///
        /// The signal handler may handle a failed drag operation based on
        /// the type of error. It should return `TRUE` if the failure has been handled
        /// and the default "drag operation failed" animation should not be shown.
        pub const drag_cancel = struct {
            pub const name = "drag-cancel";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drag: *gdk.Drag, p_reason: gdk.DragCancelReason, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DragSource, p_instance))),
                    gobject.signalLookup("drag-cancel", DragSource.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drag source when a drag is finished.
        ///
        /// A typical reason to connect to this signal is to undo
        /// things done in `gtk.DragSource.signals.prepare` or
        /// `gtk.DragSource.signals.drag_begin` handlers.
        pub const drag_end = struct {
            pub const name = "drag-end";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drag: *gdk.Drag, p_delete_data: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DragSource, p_instance))),
                    gobject.signalLookup("drag-end", DragSource.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a drag is about to be initiated.
        ///
        /// It returns the `GdkContentProvider` to use for the drag that is about
        /// to start. The default handler for this signal returns the value of
        /// the `gtk.DragSource.properties.content` property, so if you set up that
        /// property ahead of time, you don't need to connect to this signal.
        pub const prepare = struct {
            pub const name = "prepare";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) ?*gdk.ContentProvider, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DragSource, p_instance))),
                    gobject.signalLookup("prepare", DragSource.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkDragSource` object.
    extern fn gtk_drag_source_new() *gtk.DragSource;
    pub const new = gtk_drag_source_new;

    /// Cancels a currently ongoing drag operation.
    extern fn gtk_drag_source_drag_cancel(p_source: *DragSource) void;
    pub const dragCancel = gtk_drag_source_drag_cancel;

    /// Gets the actions that are currently set on the `GtkDragSource`.
    extern fn gtk_drag_source_get_actions(p_source: *DragSource) gdk.DragAction;
    pub const getActions = gtk_drag_source_get_actions;

    /// Gets the current content provider of a `GtkDragSource`.
    extern fn gtk_drag_source_get_content(p_source: *DragSource) ?*gdk.ContentProvider;
    pub const getContent = gtk_drag_source_get_content;

    /// Returns the underlying `GdkDrag` object for an ongoing drag.
    extern fn gtk_drag_source_get_drag(p_source: *DragSource) ?*gdk.Drag;
    pub const getDrag = gtk_drag_source_get_drag;

    /// Sets the actions on the `GtkDragSource`.
    ///
    /// During a DND operation, the actions are offered to potential
    /// drop targets. If `actions` include `GDK_ACTION_MOVE`, you need
    /// to listen to the `gtk.DragSource.signals.drag_end` signal and
    /// handle `delete_data` being `TRUE`.
    ///
    /// This function can be called before a drag is started,
    /// or in a handler for the `gtk.DragSource.signals.prepare` signal.
    extern fn gtk_drag_source_set_actions(p_source: *DragSource, p_actions: gdk.DragAction) void;
    pub const setActions = gtk_drag_source_set_actions;

    /// Sets a content provider on a `GtkDragSource`.
    ///
    /// When the data is requested in the cause of a DND operation,
    /// it will be obtained from the content provider.
    ///
    /// This function can be called before a drag is started,
    /// or in a handler for the `gtk.DragSource.signals.prepare` signal.
    ///
    /// You may consider setting the content provider back to
    /// `NULL` in a `gtk.DragSource.signals.drag_end` signal handler.
    extern fn gtk_drag_source_set_content(p_source: *DragSource, p_content: ?*gdk.ContentProvider) void;
    pub const setContent = gtk_drag_source_set_content;

    /// Sets a paintable to use as icon during DND operations.
    ///
    /// The hotspot coordinates determine the point on the icon
    /// that gets aligned with the hotspot of the cursor.
    ///
    /// If `paintable` is `NULL`, a default icon is used.
    ///
    /// This function can be called before a drag is started, or in
    /// a `gtk.DragSource.signals.prepare` or
    /// `gtk.DragSource.signals.drag_begin` signal handler.
    extern fn gtk_drag_source_set_icon(p_source: *DragSource, p_paintable: ?*gdk.Paintable, p_hot_x: c_int, p_hot_y: c_int) void;
    pub const setIcon = gtk_drag_source_set_icon;

    extern fn gtk_drag_source_get_type() usize;
    pub const getGObjectType = gtk_drag_source_get_type;

    extern fn g_object_ref(p_self: *gtk.DragSource) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DragSource) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DragSource, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows drawing with cairo.
///
/// <picture>
///   <source srcset="drawingarea-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkDrawingArea" src="drawingarea.png">
/// </picture>
///
/// It’s essentially a blank widget; you can draw on it. After
/// creating a drawing area, the application may want to connect to:
///
/// - The `gtk.Widget.signals.realize` signal to take any necessary actions
///   when the widget is instantiated on a particular display.
///   (Create GDK resources in response to this signal.)
///
/// - The `gtk.DrawingArea.signals.resize` signal to take any necessary
///   actions when the widget changes size.
///
/// - Call `gtk.DrawingArea.setDrawFunc` to handle redrawing the
///   contents of the widget.
///
/// The following code portion demonstrates using a drawing
/// area to display a circle in the normal widget foreground
/// color.
///
/// ## Simple GtkDrawingArea usage
///
/// ```c
/// static void
/// draw_function (GtkDrawingArea *area,
///                cairo_t        *cr,
///                int             width,
///                int             height,
///                gpointer        data)
/// {
///   GdkRGBA color;
///
///   cairo_arc (cr,
///              width / 2.0, height / 2.0,
///              MIN (width, height) / 2.0,
///              0, 2 * G_PI);
///
///   gtk_widget_get_color (GTK_WIDGET (area),
///                         &color);
///   gdk_cairo_set_source_rgba (cr, &color);
///
///   cairo_fill (cr);
/// }
///
/// int
/// main (int argc, char **argv)
/// {
///   gtk_init ();
///
///   GtkWidget *area = gtk_drawing_area_new ();
///   gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (area), 100);
///   gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (area), 100);
///   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (area),
///                                   draw_function,
///                                   NULL, NULL);
///   return 0;
/// }
/// ```
///
/// The draw function is normally called when a drawing area first comes
/// onscreen, or when it’s covered by another window and then uncovered.
/// You can also force a redraw by adding to the “damage region” of the
/// drawing area’s window using `gtk.Widget.queueDraw`.
/// This will cause the drawing area to call the draw function again.
///
/// The available routines for drawing are documented in the
/// [Cairo documentation](https://www.cairographics.org/manual/); GDK
/// offers additional API to integrate with Cairo, like `gdk.cairoSetSourceRgba`
/// or `gdk.cairoSetSourcePixbuf`.
///
/// To receive mouse events on a drawing area, you will need to use
/// event controllers. To receive keyboard events, you will need to set
/// the “can-focus” property on the drawing area, and you should probably
/// draw some user-visible indication that the drawing area is focused.
///
/// If you need more complex control over your widget, you should consider
/// creating your own `GtkWidget` subclass.
pub const DrawingArea = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.DrawingAreaClass;
    f_widget: gtk.Widget,

    pub const virtual_methods = struct {
        pub const resize = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int) void {
                return gobject.ext.as(DrawingArea.Class, p_class).f_resize.?(gobject.ext.as(DrawingArea, p_area), p_width, p_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int) callconv(.c) void) void {
                gobject.ext.as(DrawingArea.Class, p_class).f_resize = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The content height.
        pub const content_height = struct {
            pub const name = "content-height";

            pub const Type = c_int;
        };

        /// The content width.
        pub const content_width = struct {
            pub const name = "content-width";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted once when the widget is realized, and then each time the widget
        /// is changed while realized.
        ///
        /// This is useful in order to keep state up to date with the widget size,
        /// like for instance a backing surface.
        pub const resize = struct {
            pub const name = "resize";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_width: c_int, p_height: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DrawingArea, p_instance))),
                    gobject.signalLookup("resize", DrawingArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new drawing area.
    extern fn gtk_drawing_area_new() *gtk.DrawingArea;
    pub const new = gtk_drawing_area_new;

    /// Retrieves the content height of the `GtkDrawingArea`.
    extern fn gtk_drawing_area_get_content_height(p_self: *DrawingArea) c_int;
    pub const getContentHeight = gtk_drawing_area_get_content_height;

    /// Retrieves the content width of the `GtkDrawingArea`.
    extern fn gtk_drawing_area_get_content_width(p_self: *DrawingArea) c_int;
    pub const getContentWidth = gtk_drawing_area_get_content_width;

    /// Sets the desired height of the contents of the drawing area.
    ///
    /// Note that because widgets may be allocated larger sizes than they
    /// requested, it is possible that the actual height passed to your draw
    /// function is larger than the height set here. You can use
    /// `gtk.Widget.setValign` to avoid that.
    ///
    /// If the height is set to 0 (the default), the drawing area may disappear.
    extern fn gtk_drawing_area_set_content_height(p_self: *DrawingArea, p_height: c_int) void;
    pub const setContentHeight = gtk_drawing_area_set_content_height;

    /// Sets the desired width of the contents of the drawing area.
    ///
    /// Note that because widgets may be allocated larger sizes than they
    /// requested, it is possible that the actual width passed to your draw
    /// function is larger than the width set here. You can use
    /// `gtk.Widget.setHalign` to avoid that.
    ///
    /// If the width is set to 0 (the default), the drawing area may disappear.
    extern fn gtk_drawing_area_set_content_width(p_self: *DrawingArea, p_width: c_int) void;
    pub const setContentWidth = gtk_drawing_area_set_content_width;

    /// Setting a draw function is the main thing you want to do when using
    /// a drawing area.
    ///
    /// The draw function is called whenever GTK needs to draw the contents
    /// of the drawing area to the screen.
    ///
    /// The draw function will be called during the drawing stage of GTK.
    /// In the drawing stage it is not allowed to change properties of any
    /// GTK widgets or call any functions that would cause any properties
    /// to be changed. You should restrict yourself exclusively to drawing
    /// your contents in the draw function.
    ///
    /// If what you are drawing does change, call `gtk.Widget.queueDraw`
    /// on the drawing area. This will cause a redraw and will call `draw_func` again.
    extern fn gtk_drawing_area_set_draw_func(p_self: *DrawingArea, p_draw_func: ?gtk.DrawingAreaDrawFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setDrawFunc = gtk_drawing_area_set_draw_func;

    extern fn gtk_drawing_area_get_type() usize;
    pub const getGObjectType = gtk_drawing_area_get_type;

    extern fn g_object_ref(p_self: *gtk.DrawingArea) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DrawingArea) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DrawingArea, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An event controller tracking the pointer during Drag-and-Drop operations.
///
/// It is modeled after `gtk.EventControllerMotion` so if you
/// have used that, this should feel really familiar.
///
/// This controller is not able to accept drops, use `gtk.DropTarget`
/// for that purpose.
pub const DropControllerMotion = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.DropControllerMotionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the pointer of a Drag-and-Drop operation is in
        /// the controller's widget or a descendant.
        ///
        /// See also `gtk.DropControllerMotion.properties.is_pointer`.
        ///
        /// When handling crossing events, this property is updated
        /// before `gtk.DropControllerMotion.signals.enter`, but after
        /// `gtk.DropControllerMotion.signals.leave` is emitted.
        pub const contains_pointer = struct {
            pub const name = "contains-pointer";

            pub const Type = c_int;
        };

        /// The ongoing drop operation over the controller's widget or
        /// its descendant.
        ///
        /// If no drop operation is going on, this property returns `NULL`.
        ///
        /// The event controller should not modify the `drop`, but it might
        /// want to query its properties.
        ///
        /// When handling crossing events, this property is updated
        /// before `gtk.DropControllerMotion.signals.enter`, but after
        /// `gtk.DropControllerMotion.signals.leave` is emitted.
        pub const drop = struct {
            pub const name = "drop";

            pub const Type = ?*gdk.Drop;
        };

        /// Whether the pointer is in the controllers widget itself,
        /// as opposed to in a descendent widget.
        ///
        /// See also `gtk.DropControllerMotion.properties.contains_pointer`.
        ///
        /// When handling crossing events, this property is updated
        /// before `gtk.DropControllerMotion.signals.enter`, but after
        /// `gtk.DropControllerMotion.signals.leave` is emitted.
        pub const is_pointer = struct {
            pub const name = "is-pointer";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Signals that the pointer has entered the widget.
        pub const enter = struct {
            pub const name = "enter";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropControllerMotion, p_instance))),
                    gobject.signalLookup("enter", DropControllerMotion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Signals that the pointer has left the widget.
        pub const leave = struct {
            pub const name = "leave";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropControllerMotion, p_instance))),
                    gobject.signalLookup("leave", DropControllerMotion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the pointer moves inside the widget.
        pub const motion = struct {
            pub const name = "motion";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropControllerMotion, p_instance))),
                    gobject.signalLookup("motion", DropControllerMotion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new event controller that will handle pointer motion
    /// events during drag and drop.
    extern fn gtk_drop_controller_motion_new() *gtk.DropControllerMotion;
    pub const new = gtk_drop_controller_motion_new;

    /// Returns if a Drag-and-Drop operation is within the widget
    /// `self` or one of its children.
    extern fn gtk_drop_controller_motion_contains_pointer(p_self: *DropControllerMotion) c_int;
    pub const containsPointer = gtk_drop_controller_motion_contains_pointer;

    /// Returns the `GdkDrop` of a current Drag-and-Drop operation
    /// over the widget of `self`.
    extern fn gtk_drop_controller_motion_get_drop(p_self: *DropControllerMotion) ?*gdk.Drop;
    pub const getDrop = gtk_drop_controller_motion_get_drop;

    /// Returns if a Drag-and-Drop operation is within the widget
    /// `self`, not one of its children.
    extern fn gtk_drop_controller_motion_is_pointer(p_self: *DropControllerMotion) c_int;
    pub const isPointer = gtk_drop_controller_motion_is_pointer;

    extern fn gtk_drop_controller_motion_get_type() usize;
    pub const getGObjectType = gtk_drop_controller_motion_get_type;

    extern fn g_object_ref(p_self: *gtk.DropControllerMotion) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DropControllerMotion) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DropControllerMotion, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows the user to choose an item from a list of options.
///
/// <picture>
///   <source srcset="drop-down-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkDropDown" src="drop-down.png">
/// </picture>
///
/// The `GtkDropDown` displays the [selected]`gtk.DropDown.properties.selected`
/// choice.
///
/// The options are given to `GtkDropDown` in the form of `GListModel`
/// and how the individual options are represented is determined by
/// a `gtk.ListItemFactory`. The default factory displays simple strings,
/// and adds a checkmark to the selected item in the popup.
///
/// To set your own factory, use `gtk.DropDown.setFactory`. It is
/// possible to use a separate factory for the items in the popup, with
/// `gtk.DropDown.setListFactory`.
///
/// `GtkDropDown` knows how to obtain strings from the items in a
/// `gtk.StringList`; for other models, you have to provide an expression
/// to find the strings via `gtk.DropDown.setExpression`.
///
/// `GtkDropDown` can optionally allow search in the popup, which is
/// useful if the list of options is long. To enable the search entry,
/// use `gtk.DropDown.setEnableSearch`.
///
/// Here is a UI definition example for `GtkDropDown` with a simple model:
///
/// ```xml
/// <object class="GtkDropDown">
///   <property name="model">
///     <object class="GtkStringList">
///       <items>
///         <item translatable="yes">Factory</item>
///         <item translatable="yes">Home</item>
///         <item translatable="yes">Subway</item>
///       </items>
///     </object>
///   </property>
/// </object>
/// ```
///
/// If a `GtkDropDown` is created in this manner, or with
/// `gtk.DropDown.newFromStrings`, for instance, the object returned from
/// `gtk.DropDown.getSelectedItem` will be a `gtk.StringObject`.
///
/// To learn more about the list widget framework, see the
/// [overview](section-list-widget.html).
///
/// ## CSS nodes
///
/// `GtkDropDown` has a single CSS node with name dropdown,
/// with the button and popover nodes as children.
///
/// ## Accessibility
///
/// `GtkDropDown` uses the `gtk.@"AccessibleRole.combo_box"` role.
pub const DropDown = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.DropDownClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to show a search entry in the popup.
        ///
        /// Note that search requires `gtk.DropDown.properties.expression`
        /// to be set.
        pub const enable_search = struct {
            pub const name = "enable-search";

            pub const Type = c_int;
        };

        /// An expression to evaluate to obtain strings to match against the search
        /// term.
        ///
        /// See `gtk.DropDown.properties.enable_search` for how to enable search.
        /// If `gtk.DropDown.properties.factory` is not set, the expression is also
        /// used to bind strings to labels produced by a default factory.
        pub const expression = struct {
            pub const name = "expression";

            pub const Type = ?*gtk.Expression;
        };

        /// Factory for populating list items.
        pub const factory = struct {
            pub const name = "factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// The factory for creating header widgets for the popup.
        pub const header_factory = struct {
            pub const name = "header-factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// The factory for populating list items in the popup.
        ///
        /// If this is not set, `gtk.DropDown.properties.factory` is used.
        pub const list_factory = struct {
            pub const name = "list-factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// Model for the displayed items.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The match mode for the search filter.
        pub const search_match_mode = struct {
            pub const name = "search-match-mode";

            pub const Type = gtk.StringFilterMatchMode;
        };

        /// The position of the selected item.
        ///
        /// If no item is selected, the property has the value
        /// `GTK_INVALID_LIST_POSITION`.
        pub const selected = struct {
            pub const name = "selected";

            pub const Type = c_uint;
        };

        /// The selected item.
        pub const selected_item = struct {
            pub const name = "selected-item";

            pub const Type = ?*gobject.Object;
        };

        /// Whether to show an arrow within the GtkDropDown widget.
        pub const show_arrow = struct {
            pub const name = "show-arrow";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to when the drop down is activated.
        ///
        /// The `::activate` signal on `GtkDropDown` is an action signal and
        /// emitting it causes the drop down to pop up its dropdown.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropDown, p_instance))),
                    gobject.signalLookup("activate", DropDown.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkDropDown`.
    ///
    /// You may want to call `gtk.DropDown.setFactory`
    /// to set up a way to map its items to widgets.
    extern fn gtk_drop_down_new(p_model: ?*gio.ListModel, p_expression: ?*gtk.Expression) *gtk.DropDown;
    pub const new = gtk_drop_down_new;

    /// Creates a new `GtkDropDown` that is populated with
    /// the strings.
    extern fn gtk_drop_down_new_from_strings(p_strings: [*]const [*:0]const u8) *gtk.DropDown;
    pub const newFromStrings = gtk_drop_down_new_from_strings;

    /// Returns whether search is enabled.
    extern fn gtk_drop_down_get_enable_search(p_self: *DropDown) c_int;
    pub const getEnableSearch = gtk_drop_down_get_enable_search;

    /// Gets the expression set that is used to obtain strings from items.
    ///
    /// See `gtk.DropDown.setExpression`.
    extern fn gtk_drop_down_get_expression(p_self: *DropDown) ?*gtk.Expression;
    pub const getExpression = gtk_drop_down_get_expression;

    /// Gets the factory that's currently used to populate list items.
    ///
    /// The factory returned by this function is always used for the
    /// item in the button. It is also used for items in the popup
    /// if `gtk.DropDown.properties.list_factory` is not set.
    extern fn gtk_drop_down_get_factory(p_self: *DropDown) ?*gtk.ListItemFactory;
    pub const getFactory = gtk_drop_down_get_factory;

    /// Gets the factory that's currently used to create header widgets for the popup.
    extern fn gtk_drop_down_get_header_factory(p_self: *DropDown) ?*gtk.ListItemFactory;
    pub const getHeaderFactory = gtk_drop_down_get_header_factory;

    /// Gets the factory that's currently used to populate list items in the popup.
    extern fn gtk_drop_down_get_list_factory(p_self: *DropDown) ?*gtk.ListItemFactory;
    pub const getListFactory = gtk_drop_down_get_list_factory;

    /// Gets the model that provides the displayed items.
    extern fn gtk_drop_down_get_model(p_self: *DropDown) ?*gio.ListModel;
    pub const getModel = gtk_drop_down_get_model;

    /// Returns the match mode that the search filter is using.
    extern fn gtk_drop_down_get_search_match_mode(p_self: *DropDown) gtk.StringFilterMatchMode;
    pub const getSearchMatchMode = gtk_drop_down_get_search_match_mode;

    /// Gets the position of the selected item.
    extern fn gtk_drop_down_get_selected(p_self: *DropDown) c_uint;
    pub const getSelected = gtk_drop_down_get_selected;

    /// Gets the selected item. If no item is selected, `NULL` is returned.
    extern fn gtk_drop_down_get_selected_item(p_self: *DropDown) ?*gobject.Object;
    pub const getSelectedItem = gtk_drop_down_get_selected_item;

    /// Returns whether to show an arrow within the widget.
    extern fn gtk_drop_down_get_show_arrow(p_self: *DropDown) c_int;
    pub const getShowArrow = gtk_drop_down_get_show_arrow;

    /// Sets whether a search entry will be shown in the popup that
    /// allows to search for items in the list.
    ///
    /// Note that `gtk.DropDown.properties.expression` must be set for
    /// search to work.
    extern fn gtk_drop_down_set_enable_search(p_self: *DropDown, p_enable_search: c_int) void;
    pub const setEnableSearch = gtk_drop_down_set_enable_search;

    /// Sets the expression that gets evaluated to obtain strings from items.
    ///
    /// This is used for search in the popup. The expression must have
    /// a value type of `G_TYPE_STRING`.
    extern fn gtk_drop_down_set_expression(p_self: *DropDown, p_expression: ?*gtk.Expression) void;
    pub const setExpression = gtk_drop_down_set_expression;

    /// Sets the `GtkListItemFactory` to use for populating list items.
    extern fn gtk_drop_down_set_factory(p_self: *DropDown, p_factory: ?*gtk.ListItemFactory) void;
    pub const setFactory = gtk_drop_down_set_factory;

    /// Sets the `GtkListItemFactory` to use for creating header widgets for the popup.
    extern fn gtk_drop_down_set_header_factory(p_self: *DropDown, p_factory: ?*gtk.ListItemFactory) void;
    pub const setHeaderFactory = gtk_drop_down_set_header_factory;

    /// Sets the `GtkListItemFactory` to use for populating list items in the popup.
    extern fn gtk_drop_down_set_list_factory(p_self: *DropDown, p_factory: ?*gtk.ListItemFactory) void;
    pub const setListFactory = gtk_drop_down_set_list_factory;

    /// Sets the `GListModel` to use.
    extern fn gtk_drop_down_set_model(p_self: *DropDown, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_drop_down_set_model;

    /// Sets the match mode for the search filter.
    extern fn gtk_drop_down_set_search_match_mode(p_self: *DropDown, p_search_match_mode: gtk.StringFilterMatchMode) void;
    pub const setSearchMatchMode = gtk_drop_down_set_search_match_mode;

    /// Selects the item at the given position.
    extern fn gtk_drop_down_set_selected(p_self: *DropDown, p_position: c_uint) void;
    pub const setSelected = gtk_drop_down_set_selected;

    /// Sets whether an arrow will be displayed within the widget.
    extern fn gtk_drop_down_set_show_arrow(p_self: *DropDown, p_show_arrow: c_int) void;
    pub const setShowArrow = gtk_drop_down_set_show_arrow;

    extern fn gtk_drop_down_get_type() usize;
    pub const getGObjectType = gtk_drop_down_get_type;

    extern fn g_object_ref(p_self: *gtk.DropDown) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DropDown) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DropDown, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An event controller to receive Drag-and-Drop operations.
///
/// The most basic way to use a `GtkDropTarget` to receive drops on a
/// widget is to create it via `gtk.DropTarget.new`, passing in the
/// `GType` of the data you want to receive and connect to the
/// `gtk.DropTarget.signals.drop` signal to receive the data:
///
/// ```c
/// static gboolean
/// on_drop (GtkDropTarget *target,
///          const GValue  *value,
///          double         x,
///          double         y,
///          gpointer       data)
/// {
///   MyWidget *self = data;
///
///   // Call the appropriate setter depending on the type of data
///   // that we received
///   if (G_VALUE_HOLDS (value, G_TYPE_FILE))
///     my_widget_set_file (self, g_value_get_object (value));
///   else if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF))
///     my_widget_set_pixbuf (self, g_value_get_object (value));
///   else
///     return FALSE;
///
///   return TRUE;
/// }
///
/// static void
/// my_widget_init (MyWidget *self)
/// {
///   GtkDropTarget *target =
///     gtk_drop_target_new (G_TYPE_INVALID, GDK_ACTION_COPY);
///
///   // This widget accepts two types of drop types: GFile objects
///   // and GdkPixbuf objects
///   gtk_drop_target_set_gtypes (target, (GType [2]) {
///     G_TYPE_FILE,
///     GDK_TYPE_PIXBUF,
///   }, 2);
///
///   g_signal_connect (target, "drop", G_CALLBACK (on_drop), self);
///   gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (target));
/// }
/// ```
///
/// `GtkDropTarget` supports more options, such as:
///
///  * rejecting potential drops via the `gtk.DropTarget.signals.accept` signal
///    and the `gtk.DropTarget.reject` function to let other drop
///    targets handle the drop
///  * tracking an ongoing drag operation before the drop via the
///    `gtk.DropTarget.signals.enter`, `gtk.DropTarget.signals.motion` and
///    `gtk.DropTarget.signals.leave` signals
///  * configuring how to receive data by setting the
///    `gtk.DropTarget.properties.preload` property and listening for its
///    availability via the `gtk.DropTarget.properties.value` property
///
/// However, `GtkDropTarget` is ultimately modeled in a synchronous way
/// and only supports data transferred via `GType`. If you want full control
/// over an ongoing drop, the `gtk.DropTargetAsync` object gives you
/// this ability.
///
/// While a pointer is dragged over the drop target's widget and the drop
/// has not been rejected, that widget will receive the
/// `GTK_STATE_FLAG_DROP_ACTIVE` state, which can be used to style the widget.
///
/// If you are not interested in receiving the drop, but just want to update
/// UI state during a Drag-and-Drop operation (e.g. switching tabs), you can
/// use `gtk.DropControllerMotion`.
pub const DropTarget = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.DropTargetClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GdkDragActions` that this drop target supports.
        pub const actions = struct {
            pub const name = "actions";

            pub const Type = gdk.DragAction;
        };

        /// The `GdkDrop` that is currently being performed.
        pub const current_drop = struct {
            pub const name = "current-drop";

            pub const Type = ?*gdk.Drop;
        };

        /// The `GdkDrop` that is currently being performed.
        pub const drop = struct {
            pub const name = "drop";

            pub const Type = ?*gdk.Drop;
        };

        /// The `GdkContentFormats` that determine the supported data formats.
        pub const formats = struct {
            pub const name = "formats";

            pub const Type = ?*gdk.ContentFormats;
        };

        /// Whether the drop data should be preloaded when the pointer is only
        /// hovering over the widget but has not been released.
        ///
        /// Setting this property allows finer grained reaction to an ongoing
        /// drop at the cost of loading more data.
        ///
        /// The default value for this property is `FALSE` to avoid downloading
        /// huge amounts of data by accident.
        ///
        /// For example, if somebody drags a full document of gigabytes of text
        /// from a text editor across a widget with a preloading drop target,
        /// this data will be downloaded, even if the data is ultimately dropped
        /// elsewhere.
        ///
        /// For a lot of data formats, the amount of data is very small (like
        /// `GDK_TYPE_RGBA`), so enabling this property does not hurt at all.
        /// And for local-only Drag-and-Drop operations, no data transfer is done,
        /// so enabling it there is free.
        pub const preload = struct {
            pub const name = "preload";

            pub const Type = c_int;
        };

        /// The value for this drop operation.
        ///
        /// This is `NULL` if the data has not been loaded yet or no drop
        /// operation is going on.
        ///
        /// Data may be available before the `gtk.DropTarget.signals.drop`
        /// signal gets emitted - for example when the `gtk.DropTarget.properties.preload`
        /// property is set. You can use the ::notify signal to be notified
        /// of available data.
        pub const value = struct {
            pub const name = "value";

            pub const Type = ?*gobject.Value;
        };
    };

    pub const signals = struct {
        /// Emitted on the drop site when a drop operation is about to begin.
        ///
        /// If the drop is not accepted, `FALSE` will be returned and the drop target
        /// will ignore the drop. If `TRUE` is returned, the drop is accepted for now
        /// but may be rejected later via a call to `gtk.DropTarget.reject`
        /// or ultimately by returning `FALSE` from a `gtk.DropTarget.signals.drop`
        /// handler.
        ///
        /// The default handler for this signal decides whether to accept the drop
        /// based on the formats provided by the `drop`.
        ///
        /// If the decision whether the drop will be accepted or rejected depends
        /// on the data, this function should return `TRUE`, the
        /// `gtk.DropTarget.properties.preload` property should be set and the value
        /// should be inspected via the ::notify:value signal, calling
        /// `gtk.DropTarget.reject` if required.
        pub const accept = struct {
            pub const name = "accept";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drop: *gdk.Drop, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTarget, p_instance))),
                    gobject.signalLookup("accept", DropTarget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drop site when the user drops the data onto the widget.
        ///
        /// The signal handler must determine whether the pointer position is in
        /// a drop zone or not. If it is not in a drop zone, it returns `FALSE`
        /// and no further processing is necessary.
        ///
        /// Otherwise, the handler returns `TRUE`. In this case, this handler will
        /// accept the drop. The handler is responsible for using the given `value`
        /// and performing the drop operation.
        pub const drop = struct {
            pub const name = "drop";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_value: *gobject.Value, p_x: f64, p_y: f64, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTarget, p_instance))),
                    gobject.signalLookup("drop", DropTarget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drop site when the pointer enters the widget.
        ///
        /// It can be used to set up custom highlighting.
        pub const enter = struct {
            pub const name = "enter";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) gdk.DragAction, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTarget, p_instance))),
                    gobject.signalLookup("enter", DropTarget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drop site when the pointer leaves the widget.
        ///
        /// Its main purpose it to undo things done in
        /// `gtk.DropTarget.signals.enter`.
        pub const leave = struct {
            pub const name = "leave";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTarget, p_instance))),
                    gobject.signalLookup("leave", DropTarget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted while the pointer is moving over the drop target.
        pub const motion = struct {
            pub const name = "motion";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) gdk.DragAction, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTarget, p_instance))),
                    gobject.signalLookup("motion", DropTarget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkDropTarget` object.
    ///
    /// If the drop target should support more than 1 type, pass
    /// `G_TYPE_INVALID` for `type` and then call
    /// `gtk.DropTarget.setGtypes`.
    extern fn gtk_drop_target_new(p_type: usize, p_actions: gdk.DragAction) *gtk.DropTarget;
    pub const new = gtk_drop_target_new;

    /// Gets the actions that this drop target supports.
    extern fn gtk_drop_target_get_actions(p_self: *DropTarget) gdk.DragAction;
    pub const getActions = gtk_drop_target_get_actions;

    /// Gets the currently handled drop operation.
    ///
    /// If no drop operation is going on, `NULL` is returned.
    extern fn gtk_drop_target_get_current_drop(p_self: *DropTarget) ?*gdk.Drop;
    pub const getCurrentDrop = gtk_drop_target_get_current_drop;

    /// Gets the currently handled drop operation.
    ///
    /// If no drop operation is going on, `NULL` is returned.
    extern fn gtk_drop_target_get_drop(p_self: *DropTarget) ?*gdk.Drop;
    pub const getDrop = gtk_drop_target_get_drop;

    /// Gets the data formats that this drop target accepts.
    ///
    /// If the result is `NULL`, all formats are expected to be supported.
    extern fn gtk_drop_target_get_formats(p_self: *DropTarget) ?*gdk.ContentFormats;
    pub const getFormats = gtk_drop_target_get_formats;

    /// Gets the list of supported `GType`s that can be dropped on the target.
    ///
    /// If no types have been set, `NULL` will be returned.
    extern fn gtk_drop_target_get_gtypes(p_self: *DropTarget, p_n_types: ?*usize) ?[*]const usize;
    pub const getGtypes = gtk_drop_target_get_gtypes;

    /// Gets whether data should be preloaded on hover.
    extern fn gtk_drop_target_get_preload(p_self: *DropTarget) c_int;
    pub const getPreload = gtk_drop_target_get_preload;

    /// Gets the current drop data, as a `GValue`.
    extern fn gtk_drop_target_get_value(p_self: *DropTarget) ?*const gobject.Value;
    pub const getValue = gtk_drop_target_get_value;

    /// Rejects the ongoing drop operation.
    ///
    /// If no drop operation is ongoing, i.e when `gtk.DropTarget.properties.current_drop`
    /// is `NULL`, this function does nothing.
    ///
    /// This function should be used when delaying the decision
    /// on whether to accept a drag or not until after reading
    /// the data.
    extern fn gtk_drop_target_reject(p_self: *DropTarget) void;
    pub const reject = gtk_drop_target_reject;

    /// Sets the actions that this drop target supports.
    extern fn gtk_drop_target_set_actions(p_self: *DropTarget, p_actions: gdk.DragAction) void;
    pub const setActions = gtk_drop_target_set_actions;

    /// Sets the supported `GType`s for this drop target.
    extern fn gtk_drop_target_set_gtypes(p_self: *DropTarget, p_types: ?[*]usize, p_n_types: usize) void;
    pub const setGtypes = gtk_drop_target_set_gtypes;

    /// Sets whether data should be preloaded on hover.
    extern fn gtk_drop_target_set_preload(p_self: *DropTarget, p_preload: c_int) void;
    pub const setPreload = gtk_drop_target_set_preload;

    extern fn gtk_drop_target_get_type() usize;
    pub const getGObjectType = gtk_drop_target_get_type;

    extern fn g_object_ref(p_self: *gtk.DropTarget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DropTarget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DropTarget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An event controller to receive Drag-and-Drop operations, asynchronously.
///
/// It is the more complete but also more complex method of handling drop
/// operations compared to `gtk.DropTarget`, and you should only use
/// it if `GtkDropTarget` doesn't provide all the features you need.
///
/// To use a `GtkDropTargetAsync` to receive drops on a widget, you create
/// a `GtkDropTargetAsync` object, configure which data formats and actions
/// you support, connect to its signals, and then attach it to the widget
/// with `gtk.Widget.addController`.
///
/// During a drag operation, the first signal that a `GtkDropTargetAsync`
/// emits is `gtk.DropTargetAsync.signals.accept`, which is meant to determine
/// whether the target is a possible drop site for the ongoing drop. The
/// default handler for the ::accept signal accepts the drop if it finds
/// a compatible data format and an action that is supported on both sides.
///
/// If it is, and the widget becomes a target, you will receive a
/// `gtk.DropTargetAsync.signals.drag_enter` signal, followed by
/// `gtk.DropTargetAsync.signals.drag_motion` signals as the pointer moves,
/// optionally a `gtk.DropTargetAsync.signals.drop` signal when a drop happens,
/// and finally a `gtk.DropTargetAsync.signals.drag_leave` signal when the
/// pointer moves off the widget.
///
/// The ::drag-enter and ::drag-motion handler return a `GdkDragAction`
/// to update the status of the ongoing operation. The ::drop handler
/// should decide if it ultimately accepts the drop and if it does, it
/// should initiate the data transfer and finish the operation by calling
/// `gdk.Drop.finish`.
///
/// Between the ::drag-enter and ::drag-leave signals the widget is a
/// current drop target, and will receive the `GTK_STATE_FLAG_DROP_ACTIVE`
/// state, which can be used by themes to style the widget as a drop target.
pub const DropTargetAsync = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.DropTargetAsyncClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GdkDragActions` that this drop target supports.
        pub const actions = struct {
            pub const name = "actions";

            pub const Type = gdk.DragAction;
        };

        /// The `GdkContentFormats` that determines the supported data formats.
        pub const formats = struct {
            pub const name = "formats";

            pub const Type = ?*gdk.ContentFormats;
        };
    };

    pub const signals = struct {
        /// Emitted on the drop site when a drop operation is about to begin.
        ///
        /// If the drop is not accepted, `FALSE` will be returned and the drop target
        /// will ignore the drop. If `TRUE` is returned, the drop is accepted for now
        /// but may be rejected later via a call to `gtk.DropTargetAsync.rejectDrop`
        /// or ultimately by returning `FALSE` from a `gtk.DropTargetAsync.signals.drop`
        /// handler.
        ///
        /// The default handler for this signal decides whether to accept the drop
        /// based on the formats provided by the `drop`.
        ///
        /// If the decision whether the drop will be accepted or rejected needs
        /// further processing, such as inspecting the data, this function should
        /// return `TRUE` and proceed as is `drop` was accepted and if it decides to
        /// reject the drop later, it should call `gtk.DropTargetAsync.rejectDrop`.
        pub const accept = struct {
            pub const name = "accept";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drop: *gdk.Drop, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTargetAsync, p_instance))),
                    gobject.signalLookup("accept", DropTargetAsync.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drop site when the pointer enters the widget.
        ///
        /// It can be used to set up custom highlighting.
        pub const drag_enter = struct {
            pub const name = "drag-enter";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drop: *gdk.Drop, p_x: f64, p_y: f64, P_Data) callconv(.c) gdk.DragAction, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTargetAsync, p_instance))),
                    gobject.signalLookup("drag-enter", DropTargetAsync.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drop site when the pointer leaves the widget.
        ///
        /// Its main purpose it to undo things done in
        /// `GtkDropTargetAsync`::drag-enter.
        pub const drag_leave = struct {
            pub const name = "drag-leave";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drop: *gdk.Drop, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTargetAsync, p_instance))),
                    gobject.signalLookup("drag-leave", DropTargetAsync.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted while the pointer is moving over the drop target.
        pub const drag_motion = struct {
            pub const name = "drag-motion";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drop: *gdk.Drop, p_x: f64, p_y: f64, P_Data) callconv(.c) gdk.DragAction, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTargetAsync, p_instance))),
                    gobject.signalLookup("drag-motion", DropTargetAsync.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the drop site when the user drops the data onto the widget.
        ///
        /// The signal handler must determine whether the pointer position is in a
        /// drop zone or not. If it is not in a drop zone, it returns `FALSE` and no
        /// further processing is necessary.
        ///
        /// Otherwise, the handler returns `TRUE`. In this case, this handler will
        /// accept the drop. The handler must ensure that `gdk.Drop.finish`
        /// is called to let the source know that the drop is done. The call to
        /// `gdk.Drop.finish` must only be done when all data has been received.
        ///
        /// To receive the data, use one of the read functions provided by
        /// `gdk.Drop` such as `gdk.Drop.readAsync` or
        /// `gdk.Drop.readValueAsync`.
        pub const drop = struct {
            pub const name = "drop";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_drop: *gdk.Drop, p_x: f64, p_y: f64, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(DropTargetAsync, p_instance))),
                    gobject.signalLookup("drop", DropTargetAsync.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkDropTargetAsync` object.
    extern fn gtk_drop_target_async_new(p_formats: ?*gdk.ContentFormats, p_actions: gdk.DragAction) *gtk.DropTargetAsync;
    pub const new = gtk_drop_target_async_new;

    /// Gets the actions that this drop target supports.
    extern fn gtk_drop_target_async_get_actions(p_self: *DropTargetAsync) gdk.DragAction;
    pub const getActions = gtk_drop_target_async_get_actions;

    /// Gets the data formats that this drop target accepts.
    ///
    /// If the result is `NULL`, all formats are expected to be supported.
    extern fn gtk_drop_target_async_get_formats(p_self: *DropTargetAsync) ?*gdk.ContentFormats;
    pub const getFormats = gtk_drop_target_async_get_formats;

    /// Sets the `drop` as not accepted on this drag site.
    ///
    /// This function should be used when delaying the decision
    /// on whether to accept a drag or not until after reading
    /// the data.
    extern fn gtk_drop_target_async_reject_drop(p_self: *DropTargetAsync, p_drop: *gdk.Drop) void;
    pub const rejectDrop = gtk_drop_target_async_reject_drop;

    /// Sets the actions that this drop target supports.
    extern fn gtk_drop_target_async_set_actions(p_self: *DropTargetAsync, p_actions: gdk.DragAction) void;
    pub const setActions = gtk_drop_target_async_set_actions;

    /// Sets the data formats that this drop target will accept.
    extern fn gtk_drop_target_async_set_formats(p_self: *DropTargetAsync, p_formats: ?*gdk.ContentFormats) void;
    pub const setFormats = gtk_drop_target_async_set_formats;

    extern fn gtk_drop_target_async_get_type() usize;
    pub const getGObjectType = gtk_drop_target_async_get_type;

    extern fn g_object_ref(p_self: *gtk.DropTargetAsync) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.DropTargetAsync) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *DropTargetAsync, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows users to edit the displayed text by switching to an “edit mode”.
///
/// <picture>
///   <source srcset="editable-label-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkEditableLabel" src="editable-label.png">
/// </picture>
///
/// `GtkEditableLabel` does not have API of its own, but it
/// implements the `gtk.Editable` interface.
///
/// The default bindings for activating the edit mode is
/// to click or press the Enter key. The default bindings
/// for leaving the edit mode are the Enter key (to save
/// the results) or the Escape key (to cancel the editing).
///
/// # Shortcuts and Gestures
///
/// `GtkEditableLabel` supports the following keyboard shortcuts:
///
/// - <kbd>Enter</kbd> starts editing.
/// - <kbd>Escape</kbd> stops editing.
///
/// # Actions
///
/// `GtkEditableLabel` defines a set of built-in actions:
///
/// - `editing.starts` switches the widget into editing mode.
/// - `editing.stop` switches the widget out of editing mode.
///
/// # CSS nodes
///
/// ```
/// editablelabel[.editing]
/// ╰── stack
///     ├── label
///     ╰── text
/// ```
///
/// `GtkEditableLabel` has a main node with the name editablelabel.
/// When the entry is in editing mode, it gets the .editing style
/// class.
///
/// For all the subnodes added to the text node in various situations,
/// see `gtk.Text`.
pub const EditableLabel = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Editable };
    pub const Class = gtk.EditableLabelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// This property is `TRUE` while the widget is in edit mode.
        pub const editing = struct {
            pub const name = "editing";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkEditableLabel` widget.
    extern fn gtk_editable_label_new(p_str: [*:0]const u8) *gtk.EditableLabel;
    pub const new = gtk_editable_label_new;

    /// Returns whether the label is currently in “editing mode”.
    extern fn gtk_editable_label_get_editing(p_self: *EditableLabel) c_int;
    pub const getEditing = gtk_editable_label_get_editing;

    /// Switches the label into “editing mode”.
    extern fn gtk_editable_label_start_editing(p_self: *EditableLabel) void;
    pub const startEditing = gtk_editable_label_start_editing;

    /// Switches the label out of “editing mode”.
    ///
    /// If `commit` is `TRUE`, the resulting text is kept as the
    /// `gtk.Editable.properties.text` property value, otherwise the
    /// resulting text is discarded and the label will keep its
    /// previous `gtk.Editable.properties.text` property value.
    extern fn gtk_editable_label_stop_editing(p_self: *EditableLabel, p_commit: c_int) void;
    pub const stopEditing = gtk_editable_label_stop_editing;

    extern fn gtk_editable_label_get_type() usize;
    pub const getGObjectType = gtk_editable_label_get_type;

    extern fn g_object_ref(p_self: *gtk.EditableLabel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EditableLabel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EditableLabel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used by text widgets to let users insert Emoji characters.
///
/// <picture>
///   <source srcset="emojichooser-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkEmojiChooser" src="emojichooser.png">
/// </picture>
///
/// `GtkEmojiChooser` emits the `gtk.EmojiChooser.signals.emoji_picked`
/// signal when an Emoji is selected.
///
/// # Shortcuts and Gestures
///
/// `GtkEmojiChooser` supports the following keyboard shortcuts:
///
/// - <kbd>Ctrl</kbd>+<kbd>N</kbd> scrolls th the next section.
/// - <kbd>Ctrl</kbd>+<kbd>P</kbd> scrolls th the previous section.
///
/// # Actions
///
/// `GtkEmojiChooser` defines a set of built-in actions:
///
/// - `scroll.section` scrolls to the next or previous section.
///
/// # CSS nodes
///
/// ```
/// popover
/// ├── box.emoji-searchbar
/// │   ╰── entry.search
/// ╰── box.emoji-toolbar
///     ├── button.image-button.emoji-section
///     ├── ...
///     ╰── button.image-button.emoji-section
/// ```
///
/// Every `GtkEmojiChooser` consists of a main node called popover.
/// The contents of the popover are largely implementation defined
/// and supposed to inherit general styles.
/// The top searchbar used to search emoji and gets the .emoji-searchbar
/// style class itself.
/// The bottom toolbar used to switch between different emoji categories
/// consists of buttons with the .emoji-section style class and gets the
/// .emoji-toolbar style class itself.
pub const EmojiChooser = opaque {
    pub const Parent = gtk.Popover;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.ShortcutManager };
    pub const Class = gtk.EmojiChooserClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted when the user selects an Emoji.
        pub const emoji_picked = struct {
            pub const name = "emoji-picked";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_text: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EmojiChooser, p_instance))),
                    gobject.signalLookup("emoji-picked", EmojiChooser.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkEmojiChooser`.
    extern fn gtk_emoji_chooser_new() *gtk.EmojiChooser;
    pub const new = gtk_emoji_chooser_new;

    extern fn gtk_emoji_chooser_get_type() usize;
    pub const getGObjectType = gtk_emoji_chooser_get_type;

    extern fn g_object_ref(p_self: *gtk.EmojiChooser) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EmojiChooser) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EmojiChooser, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A single-line text entry widget.
///
/// <picture>
///   <source srcset="entry-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkEntry" src="entry.png">
/// </picture>
///
/// A fairly large set of key bindings are supported by default. If the
/// entered text is longer than the allocation of the widget, the widget
/// will scroll so that the cursor position is visible.
///
/// When using an entry for passwords and other sensitive information, it
/// can be put into “password mode” using `gtk.Entry.setVisibility`.
/// In this mode, entered text is displayed using a “invisible” character.
/// By default, GTK picks the best invisible character that is available
/// in the current font, but it can be changed with
/// `gtk.Entry.setInvisibleChar`.
///
/// `GtkEntry` has the ability to display progress or activity
/// information behind the text. To make an entry display such information,
/// use `gtk.Entry.setProgressFraction` or
/// `gtk.Entry.setProgressPulseStep`.
///
/// Additionally, `GtkEntry` can show icons at either side of the entry.
/// These icons can be activatable by clicking, can be set up as drag source
/// and can have tooltips. To add an icon, use
/// `gtk.Entry.setIconFromGicon` or one of the various other functions
/// that set an icon from an icon name or a paintable. To trigger an action when
/// the user clicks an icon, connect to the `gtk.Entry.signals.icon_press` signal.
/// To allow DND operations from an icon, use
/// `gtk.Entry.setIconDragSource`. To set a tooltip on an icon, use
/// `gtk.Entry.setIconTooltipText` or the corresponding function
/// for markup.
///
/// Note that functionality or information that is only available by clicking
/// on an icon in an entry may not be accessible at all to users which are not
/// able to use a mouse or other pointing device. It is therefore recommended
/// that any such functionality should also be available by other means, e.g.
/// via the context menu of the entry.
///
/// # CSS nodes
///
/// ```
/// entry[.flat][.warning][.error]
/// ├── text[.readonly]
/// ├── image.left
/// ├── image.right
/// ╰── [progress[.pulse]]
/// ```
///
/// `GtkEntry` has a main node with the name entry. Depending on the properties
/// of the entry, the style classes .read-only and .flat may appear. The style
/// classes .warning and .error may also be used with entries.
///
/// When the entry shows icons, it adds subnodes with the name image and the
/// style class .left or .right, depending on where the icon appears.
///
/// When the entry shows progress, it adds a subnode with the name progress.
/// The node has the style class .pulse when the shown progress is pulsing.
///
/// For all the subnodes added to the text node in various situations,
/// see `gtk.Text`.
///
/// # GtkEntry as GtkBuildable
///
/// The `GtkEntry` implementation of the `GtkBuildable` interface supports a
/// custom `<attributes>` element, which supports any number of `<attribute>`
/// elements. The `<attribute>` element has attributes named “name“, “value“,
/// “start“ and “end“ and allows you to specify `PangoAttribute` values for
/// this label.
///
/// An example of a UI definition fragment specifying Pango attributes:
/// ```xml
/// <object class="GtkEntry">
///   <attributes>
///     <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
///     <attribute name="background" value="red" start="5" end="10"/>
///   </attributes>
/// </object>
/// ```
///
/// The start and end attributes specify the range of characters to which the
/// Pango attribute applies. If start and end are not specified, the attribute
/// is applied to the whole text. Note that specifying ranges does not make much
/// sense with translatable attributes. Use markup embedded in the translatable
/// content instead.
///
/// # Accessibility
///
/// `GtkEntry` uses the `gtk.@"AccessibleRole.text_box"` role.
pub const Entry = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.CellEditable, gtk.ConstraintTarget, gtk.Editable };
    pub const Class = gtk.EntryClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        /// Class handler for the `GtkEntry::activate` signal. The default
        ///   implementation activates the gtk.activate-default action.
        pub const activate = struct {
            pub fn call(p_class: anytype, p_entry: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Entry.Class, p_class).f_activate.?(gobject.ext.as(Entry, p_entry));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_entry: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Entry.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Whether to activate the default widget when Enter is pressed.
        pub const activates_default = struct {
            pub const name = "activates-default";

            pub const Type = c_int;
        };

        /// A list of Pango attributes to apply to the text of the entry.
        ///
        /// This is mainly useful to change the size or weight of the text.
        ///
        /// The `PangoAttribute`'s `start_index` and `end_index` must refer to the
        /// `gtk.EntryBuffer` text, i.e. without the preedit string.
        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?*pango.AttrList;
        };

        /// The buffer object which actually stores the text.
        pub const buffer = struct {
            pub const name = "buffer";

            pub const Type = ?*gtk.EntryBuffer;
        };

        /// The auxiliary completion object to use with the entry.
        pub const completion = struct {
            pub const name = "completion";

            pub const Type = ?*gtk.EntryCompletion;
        };

        /// Whether to suggest Emoji replacements for :-delimited names
        /// like `:heart:`.
        pub const enable_emoji_completion = struct {
            pub const name = "enable-emoji-completion";

            pub const Type = c_int;
        };

        /// A menu model whose contents will be appended to the context menu.
        pub const extra_menu = struct {
            pub const name = "extra-menu";

            pub const Type = ?*gio.MenuModel;
        };

        /// Whether the entry should draw a frame.
        pub const has_frame = struct {
            pub const name = "has-frame";

            pub const Type = c_int;
        };

        /// Which IM (input method) module should be used for this entry.
        ///
        /// See `gtk.IMContext`.
        ///
        /// Setting this to a non-`NULL` value overrides the system-wide IM
        /// module setting. See the GtkSettings `gtk.Settings.properties.gtk_im_module`
        /// property.
        pub const im_module = struct {
            pub const name = "im-module";

            pub const Type = ?[*:0]u8;
        };

        /// Additional hints that allow input methods to fine-tune their behavior.
        ///
        /// Also see `gtk.Entry.properties.input_purpose`
        pub const input_hints = struct {
            pub const name = "input-hints";

            pub const Type = gtk.InputHints;
        };

        /// The purpose of this text field.
        ///
        /// This property can be used by on-screen keyboards and other input
        /// methods to adjust their behaviour.
        ///
        /// Note that setting the purpose to `GTK_INPUT_PURPOSE_PASSWORD` or
        /// `GTK_INPUT_PURPOSE_PIN` is independent from setting
        /// `gtk.Entry.properties.visibility`.
        pub const input_purpose = struct {
            pub const name = "input-purpose";

            pub const Type = gtk.InputPurpose;
        };

        /// The character to use when masking entry contents (“password mode”).
        pub const invisible_char = struct {
            pub const name = "invisible-char";

            pub const Type = c_uint;
        };

        /// Whether the invisible char has been set for the `GtkEntry`.
        pub const invisible_char_set = struct {
            pub const name = "invisible-char-set";

            pub const Type = c_int;
        };

        /// Maximum number of characters for this entry.
        pub const max_length = struct {
            pub const name = "max-length";

            pub const Type = c_int;
        };

        /// Text for an item in the context menu to activate the primary icon action.
        ///
        /// When the primary icon is activatable and this property has been set, a new entry
        /// in the context menu of this GtkEntry will appear with this text. Selecting that
        /// menu entry will result in the primary icon being activated, exactly in the same way
        /// as it would be activated from a mouse click.
        ///
        /// This simplifies adding accessibility support to applications using activatable
        /// icons. The activatable icons aren't focusable when navigating the interface with
        /// the keyboard This is why Gtk recommends to also add those actions in the context
        /// menu. This set of methods greatly simplifies this, by adding a menu item that, when
        /// enabled, calls the same callback than clicking on the icon.
        pub const menu_entry_icon_primary_text = struct {
            pub const name = "menu-entry-icon-primary-text";

            pub const Type = ?[*:0]u8;
        };

        /// Text for an item in the context menu to activate the secondary icon action.
        ///
        /// When the primary icon is activatable and this property has been set, a new entry
        /// in the context menu of this GtkEntry will appear with this text. Selecting that
        /// menu entry will result in the primary icon being activated, exactly in the same way
        /// as it would be activated from a mouse click.
        ///
        /// This simplifies adding accessibility support to applications using activatable
        /// icons. The activatable icons aren't focusable when navigating the interface with
        /// the keyboard This is why Gtk recommends to also add those actions in the context
        /// menu. This set of methods greatly simplifies this, by adding a menu item that, when
        /// enabled, calls the same callback than clicking on the icon.
        pub const menu_entry_icon_secondary_text = struct {
            pub const name = "menu-entry-icon-secondary-text";

            pub const Type = ?[*:0]u8;
        };

        /// If text is overwritten when typing in the `GtkEntry`.
        pub const overwrite_mode = struct {
            pub const name = "overwrite-mode";

            pub const Type = c_int;
        };

        /// The text that will be displayed in the `GtkEntry` when it is empty
        /// and unfocused.
        pub const placeholder_text = struct {
            pub const name = "placeholder-text";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the primary icon is activatable.
        ///
        /// GTK emits the `gtk.Entry.signals.icon_press` and
        /// `gtk.Entry.signals.icon_release` signals only on sensitive,
        /// activatable icons.
        ///
        /// Sensitive, but non-activatable icons can be used for purely
        /// informational purposes.
        pub const primary_icon_activatable = struct {
            pub const name = "primary-icon-activatable";

            pub const Type = c_int;
        };

        /// The `GIcon` to use for the primary icon for the entry.
        pub const primary_icon_gicon = struct {
            pub const name = "primary-icon-gicon";

            pub const Type = ?*gio.Icon;
        };

        /// The icon name to use for the primary icon for the entry.
        pub const primary_icon_name = struct {
            pub const name = "primary-icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// A `GdkPaintable` to use as the primary icon for the entry.
        pub const primary_icon_paintable = struct {
            pub const name = "primary-icon-paintable";

            pub const Type = ?*gdk.Paintable;
        };

        /// Whether the primary icon is sensitive.
        ///
        /// An insensitive icon appears grayed out. GTK does not emit the
        /// `gtk.Entry.signals.icon_press` and `gtk.Entry.signals.icon_release`
        /// signals and does not allow DND from insensitive icons.
        ///
        /// An icon should be set insensitive if the action that would trigger
        /// when clicked is currently not available.
        pub const primary_icon_sensitive = struct {
            pub const name = "primary-icon-sensitive";

            pub const Type = c_int;
        };

        /// The representation which is used for the primary icon of the entry.
        pub const primary_icon_storage_type = struct {
            pub const name = "primary-icon-storage-type";

            pub const Type = gtk.ImageType;
        };

        /// The contents of the tooltip on the primary icon, with markup.
        ///
        /// Also see `gtk.Entry.setIconTooltipMarkup`.
        pub const primary_icon_tooltip_markup = struct {
            pub const name = "primary-icon-tooltip-markup";

            pub const Type = ?[*:0]u8;
        };

        /// The contents of the tooltip on the primary icon.
        ///
        /// Also see `gtk.Entry.setIconTooltipText`.
        pub const primary_icon_tooltip_text = struct {
            pub const name = "primary-icon-tooltip-text";

            pub const Type = ?[*:0]u8;
        };

        /// The current fraction of the task that's been completed.
        pub const progress_fraction = struct {
            pub const name = "progress-fraction";

            pub const Type = f64;
        };

        /// The fraction of total entry width to move the progress
        /// bouncing block for each pulse.
        ///
        /// See `gtk.Entry.progressPulse`.
        pub const progress_pulse_step = struct {
            pub const name = "progress-pulse-step";

            pub const Type = f64;
        };

        /// Number of pixels of the entry scrolled off the screen to the left.
        pub const scroll_offset = struct {
            pub const name = "scroll-offset";

            pub const Type = c_int;
        };

        /// Whether the secondary icon is activatable.
        ///
        /// GTK emits the `gtk.Entry.signals.icon_press` and
        /// `gtk.Entry.signals.icon_release` signals only on sensitive,
        /// activatable icons.
        ///
        /// Sensitive, but non-activatable icons can be used for purely
        /// informational purposes.
        pub const secondary_icon_activatable = struct {
            pub const name = "secondary-icon-activatable";

            pub const Type = c_int;
        };

        /// The `GIcon` to use for the secondary icon for the entry.
        pub const secondary_icon_gicon = struct {
            pub const name = "secondary-icon-gicon";

            pub const Type = ?*gio.Icon;
        };

        /// The icon name to use for the secondary icon for the entry.
        pub const secondary_icon_name = struct {
            pub const name = "secondary-icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// A `GdkPaintable` to use as the secondary icon for the entry.
        pub const secondary_icon_paintable = struct {
            pub const name = "secondary-icon-paintable";

            pub const Type = ?*gdk.Paintable;
        };

        /// Whether the secondary icon is sensitive.
        ///
        /// An insensitive icon appears grayed out. GTK does not emit the
        /// `gtk.Entry.signals.@"icon_press[ and [signal@Gtk.Entry::icon_release"`
        /// signals and does not allow DND from insensitive icons.
        ///
        /// An icon should be set insensitive if the action that would trigger
        /// when clicked is currently not available.
        pub const secondary_icon_sensitive = struct {
            pub const name = "secondary-icon-sensitive";

            pub const Type = c_int;
        };

        /// The representation which is used for the secondary icon of the entry.
        pub const secondary_icon_storage_type = struct {
            pub const name = "secondary-icon-storage-type";

            pub const Type = gtk.ImageType;
        };

        /// The contents of the tooltip on the secondary icon, with markup.
        ///
        /// Also see `gtk.Entry.setIconTooltipMarkup`.
        pub const secondary_icon_tooltip_markup = struct {
            pub const name = "secondary-icon-tooltip-markup";

            pub const Type = ?[*:0]u8;
        };

        /// The contents of the tooltip on the secondary icon.
        ///
        /// Also see `gtk.Entry.setIconTooltipText`.
        pub const secondary_icon_tooltip_text = struct {
            pub const name = "secondary-icon-tooltip-text";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the entry will show an Emoji icon in the secondary icon position
        /// to open the Emoji chooser.
        pub const show_emoji_icon = struct {
            pub const name = "show-emoji-icon";

            pub const Type = c_int;
        };

        /// A list of tabstops to apply to the text of the entry.
        pub const tabs = struct {
            pub const name = "tabs";

            pub const Type = ?*pango.TabArray;
        };

        /// The length of the text in the `GtkEntry`.
        pub const text_length = struct {
            pub const name = "text-length";

            pub const Type = c_uint;
        };

        /// When `TRUE`, pasted multi-line text is truncated to the first line.
        pub const truncate_multiline = struct {
            pub const name = "truncate-multiline";

            pub const Type = c_int;
        };

        /// Whether the entry should show the “invisible char” instead of the
        /// actual text (“password mode”).
        pub const visibility = struct {
            pub const name = "visibility";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the entry is activated.
        ///
        /// The keybindings for this signal are all forms of the Enter key.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Entry, p_instance))),
                    gobject.signalLookup("activate", Entry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when an activatable icon is clicked.
        pub const icon_press = struct {
            pub const name = "icon-press";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_icon_pos: gtk.EntryIconPosition, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Entry, p_instance))),
                    gobject.signalLookup("icon-press", Entry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted on the button release from a mouse click
        /// over an activatable icon.
        pub const icon_release = struct {
            pub const name = "icon-release";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_icon_pos: gtk.EntryIconPosition, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Entry, p_instance))),
                    gobject.signalLookup("icon-release", Entry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new entry.
    extern fn gtk_entry_new() *gtk.Entry;
    pub const new = gtk_entry_new;

    /// Creates a new entry with the specified text buffer.
    extern fn gtk_entry_new_with_buffer(p_buffer: *gtk.EntryBuffer) *gtk.Entry;
    pub const newWithBuffer = gtk_entry_new_with_buffer;

    /// Retrieves the value set by `gtk.Entry.setActivatesDefault`.
    extern fn gtk_entry_get_activates_default(p_entry: *Entry) c_int;
    pub const getActivatesDefault = gtk_entry_get_activates_default;

    /// Gets the value set by `gtk.Entry.setAlignment`.
    ///
    /// See also: `gtk.Editable.properties.xalign`
    extern fn gtk_entry_get_alignment(p_entry: *Entry) f32;
    pub const getAlignment = gtk_entry_get_alignment;

    /// Gets the attribute list of the `GtkEntry`.
    ///
    /// See `gtk.Entry.setAttributes`.
    extern fn gtk_entry_get_attributes(p_entry: *Entry) ?*pango.AttrList;
    pub const getAttributes = gtk_entry_get_attributes;

    /// Get the `GtkEntryBuffer` object which holds the text for
    /// this widget.
    extern fn gtk_entry_get_buffer(p_entry: *Entry) *gtk.EntryBuffer;
    pub const getBuffer = gtk_entry_get_buffer;

    /// Returns the auxiliary completion object currently
    /// in use by `entry`.
    extern fn gtk_entry_get_completion(p_entry: *Entry) ?*gtk.EntryCompletion;
    pub const getCompletion = gtk_entry_get_completion;

    /// Returns the index of the icon which is the source of the
    /// current  DND operation, or -1.
    extern fn gtk_entry_get_current_icon_drag_source(p_entry: *Entry) c_int;
    pub const getCurrentIconDragSource = gtk_entry_get_current_icon_drag_source;

    /// Gets the menu model set with `gtk.Entry.setExtraMenu`.
    extern fn gtk_entry_get_extra_menu(p_entry: *Entry) ?*gio.MenuModel;
    pub const getExtraMenu = gtk_entry_get_extra_menu;

    /// Gets the value set by `gtk.Entry.setHasFrame`.
    extern fn gtk_entry_get_has_frame(p_entry: *Entry) c_int;
    pub const getHasFrame = gtk_entry_get_has_frame;

    /// Returns whether the icon is activatable.
    extern fn gtk_entry_get_icon_activatable(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) c_int;
    pub const getIconActivatable = gtk_entry_get_icon_activatable;

    /// Gets the area where entry’s icon at `icon_pos` is drawn.
    ///
    /// This function is useful when drawing something to the
    /// entry in a draw callback.
    ///
    /// If the entry is not realized or has no icon at the given
    /// position, `icon_area` is filled with zeros. Otherwise,
    /// `icon_area` will be filled with the icon's allocation,
    /// relative to `entry`'s allocation.
    extern fn gtk_entry_get_icon_area(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_icon_area: *gdk.Rectangle) void;
    pub const getIconArea = gtk_entry_get_icon_area;

    /// Finds the icon at the given position and return its index.
    ///
    /// The position’s coordinates are relative to the `entry`’s
    /// top left corner. If `x`, `y` doesn’t lie inside an icon,
    /// -1 is returned. This function is intended for use in a
    /// `gtk.Widget.signals.query_tooltip` signal handler.
    extern fn gtk_entry_get_icon_at_pos(p_entry: *Entry, p_x: c_int, p_y: c_int) c_int;
    pub const getIconAtPos = gtk_entry_get_icon_at_pos;

    /// Retrieves the `GIcon` used for the icon.
    ///
    /// `NULL` will be returned if there is no icon or if the icon was
    /// set by some other method (e.g., by `GdkPaintable` or icon name).
    extern fn gtk_entry_get_icon_gicon(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) ?*gio.Icon;
    pub const getIconGicon = gtk_entry_get_icon_gicon;

    /// Retrieves the icon name used for the icon.
    ///
    /// `NULL` is returned if there is no icon or if the icon was set
    /// by some other method (e.g., by `GdkPaintable` or gicon).
    extern fn gtk_entry_get_icon_name(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) ?[*:0]const u8;
    pub const getIconName = gtk_entry_get_icon_name;

    /// Retrieves the `GdkPaintable` used for the icon.
    ///
    /// If no `GdkPaintable` was used for the icon, `NULL` is returned.
    extern fn gtk_entry_get_icon_paintable(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) ?*gdk.Paintable;
    pub const getIconPaintable = gtk_entry_get_icon_paintable;

    /// Returns whether the icon appears sensitive or insensitive.
    extern fn gtk_entry_get_icon_sensitive(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) c_int;
    pub const getIconSensitive = gtk_entry_get_icon_sensitive;

    /// Gets the type of representation being used by the icon
    /// to store image data.
    ///
    /// If the icon has no image data, the return value will
    /// be `GTK_IMAGE_EMPTY`.
    extern fn gtk_entry_get_icon_storage_type(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) gtk.ImageType;
    pub const getIconStorageType = gtk_entry_get_icon_storage_type;

    /// Gets the contents of the tooltip on the icon at the specified
    /// position in `entry`.
    extern fn gtk_entry_get_icon_tooltip_markup(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) ?[*:0]u8;
    pub const getIconTooltipMarkup = gtk_entry_get_icon_tooltip_markup;

    /// Gets the contents of the tooltip on the icon at the specified
    /// position in `entry`.
    extern fn gtk_entry_get_icon_tooltip_text(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) ?[*:0]u8;
    pub const getIconTooltipText = gtk_entry_get_icon_tooltip_text;

    /// Gets the input hints of this `GtkEntry`.
    extern fn gtk_entry_get_input_hints(p_entry: *Entry) gtk.InputHints;
    pub const getInputHints = gtk_entry_get_input_hints;

    /// Gets the input purpose of the `GtkEntry`.
    extern fn gtk_entry_get_input_purpose(p_entry: *Entry) gtk.InputPurpose;
    pub const getInputPurpose = gtk_entry_get_input_purpose;

    /// Retrieves the character displayed in place of the actual text
    /// in “password mode”.
    extern fn gtk_entry_get_invisible_char(p_entry: *Entry) u32;
    pub const getInvisibleChar = gtk_entry_get_invisible_char;

    /// Retrieves the maximum allowed length of the text in `entry`.
    ///
    /// See `gtk.Entry.setMaxLength`.
    extern fn gtk_entry_get_max_length(p_entry: *Entry) c_int;
    pub const getMaxLength = gtk_entry_get_max_length;

    /// Gets the text that will be used in the context menu of the `GtkEntry`
    /// when the specified icon is activatable. Selecting this item in the menu
    /// results, from all aspects, the same than clicking on the specified icon.
    /// This greatly simplifies making accessible applications, because the icons
    /// aren't focusable when using keyboard navigation. This is why Gtk recommends
    /// to add the same action to the context menu.
    extern fn gtk_entry_get_menu_entry_icon_text(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition) ?[*:0]const u8;
    pub const getMenuEntryIconText = gtk_entry_get_menu_entry_icon_text;

    /// Gets whether the `GtkEntry` is in overwrite mode.
    extern fn gtk_entry_get_overwrite_mode(p_entry: *Entry) c_int;
    pub const getOverwriteMode = gtk_entry_get_overwrite_mode;

    /// Retrieves the text that will be displayed when `entry`
    /// is empty and unfocused
    extern fn gtk_entry_get_placeholder_text(p_entry: *Entry) ?[*:0]const u8;
    pub const getPlaceholderText = gtk_entry_get_placeholder_text;

    /// Returns the current fraction of the task that’s been completed.
    ///
    /// See `gtk.Entry.setProgressFraction`.
    extern fn gtk_entry_get_progress_fraction(p_entry: *Entry) f64;
    pub const getProgressFraction = gtk_entry_get_progress_fraction;

    /// Retrieves the pulse step set with
    /// `gtk.Entry.setProgressPulseStep`.
    extern fn gtk_entry_get_progress_pulse_step(p_entry: *Entry) f64;
    pub const getProgressPulseStep = gtk_entry_get_progress_pulse_step;

    /// Gets the tabstops of the `GtkEntry`.
    ///
    /// See `gtk.Entry.setTabs`.
    extern fn gtk_entry_get_tabs(p_entry: *Entry) ?*pango.TabArray;
    pub const getTabs = gtk_entry_get_tabs;

    /// Retrieves the current length of the text in `entry`.
    ///
    /// This is equivalent to getting `entry`'s `GtkEntryBuffer`
    /// and calling `gtk.EntryBuffer.getLength` on it.
    extern fn gtk_entry_get_text_length(p_entry: *Entry) u16;
    pub const getTextLength = gtk_entry_get_text_length;

    /// Retrieves whether the text in `entry` is visible.
    ///
    /// See `gtk.Entry.setVisibility`.
    extern fn gtk_entry_get_visibility(p_entry: *Entry) c_int;
    pub const getVisibility = gtk_entry_get_visibility;

    /// Causes `entry` to have keyboard focus.
    ///
    /// It behaves like `gtk.Widget.grabFocus`, except that it doesn't
    /// select the contents of the entry. You only want to call this on some
    /// special entries which the user usually doesn't want to replace all text
    /// in, such as search-as-you-type entries.
    extern fn gtk_entry_grab_focus_without_selecting(p_entry: *Entry) c_int;
    pub const grabFocusWithoutSelecting = gtk_entry_grab_focus_without_selecting;

    /// Indicates that some progress is made, but you don’t
    /// know how much.
    ///
    /// Causes the entry’s progress indicator to enter “activity
    /// mode”, where a block bounces back and forth. Each call to
    /// `gtk.Entry.progressPulse` causes the block to move by a
    /// little bit (the amount of movement per pulse is determined
    /// by `gtk.Entry.setProgressPulseStep`).
    extern fn gtk_entry_progress_pulse(p_entry: *Entry) void;
    pub const progressPulse = gtk_entry_progress_pulse;

    /// Reset the input method context of the entry if needed.
    ///
    /// This can be necessary in the case where modifying the buffer
    /// would confuse on-going input method behavior.
    extern fn gtk_entry_reset_im_context(p_entry: *Entry) void;
    pub const resetImContext = gtk_entry_reset_im_context;

    /// Sets whether pressing Enter in the `entry` will activate the default
    /// widget for the window containing the entry.
    ///
    /// This usually means that the dialog containing the entry will be closed,
    /// since the default widget is usually one of the dialog buttons.
    extern fn gtk_entry_set_activates_default(p_entry: *Entry, p_setting: c_int) void;
    pub const setActivatesDefault = gtk_entry_set_activates_default;

    /// Sets the alignment for the contents of the entry.
    ///
    /// This controls the horizontal positioning of the contents when
    /// the displayed text is shorter than the width of the entry.
    ///
    /// See also: `gtk.Editable.properties.xalign`
    extern fn gtk_entry_set_alignment(p_entry: *Entry, p_xalign: f32) void;
    pub const setAlignment = gtk_entry_set_alignment;

    /// Sets a `PangoAttrList`.
    ///
    /// The attributes in the list are applied to the entry text.
    ///
    /// Since the attributes will be applied to text that changes
    /// as the user types, it makes most sense to use attributes
    /// with unlimited extent.
    extern fn gtk_entry_set_attributes(p_entry: *Entry, p_attrs: *pango.AttrList) void;
    pub const setAttributes = gtk_entry_set_attributes;

    /// Set the `GtkEntryBuffer` object which holds the text for
    /// this widget.
    extern fn gtk_entry_set_buffer(p_entry: *Entry, p_buffer: *gtk.EntryBuffer) void;
    pub const setBuffer = gtk_entry_set_buffer;

    /// Sets `completion` to be the auxiliary completion object
    /// to use with `entry`.
    ///
    /// All further configuration of the completion mechanism is
    /// done on `completion` using the `GtkEntryCompletion` API.
    /// Completion is disabled if `completion` is set to `NULL`.
    extern fn gtk_entry_set_completion(p_entry: *Entry, p_completion: ?*gtk.EntryCompletion) void;
    pub const setCompletion = gtk_entry_set_completion;

    /// Sets a menu model to add when constructing
    /// the context menu for `entry`.
    extern fn gtk_entry_set_extra_menu(p_entry: *Entry, p_model: ?*gio.MenuModel) void;
    pub const setExtraMenu = gtk_entry_set_extra_menu;

    /// Sets whether the entry has a beveled frame around it.
    extern fn gtk_entry_set_has_frame(p_entry: *Entry, p_setting: c_int) void;
    pub const setHasFrame = gtk_entry_set_has_frame;

    /// Sets whether the icon is activatable.
    extern fn gtk_entry_set_icon_activatable(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_activatable: c_int) void;
    pub const setIconActivatable = gtk_entry_set_icon_activatable;

    /// Sets up the icon at the given position as drag source.
    ///
    /// This makes it so that GTK will start a drag
    /// operation when the user clicks and drags the icon.
    extern fn gtk_entry_set_icon_drag_source(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_provider: *gdk.ContentProvider, p_actions: gdk.DragAction) void;
    pub const setIconDragSource = gtk_entry_set_icon_drag_source;

    /// Sets the icon shown in the entry at the specified position
    /// from the current icon theme.
    ///
    /// If the icon isn’t known, a “broken image” icon will be
    /// displayed instead.
    ///
    /// If `icon` is `NULL`, no icon will be shown in the
    /// specified position.
    extern fn gtk_entry_set_icon_from_gicon(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_icon: ?*gio.Icon) void;
    pub const setIconFromGicon = gtk_entry_set_icon_from_gicon;

    /// Sets the icon shown in the entry at the specified position
    /// from the current icon theme.
    ///
    /// If the icon name isn’t known, a “broken image” icon will be
    /// displayed instead.
    ///
    /// If `icon_name` is `NULL`, no icon will be shown in the
    /// specified position.
    extern fn gtk_entry_set_icon_from_icon_name(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_icon_name: ?[*:0]const u8) void;
    pub const setIconFromIconName = gtk_entry_set_icon_from_icon_name;

    /// Sets the icon shown in the specified position using a `GdkPaintable`.
    ///
    /// If `paintable` is `NULL`, no icon will be shown in the specified position.
    extern fn gtk_entry_set_icon_from_paintable(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_paintable: ?*gdk.Paintable) void;
    pub const setIconFromPaintable = gtk_entry_set_icon_from_paintable;

    /// Sets the sensitivity for the specified icon.
    extern fn gtk_entry_set_icon_sensitive(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_sensitive: c_int) void;
    pub const setIconSensitive = gtk_entry_set_icon_sensitive;

    /// Sets `tooltip` as the contents of the tooltip for the icon at
    /// the specified position.
    ///
    /// `tooltip` is assumed to be marked up with Pango Markup.
    ///
    /// Use `NULL` for `tooltip` to remove an existing tooltip.
    ///
    /// See also `gtk.Widget.setTooltipMarkup` and
    /// `gtk.Entry.setIconTooltipText`.
    extern fn gtk_entry_set_icon_tooltip_markup(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_tooltip: ?[*:0]const u8) void;
    pub const setIconTooltipMarkup = gtk_entry_set_icon_tooltip_markup;

    /// Sets `tooltip` as the contents of the tooltip for the icon
    /// at the specified position.
    ///
    /// Use `NULL` for `tooltip` to remove an existing tooltip.
    ///
    /// See also `gtk.Widget.setTooltipText` and
    /// `gtk.Entry.setIconTooltipMarkup`.
    ///
    /// If you unset the widget tooltip via
    /// `gtk.Widget.setTooltipText` or
    /// `gtk.Widget.setTooltipMarkup`, this sets
    /// `gtk.Widget.properties.has_tooltip` to `FALSE`, which suppresses
    /// icon tooltips too. You can resolve this by then calling
    /// `gtk.Widget.setHasTooltip` to set
    /// `gtk.Widget.properties.has_tooltip` back to `TRUE`, or
    /// setting at least one non-empty tooltip on any icon
    /// achieves the same result.
    extern fn gtk_entry_set_icon_tooltip_text(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_tooltip: ?[*:0]const u8) void;
    pub const setIconTooltipText = gtk_entry_set_icon_tooltip_text;

    /// Set additional hints which allow input methods to
    /// fine-tune their behavior.
    extern fn gtk_entry_set_input_hints(p_entry: *Entry, p_hints: gtk.InputHints) void;
    pub const setInputHints = gtk_entry_set_input_hints;

    /// Sets the input purpose which can be used by input methods
    /// to adjust their behavior.
    extern fn gtk_entry_set_input_purpose(p_entry: *Entry, p_purpose: gtk.InputPurpose) void;
    pub const setInputPurpose = gtk_entry_set_input_purpose;

    /// Sets the character to use in place of the actual text
    /// in “password mode”.
    ///
    /// See `gtk.Entry.setVisibility` for how to enable
    /// “password mode”.
    ///
    /// By default, GTK picks the best invisible char available in
    /// the current font. If you set the invisible char to 0, then
    /// the user will get no feedback at all; there will be no text
    /// on the screen as they type.
    extern fn gtk_entry_set_invisible_char(p_entry: *Entry, p_ch: u32) void;
    pub const setInvisibleChar = gtk_entry_set_invisible_char;

    /// Sets the maximum allowed length of the contents of the widget.
    ///
    /// If the current contents are longer than the given length, then
    /// they will be truncated to fit. The length is in characters.
    ///
    /// This is equivalent to getting `entry`'s `GtkEntryBuffer` and
    /// calling `gtk.EntryBuffer.setMaxLength` on it.
    extern fn gtk_entry_set_max_length(p_entry: *Entry, p_max: c_int) void;
    pub const setMaxLength = gtk_entry_set_max_length;

    /// Sets the text that will be used in the context menu of the `GtkEntry`
    /// when the specified icon is activatable. Selecting this item in the menu
    /// results, from all aspects, the same than clicking on the specified icon.
    /// This greatly simplifies making accessible applications, because the icons
    /// aren't focusable when using keyboard navigation. This is why Gtk recommends
    /// to add the same action to the context menu.
    extern fn gtk_entry_set_menu_entry_icon_text(p_entry: *Entry, p_icon_pos: gtk.EntryIconPosition, p_text: [*:0]const u8) void;
    pub const setMenuEntryIconText = gtk_entry_set_menu_entry_icon_text;

    /// Sets whether the text is overwritten when typing in the `GtkEntry`.
    extern fn gtk_entry_set_overwrite_mode(p_entry: *Entry, p_overwrite: c_int) void;
    pub const setOverwriteMode = gtk_entry_set_overwrite_mode;

    /// Sets text to be displayed in `entry` when it is empty.
    ///
    /// This can be used to give a visual hint of the expected
    /// contents of the `GtkEntry`.
    extern fn gtk_entry_set_placeholder_text(p_entry: *Entry, p_text: ?[*:0]const u8) void;
    pub const setPlaceholderText = gtk_entry_set_placeholder_text;

    /// Causes the entry’s progress indicator to “fill in” the given
    /// fraction of the bar.
    ///
    /// The fraction should be between 0.0 and 1.0, inclusive.
    extern fn gtk_entry_set_progress_fraction(p_entry: *Entry, p_fraction: f64) void;
    pub const setProgressFraction = gtk_entry_set_progress_fraction;

    /// Sets the fraction of total entry width to move the progress
    /// bouncing block for each pulse.
    ///
    /// Use `gtk.Entry.progressPulse` to pulse
    /// the progress.
    extern fn gtk_entry_set_progress_pulse_step(p_entry: *Entry, p_fraction: f64) void;
    pub const setProgressPulseStep = gtk_entry_set_progress_pulse_step;

    /// Sets a `PangoTabArray`.
    ///
    /// The tabstops in the array are applied to the entry text.
    extern fn gtk_entry_set_tabs(p_entry: *Entry, p_tabs: ?*pango.TabArray) void;
    pub const setTabs = gtk_entry_set_tabs;

    /// Sets whether the contents of the entry are visible or not.
    ///
    /// When visibility is set to `FALSE`, characters are displayed
    /// as the invisible char, and will also appear that way when
    /// the text in the entry widget is copied elsewhere.
    ///
    /// By default, GTK picks the best invisible character available
    /// in the current font, but it can be changed with
    /// `gtk.Entry.setInvisibleChar`.
    ///
    /// Note that you probably want to set `gtk.Entry.properties.input_purpose`
    /// to `GTK_INPUT_PURPOSE_PASSWORD` or `GTK_INPUT_PURPOSE_PIN` to
    /// inform input methods about the purpose of this entry,
    /// in addition to setting visibility to `FALSE`.
    extern fn gtk_entry_set_visibility(p_entry: *Entry, p_visible: c_int) void;
    pub const setVisibility = gtk_entry_set_visibility;

    /// Unsets the invisible char, so that the default invisible char
    /// is used again. See `gtk.Entry.setInvisibleChar`.
    extern fn gtk_entry_unset_invisible_char(p_entry: *Entry) void;
    pub const unsetInvisibleChar = gtk_entry_unset_invisible_char;

    extern fn gtk_entry_get_type() usize;
    pub const getGObjectType = gtk_entry_get_type;

    extern fn g_object_ref(p_self: *gtk.Entry) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Entry) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Entry, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Holds the text that is displayed in a single-line text entry widget.
///
/// A single `GtkEntryBuffer` object can be shared by multiple widgets
/// which will then share the same text content, but not the cursor
/// position, visibility attributes, icon etc.
///
/// `GtkEntryBuffer` may be derived from. Such a derived class might allow
/// text to be stored in an alternate location, such as non-pageable memory,
/// useful in the case of important passwords. Or a derived class could
/// integrate with an application’s concept of undo/redo.
pub const EntryBuffer = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.EntryBufferClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Deletes a sequence of characters from the buffer.
        ///
        /// `n_chars` characters are deleted starting at `position`.
        /// If `n_chars` is negative, then all characters until the
        /// end of the text are deleted.
        ///
        /// If `position` or `n_chars` are out of bounds, then they
        /// are coerced to sane values.
        ///
        /// Note that the positions are specified in characters,
        /// not bytes.
        pub const delete_text = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_chars: c_uint) c_uint {
                return gobject.ext.as(EntryBuffer.Class, p_class).f_delete_text.?(gobject.ext.as(EntryBuffer, p_buffer), p_position, p_n_chars);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_chars: c_uint) callconv(.c) c_uint) void {
                gobject.ext.as(EntryBuffer.Class, p_class).f_delete_text = @ptrCast(p_implementation);
            }
        };

        pub const deleted_text = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_chars: c_uint) void {
                return gobject.ext.as(EntryBuffer.Class, p_class).f_deleted_text.?(gobject.ext.as(EntryBuffer, p_buffer), p_position, p_n_chars);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_chars: c_uint) callconv(.c) void) void {
                gobject.ext.as(EntryBuffer.Class, p_class).f_deleted_text = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the length in characters of the buffer.
        pub const get_length = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_uint {
                return gobject.ext.as(EntryBuffer.Class, p_class).f_get_length.?(gobject.ext.as(EntryBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_uint) void {
                gobject.ext.as(EntryBuffer.Class, p_class).f_get_length = @ptrCast(p_implementation);
            }
        };

        pub const get_text = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_n_bytes: *usize) [*:0]const u8 {
                return gobject.ext.as(EntryBuffer.Class, p_class).f_get_text.?(gobject.ext.as(EntryBuffer, p_buffer), p_n_bytes);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_n_bytes: *usize) callconv(.c) [*:0]const u8) void {
                gobject.ext.as(EntryBuffer.Class, p_class).f_get_text = @ptrCast(p_implementation);
            }
        };

        /// Inserts `n_chars` characters of `chars` into the contents of the
        /// buffer, at position `position`.
        ///
        /// If `n_chars` is negative, then characters from chars will be inserted
        /// until a null-terminator is found. If `position` or `n_chars` are out of
        /// bounds, or the maximum buffer text length is exceeded, then they are
        /// coerced to sane values.
        ///
        /// Note that the position and length are in characters, not in bytes.
        pub const insert_text = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) c_uint {
                return gobject.ext.as(EntryBuffer.Class, p_class).f_insert_text.?(gobject.ext.as(EntryBuffer, p_buffer), p_position, p_chars, p_n_chars);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) callconv(.c) c_uint) void {
                gobject.ext.as(EntryBuffer.Class, p_class).f_insert_text = @ptrCast(p_implementation);
            }
        };

        pub const inserted_text = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) void {
                return gobject.ext.as(EntryBuffer.Class, p_class).f_inserted_text.?(gobject.ext.as(EntryBuffer, p_buffer), p_position, p_chars, p_n_chars);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) callconv(.c) void) void {
                gobject.ext.as(EntryBuffer.Class, p_class).f_inserted_text = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The length (in characters) of the text in buffer.
        pub const length = struct {
            pub const name = "length";

            pub const Type = c_uint;
        };

        /// The maximum length (in characters) of the text in the buffer.
        pub const max_length = struct {
            pub const name = "max-length";

            pub const Type = c_int;
        };

        /// The contents of the buffer.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// The text is altered in the default handler for this signal.
        ///
        /// If you want access to the text after the text has been modified,
        /// use `G_CONNECT_AFTER`.
        pub const deleted_text = struct {
            pub const name = "deleted-text";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, p_n_chars: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EntryBuffer, p_instance))),
                    gobject.signalLookup("deleted-text", EntryBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is emitted after text is inserted into the buffer.
        pub const inserted_text = struct {
            pub const name = "inserted-text";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, p_chars: [*:0]u8, p_n_chars: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EntryBuffer, p_instance))),
                    gobject.signalLookup("inserted-text", EntryBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Create a new `GtkEntryBuffer` object.
    ///
    /// Optionally, specify initial text to set in the buffer.
    extern fn gtk_entry_buffer_new(p_initial_chars: ?[*:0]const u8, p_n_initial_chars: c_int) *gtk.EntryBuffer;
    pub const new = gtk_entry_buffer_new;

    /// Deletes a sequence of characters from the buffer.
    ///
    /// `n_chars` characters are deleted starting at `position`.
    /// If `n_chars` is negative, then all characters until the
    /// end of the text are deleted.
    ///
    /// If `position` or `n_chars` are out of bounds, then they
    /// are coerced to sane values.
    ///
    /// Note that the positions are specified in characters,
    /// not bytes.
    extern fn gtk_entry_buffer_delete_text(p_buffer: *EntryBuffer, p_position: c_uint, p_n_chars: c_int) c_uint;
    pub const deleteText = gtk_entry_buffer_delete_text;

    /// Used when subclassing `GtkEntryBuffer`.
    extern fn gtk_entry_buffer_emit_deleted_text(p_buffer: *EntryBuffer, p_position: c_uint, p_n_chars: c_uint) void;
    pub const emitDeletedText = gtk_entry_buffer_emit_deleted_text;

    /// Used when subclassing `GtkEntryBuffer`.
    extern fn gtk_entry_buffer_emit_inserted_text(p_buffer: *EntryBuffer, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) void;
    pub const emitInsertedText = gtk_entry_buffer_emit_inserted_text;

    /// Retrieves the length in bytes of the buffer.
    ///
    /// See `gtk.EntryBuffer.getLength`.
    extern fn gtk_entry_buffer_get_bytes(p_buffer: *EntryBuffer) usize;
    pub const getBytes = gtk_entry_buffer_get_bytes;

    /// Retrieves the length in characters of the buffer.
    extern fn gtk_entry_buffer_get_length(p_buffer: *EntryBuffer) c_uint;
    pub const getLength = gtk_entry_buffer_get_length;

    /// Retrieves the maximum allowed length of the text in `buffer`.
    extern fn gtk_entry_buffer_get_max_length(p_buffer: *EntryBuffer) c_int;
    pub const getMaxLength = gtk_entry_buffer_get_max_length;

    /// Retrieves the contents of the buffer.
    ///
    /// The memory pointer returned by this call will not change
    /// unless this object emits a signal, or is finalized.
    extern fn gtk_entry_buffer_get_text(p_buffer: *EntryBuffer) [*:0]const u8;
    pub const getText = gtk_entry_buffer_get_text;

    /// Inserts `n_chars` characters of `chars` into the contents of the
    /// buffer, at position `position`.
    ///
    /// If `n_chars` is negative, then characters from chars will be inserted
    /// until a null-terminator is found. If `position` or `n_chars` are out of
    /// bounds, or the maximum buffer text length is exceeded, then they are
    /// coerced to sane values.
    ///
    /// Note that the position and length are in characters, not in bytes.
    extern fn gtk_entry_buffer_insert_text(p_buffer: *EntryBuffer, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_int) c_uint;
    pub const insertText = gtk_entry_buffer_insert_text;

    /// Sets the maximum allowed length of the contents of the buffer.
    ///
    /// If the current contents are longer than the given length, then
    /// they will be truncated to fit.
    extern fn gtk_entry_buffer_set_max_length(p_buffer: *EntryBuffer, p_max_length: c_int) void;
    pub const setMaxLength = gtk_entry_buffer_set_max_length;

    /// Sets the text in the buffer.
    ///
    /// This is roughly equivalent to calling
    /// `gtk.EntryBuffer.deleteText` and
    /// `gtk.EntryBuffer.insertText`.
    ///
    /// Note that `n_chars` is in characters, not in bytes.
    extern fn gtk_entry_buffer_set_text(p_buffer: *EntryBuffer, p_chars: [*:0]const u8, p_n_chars: c_int) void;
    pub const setText = gtk_entry_buffer_set_text;

    extern fn gtk_entry_buffer_get_type() usize;
    pub const getGObjectType = gtk_entry_buffer_get_type;

    extern fn g_object_ref(p_self: *gtk.EntryBuffer) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EntryBuffer) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EntryBuffer, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkEntryCompletion` is an auxiliary object to provide completion functionality
/// for `GtkEntry`.
///
/// It implements the `gtk.CellLayout` interface, to allow the user
/// to add extra cells to the `GtkTreeView` with completion matches.
///
/// “Completion functionality” means that when the user modifies the text
/// in the entry, `GtkEntryCompletion` checks which rows in the model match
/// the current content of the entry, and displays a list of matches.
/// By default, the matching is done by comparing the entry text
/// case-insensitively against the text column of the model (see
/// `gtk.EntryCompletion.setTextColumn`), but this can be overridden
/// with a custom match function (see `gtk.EntryCompletion.setMatchFunc`).
///
/// When the user selects a completion, the content of the entry is
/// updated. By default, the content of the entry is replaced by the
/// text column of the model, but this can be overridden by connecting
/// to the `gtk.EntryCompletion.signals.match_selected` signal and updating the
/// entry in the signal handler. Note that you should return `TRUE` from
/// the signal handler to suppress the default behaviour.
///
/// To add completion functionality to an entry, use
/// `gtk.Entry.setCompletion`.
///
/// `GtkEntryCompletion` uses a `gtk.TreeModelFilter` model to
/// represent the subset of the entire model that is currently matching.
/// While the `GtkEntryCompletion` signals
/// `gtk.EntryCompletion.signals.match_selected` and
/// `gtk.EntryCompletion.signals.cursor_on_match` take the original model
/// and an iter pointing to that model as arguments, other callbacks and
/// signals (such as `GtkCellLayoutDataFunc` or
/// `gtk.CellArea.signals.@"apply_attributes)"`
/// will generally take the filter model as argument. As long as you are
/// only calling `gtk.TreeModel.get`, this will make no difference to
/// you. If for some reason, you need the original model, use
/// `gtk.TreeModelFilter.getModel`. Don’t forget to use
/// `gtk.TreeModelFilter.convertIterToChildIter` to obtain a
/// matching iter.
pub const EntryCompletion = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gtk.Buildable, gtk.CellLayout };
    pub const Class = opaque {
        pub const Instance = EntryCompletion;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkCellArea` used to layout cell renderers in the treeview column.
        ///
        /// If no area is specified when creating the entry completion with
        /// `gtk.EntryCompletion.newWithArea`, a horizontally oriented
        /// `gtk.CellAreaBox` will be used.
        pub const cell_area = struct {
            pub const name = "cell-area";

            pub const Type = ?*gtk.CellArea;
        };

        /// Determines whether the common prefix of the possible completions
        /// should be inserted automatically in the entry.
        ///
        /// Note that this requires text-column to be set, even if you are
        /// using a custom match function.
        pub const inline_completion = struct {
            pub const name = "inline-completion";

            pub const Type = c_int;
        };

        /// Determines whether the possible completions on the popup
        /// will appear in the entry as you navigate through them.
        pub const inline_selection = struct {
            pub const name = "inline-selection";

            pub const Type = c_int;
        };

        /// The minimum key length as set for completion.
        pub const minimum_key_length = struct {
            pub const name = "minimum-key-length";

            pub const Type = c_int;
        };

        /// The model used as data source.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };

        /// Determines whether the possible completions should be
        /// shown in a popup window.
        pub const popup_completion = struct {
            pub const name = "popup-completion";

            pub const Type = c_int;
        };

        /// Determines whether the completions popup window will be
        /// resized to the width of the entry.
        pub const popup_set_width = struct {
            pub const name = "popup-set-width";

            pub const Type = c_int;
        };

        /// Determines whether the completions popup window will shown
        /// for a single possible completion.
        ///
        /// You probably want to set this to `FALSE` if you are using
        /// `gtk.EntryCompletion.properties.inline_completion`.
        pub const popup_single_match = struct {
            pub const name = "popup-single-match";

            pub const Type = c_int;
        };

        /// The column of the model containing the strings.
        ///
        /// Note that the strings must be UTF-8.
        pub const text_column = struct {
            pub const name = "text-column";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when a match from the cursor is on a match of the list.
        ///
        /// The default behaviour is to replace the contents
        /// of the entry with the contents of the text column in the row
        /// pointed to by `iter`.
        ///
        /// Note that `model` is the model that was passed to
        /// `gtk.EntryCompletion.setModel`.
        pub const cursor_on_match = struct {
            pub const name = "cursor-on-match";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EntryCompletion, p_instance))),
                    gobject.signalLookup("cursor-on-match", EntryCompletion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the inline autocompletion is triggered.
        ///
        /// The default behaviour is to make the entry display the
        /// whole prefix and select the newly inserted part.
        ///
        /// Applications may connect to this signal in order to insert only a
        /// smaller part of the `prefix` into the entry - e.g. the entry used in
        /// the `GtkFileChooser` inserts only the part of the prefix up to the
        /// next '/'.
        pub const insert_prefix = struct {
            pub const name = "insert-prefix";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_prefix: [*:0]u8, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EntryCompletion, p_instance))),
                    gobject.signalLookup("insert-prefix", EntryCompletion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a match from the list is selected.
        ///
        /// The default behaviour is to replace the contents of the
        /// entry with the contents of the text column in the row
        /// pointed to by `iter`.
        ///
        /// Note that `model` is the model that was passed to
        /// `gtk.EntryCompletion.setModel`.
        pub const match_selected = struct {
            pub const name = "match-selected";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EntryCompletion, p_instance))),
                    gobject.signalLookup("match-selected", EntryCompletion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the filter model has zero
        /// number of rows in completion_complete method.
        ///
        /// In other words when `GtkEntryCompletion` is out of suggestions.
        pub const no_matches = struct {
            pub const name = "no-matches";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EntryCompletion, p_instance))),
                    gobject.signalLookup("no-matches", EntryCompletion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkEntryCompletion` object.
    extern fn gtk_entry_completion_new() *gtk.EntryCompletion;
    pub const new = gtk_entry_completion_new;

    /// Creates a new `GtkEntryCompletion` object using the
    /// specified `area`.
    ///
    /// The `GtkCellArea` is used to layout cells in the underlying
    /// `GtkTreeViewColumn` for the drop-down menu.
    extern fn gtk_entry_completion_new_with_area(p_area: *gtk.CellArea) *gtk.EntryCompletion;
    pub const newWithArea = gtk_entry_completion_new_with_area;

    /// Requests a completion operation, or in other words a refiltering of the
    /// current list with completions, using the current key.
    ///
    /// The completion list view will be updated accordingly.
    extern fn gtk_entry_completion_complete(p_completion: *EntryCompletion) void;
    pub const complete = gtk_entry_completion_complete;

    /// Computes the common prefix that is shared by all rows in `completion`
    /// that start with `key`.
    ///
    /// If no row matches `key`, `NULL` will be returned.
    /// Note that a text column must have been set for this function to work,
    /// see `gtk.EntryCompletion.setTextColumn` for details.
    extern fn gtk_entry_completion_compute_prefix(p_completion: *EntryCompletion, p_key: [*:0]const u8) ?[*:0]u8;
    pub const computePrefix = gtk_entry_completion_compute_prefix;

    /// Get the original text entered by the user that triggered
    /// the completion or `NULL` if there’s no completion ongoing.
    extern fn gtk_entry_completion_get_completion_prefix(p_completion: *EntryCompletion) ?[*:0]const u8;
    pub const getCompletionPrefix = gtk_entry_completion_get_completion_prefix;

    /// Gets the entry `completion` has been attached to.
    extern fn gtk_entry_completion_get_entry(p_completion: *EntryCompletion) *gtk.Widget;
    pub const getEntry = gtk_entry_completion_get_entry;

    /// Returns whether the common prefix of the possible completions should
    /// be automatically inserted in the entry.
    extern fn gtk_entry_completion_get_inline_completion(p_completion: *EntryCompletion) c_int;
    pub const getInlineCompletion = gtk_entry_completion_get_inline_completion;

    /// Returns `TRUE` if inline-selection mode is turned on.
    extern fn gtk_entry_completion_get_inline_selection(p_completion: *EntryCompletion) c_int;
    pub const getInlineSelection = gtk_entry_completion_get_inline_selection;

    /// Returns the minimum key length as set for `completion`.
    extern fn gtk_entry_completion_get_minimum_key_length(p_completion: *EntryCompletion) c_int;
    pub const getMinimumKeyLength = gtk_entry_completion_get_minimum_key_length;

    /// Returns the model the `GtkEntryCompletion` is using as data source.
    ///
    /// Returns `NULL` if the model is unset.
    extern fn gtk_entry_completion_get_model(p_completion: *EntryCompletion) ?*gtk.TreeModel;
    pub const getModel = gtk_entry_completion_get_model;

    /// Returns whether the completions should be presented in a popup window.
    extern fn gtk_entry_completion_get_popup_completion(p_completion: *EntryCompletion) c_int;
    pub const getPopupCompletion = gtk_entry_completion_get_popup_completion;

    /// Returns whether the completion popup window will be resized to the
    /// width of the entry.
    extern fn gtk_entry_completion_get_popup_set_width(p_completion: *EntryCompletion) c_int;
    pub const getPopupSetWidth = gtk_entry_completion_get_popup_set_width;

    /// Returns whether the completion popup window will appear even if there is
    /// only a single match.
    extern fn gtk_entry_completion_get_popup_single_match(p_completion: *EntryCompletion) c_int;
    pub const getPopupSingleMatch = gtk_entry_completion_get_popup_single_match;

    /// Returns the column in the model of `completion` to get strings from.
    extern fn gtk_entry_completion_get_text_column(p_completion: *EntryCompletion) c_int;
    pub const getTextColumn = gtk_entry_completion_get_text_column;

    /// Requests a prefix insertion.
    extern fn gtk_entry_completion_insert_prefix(p_completion: *EntryCompletion) void;
    pub const insertPrefix = gtk_entry_completion_insert_prefix;

    /// Sets whether the common prefix of the possible completions should
    /// be automatically inserted in the entry.
    extern fn gtk_entry_completion_set_inline_completion(p_completion: *EntryCompletion, p_inline_completion: c_int) void;
    pub const setInlineCompletion = gtk_entry_completion_set_inline_completion;

    /// Sets whether it is possible to cycle through the possible completions
    /// inside the entry.
    extern fn gtk_entry_completion_set_inline_selection(p_completion: *EntryCompletion, p_inline_selection: c_int) void;
    pub const setInlineSelection = gtk_entry_completion_set_inline_selection;

    /// Sets the match function for `completion` to be `func`.
    ///
    /// The match function is used to determine if a row should or
    /// should not be in the completion list.
    extern fn gtk_entry_completion_set_match_func(p_completion: *EntryCompletion, p_func: gtk.EntryCompletionMatchFunc, p_func_data: ?*anyopaque, p_func_notify: ?glib.DestroyNotify) void;
    pub const setMatchFunc = gtk_entry_completion_set_match_func;

    /// Requires the length of the search key for `completion` to be at least
    /// `length`.
    ///
    /// This is useful for long lists, where completing using a small
    /// key takes a lot of time and will come up with meaningless results anyway
    /// (ie, a too large dataset).
    extern fn gtk_entry_completion_set_minimum_key_length(p_completion: *EntryCompletion, p_length: c_int) void;
    pub const setMinimumKeyLength = gtk_entry_completion_set_minimum_key_length;

    /// Sets the model for a `GtkEntryCompletion`.
    ///
    /// If `completion` already has a model set, it will remove it
    /// before setting the new model. If model is `NULL`, then it
    /// will unset the model.
    extern fn gtk_entry_completion_set_model(p_completion: *EntryCompletion, p_model: ?*gtk.TreeModel) void;
    pub const setModel = gtk_entry_completion_set_model;

    /// Sets whether the completions should be presented in a popup window.
    extern fn gtk_entry_completion_set_popup_completion(p_completion: *EntryCompletion, p_popup_completion: c_int) void;
    pub const setPopupCompletion = gtk_entry_completion_set_popup_completion;

    /// Sets whether the completion popup window will be resized to be the same
    /// width as the entry.
    extern fn gtk_entry_completion_set_popup_set_width(p_completion: *EntryCompletion, p_popup_set_width: c_int) void;
    pub const setPopupSetWidth = gtk_entry_completion_set_popup_set_width;

    /// Sets whether the completion popup window will appear even if there is
    /// only a single match.
    ///
    /// You may want to set this to `FALSE` if you
    /// are using `gtk.EntryCompletion.properties.inline_completion`.
    extern fn gtk_entry_completion_set_popup_single_match(p_completion: *EntryCompletion, p_popup_single_match: c_int) void;
    pub const setPopupSingleMatch = gtk_entry_completion_set_popup_single_match;

    /// Convenience function for setting up the most used case of this code: a
    /// completion list with just strings.
    ///
    /// This function will set up `completion`
    /// to have a list displaying all (and just) strings in the completion list,
    /// and to get those strings from `column` in the model of `completion`.
    ///
    /// This functions creates and adds a `GtkCellRendererText` for the selected
    /// column. If you need to set the text column, but don't want the cell
    /// renderer, use `gobject.Object.set` to set the
    /// `gtk.EntryCompletion.properties.text_column` property directly.
    extern fn gtk_entry_completion_set_text_column(p_completion: *EntryCompletion, p_column: c_int) void;
    pub const setTextColumn = gtk_entry_completion_set_text_column;

    extern fn gtk_entry_completion_get_type() usize;
    pub const getGObjectType = gtk_entry_completion_get_type;

    extern fn g_object_ref(p_self: *gtk.EntryCompletion) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EntryCompletion) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EntryCompletion, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The base class for event controllers.
///
/// These are ancillary objects associated to widgets, which react
/// to `GdkEvents`, and possibly trigger actions as a consequence.
///
/// Event controllers are added to a widget with
/// `gtk.Widget.addController`. It is rarely necessary to
/// explicitly remove a controller with `gtk.Widget.removeController`.
///
/// See the chapter on [input handling](input-handling.html) for
/// an overview of the basic concepts, such as the capture and bubble
/// phases of event propagation.
pub const EventController = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.EventControllerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The name for this controller, typically used for debugging purposes.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// The limit for which events this controller will handle.
        pub const propagation_limit = struct {
            pub const name = "propagation-limit";

            pub const Type = gtk.PropagationLimit;
        };

        /// The propagation phase at which this controller will handle events.
        pub const propagation_phase = struct {
            pub const name = "propagation-phase";

            pub const Type = gtk.PropagationPhase;
        };

        /// The widget receiving the `GdkEvents` that the controller will handle.
        pub const widget = struct {
            pub const name = "widget";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {};

    /// Returns the event that is currently being handled by the controller.
    ///
    /// At other times, `NULL` is returned.
    extern fn gtk_event_controller_get_current_event(p_controller: *EventController) ?*gdk.Event;
    pub const getCurrentEvent = gtk_event_controller_get_current_event;

    /// Returns the device of the event that is currently being
    /// handled by the controller.
    ///
    /// At other times, `NULL` is returned.
    extern fn gtk_event_controller_get_current_event_device(p_controller: *EventController) ?*gdk.Device;
    pub const getCurrentEventDevice = gtk_event_controller_get_current_event_device;

    /// Returns the modifier state of the event that is currently being
    /// handled by the controller.
    ///
    /// At other times, 0 is returned.
    extern fn gtk_event_controller_get_current_event_state(p_controller: *EventController) gdk.ModifierType;
    pub const getCurrentEventState = gtk_event_controller_get_current_event_state;

    /// Returns the timestamp of the event that is currently being
    /// handled by the controller.
    ///
    /// At other times, 0 is returned.
    extern fn gtk_event_controller_get_current_event_time(p_controller: *EventController) u32;
    pub const getCurrentEventTime = gtk_event_controller_get_current_event_time;

    /// Gets the name of `controller`.
    extern fn gtk_event_controller_get_name(p_controller: *EventController) ?[*:0]const u8;
    pub const getName = gtk_event_controller_get_name;

    /// Gets the propagation limit of the event controller.
    extern fn gtk_event_controller_get_propagation_limit(p_controller: *EventController) gtk.PropagationLimit;
    pub const getPropagationLimit = gtk_event_controller_get_propagation_limit;

    /// Gets the propagation phase at which `controller` handles events.
    extern fn gtk_event_controller_get_propagation_phase(p_controller: *EventController) gtk.PropagationPhase;
    pub const getPropagationPhase = gtk_event_controller_get_propagation_phase;

    /// Returns the `GtkWidget` this controller relates to.
    extern fn gtk_event_controller_get_widget(p_controller: *EventController) ?*gtk.Widget;
    pub const getWidget = gtk_event_controller_get_widget;

    /// Resets the `controller` to a clean state.
    extern fn gtk_event_controller_reset(p_controller: *EventController) void;
    pub const reset = gtk_event_controller_reset;

    /// Sets a name on the controller that can be used for debugging.
    extern fn gtk_event_controller_set_name(p_controller: *EventController, p_name: ?[*:0]const u8) void;
    pub const setName = gtk_event_controller_set_name;

    /// Sets the event propagation limit on the event controller.
    ///
    /// If the limit is set to `GTK_LIMIT_SAME_NATIVE`, the controller
    /// won't handle events that are targeted at widgets on a different
    /// surface, such as popovers.
    extern fn gtk_event_controller_set_propagation_limit(p_controller: *EventController, p_limit: gtk.PropagationLimit) void;
    pub const setPropagationLimit = gtk_event_controller_set_propagation_limit;

    /// Sets the propagation phase at which a controller handles events.
    ///
    /// If `phase` is `GTK_PHASE_NONE`, no automatic event handling will be
    /// performed, but other additional gesture maintenance will.
    extern fn gtk_event_controller_set_propagation_phase(p_controller: *EventController, p_phase: gtk.PropagationPhase) void;
    pub const setPropagationPhase = gtk_event_controller_set_propagation_phase;

    /// Sets a name on the controller that can be used for debugging.
    extern fn gtk_event_controller_set_static_name(p_controller: *EventController, p_name: ?[*:0]const u8) void;
    pub const setStaticName = gtk_event_controller_set_static_name;

    extern fn gtk_event_controller_get_type() usize;
    pub const getGObjectType = gtk_event_controller_get_type;

    extern fn g_object_ref(p_self: *gtk.EventController) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EventController) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EventController, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Tracks keyboard focus.
///
/// The event controller offers `gtk.EventControllerFocus.signals.enter`
/// and `gtk.EventControllerFocus.signals.leave` signals, as well as
/// `gtk.EventControllerFocus.properties.is_focus` and
/// `gtk.EventControllerFocus.properties.contains_focus` properties
/// which are updated to reflect focus changes inside the widget hierarchy
/// that is rooted at the controllers widget.
pub const EventControllerFocus = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.EventControllerFocusClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// `TRUE` if focus is contained in the controllers widget.
        ///
        /// See `gtk.EventControllerFocus.properties.is_focus` for whether
        /// the focus is in the widget itself or inside a descendent.
        ///
        /// When handling focus events, this property is updated
        /// before `gtk.EventControllerFocus.signals.enter` or
        /// `gtk.EventControllerFocus.signals.leave` are emitted.
        pub const contains_focus = struct {
            pub const name = "contains-focus";

            pub const Type = c_int;
        };

        /// `TRUE` if focus is in the controllers widget itself,
        /// as opposed to in a descendent widget.
        ///
        /// See also `gtk.EventControllerFocus.properties.contains_focus`.
        ///
        /// When handling focus events, this property is updated
        /// before `gtk.EventControllerFocus.signals.enter` or
        /// `gtk.EventControllerFocus.signals.leave` are emitted.
        pub const is_focus = struct {
            pub const name = "is-focus";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted whenever the focus enters into the widget or one
        /// of its descendents.
        ///
        /// Note that this means you may not get an ::enter signal
        /// even though the widget becomes the focus location, in
        /// certain cases (such as when the focus moves from a descendent
        /// of the widget to the widget itself). If you are interested
        /// in these cases, you can monitor the
        /// `gtk.EventControllerFocus.properties.is_focus`
        /// property for changes.
        pub const enter = struct {
            pub const name = "enter";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerFocus, p_instance))),
                    gobject.signalLookup("enter", EventControllerFocus.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever the focus leaves the widget hierarchy
        /// that is rooted at the widget that the controller is attached to.
        ///
        /// Note that this means you may not get a ::leave signal
        /// even though the focus moves away from the widget, in
        /// certain cases (such as when the focus moves from the widget
        /// to a descendent). If you are interested in these cases, you
        /// can monitor the `gtk.EventControllerFocus.properties.is_focus`
        /// property for changes.
        pub const leave = struct {
            pub const name = "leave";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerFocus, p_instance))),
                    gobject.signalLookup("leave", EventControllerFocus.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new event controller that will handle focus events.
    extern fn gtk_event_controller_focus_new() *gtk.EventControllerFocus;
    pub const new = gtk_event_controller_focus_new;

    /// Returns `TRUE` if focus is within `self` or one of its children.
    extern fn gtk_event_controller_focus_contains_focus(p_self: *EventControllerFocus) c_int;
    pub const containsFocus = gtk_event_controller_focus_contains_focus;

    /// Returns `TRUE` if focus is within `self`, but not one of its children.
    extern fn gtk_event_controller_focus_is_focus(p_self: *EventControllerFocus) c_int;
    pub const isFocus = gtk_event_controller_focus_is_focus;

    extern fn gtk_event_controller_focus_get_type() usize;
    pub const getGObjectType = gtk_event_controller_focus_get_type;

    extern fn g_object_ref(p_self: *gtk.EventControllerFocus) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EventControllerFocus) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EventControllerFocus, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides access to key events.
pub const EventControllerKey = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.EventControllerKeyClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever the input method context filters away
        /// a keypress and prevents the `controller` receiving it.
        ///
        /// See `gtk.EventControllerKey.setImContext` and
        /// `gtk.IMContext.filterKeypress`.
        pub const im_update = struct {
            pub const name = "im-update";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerKey, p_instance))),
                    gobject.signalLookup("im-update", EventControllerKey.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever a key is pressed.
        pub const key_pressed = struct {
            pub const name = "key-pressed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_keyval: c_uint, p_keycode: c_uint, p_state: gdk.ModifierType, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerKey, p_instance))),
                    gobject.signalLookup("key-pressed", EventControllerKey.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever a key is released.
        pub const key_released = struct {
            pub const name = "key-released";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_keyval: c_uint, p_keycode: c_uint, p_state: gdk.ModifierType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerKey, p_instance))),
                    gobject.signalLookup("key-released", EventControllerKey.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever the state of modifier keys and pointer buttons change.
        pub const modifiers = struct {
            pub const name = "modifiers";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_state: gdk.ModifierType, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerKey, p_instance))),
                    gobject.signalLookup("modifiers", EventControllerKey.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new event controller that will handle key events.
    extern fn gtk_event_controller_key_new() *gtk.EventControllerKey;
    pub const new = gtk_event_controller_key_new;

    /// Forwards the current event of this `controller` to a `widget`.
    ///
    /// This function can only be used in handlers for the
    /// `gtk.EventControllerKey.signals.key_pressed`,
    /// `gtk.EventControllerKey.signals.key_released`
    /// or `gtk.EventControllerKey.signals.modifiers` signals.
    extern fn gtk_event_controller_key_forward(p_controller: *EventControllerKey, p_widget: *gtk.Widget) c_int;
    pub const forward = gtk_event_controller_key_forward;

    /// Gets the key group of the current event of this `controller`.
    ///
    /// See `gdk.KeyEvent.getLayout`.
    extern fn gtk_event_controller_key_get_group(p_controller: *EventControllerKey) c_uint;
    pub const getGroup = gtk_event_controller_key_get_group;

    /// Gets the input method context of the key `controller`.
    extern fn gtk_event_controller_key_get_im_context(p_controller: *EventControllerKey) ?*gtk.IMContext;
    pub const getImContext = gtk_event_controller_key_get_im_context;

    /// Sets the input method context of the key `controller`.
    extern fn gtk_event_controller_key_set_im_context(p_controller: *EventControllerKey, p_im_context: ?*gtk.IMContext) void;
    pub const setImContext = gtk_event_controller_key_set_im_context;

    extern fn gtk_event_controller_key_get_type() usize;
    pub const getGObjectType = gtk_event_controller_key_get_type;

    extern fn g_object_ref(p_self: *gtk.EventControllerKey) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EventControllerKey) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EventControllerKey, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides raw access to the event stream.
///
/// It should only be used as a last resort if none of the other event
/// controllers or gestures do the job.
pub const EventControllerLegacy = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.EventControllerLegacyClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted for each GDK event delivered to `controller`.
        pub const event = struct {
            pub const name = "event";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_event: *gdk.Event, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerLegacy, p_instance))),
                    gobject.signalLookup("event", EventControllerLegacy.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new legacy event controller.
    extern fn gtk_event_controller_legacy_new() *gtk.EventControllerLegacy;
    pub const new = gtk_event_controller_legacy_new;

    extern fn gtk_event_controller_legacy_get_type() usize;
    pub const getGObjectType = gtk_event_controller_legacy_get_type;

    extern fn g_object_ref(p_self: *gtk.EventControllerLegacy) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EventControllerLegacy) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EventControllerLegacy, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Tracks the pointer position.
///
/// The event controller offers `gtk.EventControllerMotion.signals.enter`
/// and `gtk.EventControllerMotion.signals.leave` signals, as well as
/// `gtk.EventControllerMotion.properties.is_pointer` and
/// `gtk.EventControllerMotion.properties.contains_pointer` properties
/// which are updated to reflect changes in the pointer position as it
/// moves over the widget.
pub const EventControllerMotion = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.EventControllerMotionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the pointer is in the controllers widget or a descendant.
        ///
        /// See also `gtk.EventControllerMotion.properties.is_pointer`.
        ///
        /// When handling crossing events, this property is updated
        /// before `gtk.EventControllerMotion.signals.enter`, but after
        /// `gtk.EventControllerMotion.signals.leave` is emitted.
        pub const contains_pointer = struct {
            pub const name = "contains-pointer";

            pub const Type = c_int;
        };

        /// Whether the pointer is in the controllers widget itself,
        /// as opposed to in a descendent widget.
        ///
        /// See also `gtk.EventControllerMotion.properties.contains_pointer`.
        ///
        /// When handling crossing events, this property is updated
        /// before `gtk.EventControllerMotion.signals.enter`, but after
        /// `gtk.EventControllerMotion.signals.leave` is emitted.
        pub const is_pointer = struct {
            pub const name = "is-pointer";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Signals that the pointer has entered the widget.
        pub const enter = struct {
            pub const name = "enter";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerMotion, p_instance))),
                    gobject.signalLookup("enter", EventControllerMotion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Signals that the pointer has left the widget.
        pub const leave = struct {
            pub const name = "leave";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerMotion, p_instance))),
                    gobject.signalLookup("leave", EventControllerMotion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the pointer moves inside the widget.
        pub const motion = struct {
            pub const name = "motion";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerMotion, p_instance))),
                    gobject.signalLookup("motion", EventControllerMotion.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new event controller that will handle motion events.
    extern fn gtk_event_controller_motion_new() *gtk.EventControllerMotion;
    pub const new = gtk_event_controller_motion_new;

    /// Returns if a pointer is within `self` or one of its children.
    extern fn gtk_event_controller_motion_contains_pointer(p_self: *EventControllerMotion) c_int;
    pub const containsPointer = gtk_event_controller_motion_contains_pointer;

    /// Returns if a pointer is within `self`, but not one of its children.
    extern fn gtk_event_controller_motion_is_pointer(p_self: *EventControllerMotion) c_int;
    pub const isPointer = gtk_event_controller_motion_is_pointer;

    extern fn gtk_event_controller_motion_get_type() usize;
    pub const getGObjectType = gtk_event_controller_motion_get_type;

    extern fn g_object_ref(p_self: *gtk.EventControllerMotion) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EventControllerMotion) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EventControllerMotion, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Handles scroll events.
///
/// It is capable of handling both discrete and continuous scroll
/// events from mice or touchpads, abstracting them both with the
/// `gtk.EventControllerScroll.signals.scroll` signal. Deltas in
/// the discrete case are multiples of 1.
///
/// In the case of continuous scroll events, `GtkEventControllerScroll`
/// encloses all `gtk.EventControllerScroll.signals.scroll` emissions
/// between two `gtk.EventControllerScroll.signals.scroll_begin` and
/// `gtk.EventControllerScroll.signals.scroll_end` signals.
///
/// The behavior of the event controller can be modified by the flags
/// given at creation time, or modified at a later point through
/// `gtk.EventControllerScroll.setFlags` (e.g. because the scrolling
/// conditions of the widget changed).
///
/// The controller can be set up to emit motion for either/both vertical
/// and horizontal scroll events through `GTK_EVENT_CONTROLLER_SCROLL_VERTICAL`,
/// `GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL` and `GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES`.
/// If any axis is disabled, the respective `gtk.EventControllerScroll.signals.scroll`
/// delta will be 0. Vertical scroll events will be translated to horizontal
/// motion for the devices incapable of horizontal scrolling.
///
/// The event controller can also be forced to emit discrete events on all
/// devices through `GTK_EVENT_CONTROLLER_SCROLL_DISCRETE`. This can be used
/// to implement discrete actions triggered through scroll events (e.g.
/// switching across combobox options).
///
/// The `GTK_EVENT_CONTROLLER_SCROLL_KINETIC` flag toggles the emission of the
/// `gtk.EventControllerScroll.signals.decelerate` signal, emitted at the end
/// of scrolling with two X/Y velocity arguments that are consistent with the
/// motion that was received.
pub const EventControllerScroll = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.EventControllerScrollClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The flags affecting event controller behavior.
        pub const flags = struct {
            pub const name = "flags";

            pub const Type = gtk.EventControllerScrollFlags;
        };
    };

    pub const signals = struct {
        /// Emitted after scroll is finished if the
        /// `GTK_EVENT_CONTROLLER_SCROLL_KINETIC` flag is set.
        ///
        /// `vel_x` and `vel_y` express the initial velocity that was
        /// imprinted by the scroll events. `vel_x` and `vel_y` are expressed in
        /// pixels/ms.
        pub const decelerate = struct {
            pub const name = "decelerate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_vel_x: f64, p_vel_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerScroll, p_instance))),
                    gobject.signalLookup("decelerate", EventControllerScroll.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Signals that the widget should scroll by the
        /// amount specified by `dx` and `dy`.
        ///
        /// For the representation unit of the deltas, see
        /// `gtk.EventControllerScroll.getUnit`.
        pub const scroll = struct {
            pub const name = "scroll";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_dx: f64, p_dy: f64, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerScroll, p_instance))),
                    gobject.signalLookup("scroll", EventControllerScroll.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Signals that a new scrolling operation has begun.
        ///
        /// It will only be emitted on devices capable of it.
        pub const scroll_begin = struct {
            pub const name = "scroll-begin";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerScroll, p_instance))),
                    gobject.signalLookup("scroll-begin", EventControllerScroll.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Signals that a scrolling operation has finished.
        ///
        /// It will only be emitted on devices capable of it.
        pub const scroll_end = struct {
            pub const name = "scroll-end";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(EventControllerScroll, p_instance))),
                    gobject.signalLookup("scroll-end", EventControllerScroll.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new event controller that will handle scroll events.
    extern fn gtk_event_controller_scroll_new(p_flags: gtk.EventControllerScrollFlags) *gtk.EventControllerScroll;
    pub const new = gtk_event_controller_scroll_new;

    /// Gets the flags conditioning the scroll controller behavior.
    extern fn gtk_event_controller_scroll_get_flags(p_scroll: *EventControllerScroll) gtk.EventControllerScrollFlags;
    pub const getFlags = gtk_event_controller_scroll_get_flags;

    /// Gets the scroll unit of the last
    /// `gtk.EventControllerScroll.signals.scroll` signal received.
    ///
    /// Always returns `GDK_SCROLL_UNIT_WHEEL` if the
    /// `GTK_EVENT_CONTROLLER_SCROLL_DISCRETE` flag is set.
    extern fn gtk_event_controller_scroll_get_unit(p_scroll: *EventControllerScroll) gdk.ScrollUnit;
    pub const getUnit = gtk_event_controller_scroll_get_unit;

    /// Sets the flags conditioning scroll controller behavior.
    extern fn gtk_event_controller_scroll_set_flags(p_scroll: *EventControllerScroll, p_flags: gtk.EventControllerScrollFlags) void;
    pub const setFlags = gtk_event_controller_scroll_set_flags;

    extern fn gtk_event_controller_scroll_get_type() usize;
    pub const getGObjectType = gtk_event_controller_scroll_get_type;

    extern fn g_object_ref(p_self: *gtk.EventControllerScroll) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EventControllerScroll) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EventControllerScroll, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Matches an item when each of its filters matches.
///
/// To add filters to a `GtkEveryFilter`, use `gtk.MultiFilter.append`.
pub const EveryFilter = opaque {
    pub const Parent = gtk.MultiFilter;
    pub const Implements = [_]type{ gio.ListModel, gtk.Buildable };
    pub const Class = gtk.EveryFilterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new empty "every" filter.
    ///
    /// Use `gtk.MultiFilter.append` to add filters to it.
    ///
    /// This filter matches an item if each of the filters added to it
    /// matches the item. In particular, this means that if no filter
    /// has been added to it, the filter matches every item.
    extern fn gtk_every_filter_new() *gtk.EveryFilter;
    pub const new = gtk_every_filter_new;

    extern fn gtk_every_filter_get_type() usize;
    pub const getGObjectType = gtk_every_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.EveryFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.EveryFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *EveryFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows the user to reveal or conceal a child widget.
///
/// <picture>
///   <source srcset="expander-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkExpander" src="expander.png">
/// </picture>
///
/// This is similar to the triangles used in a `GtkTreeView`.
///
/// Normally you use an expander as you would use a frame; you create
/// the child widget and use `gtk.Expander.setChild` to add it
/// to the expander. When the expander is toggled, it will take care of
/// showing and hiding the child automatically.
///
/// # Special Usage
///
/// There are situations in which you may prefer to show and hide the
/// expanded widget yourself, such as when you want to actually create
/// the widget at expansion time. In this case, create a `GtkExpander`
/// but do not add a child to it. The expander widget has an
/// `gtk.Expander.properties.expanded` property which can be used to
/// monitor its expansion state. You should watch this property with
/// a signal connection as follows:
///
/// ```c
/// static void
/// expander_callback (GObject    *object,
///                    GParamSpec *param_spec,
///                    gpointer    user_data)
/// {
///   GtkExpander *expander;
///
///   expander = GTK_EXPANDER (object);
///
///   if (gtk_expander_get_expanded (expander))
///     {
///       // Show or create widgets
///     }
///   else
///     {
///       // Hide or destroy widgets
///     }
/// }
///
/// static void
/// create_expander (void)
/// {
///   GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options");
///   g_signal_connect (expander, "notify::expanded",
///                     G_CALLBACK (expander_callback), NULL);
///
///   // ...
/// }
/// ```
///
/// # GtkExpander as GtkBuildable
///
/// An example of a UI definition fragment with GtkExpander:
///
/// ```xml
/// <object class="GtkExpander">
///   <property name="label-widget">
///     <object class="GtkLabel" id="expander-label"/>
///   </property>
///   <property name="child">
///     <object class="GtkEntry" id="expander-content"/>
///   </property>
/// </object>
/// ```
///
/// # CSS nodes
///
/// ```
/// expander-widget
/// ╰── box
///     ├── title
///     │   ├── expander
///     │   ╰── <label widget>
///     ╰── <child>
/// ```
///
/// `GtkExpander` has a main node `expander-widget`, and subnode `box` containing
/// the title and child widget. The box subnode `title` contains node `expander`,
/// i.e. the expand/collapse arrow; then the label widget if any. The arrow of an
/// expander that is showing its child gets the `:checked` pseudoclass set on it.
///
/// # Accessibility
///
/// `GtkExpander` uses the `gtk.@"AccessibleRole.button"` role.
pub const Expander = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Expander;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the expander has been opened to reveal the child.
        pub const expanded = struct {
            pub const name = "expanded";

            pub const Type = c_int;
        };

        /// The text of the expanders label.
        pub const label = struct {
            pub const name = "label";

            pub const Type = ?[*:0]u8;
        };

        /// A widget to display instead of the usual expander label.
        pub const label_widget = struct {
            pub const name = "label-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// When this property is `TRUE`, the expander will resize the toplevel
        /// widget containing the expander upon expanding and collapsing.
        pub const resize_toplevel = struct {
            pub const name = "resize-toplevel";

            pub const Type = c_int;
        };

        /// Whether the text in the label is Pango markup.
        pub const use_markup = struct {
            pub const name = "use-markup";

            pub const Type = c_int;
        };

        /// Whether an underline in the text indicates a mnemonic.
        pub const use_underline = struct {
            pub const name = "use-underline";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Activates the `GtkExpander`.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Expander, p_instance))),
                    gobject.signalLookup("activate", Expander.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new expander using `label` as the text of the label.
    extern fn gtk_expander_new(p_label: ?[*:0]const u8) *gtk.Expander;
    pub const new = gtk_expander_new;

    /// Creates a new expander using `label` as the text of the label.
    ///
    /// If characters in `label` are preceded by an underscore, they are
    /// underlined. If you need a literal underscore character in a label,
    /// use “__” (two underscores). The first underlined character represents
    /// a keyboard accelerator called a mnemonic.
    ///
    /// Pressing Alt and that key activates the button.
    extern fn gtk_expander_new_with_mnemonic(p_label: ?[*:0]const u8) *gtk.Expander;
    pub const newWithMnemonic = gtk_expander_new_with_mnemonic;

    /// Gets the child widget of `expander`.
    extern fn gtk_expander_get_child(p_expander: *Expander) ?*gtk.Widget;
    pub const getChild = gtk_expander_get_child;

    /// Queries a `GtkExpander` and returns its current state.
    ///
    /// Returns `TRUE` if the child widget is revealed.
    extern fn gtk_expander_get_expanded(p_expander: *Expander) c_int;
    pub const getExpanded = gtk_expander_get_expanded;

    /// Fetches the text from a label widget.
    ///
    /// This is including any embedded underlines indicating mnemonics and
    /// Pango markup, as set by `gtk.Expander.setLabel`. If the label
    /// text has not been set the return value will be `NULL`. This will be the
    /// case if you create an empty button with `gtk.Button.new` to use as a
    /// container.
    extern fn gtk_expander_get_label(p_expander: *Expander) ?[*:0]const u8;
    pub const getLabel = gtk_expander_get_label;

    /// Retrieves the label widget for the frame.
    extern fn gtk_expander_get_label_widget(p_expander: *Expander) ?*gtk.Widget;
    pub const getLabelWidget = gtk_expander_get_label_widget;

    /// Returns whether the expander will resize the toplevel widget
    /// containing the expander upon resizing and collapsing.
    extern fn gtk_expander_get_resize_toplevel(p_expander: *Expander) c_int;
    pub const getResizeToplevel = gtk_expander_get_resize_toplevel;

    /// Returns whether the label’s text is interpreted as Pango markup.
    extern fn gtk_expander_get_use_markup(p_expander: *Expander) c_int;
    pub const getUseMarkup = gtk_expander_get_use_markup;

    /// Returns whether an underline in the text indicates a mnemonic.
    extern fn gtk_expander_get_use_underline(p_expander: *Expander) c_int;
    pub const getUseUnderline = gtk_expander_get_use_underline;

    /// Sets the child widget of `expander`.
    extern fn gtk_expander_set_child(p_expander: *Expander, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_expander_set_child;

    /// Sets the state of the expander.
    ///
    /// Set to `TRUE`, if you want the child widget to be revealed,
    /// and `FALSE` if you want the child widget to be hidden.
    extern fn gtk_expander_set_expanded(p_expander: *Expander, p_expanded: c_int) void;
    pub const setExpanded = gtk_expander_set_expanded;

    /// Sets the text of the label of the expander to `label`.
    ///
    /// This will also clear any previously set labels.
    extern fn gtk_expander_set_label(p_expander: *Expander, p_label: ?[*:0]const u8) void;
    pub const setLabel = gtk_expander_set_label;

    /// Set the label widget for the expander.
    ///
    /// This is the widget that will appear embedded alongside
    /// the expander arrow.
    extern fn gtk_expander_set_label_widget(p_expander: *Expander, p_label_widget: ?*gtk.Widget) void;
    pub const setLabelWidget = gtk_expander_set_label_widget;

    /// Sets whether the expander will resize the toplevel widget
    /// containing the expander upon resizing and collapsing.
    extern fn gtk_expander_set_resize_toplevel(p_expander: *Expander, p_resize_toplevel: c_int) void;
    pub const setResizeToplevel = gtk_expander_set_resize_toplevel;

    /// Sets whether the text of the label contains Pango markup.
    extern fn gtk_expander_set_use_markup(p_expander: *Expander, p_use_markup: c_int) void;
    pub const setUseMarkup = gtk_expander_set_use_markup;

    /// If true, an underline in the text indicates a mnemonic.
    extern fn gtk_expander_set_use_underline(p_expander: *Expander, p_use_underline: c_int) void;
    pub const setUseUnderline = gtk_expander_set_use_underline;

    extern fn gtk_expander_get_type() usize;
    pub const getGObjectType = gtk_expander_get_type;

    extern fn g_object_ref(p_self: *gtk.Expander) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Expander) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Expander, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides a way to describe references to values.
///
/// An important aspect of expressions is that the value can be obtained
/// from a source that is several steps away. For example, an expression
/// may describe ‘the value of property A of `object1`, which is itself the
/// value of a property of `object2`’. And `object1` may not even exist yet
/// at the time that the expression is created. This is contrast to `GObject`
/// property bindings, which can only create direct connections between
/// the properties of two objects that must both exist for the duration
/// of the binding.
///
/// An expression needs to be "evaluated" to obtain the value that it currently
/// refers to. An evaluation always happens in the context of a current object
/// called `this` (it mirrors the behavior of object-oriented languages),
/// which may or may not influence the result of the evaluation. Use
/// `gtk.Expression.evaluate` for evaluating an expression.
///
/// Various methods for defining expressions exist, from simple constants via
/// `gtk.ConstantExpression.new` to looking up properties in a `GObject`
/// (even recursively) via `gtk.PropertyExpression.new` or providing
/// custom functions to transform and combine expressions via
/// `gtk.ClosureExpression.new`.
///
/// Here is an example of a complex expression:
///
/// ```c
///   color_expr = gtk_property_expression_new (GTK_TYPE_LIST_ITEM,
///                                             NULL, "item");
///   expression = gtk_property_expression_new (GTK_TYPE_COLOR,
///                                             color_expr, "name");
/// ```
///
/// when evaluated with `this` being a `GtkListItem`, it will obtain the
/// "item" property from the `GtkListItem`, and then obtain the "name" property
/// from the resulting object (which is assumed to be of type `GTK_TYPE_COLOR`).
///
/// A more concise way to describe this would be
///
/// ```
///   this->item->name
/// ```
///
/// The most likely place where you will encounter expressions is in the context
/// of list models and list widgets using them. For example, `GtkDropDown` is
/// evaluating a `GtkExpression` to obtain strings from the items in its model
/// that it can then use to match against the contents of its search entry.
/// `GtkStringFilter` is using a `GtkExpression` for similar reasons.
///
/// By default, expressions are not paying attention to changes and evaluation is
/// just a snapshot of the current state at a given time. To get informed about
/// changes, an expression needs to be "watched" via a `gtk.ExpressionWatch`,
/// which will cause a callback to be called whenever the value of the expression may
/// have changed; `gtk.Expression.watch` starts watching an expression, and
/// `gtk.ExpressionWatch.unwatch` stops.
///
/// Watches can be created for automatically updating the property of an object,
/// similar to GObject's `GBinding` mechanism, by using `gtk.Expression.bind`.
///
/// ## GtkExpression in GObject properties
///
/// In order to use a `GtkExpression` as a `GObject` property, you must use the
/// `gtk.paramSpecExpression` when creating a `GParamSpec` to install in the
/// `GObject` class being defined; for instance:
///
/// ```c
/// obj_props[PROP_EXPRESSION] =
///   gtk_param_spec_expression ("expression",
///                              "Expression",
///                              "The expression used by the widget",
///                              G_PARAM_READWRITE |
///                              G_PARAM_STATIC_STRINGS |
///                              G_PARAM_EXPLICIT_NOTIFY);
/// ```
///
/// When implementing the `GObjectClass.set_property` and `GObjectClass.get_property`
/// virtual functions, you must use `gtk.valueGetExpression`, to retrieve the
/// stored `GtkExpression` from the `GValue` container, and `gtk.valueSetExpression`,
/// to store the `GtkExpression` into the `GValue`; for instance:
///
/// ```c
///   // in `set_property`...
///   case PROP_EXPRESSION:
///     foo_widget_set_expression (foo, gtk_value_get_expression (value));
///     break;
///
///   // in `get_property`...
///   case PROP_EXPRESSION:
///     gtk_value_set_expression (value, foo->expression);
///     break;
/// ```
///
/// ## GtkExpression in .ui files
///
/// `GtkBuilder` has support for creating expressions. The syntax here can be used where
/// a `GtkExpression` object is needed like in a `<property>` tag for an expression
/// property, or in a `<binding name="property">` tag to bind a property to an expression.
///
/// To create a property expression, use the `<lookup>` element. It can have a `type`
/// attribute to specify the object type, and a `name` attribute to specify the property
/// to look up. The content of `<lookup>` can either be a string that specifies the name
/// of the object to use, an element specifying an expression to provide an object, or
/// empty to use the `this` object.
///
/// Example:
///
/// ```xml
///   <lookup name='search'>string_filter</lookup>
/// ```
///
/// Since the `<lookup>` element creates an expression and its element content can
/// itself be an expression, this means that `<lookup>` tags can also be nested.
/// This is a common idiom when dealing with `GtkListItem`s. See
/// `gtk.BuilderListItemFactory` for an example of this technique.
///
/// To create a constant expression, use the `<constant>` element. If the type attribute
/// is specified, the element content is interpreted as a value of that type, and the
/// initial attribute can be specified to get the initial value for that type. Otherwise,
/// it is assumed to be an object. For instance:
///
/// ```xml
///   <constant>string_filter</constant>
///   <constant type='gchararray'>Hello, world</constant>
///   <constant type='gchararray' initial='true' /> <!-- NULL -->
/// ```
///
/// String (`type='gchararray'`) constants can be marked for translation with the
/// `translatable=` attribute, and will then be looked up in the
/// `gtk.Builder.properties.translation_domain` when the expression is constructed.
///
/// ```xml
///   <constant type='gchararray' translatable='yes'>I'm translatable!</constant>
/// ```
///
/// As with other translatable strings in `gtk.Builder`, constants can
/// also have a context and/or translation comment:
///
/// ```xml
///   <constant type='gchararray'
///             translatable='yes'
///             context='example'
///             comments='A sample string'>I'm translatable!</constant>
/// ```
///
/// To create a closure expression, use the `<closure>` element. The `function`
/// attribute specifies what function to use for the closure, and the `type`
/// attribute specifies its return type. The content of the element contains the
/// expressions for the parameters. For instance:
///
/// ```xml
///   <closure type='gchararray' function='combine_args_somehow'>
///     <constant type='gchararray'>File size:</constant>
///     <lookup type='GFile' name='size'>myfile</lookup>
///   </closure>
/// ```
///
/// If an expression can fail, a `<try>` element can be used to provide fallbacks.
/// The expressions are tried from top to bottom until one of them succeeds.
/// If none of the expressions succeed, the expression fails as normal:
///
/// ```xml
///   <try>
///     <lookup type='GtkWindow' name='title'>
///       <lookup type='GtkLabel' name='root'></lookup>
///     </lookup>
///     <constant type='gchararray'>Hello World</constant>
///   </try>
/// ```
///
/// To create a property binding, use the `<binding>` element in place of where a
/// `<property>` tag would ordinarily be used. The `name` and `object` attributes are
/// supported. The `name` attribute is required, and pertains to the applicable property
/// name. The `object` attribute is optional. If provided, it will use the specified object
/// as the `this` object when the expression is evaluated. Here is an example in which the
/// `label` property of a `GtkLabel` is bound to the `string` property of another arbitrary
/// object:
///
/// ```xml
///   <object class='GtkLabel'>
///     <binding name='label'>
///       <lookup name='string'>some_other_object</lookup>
///     </binding>
///   </object>
/// ```
pub const Expression = opaque {
    pub const Parent = gobject.TypeInstance;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = Expression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Bind `target`'s property named `property` to `self`.
    ///
    /// The value that `self` evaluates to is set via ``gobject.Object.set`` on
    /// `target`. This is repeated whenever `self` changes to ensure that
    /// the object's property stays synchronized with `self`.
    ///
    /// If `self`'s evaluation fails, `target`'s `property` is not updated.
    /// Use a `gtk.TryExpression` to provide a fallback for this case.
    ///
    /// Note that this function takes ownership of `self`. If you want
    /// to keep it around, you should `gtk.Expression.ref` it beforehand.
    extern fn gtk_expression_bind(p_self: *Expression, p_target: *gobject.Object, p_property: [*:0]const u8, p_this_: ?*gobject.Object) *gtk.ExpressionWatch;
    pub const bind = gtk_expression_bind;

    /// Evaluates the given expression and on success stores the result
    /// in `value`.
    ///
    /// The `GType` of `value` will be the type given by
    /// `gtk.Expression.getValueType`.
    ///
    /// It is possible that expressions cannot be evaluated - for example
    /// when the expression references objects that have been destroyed or
    /// set to `NULL`. In that case `value` will remain empty and `FALSE`
    /// will be returned.
    extern fn gtk_expression_evaluate(p_self: *Expression, p_this_: ?*gobject.Object, p_value: *gobject.Value) c_int;
    pub const evaluate = gtk_expression_evaluate;

    /// Gets the `GType` that this expression evaluates to.
    ///
    /// This type is constant and will not change over the lifetime
    /// of this expression.
    extern fn gtk_expression_get_value_type(p_self: *Expression) usize;
    pub const getValueType = gtk_expression_get_value_type;

    /// Checks if the expression is static.
    ///
    /// A static expression will never change its result when
    /// `gtk.Expression.evaluate` is called on it with the same arguments.
    ///
    /// That means a call to `gtk.Expression.watch` is not necessary because
    /// it will never trigger a notify.
    extern fn gtk_expression_is_static(p_self: *Expression) c_int;
    pub const isStatic = gtk_expression_is_static;

    /// Acquires a reference on the given `GtkExpression`.
    extern fn gtk_expression_ref(p_self: *Expression) *gtk.Expression;
    pub const ref = gtk_expression_ref;

    /// Releases a reference on the given `GtkExpression`.
    ///
    /// If the reference was the last, the resources associated to the `self` are
    /// freed.
    extern fn gtk_expression_unref(p_self: *Expression) void;
    pub const unref = gtk_expression_unref;

    /// Watch the given `expression` for changes.
    ///
    /// The `notify` function will be called whenever the evaluation of `self`
    /// may have changed.
    ///
    /// GTK cannot guarantee that the evaluation did indeed change when the `notify`
    /// gets invoked, but it guarantees the opposite: When it did in fact change,
    /// the `notify` will be invoked.
    extern fn gtk_expression_watch(p_self: *Expression, p_this_: ?*gobject.Object, p_notify: gtk.ExpressionNotify, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) *gtk.ExpressionWatch;
    pub const watch = gtk_expression_watch;

    extern fn gtk_expression_get_type() usize;
    pub const getGObjectType = gtk_expression_get_type;

    pub fn as(p_instance: *Expression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkFileChooserDialog` is a dialog suitable for use with
/// “File Open” or “File Save” commands.
///
/// ![An example GtkFileChooserDialog](filechooser.png)
///
/// This widget works by putting a `gtk.FileChooserWidget`
/// inside a `gtk.Dialog`. It exposes the `gtk.FileChooser`
/// interface, so you can use all of the `gtk.FileChooser` functions
/// on the file chooser dialog as well as those for `gtk.Dialog`.
///
/// Note that `GtkFileChooserDialog` does not have any methods of its
/// own. Instead, you should use the functions that work on a
/// `gtk.FileChooser`.
///
/// If you want to integrate well with the platform you should use the
/// `gtk.FileChooserNative` API, which will use a platform-specific
/// dialog if available and fall back to `GtkFileChooserDialog`
/// otherwise.
///
/// ## Typical usage
///
/// In the simplest of cases, you can the following code to use
/// `GtkFileChooserDialog` to select a file for opening:
///
/// ```c
/// static void
/// on_open_response (GtkDialog *dialog,
///                   int        response)
/// {
///   if (response == GTK_RESPONSE_ACCEPT)
///     {
///       GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
///
///       g_autoptr(GFile) file = gtk_file_chooser_get_file (chooser);
///
///       open_file (file);
///     }
///
///   gtk_window_destroy (GTK_WINDOW (dialog));
/// }
///
///   // ...
///   GtkWidget *dialog;
///   GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
///
///   dialog = gtk_file_chooser_dialog_new ("Open File",
///                                         parent_window,
///                                         action,
///                                         _("_Cancel"),
///                                         GTK_RESPONSE_CANCEL,
///                                         _("_Open"),
///                                         GTK_RESPONSE_ACCEPT,
///                                         NULL);
///
///   gtk_window_present (GTK_WINDOW (dialog));
///
///   g_signal_connect (dialog, "response",
///                     G_CALLBACK (on_open_response),
///                     NULL);
/// ```
///
/// To use a dialog for saving, you can use this:
///
/// ```c
/// static void
/// on_save_response (GtkDialog *dialog,
///                   int        response)
/// {
///   if (response == GTK_RESPONSE_ACCEPT)
///     {
///       GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
///
///       g_autoptr(GFile) file = gtk_file_chooser_get_file (chooser);
///
///       save_to_file (file);
///     }
///
///   gtk_window_destroy (GTK_WINDOW (dialog));
/// }
///
///   // ...
///   GtkWidget *dialog;
///   GtkFileChooser *chooser;
///   GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
///
///   dialog = gtk_file_chooser_dialog_new ("Save File",
///                                         parent_window,
///                                         action,
///                                         _("_Cancel"),
///                                         GTK_RESPONSE_CANCEL,
///                                         _("_Save"),
///                                         GTK_RESPONSE_ACCEPT,
///                                         NULL);
///   chooser = GTK_FILE_CHOOSER (dialog);
///
///   if (user_edited_a_new_document)
///     gtk_file_chooser_set_current_name (chooser, _("Untitled document"));
///   else
///     gtk_file_chooser_set_file (chooser, existing_filename);
///
///   gtk_window_present (GTK_WINDOW (dialog));
///
///   g_signal_connect (dialog, "response",
///                     G_CALLBACK (on_save_response),
///                     NULL);
/// ```
///
/// ## Setting up a file chooser dialog
///
/// There are various cases in which you may need to use a `GtkFileChooserDialog`:
///
/// - To select a file for opening, use `GTK_FILE_CHOOSER_ACTION_OPEN`.
///
/// - To save a file for the first time, use `GTK_FILE_CHOOSER_ACTION_SAVE`,
///   and suggest a name such as “Untitled” with
///   `gtk.FileChooser.setCurrentName`.
///
/// - To save a file under a different name, use `GTK_FILE_CHOOSER_ACTION_SAVE`,
///   and set the existing file with `gtk.FileChooser.setFile`.
///
/// - To choose a folder instead of a file, use `GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER`.
///
/// In general, you should only cause the file chooser to show a specific
/// folder when it is appropriate to use `gtk.FileChooser.setFile`,
/// i.e. when you are doing a “Save As” command and you already have a file
/// saved somewhere.
///
/// ## Response Codes
///
/// `GtkFileChooserDialog` inherits from `gtk.Dialog`, so buttons that
/// go in its action area have response codes such as `GTK_RESPONSE_ACCEPT` and
/// `GTK_RESPONSE_CANCEL`. For example, you could call
/// `gtk.FileChooserDialog.new` as follows:
///
/// ```c
/// GtkWidget *dialog;
/// GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
///
/// dialog = gtk_file_chooser_dialog_new ("Open File",
///                                       parent_window,
///                                       action,
///                                       _("_Cancel"),
///                                       GTK_RESPONSE_CANCEL,
///                                       _("_Open"),
///                                       GTK_RESPONSE_ACCEPT,
///                                       NULL);
/// ```
///
/// This will create buttons for “Cancel” and “Open” that use predefined
/// response identifiers from `gtk.ResponseType`.  For most dialog
/// boxes you can use your own custom response codes rather than the
/// ones in `gtk.ResponseType`, but `GtkFileChooserDialog` assumes that
/// its “accept”-type action, e.g. an “Open” or “Save” button,
/// will have one of the following response codes:
///
/// - `GTK_RESPONSE_ACCEPT`
/// - `GTK_RESPONSE_OK`
/// - `GTK_RESPONSE_YES`
/// - `GTK_RESPONSE_APPLY`
///
/// This is because `GtkFileChooserDialog` must intercept responses and switch
/// to folders if appropriate, rather than letting the dialog terminate — the
/// implementation uses these known response codes to know which responses can
/// be blocked if appropriate.
///
/// To summarize, make sure you use a predefined response code
/// when you use `GtkFileChooserDialog` to ensure proper operation.
///
/// ## CSS nodes
///
/// `GtkFileChooserDialog` has a single CSS node with the name `window` and style
/// class `.filechooser`.
pub const FileChooserDialog = opaque {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.FileChooser, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = FileChooserDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkFileChooserDialog`.
    ///
    /// This function is analogous to `gtk.Dialog.newWithButtons`.
    extern fn gtk_file_chooser_dialog_new(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window, p_action: gtk.FileChooserAction, p_first_button_text: ?[*:0]const u8, ...) *gtk.FileChooserDialog;
    pub const new = gtk_file_chooser_dialog_new;

    extern fn gtk_file_chooser_dialog_get_type() usize;
    pub const getGObjectType = gtk_file_chooser_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.FileChooserDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileChooserDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileChooserDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkFileChooserNative` is an abstraction of a dialog suitable
/// for use with “File Open” or “File Save as” commands.
///
/// By default, this just uses a `GtkFileChooserDialog` to implement
/// the actual dialog. However, on some platforms, such as Windows and
/// macOS, the native platform file chooser is used instead. When the
/// application is running in a sandboxed environment without direct
/// filesystem access (such as Flatpak), `GtkFileChooserNative` may call
/// the proper APIs (portals) to let the user choose a file and make it
/// available to the application.
///
/// While the API of `GtkFileChooserNative` closely mirrors `GtkFileChooserDialog`,
/// the main difference is that there is no access to any `GtkWindow` or `GtkWidget`
/// for the dialog. This is required, as there may not be one in the case of a
/// platform native dialog.
///
/// Showing, hiding and running the dialog is handled by the
/// `gtk.NativeDialog` functions.
///
/// Note that unlike `GtkFileChooserDialog`, `GtkFileChooserNative` objects
/// are not toplevel widgets, and GTK does not keep them alive. It is your
/// responsibility to keep a reference until you are done with the
/// object.
///
/// ## Typical usage
///
/// In the simplest of cases, you can the following code to use
/// `GtkFileChooserNative` to select a file for opening:
///
/// ```c
/// static void
/// on_response (GtkNativeDialog *native,
///              int              response)
/// {
///   if (response == GTK_RESPONSE_ACCEPT)
///     {
///       GtkFileChooser *chooser = GTK_FILE_CHOOSER (native);
///       GFile *file = gtk_file_chooser_get_file (chooser);
///
///       open_file (file);
///
///       g_object_unref (file);
///     }
///
///   g_object_unref (native);
/// }
///
///   // ...
///   GtkFileChooserNative *native;
///   GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
///
///   native = gtk_file_chooser_native_new ("Open File",
///                                         parent_window,
///                                         action,
///                                         "_Open",
///                                         "_Cancel");
///
///   g_signal_connect (native, "response", G_CALLBACK (on_response), NULL);
///   gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
/// ```
///
/// To use a `GtkFileChooserNative` for saving, you can use this:
///
/// ```c
/// static void
/// on_response (GtkNativeDialog *native,
///              int              response)
/// {
///   if (response == GTK_RESPONSE_ACCEPT)
///     {
///       GtkFileChooser *chooser = GTK_FILE_CHOOSER (native);
///       GFile *file = gtk_file_chooser_get_file (chooser);
///
///       save_to_file (file);
///
///       g_object_unref (file);
///     }
///
///   g_object_unref (native);
/// }
///
///   // ...
///   GtkFileChooserNative *native;
///   GtkFileChooser *chooser;
///   GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
///
///   native = gtk_file_chooser_native_new ("Save File",
///                                         parent_window,
///                                         action,
///                                         "_Save",
///                                         "_Cancel");
///   chooser = GTK_FILE_CHOOSER (native);
///
///   if (user_edited_a_new_document)
///     gtk_file_chooser_set_current_name (chooser, _("Untitled document"));
///   else
///     gtk_file_chooser_set_file (chooser, existing_file, NULL);
///
///   g_signal_connect (native, "response", G_CALLBACK (on_response), NULL);
///   gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
/// ```
///
/// For more information on how to best set up a file dialog,
/// see the `gtk.FileChooserDialog` documentation.
///
/// ## Response Codes
///
/// `GtkFileChooserNative` inherits from `gtk.NativeDialog`,
/// which means it will return `GTK_RESPONSE_ACCEPT` if the user accepted,
/// and `GTK_RESPONSE_CANCEL` if he pressed cancel. It can also return
/// `GTK_RESPONSE_DELETE_EVENT` if the window was unexpectedly closed.
///
/// ## Differences from `GtkFileChooserDialog`
///
/// There are a few things in the `gtk.FileChooser` interface that
/// are not possible to use with `GtkFileChooserNative`, as such use would
/// prohibit the use of a native dialog.
///
/// No operations that change the dialog work while the dialog is visible.
/// Set all the properties that are required before showing the dialog.
///
/// ## Win32 details
///
/// On windows the `IFileDialog` implementation (added in Windows Vista) is
/// used. It supports many of the features that `GtkFileChooser` has, but
/// there are some things it does not handle:
///
/// * Any `gtk.FileFilter` added using a mimetype
///
/// If any of these features are used the regular `GtkFileChooserDialog`
/// will be used in place of the native one.
///
/// ## Portal details
///
/// When the `org.freedesktop.portal.FileChooser` portal is available on
/// the session bus, it is used to bring up an out-of-process file chooser.
/// Depending on the kind of session the application is running in, this may
/// or may not be a GTK file chooser.
///
/// ## macOS details
///
/// On macOS the `NSSavePanel` and `NSOpenPanel` classes are used to provide
/// native file chooser dialogs. Some features provided by `GtkFileChooser`
/// are not supported:
///
/// * Shortcut folders.
pub const FileChooserNative = opaque {
    pub const Parent = gtk.NativeDialog;
    pub const Implements = [_]type{gtk.FileChooser};
    pub const Class = gtk.FileChooserNativeClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The text used for the label on the accept button in the dialog, or
        /// `NULL` to use the default text.
        pub const accept_label = struct {
            pub const name = "accept-label";

            pub const Type = ?[*:0]u8;
        };

        /// The text used for the label on the cancel button in the dialog, or
        /// `NULL` to use the default text.
        pub const cancel_label = struct {
            pub const name = "cancel-label";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFileChooserNative`.
    extern fn gtk_file_chooser_native_new(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window, p_action: gtk.FileChooserAction, p_accept_label: ?[*:0]const u8, p_cancel_label: ?[*:0]const u8) *gtk.FileChooserNative;
    pub const new = gtk_file_chooser_native_new;

    /// Retrieves the custom label text for the accept button.
    extern fn gtk_file_chooser_native_get_accept_label(p_self: *FileChooserNative) ?[*:0]const u8;
    pub const getAcceptLabel = gtk_file_chooser_native_get_accept_label;

    /// Retrieves the custom label text for the cancel button.
    extern fn gtk_file_chooser_native_get_cancel_label(p_self: *FileChooserNative) ?[*:0]const u8;
    pub const getCancelLabel = gtk_file_chooser_native_get_cancel_label;

    /// Sets the custom label text for the accept button.
    ///
    /// If characters in `label` are preceded by an underscore, they are
    /// underlined. If you need a literal underscore character in a label,
    /// use “__” (two underscores). The first underlined character represents
    /// a keyboard accelerator called a mnemonic.
    ///
    /// Pressing Alt and that key should activate the button.
    extern fn gtk_file_chooser_native_set_accept_label(p_self: *FileChooserNative, p_accept_label: ?[*:0]const u8) void;
    pub const setAcceptLabel = gtk_file_chooser_native_set_accept_label;

    /// Sets the custom label text for the cancel button.
    ///
    /// If characters in `label` are preceded by an underscore, they are
    /// underlined. If you need a literal underscore character in a label,
    /// use “__” (two underscores). The first underlined character represents
    /// a keyboard accelerator called a mnemonic.
    ///
    /// Pressing Alt and that key should activate the button.
    extern fn gtk_file_chooser_native_set_cancel_label(p_self: *FileChooserNative, p_cancel_label: ?[*:0]const u8) void;
    pub const setCancelLabel = gtk_file_chooser_native_set_cancel_label;

    extern fn gtk_file_chooser_native_get_type() usize;
    pub const getGObjectType = gtk_file_chooser_native_get_type;

    extern fn g_object_ref(p_self: *gtk.FileChooserNative) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileChooserNative) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileChooserNative, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkFileChooserWidget` is a widget for choosing files.
///
/// It exposes the `gtk.FileChooser` interface, and you should
/// use the methods of this interface to interact with the
/// widget.
///
/// # Shortcuts and Gestures
///
/// `GtkFileChooserWidget` supports the following keyboard shortcuts:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
///
/// The following signals have default keybindings:
///
/// - `gtk.FileChooserWidget.signals.desktop_folder`
/// - `gtk.FileChooserWidget.signals.down_folder`
/// - `gtk.FileChooserWidget.signals.home_folder`
/// - `gtk.FileChooserWidget.signals.location_popup`
/// - `gtk.FileChooserWidget.signals.location_popup_on_paste`
/// - `gtk.FileChooserWidget.signals.location_toggle_popup`
/// - `gtk.FileChooserWidget.signals.places_shortcut`
/// - `gtk.FileChooserWidget.signals.quick_bookmark`
/// - `gtk.FileChooserWidget.signals.recent_shortcut`
/// - `gtk.FileChooserWidget.signals.search_shortcut`
/// - `gtk.FileChooserWidget.signals.show_hidden`
/// - `gtk.FileChooserWidget.signals.up_folder`
///
/// # CSS nodes
///
/// `GtkFileChooserWidget` has a single CSS node with name filechooser.
pub const FileChooserWidget = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.FileChooser };
    pub const Class = opaque {
        pub const Instance = FileChooserWidget;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether search mode is enabled.
        pub const search_mode = struct {
            pub const name = "search-mode";

            pub const Type = c_int;
        };

        /// Whether to show the time.
        pub const show_time = struct {
            pub const name = "show-time";

            pub const Type = c_int;
        };

        /// The subtitle of the file chooser widget.
        pub const subtitle = struct {
            pub const name = "subtitle";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser show the user's Desktop
        /// folder in the file list.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>D</kbd>.
        pub const desktop_folder = struct {
            pub const name = "desktop-folder";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("desktop-folder", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser go to a child of the
        /// current folder in the file hierarchy. The subfolder that will
        /// be used is displayed in the path bar widget of the file chooser.
        /// For example, if the path bar is showing "/foo/bar/baz", with bar
        /// currently displayed, then this will cause the file chooser to
        /// switch to the "baz" subfolder.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>Down</kbd>.
        pub const down_folder = struct {
            pub const name = "down-folder";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("down-folder", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser show the user's home
        /// folder in the file list.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>Home</kbd>.
        pub const home_folder = struct {
            pub const name = "home-folder";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("home-folder", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser show a "Location" prompt which
        /// the user can use to manually type the name of the file he wishes to select.
        ///
        /// The default bindings for this signal are <kbd>Control</kbd>-<kbd>L</kbd>
        /// with a `path` string of "" (the empty string). It is also bound to
        /// <kbd>/</kbd> with a `path` string of "`/`" (a slash):  this lets you
        /// type `/` and immediately type a path name. On Unix systems, this is
        /// bound to <kbd>~</kbd> (tilde) with a `path` string of "~" itself for
        /// access to home directories.
        pub const location_popup = struct {
            pub const name = "location-popup";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("location-popup", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser show a "Location" prompt
        /// when the user pastes into a `GtkFileChooserWidget`.
        ///
        /// The default binding for this signal is <kbd>Control</kbd>-<kbd>V</kbd>.
        pub const location_popup_on_paste = struct {
            pub const name = "location-popup-on-paste";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("location-popup-on-paste", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to toggle the visibility of a "Location" prompt
        /// which the user can use to manually type the name of the file
        /// he wishes to select.
        ///
        /// The default binding for this signal is <kbd>Control</kbd>-<kbd>L</kbd>.
        pub const location_toggle_popup = struct {
            pub const name = "location-toggle-popup";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("location-toggle-popup", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to move the focus to the places sidebar.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>P</kbd>.
        pub const places_shortcut = struct {
            pub const name = "places-shortcut";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("places-shortcut", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser switch to the bookmark
        /// specified in the `bookmark_index` parameter. For example, if
        /// you have three bookmarks, you can pass 0, 1, 2 to this signal
        /// to switch to each of them, respectively.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>1</kbd>,
        /// <kbd>Alt</kbd>-<kbd>2</kbd>, etc. until <kbd>Alt</kbd>-<kbd>0</kbd>.
        /// Note that in the default binding, that <kbd>Alt</kbd>-<kbd>1</kbd> is
        /// actually defined to switch to the bookmark at index 0, and so on
        /// successively.
        pub const quick_bookmark = struct {
            pub const name = "quick-bookmark";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_bookmark_index: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("quick-bookmark", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser show the Recent location.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>R</kbd>.
        pub const recent_shortcut = struct {
            pub const name = "recent-shortcut";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("recent-shortcut", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser show the search entry.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>S</kbd>.
        pub const search_shortcut = struct {
            pub const name = "search-shortcut";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("search-shortcut", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser display hidden files.
        ///
        /// The default binding for this signal is <kbd>Control</kbd>-<kbd>H</kbd>.
        pub const show_hidden = struct {
            pub const name = "show-hidden";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("show-hidden", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This is used to make the file chooser go to the parent
        /// of the current folder in the file hierarchy.
        ///
        /// The default binding for this signal is <kbd>Alt</kbd>-<kbd>Up</kbd>.
        pub const up_folder = struct {
            pub const name = "up-folder";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FileChooserWidget, p_instance))),
                    gobject.signalLookup("up-folder", FileChooserWidget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkFileChooserWidget`.
    ///
    /// This is a file chooser widget that can be embedded in custom
    /// windows, and it is the same widget that is used by
    /// `GtkFileChooserDialog`.
    extern fn gtk_file_chooser_widget_new(p_action: gtk.FileChooserAction) *gtk.FileChooserWidget;
    pub const new = gtk_file_chooser_widget_new;

    extern fn gtk_file_chooser_widget_get_type() usize;
    pub const getGObjectType = gtk_file_chooser_widget_get_type;

    extern fn g_object_ref(p_self: *gtk.FileChooserWidget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileChooserWidget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileChooserWidget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asynchronous API to present a file chooser dialog.
///
/// `GtkFileDialog` collects the arguments that are needed to present
/// the dialog to the user, such as a title for the dialog and whether
/// it should be modal.
///
/// The dialog is shown with `gtk.FileDialog.open`,
/// `gtk.FileDialog.save`, etc.
pub const FileDialog = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.FileDialogClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Label for the file chooser's accept button.
        pub const accept_label = struct {
            pub const name = "accept-label";

            pub const Type = ?[*:0]u8;
        };

        /// The default filter.
        ///
        /// This filter is initially active in the file chooser dialog.
        ///
        /// If the default filter is `NULL`, the first filter of `gtk.FileDialog.properties.filters`
        /// is used as the default filter. If that property contains no filter, the dialog will
        /// be unfiltered.
        ///
        /// If `gtk.FileDialog.properties.filters` is not `NULL`, the default filter should be
        /// part of the list. If it is not, the dialog may choose to not make it available.
        pub const default_filter = struct {
            pub const name = "default-filter";

            pub const Type = ?*gtk.FileFilter;
        };

        /// The list of filters.
        ///
        /// See `gtk.FileDialog.properties.default_filter` about how these
        /// two properties interact.
        pub const filters = struct {
            pub const name = "filters";

            pub const Type = ?*gio.ListModel;
        };

        /// The initial file.
        ///
        /// This file is initially selected in the file chooser dialog
        ///
        /// This is a utility property that sets both `gtk.FileDialog.properties.initial_folder`
        /// and `gtk.FileDialog.properties.initial_name`.
        pub const initial_file = struct {
            pub const name = "initial-file";

            pub const Type = ?*gio.File;
        };

        /// The initial folder.
        ///
        /// This is the directory that is initially opened in the file chooser dialog.
        pub const initial_folder = struct {
            pub const name = "initial-folder";

            pub const Type = ?*gio.File;
        };

        /// The initial name.
        ///
        /// This is the name of the file that is initially selected in the file chooser dialog.
        pub const initial_name = struct {
            pub const name = "initial-name";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the file chooser dialog is modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// A title that may be shown on the file chooser dialog.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFileDialog` object.
    extern fn gtk_file_dialog_new() *gtk.FileDialog;
    pub const new = gtk_file_dialog_new;

    /// Retrieves the text used by the dialog on its accept button.
    extern fn gtk_file_dialog_get_accept_label(p_self: *FileDialog) ?[*:0]const u8;
    pub const getAcceptLabel = gtk_file_dialog_get_accept_label;

    /// Gets the filter that will be selected by default
    /// in the file chooser dialog.
    extern fn gtk_file_dialog_get_default_filter(p_self: *FileDialog) ?*gtk.FileFilter;
    pub const getDefaultFilter = gtk_file_dialog_get_default_filter;

    /// Gets the filters that will be offered to the user
    /// in the file chooser dialog.
    extern fn gtk_file_dialog_get_filters(p_self: *FileDialog) ?*gio.ListModel;
    pub const getFilters = gtk_file_dialog_get_filters;

    /// Gets the file that will be initially selected in
    /// the file chooser dialog.
    extern fn gtk_file_dialog_get_initial_file(p_self: *FileDialog) ?*gio.File;
    pub const getInitialFile = gtk_file_dialog_get_initial_file;

    /// Gets the folder that will be set as the
    /// initial folder in the file chooser dialog.
    extern fn gtk_file_dialog_get_initial_folder(p_self: *FileDialog) ?*gio.File;
    pub const getInitialFolder = gtk_file_dialog_get_initial_folder;

    /// Gets the filename that will be initially selected.
    extern fn gtk_file_dialog_get_initial_name(p_self: *FileDialog) ?[*:0]const u8;
    pub const getInitialName = gtk_file_dialog_get_initial_name;

    /// Returns whether the file chooser dialog blocks interaction
    /// with the parent window while it is presented.
    extern fn gtk_file_dialog_get_modal(p_self: *FileDialog) c_int;
    pub const getModal = gtk_file_dialog_get_modal;

    /// Returns the title that will be shown on the file chooser dialog.
    extern fn gtk_file_dialog_get_title(p_self: *FileDialog) [*:0]const u8;
    pub const getTitle = gtk_file_dialog_get_title;

    /// Presents a file chooser dialog to the user.
    ///
    /// The file chooser dialog will be set up to select a single file.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_open(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const open = gtk_file_dialog_open;

    /// Finishes the `gtk.FileDialog.open` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_open_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gio.File;
    pub const openFinish = gtk_file_dialog_open_finish;

    /// Presents a file chooser dialog to the user.
    ///
    /// The file chooser dialog will be set up to select multiple files.
    ///
    /// The file chooser dialog will initially be opened in the directory
    /// `gtk.FileDialog.properties.initial_folder`.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_open_multiple(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const openMultiple = gtk_file_dialog_open_multiple;

    /// Finishes the `gtk.FileDialog.open` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_open_multiple_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gio.ListModel;
    pub const openMultipleFinish = gtk_file_dialog_open_multiple_finish;

    /// Presents a file chooser dialog to the user.
    ///
    /// The file chooser dialog will be set up to select multiple files.
    ///
    /// The file chooser dialog will initially be opened in the directory
    /// `gtk.FileDialog.properties.initial_folder`.
    ///
    /// In contrast to `gtk.FileDialog.open`, this function
    /// lets the user select the text encoding for the files, if possible.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_open_multiple_text_files(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const openMultipleTextFiles = gtk_file_dialog_open_multiple_text_files;

    /// Finishes the `gtk.FileDialog.open` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_open_multiple_text_files_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_encoding: *[*:0]const u8, p_error: ?*?*glib.Error) ?*gio.ListModel;
    pub const openMultipleTextFilesFinish = gtk_file_dialog_open_multiple_text_files_finish;

    /// Initiates a file selection operation by presenting a file chooser
    /// dialog to the user.
    ///
    /// In contrast to `gtk.FileDialog.open`, this function
    /// lets the user select the text encoding for the file, if possible.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_open_text_file(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const openTextFile = gtk_file_dialog_open_text_file;

    /// Finishes the `gtk.FileDialog.openTextFile` call
    /// and returns the resulting file and text encoding.
    ///
    /// If the user has explicitly selected a text encoding to use
    /// for the file, then `encoding` will be set to a codeset name that
    /// is suitable for passing to `iconv_open`. Otherwise, it will
    /// be `NULL`.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_open_text_file_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_encoding: *[*:0]const u8, p_error: ?*?*glib.Error) ?*gio.File;
    pub const openTextFileFinish = gtk_file_dialog_open_text_file_finish;

    /// Presents a file chooser dialog to the user.
    ///
    /// The file chooser dialog will be save mode.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_save(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const save = gtk_file_dialog_save;

    /// Finishes the `gtk.FileDialog.save` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_save_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gio.File;
    pub const saveFinish = gtk_file_dialog_save_finish;

    /// Initiates a file save operation by presenting a file chooser
    /// dialog to the user.
    ///
    /// In contrast to `gtk.FileDialog.save`, this function
    /// lets the user select the text encoding and line endings for
    /// the text file, if possible.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_save_text_file(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const saveTextFile = gtk_file_dialog_save_text_file;

    /// Finishes the `gtk.FileDialog.saveTextFile` call
    /// and returns the resulting file, text encoding and line endings.
    ///
    /// If the user has explicitly selected a text encoding to use
    /// for the file, then `encoding` will be set to a codeset name that
    /// is suitable for passing to `iconv_open`. Otherwise, it will
    /// be `NULL`.
    ///
    /// The `line_ending` will be set to one of "\n", "\r\n", "\r" or "",
    /// where the latter means to preserve existing line endings.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_save_text_file_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_encoding: *[*:0]const u8, p_line_ending: *[*:0]const u8, p_error: ?*?*glib.Error) ?*gio.File;
    pub const saveTextFileFinish = gtk_file_dialog_save_text_file_finish;

    /// Presents a file chooser dialog to the user.
    ///
    /// The file chooser dialog will be set up to select a single folder.
    ///
    /// If you pass `initial_folder`, the file chooser dialog will initially
    /// be opened in the parent directory of that folder, otherwise, it
    /// will be in the directory `gtk.FileDialog.properties.initial_folder`.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_select_folder(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const selectFolder = gtk_file_dialog_select_folder;

    /// Finishes the `gtk.FileDialog.selectFolder` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_select_folder_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gio.File;
    pub const selectFolderFinish = gtk_file_dialog_select_folder_finish;

    /// Presents a file chooser dialog to the user.
    ///
    /// The file chooser dialog will be set up to allow selecting
    /// multiple folders.
    ///
    /// The file chooser dialog will initially be opened in the
    /// directory `gtk.FileDialog.properties.initial_folder`.
    ///
    /// The `callback` will be called when the dialog is closed.
    extern fn gtk_file_dialog_select_multiple_folders(p_self: *FileDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const selectMultipleFolders = gtk_file_dialog_select_multiple_folders;

    /// Finishes the `gtk.FileDialog.selectMultipleFolders` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_file_dialog_select_multiple_folders_finish(p_self: *FileDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gio.ListModel;
    pub const selectMultipleFoldersFinish = gtk_file_dialog_select_multiple_folders_finish;

    /// Sets the label shown on the file chooser's accept button.
    ///
    /// Leaving the accept label unset or setting it as `NULL` will
    /// fall back to a default label, depending on what API is used
    /// to launch the file dialog.
    extern fn gtk_file_dialog_set_accept_label(p_self: *FileDialog, p_accept_label: ?[*:0]const u8) void;
    pub const setAcceptLabel = gtk_file_dialog_set_accept_label;

    /// Sets the filter that will be selected by default
    /// in the file chooser dialog.
    ///
    /// If set to `NULL`, the first item in `gtk.FileDialog.properties.filters`
    /// will be used as the default filter. If that list is empty, the dialog
    /// will be unfiltered.
    extern fn gtk_file_dialog_set_default_filter(p_self: *FileDialog, p_filter: ?*gtk.FileFilter) void;
    pub const setDefaultFilter = gtk_file_dialog_set_default_filter;

    /// Sets the filters that will be offered to the user
    /// in the file chooser dialog.
    extern fn gtk_file_dialog_set_filters(p_self: *FileDialog, p_filters: ?*gio.ListModel) void;
    pub const setFilters = gtk_file_dialog_set_filters;

    /// Sets the file that will be initially selected in
    /// the file chooser dialog.
    ///
    /// This function is a shortcut for calling both
    /// `gtk.FileDialog.setInitialFolder` and
    /// `gtk.FileDialog.setInitialName` with the
    /// directory and name of `file`, respectively.
    extern fn gtk_file_dialog_set_initial_file(p_self: *FileDialog, p_file: ?*gio.File) void;
    pub const setInitialFile = gtk_file_dialog_set_initial_file;

    /// Sets the folder that will be set as the
    /// initial folder in the file chooser dialog.
    extern fn gtk_file_dialog_set_initial_folder(p_self: *FileDialog, p_folder: ?*gio.File) void;
    pub const setInitialFolder = gtk_file_dialog_set_initial_folder;

    /// Sets the filename that will be initially selected.
    ///
    /// For save dialogs, `name` will usually be pre-entered into the
    /// name field.
    ///
    /// If a file with this name already exists in the directory set
    /// via `gtk.FileDialog.properties.initial_folder`, the dialog will
    /// preselect it.
    extern fn gtk_file_dialog_set_initial_name(p_self: *FileDialog, p_name: ?[*:0]const u8) void;
    pub const setInitialName = gtk_file_dialog_set_initial_name;

    /// Sets whether the file chooser dialog blocks interaction
    /// with the parent window while it is presented.
    extern fn gtk_file_dialog_set_modal(p_self: *FileDialog, p_modal: c_int) void;
    pub const setModal = gtk_file_dialog_set_modal;

    /// Sets the title that will be shown on the file chooser dialog.
    extern fn gtk_file_dialog_set_title(p_self: *FileDialog, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_file_dialog_set_title;

    extern fn gtk_file_dialog_get_type() usize;
    pub const getGObjectType = gtk_file_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.FileDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Filters files by name or mime type.
///
/// `GtkFileFilter` can be used to restrict the files being shown in a
/// file chooser. Files can be filtered based on their name (with
/// `gtk.FileFilter.addPattern` or `gtk.FileFilter.addSuffix`)
/// or on their mime type (with `gtk.FileFilter.addMimeType`).
///
/// Filtering by mime types handles aliasing and subclassing of mime
/// types; e.g. a filter for text/plain also matches a file with mime
/// type application/rtf, since application/rtf is a subclass of
/// text/plain. Note that `GtkFileFilter` allows wildcards for the
/// subtype of a mime type, so you can e.g. filter for image/\*.
///
/// Normally, file filters are used by adding them to a file chooser
/// (see `gtk.FileDialog.setFilters`), but it is also possible to
/// manually use a file filter on any `gtk.FilterListModel` containing
/// `GFileInfo` objects.
///
/// # GtkFileFilter as GtkBuildable
///
/// The `GtkFileFilter` implementation of the `GtkBuildable` interface
/// supports adding rules using the `<mime-types>` and `<patterns>` and
/// `<suffixes>` elements and listing the rules within. Specifying a
/// `<mime-type>` or `<pattern>` or `<suffix>` has the same effect as
/// as calling
/// `gtk.FileFilter.addMimeType` or
/// `gtk.FileFilter.addPattern` or
/// `gtk.FileFilter.addSuffix`.
///
/// An example of a UI definition fragment specifying `GtkFileFilter`
/// rules:
/// ```xml
/// <object class="GtkFileFilter">
///   <property name="name" translatable="yes">Text and Images</property>
///   <mime-types>
///     <mime-type>text/plain</mime-type>
///     <mime-type>image/ *</mime-type>
///   </mime-types>
///   <patterns>
///     <pattern>*.txt</pattern>
///   </patterns>
///   <suffixes>
///     <suffix>png</suffix>
///   </suffixes>
/// </object>
/// ```
pub const FileFilter = opaque {
    pub const Parent = gtk.Filter;
    pub const Implements = [_]type{gtk.Buildable};
    pub const Class = opaque {
        pub const Instance = FileFilter;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The MIME types that this filter matches.
        pub const mime_types = struct {
            pub const name = "mime-types";

            pub const Type = ?[*][*:0]u8;
        };

        /// The human-readable name of the filter.
        ///
        /// This is the string that will be displayed in the user interface
        /// if there is a selectable list of filters.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// The patterns that this filter matches.
        pub const patterns = struct {
            pub const name = "patterns";

            pub const Type = ?[*][*:0]u8;
        };

        /// The suffixes that this filter matches.
        pub const suffixes = struct {
            pub const name = "suffixes";

            pub const Type = ?[*][*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFileFilter` with no rules added to it.
    ///
    /// Such a filter doesn’t accept any files, so is not
    /// particularly useful until you add rules with
    /// `gtk.FileFilter.addMimeType`,
    /// `gtk.FileFilter.addPattern`,
    /// `gtk.FileFilter.addSuffix` or
    /// `gtk.FileFilter.addPixbufFormats`.
    ///
    /// To create a filter that accepts any file, use:
    /// ```c
    /// GtkFileFilter *filter = gtk_file_filter_new ();
    /// gtk_file_filter_add_pattern (filter, "*");
    /// ```
    extern fn gtk_file_filter_new() *gtk.FileFilter;
    pub const new = gtk_file_filter_new;

    /// Deserialize a file filter from a `GVariant`.
    ///
    /// The variant must be in the format produced by
    /// `gtk.FileFilter.toGvariant`.
    extern fn gtk_file_filter_new_from_gvariant(p_variant: *glib.Variant) *gtk.FileFilter;
    pub const newFromGvariant = gtk_file_filter_new_from_gvariant;

    /// Adds a rule allowing a given mime type.
    extern fn gtk_file_filter_add_mime_type(p_filter: *FileFilter, p_mime_type: [*:0]const u8) void;
    pub const addMimeType = gtk_file_filter_add_mime_type;

    /// Adds a rule allowing a given array of mime types.
    /// It can for example be used with
    /// [Gly.Loader.get_mime_types](https://gnome.pages.gitlab.gnome.org/glycin/libglycin/type_func.Loader.get_mime_types.html).
    ///
    /// This is equivalent to calling `gtk.FileFilter.addMimeType`
    /// for all the supported mime types.
    extern fn gtk_file_filter_add_mime_types(p_filter: *FileFilter, p_mime_types: [*][*:0]const u8) void;
    pub const addMimeTypes = gtk_file_filter_add_mime_types;

    /// Adds a rule allowing a shell style glob pattern.
    ///
    /// Note that it depends on the platform whether pattern
    /// matching ignores case or not. On Windows, it does, on
    /// other platforms, it doesn't.
    extern fn gtk_file_filter_add_pattern(p_filter: *FileFilter, p_pattern: [*:0]const u8) void;
    pub const addPattern = gtk_file_filter_add_pattern;

    /// Adds a rule allowing image files in the formats supported by `GdkPixbuf`.
    ///
    /// This is equivalent to calling `gtk.FileFilter.addMimeType`
    /// for all the supported mime types.
    extern fn gtk_file_filter_add_pixbuf_formats(p_filter: *FileFilter) void;
    pub const addPixbufFormats = gtk_file_filter_add_pixbuf_formats;

    /// Adds a suffix match rule to a filter.
    ///
    /// This is similar to adding a match for the pattern "*.`suffix`"
    ///
    /// An exaple to filter files with the suffix ".sub":
    /// ```c
    /// gtk_file_filter_add_suffix (filter, "sub");
    /// ```
    ///
    /// Filters with multiple dots are allowed.
    ///
    /// In contrast to pattern matches, suffix matches
    /// are *always* case-insensitive.
    extern fn gtk_file_filter_add_suffix(p_filter: *FileFilter, p_suffix: [*:0]const u8) void;
    pub const addSuffix = gtk_file_filter_add_suffix;

    /// Gets the attributes that need to be filled in for the `GFileInfo`
    /// passed to this filter.
    ///
    /// This function will not typically be used by applications;
    /// it is intended for use in file chooser implementation.
    extern fn gtk_file_filter_get_attributes(p_filter: *FileFilter) [*][*:0]const u8;
    pub const getAttributes = gtk_file_filter_get_attributes;

    /// Gets the human-readable name for the filter.
    ///
    /// See `gtk.FileFilter.setName`.
    extern fn gtk_file_filter_get_name(p_filter: *FileFilter) ?[*:0]const u8;
    pub const getName = gtk_file_filter_get_name;

    /// Sets a human-readable name of the filter.
    ///
    /// This is the string that will be displayed in the user interface
    /// if there is a selectable list of filters.
    extern fn gtk_file_filter_set_name(p_filter: *FileFilter, p_name: ?[*:0]const u8) void;
    pub const setName = gtk_file_filter_set_name;

    /// Serialize a file filter to an `a{sv}` variant.
    extern fn gtk_file_filter_to_gvariant(p_filter: *FileFilter) *glib.Variant;
    pub const toGvariant = gtk_file_filter_to_gvariant;

    extern fn gtk_file_filter_get_type() usize;
    pub const getGObjectType = gtk_file_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.FileFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asynchronous API to open a file with an application.
///
/// `GtkFileLauncher` collects the arguments that are needed to open the file.
///
/// Depending on system configuration, user preferences and available APIs, this
/// may or may not show an app chooser dialog or launch the default application
/// right away.
///
/// The operation is started with the `gtk.FileLauncher.launch` function.
///
/// To launch uris that don't represent files, use `gtk.UriLauncher`.
pub const FileLauncher = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.FileLauncherClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to ask the user to choose an app for opening the file. If `FALSE`,
        /// the file might be opened with a default app or the previous choice.
        pub const always_ask = struct {
            pub const name = "always-ask";

            pub const Type = c_int;
        };

        /// The file to launch.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?*gio.File;
        };

        /// Whether to make the file writable for the handler.
        pub const writable = struct {
            pub const name = "writable";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFileLauncher` object.
    extern fn gtk_file_launcher_new(p_file: ?*gio.File) *gtk.FileLauncher;
    pub const new = gtk_file_launcher_new;

    /// Returns whether to ask the user which app to use.
    extern fn gtk_file_launcher_get_always_ask(p_self: *FileLauncher) c_int;
    pub const getAlwaysAsk = gtk_file_launcher_get_always_ask;

    /// Gets the file that will be opened.
    extern fn gtk_file_launcher_get_file(p_self: *FileLauncher) ?*gio.File;
    pub const getFile = gtk_file_launcher_get_file;

    /// Returns whether to make the file writable for the handler.
    extern fn gtk_file_launcher_get_writable(p_self: *FileLauncher) c_int;
    pub const getWritable = gtk_file_launcher_get_writable;

    /// Launches an application to open the file.
    ///
    /// This may present an app chooser dialog to the user.
    extern fn gtk_file_launcher_launch(p_self: *FileLauncher, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const launch = gtk_file_launcher_launch;

    /// Finishes the `gtk.FileLauncher.launch` call and
    /// returns the result.
    extern fn gtk_file_launcher_launch_finish(p_self: *FileLauncher, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) c_int;
    pub const launchFinish = gtk_file_launcher_launch_finish;

    /// Launches a file manager to show the file in its parent directory.
    ///
    /// This is only supported for native files. It will fail if `file`
    /// is e.g. a http:// uri.
    extern fn gtk_file_launcher_open_containing_folder(p_self: *FileLauncher, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const openContainingFolder = gtk_file_launcher_open_containing_folder;

    /// Finishes the `gtk.FileLauncher.openContainingFolder`
    /// call and returns the result.
    extern fn gtk_file_launcher_open_containing_folder_finish(p_self: *FileLauncher, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) c_int;
    pub const openContainingFolderFinish = gtk_file_launcher_open_containing_folder_finish;

    /// Sets whether to always ask the user which app to use.
    ///
    /// If false, the file might be opened with a default app
    /// or the previous choice.
    extern fn gtk_file_launcher_set_always_ask(p_self: *FileLauncher, p_always_ask: c_int) void;
    pub const setAlwaysAsk = gtk_file_launcher_set_always_ask;

    /// Sets the file that will be opened.
    extern fn gtk_file_launcher_set_file(p_self: *FileLauncher, p_file: ?*gio.File) void;
    pub const setFile = gtk_file_launcher_set_file;

    /// Sets whether to make the file writable for the handler.
    extern fn gtk_file_launcher_set_writable(p_self: *FileLauncher, p_writable: c_int) void;
    pub const setWritable = gtk_file_launcher_set_writable;

    extern fn gtk_file_launcher_get_type() usize;
    pub const getGObjectType = gtk_file_launcher_get_type;

    extern fn g_object_ref(p_self: *gtk.FileLauncher) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileLauncher) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileLauncher, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the filtering to be performed by a `gtk.FilterListModel`.
///
/// The model will use the filter to determine if it should include items
/// or not by calling `gtk.Filter.match` for each item and only
/// keeping the ones that the function returns true for.
///
/// Filters may change what items they match through their lifetime. In that
/// case, they will emit the `gtk.Filter.signals.changed` signal to notify
/// that previous filter results are no longer valid and that items should
/// be checked again via `gtk.Filter.match`.
///
/// GTK provides various pre-made filter implementations for common filtering
/// operations. These filters often include properties that can be linked to
/// various widgets to easily allow searches.
///
/// However, in particular for large lists or complex search methods, it is
/// also possible to subclass `GtkFilter` and provide one's own filter.
pub const Filter = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.FilterClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Gets the known strictness of a filter.
        ///
        /// If the strictness is not known, `gtk.@"FilterMatch.some"` is returned.
        ///
        /// This value may change after emission of the `gtk.Filter.signals.changed`
        /// signal.
        ///
        /// This function is meant purely for optimization purposes. Filters can
        /// choose to omit implementing it, but `GtkFilterListModel` uses it.
        pub const get_strictness = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) gtk.FilterMatch {
                return gobject.ext.as(Filter.Class, p_class).f_get_strictness.?(gobject.ext.as(Filter, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) gtk.FilterMatch) void {
                gobject.ext.as(Filter.Class, p_class).f_get_strictness = @ptrCast(p_implementation);
            }
        };

        /// Checks if the given `item` is matched by the filter or not.
        pub const match = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_item: ?*gobject.Object) c_int {
                return gobject.ext.as(Filter.Class, p_class).f_match.?(gobject.ext.as(Filter, p_self), p_item);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_item: ?*gobject.Object) callconv(.c) c_int) void {
                gobject.ext.as(Filter.Class, p_class).f_match = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever the filter changed.
        ///
        /// Users of the filter should then check items again via
        /// `gtk.Filter.match`.
        ///
        /// `GtkFilterListModel` handles this signal automatically.
        ///
        /// Depending on the `change` parameter, not all items need
        /// to be checked, but only some. Refer to the `gtk.FilterChange`
        /// documentation for details.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_change: gtk.FilterChange, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Filter, p_instance))),
                    gobject.signalLookup("changed", Filter.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Notifies all users of the filter that it has changed.
    ///
    /// This emits the `gtk.Filter.signals.changed` signal. Users
    /// of the filter should then check items again via
    /// `gtk.Filter.match`.
    ///
    /// Depending on the `change` parameter, not all items need to
    /// be changed, but only some. Refer to the `gtk.FilterChange`
    /// documentation for details.
    ///
    /// This function is intended for implementers of `GtkFilter`
    /// subclasses and should not be called from other functions.
    extern fn gtk_filter_changed(p_self: *Filter, p_change: gtk.FilterChange) void;
    pub const changed = gtk_filter_changed;

    /// Gets the known strictness of a filter.
    ///
    /// If the strictness is not known, `gtk.@"FilterMatch.some"` is returned.
    ///
    /// This value may change after emission of the `gtk.Filter.signals.changed`
    /// signal.
    ///
    /// This function is meant purely for optimization purposes. Filters can
    /// choose to omit implementing it, but `GtkFilterListModel` uses it.
    extern fn gtk_filter_get_strictness(p_self: *Filter) gtk.FilterMatch;
    pub const getStrictness = gtk_filter_get_strictness;

    /// Checks if the given `item` is matched by the filter or not.
    extern fn gtk_filter_match(p_self: *Filter, p_item: *gobject.Object) c_int;
    pub const match = gtk_filter_match;

    extern fn gtk_filter_get_type() usize;
    pub const getGObjectType = gtk_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.Filter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Filter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Filter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that filters the elements of another model.
///
/// It hides some elements from the underlying model according to
/// criteria given by a `GtkFilter`.
///
/// The model can be set up to do incremental filtering, so that
/// filtering long lists doesn't block the UI. See
/// `gtk.FilterListModel.setIncremental` for details.
///
/// `GtkFilterListModel` passes through sections from the underlying model.
pub const FilterListModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel };
    pub const Class = gtk.FilterListModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The filter for this model.
        pub const filter = struct {
            pub const name = "filter";

            pub const Type = ?*gtk.Filter;
        };

        /// If the model should filter items incrementally.
        pub const incremental = struct {
            pub const name = "incremental";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being filtered.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// Number of items not yet filtered.
        pub const pending = struct {
            pub const name = "pending";

            pub const Type = c_uint;
        };

        /// Monitor the list items for changes. It may impact performance.
        pub const watch_items = struct {
            pub const name = "watch-items";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFilterListModel` that will filter `model` using the given
    /// `filter`.
    extern fn gtk_filter_list_model_new(p_model: ?*gio.ListModel, p_filter: ?*gtk.Filter) *gtk.FilterListModel;
    pub const new = gtk_filter_list_model_new;

    /// Gets the `GtkFilter` currently set on `self`.
    extern fn gtk_filter_list_model_get_filter(p_self: *FilterListModel) ?*gtk.Filter;
    pub const getFilter = gtk_filter_list_model_get_filter;

    /// Returns whether incremental filtering is enabled.
    ///
    /// See `gtk.FilterListModel.setIncremental`.
    extern fn gtk_filter_list_model_get_incremental(p_self: *FilterListModel) c_int;
    pub const getIncremental = gtk_filter_list_model_get_incremental;

    /// Gets the model currently filtered or `NULL` if none.
    extern fn gtk_filter_list_model_get_model(p_self: *FilterListModel) ?*gio.ListModel;
    pub const getModel = gtk_filter_list_model_get_model;

    /// Returns the number of items that have not been filtered yet.
    ///
    /// You can use this value to check if `self` is busy filtering by
    /// comparing the return value to 0 or you can compute the percentage
    /// of the filter remaining by dividing the return value by the total
    /// number of items in the underlying model:
    ///
    /// ```c
    /// pending = gtk_filter_list_model_get_pending (self);
    /// model = gtk_filter_list_model_get_model (self);
    /// percentage = pending / (double) g_list_model_get_n_items (model);
    /// ```
    ///
    /// If no filter operation is ongoing - in particular when
    /// `gtk.FilterListModel.properties.incremental` is `FALSE` - this
    /// function returns 0.
    extern fn gtk_filter_list_model_get_pending(p_self: *FilterListModel) c_uint;
    pub const getPending = gtk_filter_list_model_get_pending;

    /// Returns whether watching items is enabled.
    ///
    /// See `gtk.FilterListModel.setWatchItems`.
    extern fn gtk_filter_list_model_get_watch_items(p_self: *FilterListModel) c_int;
    pub const getWatchItems = gtk_filter_list_model_get_watch_items;

    /// Sets the filter used to filter items.
    extern fn gtk_filter_list_model_set_filter(p_self: *FilterListModel, p_filter: ?*gtk.Filter) void;
    pub const setFilter = gtk_filter_list_model_set_filter;

    /// Sets the filter model to do an incremental sort.
    ///
    /// When incremental filtering is enabled, the `GtkFilterListModel` will not
    /// run filters immediately, but will instead queue an idle handler that
    /// incrementally filters the items and adds them to the list. This of course
    /// means that items are not instantly added to the list, but only appear
    /// incrementally.
    ///
    /// When your filter blocks the UI while filtering, you might consider
    /// turning this on. Depending on your model and filters, this may become
    /// interesting around 10,000 to 100,000 items.
    ///
    /// By default, incremental filtering is disabled.
    ///
    /// See `gtk.FilterListModel.getPending` for progress information
    /// about an ongoing incremental filtering operation.
    extern fn gtk_filter_list_model_set_incremental(p_self: *FilterListModel, p_incremental: c_int) void;
    pub const setIncremental = gtk_filter_list_model_set_incremental;

    /// Sets the model to be filtered.
    ///
    /// Note that GTK makes no effort to ensure that `model` conforms to
    /// the item type of `self`. It assumes that the caller knows what they
    /// are doing and have set up an appropriate filter to ensure that item
    /// types match.
    extern fn gtk_filter_list_model_set_model(p_self: *FilterListModel, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_filter_list_model_set_model;

    /// Sets the filter model to monitor properties of its items.
    ///
    /// This allows implementations of `gtk.Filter` that support expression
    /// watching to react to property changes. This property has no effect if the
    /// current filter doesn't support watching items.
    ///
    /// By default, watching items is disabled.
    extern fn gtk_filter_list_model_set_watch_items(p_self: *FilterListModel, p_watch_items: c_int) void;
    pub const setWatchItems = gtk_filter_list_model_set_watch_items;

    extern fn gtk_filter_list_model_get_type() usize;
    pub const getGObjectType = gtk_filter_list_model_get_type;

    extern fn g_object_ref(p_self: *gtk.FilterListModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FilterListModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FilterListModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Places its child widgets at fixed positions and with fixed sizes.
///
/// `GtkFixed` performs no automatic layout management.
///
/// For most applications, you should not use this container! It keeps
/// you from having to learn about the other GTK containers, but it
/// results in broken applications.  With `GtkFixed`, the following
/// things will result in truncated text, overlapping widgets, and
/// other display bugs:
///
/// - Themes, which may change widget sizes.
///
/// - Fonts other than the one you used to write the app will of course
///   change the size of widgets containing text; keep in mind that
///   users may use a larger font because of difficulty reading the
///   default, or they may be using a different OS that provides different fonts.
///
/// - Translation of text into other languages changes its size. Also,
///   display of non-English text will use a different font in many
///   cases.
///
/// In addition, `GtkFixed` does not pay attention to text direction and
/// thus may produce unwanted results if your app is run under right-to-left
/// languages such as Hebrew or Arabic. That is: normally GTK will order
/// containers appropriately for the text direction, e.g. to put labels to
/// the right of the thing they label when using an RTL language, but it can’t
/// do that with `GtkFixed`. So if you need to reorder widgets depending on
/// the text direction, you would need to manually detect it and adjust child
/// positions accordingly.
///
/// Finally, fixed positioning makes it kind of annoying to add/remove
/// UI elements, since you have to reposition all the other elements. This
/// is a long-term maintenance problem for your application.
///
/// If you know none of these things are an issue for your application,
/// and prefer the simplicity of `GtkFixed`, by all means use the
/// widget. But you should be aware of the tradeoffs.
pub const Fixed = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.FixedClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkFixed`.
    extern fn gtk_fixed_new() *gtk.Fixed;
    pub const new = gtk_fixed_new;

    /// Retrieves the translation transformation of the
    /// given child `GtkWidget` in the `GtkFixed`.
    ///
    /// See also: `gtk.Fixed.getChildTransform`.
    extern fn gtk_fixed_get_child_position(p_fixed: *Fixed, p_widget: *gtk.Widget, p_x: *f64, p_y: *f64) void;
    pub const getChildPosition = gtk_fixed_get_child_position;

    /// Retrieves the transformation for `widget` set using
    /// `gtk.Fixed.setChildTransform`.
    extern fn gtk_fixed_get_child_transform(p_fixed: *Fixed, p_widget: *gtk.Widget) ?*gsk.Transform;
    pub const getChildTransform = gtk_fixed_get_child_transform;

    /// Sets a translation transformation to the given `x` and `y`
    /// coordinates to the child `widget` of the `GtkFixed`.
    extern fn gtk_fixed_move(p_fixed: *Fixed, p_widget: *gtk.Widget, p_x: f64, p_y: f64) void;
    pub const move = gtk_fixed_move;

    /// Adds a widget to a `GtkFixed` at the given position.
    extern fn gtk_fixed_put(p_fixed: *Fixed, p_widget: *gtk.Widget, p_x: f64, p_y: f64) void;
    pub const put = gtk_fixed_put;

    /// Removes a child from `fixed`.
    extern fn gtk_fixed_remove(p_fixed: *Fixed, p_widget: *gtk.Widget) void;
    pub const remove = gtk_fixed_remove;

    /// Sets the transformation for `widget`.
    ///
    /// This is a convenience function that retrieves the
    /// `gtk.FixedLayoutChild` instance associated to
    /// `widget` and calls `gtk.FixedLayoutChild.setTransform`.
    extern fn gtk_fixed_set_child_transform(p_fixed: *Fixed, p_widget: *gtk.Widget, p_transform: ?*gsk.Transform) void;
    pub const setChildTransform = gtk_fixed_set_child_transform;

    extern fn gtk_fixed_get_type() usize;
    pub const getGObjectType = gtk_fixed_get_type;

    extern fn g_object_ref(p_self: *gtk.Fixed) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Fixed) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Fixed, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Places child widgets at fixed positions.
///
/// Most applications should never use this layout manager; fixed positioning
/// and sizing requires constant recalculations on where children need to be
/// positioned and sized. Other layout managers perform this kind of work
/// internally so that application developers don't need to do it. Specifically,
/// widgets positioned in a fixed layout manager will need to take into account:
///
/// - Themes, which may change widget sizes.
///
/// - Fonts other than the one you used to write the app will of course
///   change the size of widgets containing text; keep in mind that
///   users may use a larger font because of difficulty reading the
///   default, or they may be using a different OS that provides different
///   fonts.
///
/// - Translation of text into other languages changes its size. Also,
///   display of non-English text will use a different font in many
///   cases.
///
/// In addition, `GtkFixedLayout` does not pay attention to text direction and
/// thus may produce unwanted results if your app is run under right-to-left
/// languages such as Hebrew or Arabic. That is: normally GTK will order
/// containers appropriately depending on the text direction, e.g. to put labels
/// to the right of the thing they label when using an RTL language;
/// `GtkFixedLayout` won't be able to do that for you.
///
/// Finally, fixed positioning makes it kind of annoying to add/remove UI
/// elements, since you have to reposition all the other  elements. This is a
/// long-term maintenance problem for your application.
pub const FixedLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{};
    pub const Class = gtk.FixedLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkFixedLayout`.
    extern fn gtk_fixed_layout_new() *gtk.FixedLayout;
    pub const new = gtk_fixed_layout_new;

    extern fn gtk_fixed_layout_get_type() usize;
    pub const getGObjectType = gtk_fixed_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.FixedLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FixedLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FixedLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkLayoutChild` subclass for children in a `GtkFixedLayout`.
pub const FixedLayoutChild = opaque {
    pub const Parent = gtk.LayoutChild;
    pub const Implements = [_]type{};
    pub const Class = gtk.FixedLayoutChildClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The transform of the child.
        pub const transform = struct {
            pub const name = "transform";

            pub const Type = ?*gsk.Transform;
        };
    };

    pub const signals = struct {};

    /// Retrieves the transformation of the child.
    extern fn gtk_fixed_layout_child_get_transform(p_child: *FixedLayoutChild) ?*gsk.Transform;
    pub const getTransform = gtk_fixed_layout_child_get_transform;

    /// Sets the transformation of the child of a `GtkFixedLayout`.
    extern fn gtk_fixed_layout_child_set_transform(p_child: *FixedLayoutChild, p_transform: *gsk.Transform) void;
    pub const setTransform = gtk_fixed_layout_child_set_transform;

    extern fn gtk_fixed_layout_child_get_type() usize;
    pub const getGObjectType = gtk_fixed_layout_child_get_type;

    extern fn g_object_ref(p_self: *gtk.FixedLayoutChild) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FixedLayoutChild) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FixedLayoutChild, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that concatenates other list models.
///
/// `GtkFlattenListModel` takes a list model containing list models, and flattens
/// it into a single model. Each list model becomes a section in the single model.
pub const FlattenListModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel };
    pub const Class = gtk.FlattenListModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being flattened.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFlattenListModel` that flattens `list`.
    extern fn gtk_flatten_list_model_new(p_model: ?*gio.ListModel) *gtk.FlattenListModel;
    pub const new = gtk_flatten_list_model_new;

    /// Gets the model set via `gtk.FlattenListModel.setModel`.
    extern fn gtk_flatten_list_model_get_model(p_self: *FlattenListModel) ?*gio.ListModel;
    pub const getModel = gtk_flatten_list_model_get_model;

    /// Returns the model containing the item at the given position.
    extern fn gtk_flatten_list_model_get_model_for_item(p_self: *FlattenListModel, p_position: c_uint) ?*gio.ListModel;
    pub const getModelForItem = gtk_flatten_list_model_get_model_for_item;

    /// Sets a new model to be flattened.
    extern fn gtk_flatten_list_model_set_model(p_self: *FlattenListModel, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_flatten_list_model_set_model;

    extern fn gtk_flatten_list_model_get_type() usize;
    pub const getGObjectType = gtk_flatten_list_model_get_type;

    extern fn g_object_ref(p_self: *gtk.FlattenListModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FlattenListModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FlattenListModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Puts child widgets in a reflowing grid.
///
/// <picture>
///   <source srcset="flow-box-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkFlowBox" src="flow-box.png">
/// </picture>
///
/// For instance, with the horizontal orientation, the widgets will be
/// arranged from left to right, starting a new row under the previous
/// row when necessary. Reducing the width in this case will require more
/// rows, so a larger height will be requested.
///
/// Likewise, with the vertical orientation, the widgets will be arranged
/// from top to bottom, starting a new column to the right when necessary.
/// Reducing the height will require more columns, so a larger width will
/// be requested.
///
/// The size request of a `GtkFlowBox` alone may not be what you expect;
/// if you need to be able to shrink it along both axes and dynamically
/// reflow its children, you may have to wrap it in a `GtkScrolledWindow`
/// to enable that.
///
/// The children of a `GtkFlowBox` can be dynamically sorted and filtered.
///
/// Although a `GtkFlowBox` must have only `GtkFlowBoxChild` children, you
/// can add any kind of widget to it via `gtk.FlowBox.insert`, and a
/// `GtkFlowBoxChild` widget will automatically be inserted between the box
/// and the widget.
///
/// Also see `gtk.ListBox`.
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.FlowBox.signals.move_cursor`
/// - `gtk.FlowBox.signals.select_all`
/// - `gtk.FlowBox.signals.toggle_cursor_child`
/// - `gtk.FlowBox.signals.unselect_all`
///
/// # CSS nodes
///
/// ```
/// flowbox
/// ├── flowboxchild
/// │   ╰── <child>
/// ├── flowboxchild
/// │   ╰── <child>
/// ┊
/// ╰── [rubberband]
/// ```
///
/// `GtkFlowBox` uses a single CSS node with name flowbox. `GtkFlowBoxChild`
/// uses a single CSS node with name flowboxchild. For rubberband selection,
/// a subnode with name rubberband is used.
///
/// # Accessibility
///
/// `GtkFlowBox` uses the `gtk.@"AccessibleRole.grid"` role, and `GtkFlowBoxChild`
/// uses the `gtk.@"AccessibleRole.grid_cell"` role.
pub const FlowBox = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = FlowBox;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to accept unpaired release events.
        pub const accept_unpaired_release = struct {
            pub const name = "accept-unpaired-release";

            pub const Type = c_int;
        };

        /// Determines whether children can be activated with a single
        /// click, or require a double-click.
        pub const activate_on_single_click = struct {
            pub const name = "activate-on-single-click";

            pub const Type = c_int;
        };

        /// The amount of horizontal space between two children.
        pub const column_spacing = struct {
            pub const name = "column-spacing";

            pub const Type = c_uint;
        };

        /// Determines whether all children should be allocated the
        /// same size.
        pub const homogeneous = struct {
            pub const name = "homogeneous";

            pub const Type = c_int;
        };

        /// The maximum amount of children to request space for consecutively
        /// in the given orientation.
        pub const max_children_per_line = struct {
            pub const name = "max-children-per-line";

            pub const Type = c_uint;
        };

        /// The minimum number of children to allocate consecutively
        /// in the given orientation.
        ///
        /// Setting the minimum children per line ensures
        /// that a reasonably small height will be requested
        /// for the overall minimum width of the box.
        pub const min_children_per_line = struct {
            pub const name = "min-children-per-line";

            pub const Type = c_uint;
        };

        /// The amount of vertical space between two children.
        pub const row_spacing = struct {
            pub const name = "row-spacing";

            pub const Type = c_uint;
        };

        /// The selection mode used by the flow box.
        pub const selection_mode = struct {
            pub const name = "selection-mode";

            pub const Type = gtk.SelectionMode;
        };
    };

    pub const signals = struct {
        /// Emitted when the user activates the `box`.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        pub const activate_cursor_child = struct {
            pub const name = "activate-cursor-child";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("activate-cursor-child", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a child has been activated by the user.
        pub const child_activated = struct {
            pub const name = "child-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_child: *gtk.FlowBoxChild, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("child-activated", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a cursor movement.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control the cursor
        /// programmatically.
        ///
        /// The default bindings for this signal come in two variants,
        /// the variant with the Shift modifier extends the selection,
        /// the variant without the Shift modifier does not.
        /// There are too many key combinations to list them all here.
        ///
        /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
        ///   move by individual children
        /// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
        /// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, p_modify: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("move-cursor", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to select all children of the box,
        /// if the selection mode permits it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
        pub const select_all = struct {
            pub const name = "select-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("select-all", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the set of selected children changes.
        ///
        /// Use `gtk.FlowBox.selectedForeach` or
        /// `gtk.FlowBox.getSelectedChildren` to obtain the
        /// selected children.
        pub const selected_children_changed = struct {
            pub const name = "selected-children-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("selected-children-changed", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to toggle the selection of the child that has the focus.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Space</kbd>.
        pub const toggle_cursor_child = struct {
            pub const name = "toggle-cursor-child";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("toggle-cursor-child", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to unselect all children of the box,
        /// if the selection mode permits it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
        pub const unselect_all = struct {
            pub const name = "unselect-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBox, p_instance))),
                    gobject.signalLookup("unselect-all", FlowBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a `GtkFlowBox`.
    extern fn gtk_flow_box_new() *gtk.FlowBox;
    pub const new = gtk_flow_box_new;

    /// Adds `child` to the end of `self`.
    ///
    /// If a sort function is set, the widget will
    /// actually be inserted at the calculated position.
    ///
    /// See also: `gtk.FlowBox.insert`.
    extern fn gtk_flow_box_append(p_self: *FlowBox, p_child: *gtk.Widget) void;
    pub const append = gtk_flow_box_append;

    /// Binds `model` to `box`.
    ///
    /// If `box` was already bound to a model, that previous binding is
    /// destroyed.
    ///
    /// The contents of `box` are cleared and then filled with widgets that
    /// represent items from `model`. `box` is updated whenever `model` changes.
    /// If `model` is `NULL`, `box` is left empty.
    ///
    /// It is undefined to add or remove widgets directly (for example, with
    /// `gtk.FlowBox.insert`) while `box` is bound to a model.
    ///
    /// Note that using a model is incompatible with the filtering and sorting
    /// functionality in `GtkFlowBox`. When using a model, filtering and sorting
    /// should be implemented by the model.
    extern fn gtk_flow_box_bind_model(p_box: *FlowBox, p_model: ?*gio.ListModel, p_create_widget_func: gtk.FlowBoxCreateWidgetFunc, p_user_data: ?*anyopaque, p_user_data_free_func: ?glib.DestroyNotify) void;
    pub const bindModel = gtk_flow_box_bind_model;

    /// Returns whether children activate on single clicks.
    extern fn gtk_flow_box_get_activate_on_single_click(p_box: *FlowBox) c_int;
    pub const getActivateOnSingleClick = gtk_flow_box_get_activate_on_single_click;

    /// Gets the nth child in the `box`.
    extern fn gtk_flow_box_get_child_at_index(p_box: *FlowBox, p_idx: c_int) ?*gtk.FlowBoxChild;
    pub const getChildAtIndex = gtk_flow_box_get_child_at_index;

    /// Gets the child in the (`x`, `y`) position.
    ///
    /// Both `x` and `y` are assumed to be relative to the origin of `box`.
    extern fn gtk_flow_box_get_child_at_pos(p_box: *FlowBox, p_x: c_int, p_y: c_int) ?*gtk.FlowBoxChild;
    pub const getChildAtPos = gtk_flow_box_get_child_at_pos;

    /// Gets the horizontal spacing.
    extern fn gtk_flow_box_get_column_spacing(p_box: *FlowBox) c_uint;
    pub const getColumnSpacing = gtk_flow_box_get_column_spacing;

    /// Returns whether the box is homogeneous.
    extern fn gtk_flow_box_get_homogeneous(p_box: *FlowBox) c_int;
    pub const getHomogeneous = gtk_flow_box_get_homogeneous;

    /// Gets the maximum number of children per line.
    extern fn gtk_flow_box_get_max_children_per_line(p_box: *FlowBox) c_uint;
    pub const getMaxChildrenPerLine = gtk_flow_box_get_max_children_per_line;

    /// Gets the minimum number of children per line.
    extern fn gtk_flow_box_get_min_children_per_line(p_box: *FlowBox) c_uint;
    pub const getMinChildrenPerLine = gtk_flow_box_get_min_children_per_line;

    /// Gets the vertical spacing.
    extern fn gtk_flow_box_get_row_spacing(p_box: *FlowBox) c_uint;
    pub const getRowSpacing = gtk_flow_box_get_row_spacing;

    /// Creates a list of all selected children.
    extern fn gtk_flow_box_get_selected_children(p_box: *FlowBox) *glib.List;
    pub const getSelectedChildren = gtk_flow_box_get_selected_children;

    /// Gets the selection mode of `box`.
    extern fn gtk_flow_box_get_selection_mode(p_box: *FlowBox) gtk.SelectionMode;
    pub const getSelectionMode = gtk_flow_box_get_selection_mode;

    /// Inserts the `widget` into `box` at `position`.
    ///
    /// If a sort function is set, the widget will actually be inserted
    /// at the calculated position.
    ///
    /// If `position` is -1, or larger than the total number of children
    /// in the `box`, then the `widget` will be appended to the end.
    extern fn gtk_flow_box_insert(p_box: *FlowBox, p_widget: *gtk.Widget, p_position: c_int) void;
    pub const insert = gtk_flow_box_insert;

    /// Updates the filtering for all children.
    ///
    /// Call this function when the result of the filter
    /// function on the `box` is changed due to an external
    /// factor. For instance, this would be used if the
    /// filter function just looked for a specific search
    /// term, and the entry with the string has changed.
    extern fn gtk_flow_box_invalidate_filter(p_box: *FlowBox) void;
    pub const invalidateFilter = gtk_flow_box_invalidate_filter;

    /// Updates the sorting for all children.
    ///
    /// Call this when the result of the sort function on
    /// `box` is changed due to an external factor.
    extern fn gtk_flow_box_invalidate_sort(p_box: *FlowBox) void;
    pub const invalidateSort = gtk_flow_box_invalidate_sort;

    /// Adds `child` to the start of `self`.
    ///
    /// If a sort function is set, the widget will
    /// actually be inserted at the calculated position.
    ///
    /// See also: `gtk.FlowBox.insert`.
    extern fn gtk_flow_box_prepend(p_self: *FlowBox, p_child: *gtk.Widget) void;
    pub const prepend = gtk_flow_box_prepend;

    /// Removes a child from `box`.
    extern fn gtk_flow_box_remove(p_box: *FlowBox, p_widget: *gtk.Widget) void;
    pub const remove = gtk_flow_box_remove;

    /// Removes all children from `box`.
    ///
    /// This function does nothing if `box` is backed by a model.
    extern fn gtk_flow_box_remove_all(p_box: *FlowBox) void;
    pub const removeAll = gtk_flow_box_remove_all;

    /// Select all children of `box`, if the selection
    /// mode allows it.
    extern fn gtk_flow_box_select_all(p_box: *FlowBox) void;
    pub const selectAll = gtk_flow_box_select_all;

    /// Selects a single child of `box`, if the selection
    /// mode allows it.
    extern fn gtk_flow_box_select_child(p_box: *FlowBox, p_child: *gtk.FlowBoxChild) void;
    pub const selectChild = gtk_flow_box_select_child;

    /// Calls a function for each selected child.
    ///
    /// Note that the selection cannot be modified from within
    /// this function.
    extern fn gtk_flow_box_selected_foreach(p_box: *FlowBox, p_func: gtk.FlowBoxForeachFunc, p_data: ?*anyopaque) void;
    pub const selectedForeach = gtk_flow_box_selected_foreach;

    /// If `single` is `TRUE`, children will be activated when you click
    /// on them, otherwise you need to double-click.
    extern fn gtk_flow_box_set_activate_on_single_click(p_box: *FlowBox, p_single: c_int) void;
    pub const setActivateOnSingleClick = gtk_flow_box_set_activate_on_single_click;

    /// Sets the horizontal space to add between children.
    extern fn gtk_flow_box_set_column_spacing(p_box: *FlowBox, p_spacing: c_uint) void;
    pub const setColumnSpacing = gtk_flow_box_set_column_spacing;

    /// By setting a filter function on the `box` one can decide dynamically
    /// which of the children to show.
    ///
    /// For instance, to implement a search function that only shows the
    /// children matching the search terms.
    ///
    /// The `filter_func` will be called for each child after the call, and
    /// it will continue to be called each time a child changes (via
    /// `gtk.FlowBoxChild.changed`) or when
    /// `gtk.FlowBox.invalidateFilter` is called.
    ///
    /// Note that using a filter function is incompatible with using a model
    /// (see `gtk.FlowBox.bindModel`).
    extern fn gtk_flow_box_set_filter_func(p_box: *FlowBox, p_filter_func: ?gtk.FlowBoxFilterFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setFilterFunc = gtk_flow_box_set_filter_func;

    /// Hooks up an adjustment to focus handling in `box`.
    ///
    /// The adjustment is also used for autoscrolling during
    /// rubberband selection. See `gtk.ScrolledWindow.getHadjustment`
    /// for a typical way of obtaining the adjustment, and
    /// `gtk.FlowBox.setVadjustment` for setting the vertical
    /// adjustment.
    ///
    /// The adjustments have to be in pixel units and in the same
    /// coordinate system as the allocation for immediate children
    /// of the box.
    extern fn gtk_flow_box_set_hadjustment(p_box: *FlowBox, p_adjustment: *gtk.Adjustment) void;
    pub const setHadjustment = gtk_flow_box_set_hadjustment;

    /// Sets whether or not all children of `box` are given
    /// equal space in the box.
    extern fn gtk_flow_box_set_homogeneous(p_box: *FlowBox, p_homogeneous: c_int) void;
    pub const setHomogeneous = gtk_flow_box_set_homogeneous;

    /// Sets the maximum number of children to request and
    /// allocate space for in `box`’s orientation.
    ///
    /// Setting the maximum number of children per line
    /// limits the overall natural size request to be no more
    /// than `n_children` children long in the given orientation.
    extern fn gtk_flow_box_set_max_children_per_line(p_box: *FlowBox, p_n_children: c_uint) void;
    pub const setMaxChildrenPerLine = gtk_flow_box_set_max_children_per_line;

    /// Sets the minimum number of children to line up
    /// in `box`’s orientation before flowing.
    extern fn gtk_flow_box_set_min_children_per_line(p_box: *FlowBox, p_n_children: c_uint) void;
    pub const setMinChildrenPerLine = gtk_flow_box_set_min_children_per_line;

    /// Sets the vertical space to add between children.
    extern fn gtk_flow_box_set_row_spacing(p_box: *FlowBox, p_spacing: c_uint) void;
    pub const setRowSpacing = gtk_flow_box_set_row_spacing;

    /// Sets how selection works in `box`.
    extern fn gtk_flow_box_set_selection_mode(p_box: *FlowBox, p_mode: gtk.SelectionMode) void;
    pub const setSelectionMode = gtk_flow_box_set_selection_mode;

    /// By setting a sort function on the `box`, one can dynamically
    /// reorder the children of the box, based on the contents of
    /// the children.
    ///
    /// The `sort_func` will be called for each child after the call,
    /// and will continue to be called each time a child changes (via
    /// `gtk.FlowBoxChild.changed`) and when
    /// `gtk.FlowBox.invalidateSort` is called.
    ///
    /// Note that using a sort function is incompatible with using a model
    /// (see `gtk.FlowBox.bindModel`).
    extern fn gtk_flow_box_set_sort_func(p_box: *FlowBox, p_sort_func: ?gtk.FlowBoxSortFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setSortFunc = gtk_flow_box_set_sort_func;

    /// Hooks up an adjustment to focus handling in `box`.
    ///
    /// The adjustment is also used for autoscrolling during
    /// rubberband selection. See `gtk.ScrolledWindow.getVadjustment`
    /// for a typical way of obtaining the adjustment, and
    /// `gtk.FlowBox.setHadjustment` for setting the horizontal
    /// adjustment.
    ///
    /// The adjustments have to be in pixel units and in the same
    /// coordinate system as the allocation for immediate children
    /// of the box.
    extern fn gtk_flow_box_set_vadjustment(p_box: *FlowBox, p_adjustment: *gtk.Adjustment) void;
    pub const setVadjustment = gtk_flow_box_set_vadjustment;

    /// Unselect all children of `box`, if the selection
    /// mode allows it.
    extern fn gtk_flow_box_unselect_all(p_box: *FlowBox) void;
    pub const unselectAll = gtk_flow_box_unselect_all;

    /// Unselects a single child of `box`, if the selection
    /// mode allows it.
    extern fn gtk_flow_box_unselect_child(p_box: *FlowBox, p_child: *gtk.FlowBoxChild) void;
    pub const unselectChild = gtk_flow_box_unselect_child;

    extern fn gtk_flow_box_get_type() usize;
    pub const getGObjectType = gtk_flow_box_get_type;

    extern fn g_object_ref(p_self: *gtk.FlowBox) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FlowBox) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FlowBox, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The kind of widget that can be added to a `GtkFlowBox`.
///
/// `gtk.FlowBox` will automatically wrap its children in a `GtkFlowBoxChild`
/// when necessary.
pub const FlowBoxChild = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.FlowBoxChildClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const activate = struct {
            pub fn call(p_class: anytype, p_child: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(FlowBoxChild.Class, p_class).f_activate.?(gobject.ext.as(FlowBoxChild, p_child));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_child: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(FlowBoxChild.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {
        /// Emitted when the user activates a child widget in a `GtkFlowBox`.
        ///
        /// This can happen either by clicking or double-clicking,
        /// or via a keybinding.
        ///
        /// This is a [keybinding signal](class.SignalAction.html),
        /// but it can be used by applications for their own purposes.
        ///
        /// The default bindings are <kbd>Space</kbd> and <kbd>Enter</kbd>.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FlowBoxChild, p_instance))),
                    gobject.signalLookup("activate", FlowBoxChild.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkFlowBoxChild`.
    ///
    /// This should only be used as a child of a `GtkFlowBox`.
    extern fn gtk_flow_box_child_new() *gtk.FlowBoxChild;
    pub const new = gtk_flow_box_child_new;

    /// Marks `child` as changed, causing any state that depends on this
    /// to be updated.
    ///
    /// This affects sorting and filtering.
    ///
    /// Note that calls to this method must be in sync with the data
    /// used for the sorting and filtering functions. For instance, if
    /// the list is mirroring some external data set, and *two* children
    /// changed in the external data set when you call
    /// `gtk.FlowBoxChild.changed` on the first child, the sort function
    /// must only read the new data for the first of the two changed
    /// children, otherwise the resorting of the children will be wrong.
    ///
    /// This generally means that if you don’t fully control the data
    /// model, you have to duplicate the data that affects the sorting
    /// and filtering functions into the widgets themselves.
    ///
    /// Another alternative is to call `gtk.FlowBox.invalidateSort`
    /// on any model change, but that is more expensive.
    extern fn gtk_flow_box_child_changed(p_child: *FlowBoxChild) void;
    pub const changed = gtk_flow_box_child_changed;

    /// Gets the child widget of `self`.
    extern fn gtk_flow_box_child_get_child(p_self: *FlowBoxChild) ?*gtk.Widget;
    pub const getChild = gtk_flow_box_child_get_child;

    /// Gets the current index of the `child` in its `GtkFlowBox` container.
    extern fn gtk_flow_box_child_get_index(p_child: *FlowBoxChild) c_int;
    pub const getIndex = gtk_flow_box_child_get_index;

    /// Returns whether the `child` is currently selected in its
    /// `GtkFlowBox` container.
    extern fn gtk_flow_box_child_is_selected(p_child: *FlowBoxChild) c_int;
    pub const isSelected = gtk_flow_box_child_is_selected;

    /// Sets the child widget of `self`.
    extern fn gtk_flow_box_child_set_child(p_self: *FlowBoxChild, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_flow_box_child_set_child;

    extern fn gtk_flow_box_child_get_type() usize;
    pub const getGObjectType = gtk_flow_box_child_get_type;

    extern fn g_object_ref(p_self: *gtk.FlowBoxChild) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FlowBoxChild) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FlowBoxChild, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkFontButton` allows to open a font chooser dialog to change
/// the font.
///
/// <picture>
///   <source srcset="font-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkFontButton" src="font-button.png">
/// </picture>
///
/// It is suitable widget for selecting a font in a preference dialog.
///
/// # CSS nodes
///
/// ```
/// fontbutton
/// ╰── button.font
///     ╰── [content]
/// ```
///
/// `GtkFontButton` has a single CSS node with name fontbutton which
/// contains a button node with the .font style class.
pub const FontButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.FontChooser };
    pub const Class = opaque {
        pub const Instance = FontButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the font chooser dialog should be modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// The title of the font chooser dialog.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the buttons label will be drawn in the selected font.
        pub const use_font = struct {
            pub const name = "use-font";

            pub const Type = c_int;
        };

        /// Whether the buttons label will use the selected font size.
        pub const use_size = struct {
            pub const name = "use-size";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to when the font button is activated.
        ///
        /// The `::activate` signal on `GtkFontButton` is an action signal and
        /// emitting it causes the button to present its dialog.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FontButton, p_instance))),
                    gobject.signalLookup("activate", FontButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user selects a font.
        ///
        /// When handling this signal, use `gtk.FontChooser.getFont`
        /// to find out which font was just selected.
        ///
        /// Note that this signal is only emitted when the user changes the font.
        /// If you need to react to programmatic font changes as well, use
        /// the notify::font signal.
        pub const font_set = struct {
            pub const name = "font-set";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FontButton, p_instance))),
                    gobject.signalLookup("font-set", FontButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new font picker widget.
    extern fn gtk_font_button_new() *gtk.FontButton;
    pub const new = gtk_font_button_new;

    /// Creates a new font picker widget showing the given font.
    extern fn gtk_font_button_new_with_font(p_fontname: [*:0]const u8) *gtk.FontButton;
    pub const newWithFont = gtk_font_button_new_with_font;

    /// Gets whether the dialog is modal.
    extern fn gtk_font_button_get_modal(p_font_button: *FontButton) c_int;
    pub const getModal = gtk_font_button_get_modal;

    /// Retrieves the title of the font chooser dialog.
    extern fn gtk_font_button_get_title(p_font_button: *FontButton) [*:0]const u8;
    pub const getTitle = gtk_font_button_get_title;

    /// Returns whether the selected font is used in the label.
    extern fn gtk_font_button_get_use_font(p_font_button: *FontButton) c_int;
    pub const getUseFont = gtk_font_button_get_use_font;

    /// Returns whether the selected size is used in the label.
    extern fn gtk_font_button_get_use_size(p_font_button: *FontButton) c_int;
    pub const getUseSize = gtk_font_button_get_use_size;

    /// Sets whether the dialog should be modal.
    extern fn gtk_font_button_set_modal(p_font_button: *FontButton, p_modal: c_int) void;
    pub const setModal = gtk_font_button_set_modal;

    /// Sets the title for the font chooser dialog.
    extern fn gtk_font_button_set_title(p_font_button: *FontButton, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_font_button_set_title;

    /// If `use_font` is `TRUE`, the font name will be written
    /// using the selected font.
    extern fn gtk_font_button_set_use_font(p_font_button: *FontButton, p_use_font: c_int) void;
    pub const setUseFont = gtk_font_button_set_use_font;

    /// If `use_size` is `TRUE`, the font name will be written using
    /// the selected size.
    extern fn gtk_font_button_set_use_size(p_font_button: *FontButton, p_use_size: c_int) void;
    pub const setUseSize = gtk_font_button_set_use_size;

    extern fn gtk_font_button_get_type() usize;
    pub const getGObjectType = gtk_font_button_get_type;

    extern fn g_object_ref(p_self: *gtk.FontButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FontButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FontButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkFontChooserDialog` widget is a dialog for selecting a font.
///
/// <picture>
///   <source srcset="fontchooser-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkFontChooserDialog" src="fontchooser.png">
/// </picture>
///
/// `GtkFontChooserDialog` implements the `gtk.FontChooser` interface
/// and does not provide much API of its own.
///
/// To create a `GtkFontChooserDialog`, use `gtk.FontChooserDialog.new`.
///
/// # GtkFontChooserDialog as GtkBuildable
///
/// The `GtkFontChooserDialog` implementation of the `GtkBuildable`
/// interface exposes the buttons with the names “select_button”
/// and “cancel_button”.
///
/// ## CSS nodes
///
/// `GtkFontChooserDialog` has a single CSS node with the name `window` and style
/// class `.fontchooser`.
pub const FontChooserDialog = opaque {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.FontChooser, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = FontChooserDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkFontChooserDialog`.
    extern fn gtk_font_chooser_dialog_new(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window) *gtk.FontChooserDialog;
    pub const new = gtk_font_chooser_dialog_new;

    extern fn gtk_font_chooser_dialog_get_type() usize;
    pub const getGObjectType = gtk_font_chooser_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.FontChooserDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FontChooserDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FontChooserDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkFontChooserWidget` widget lets the user select a font.
///
/// It is used in the `GtkFontChooserDialog` widget to provide a
/// dialog for selecting fonts.
///
/// To set the font which is initially selected, use
/// `gtk.FontChooser.setFont` or `gtk.FontChooser.setFontDesc`.
///
/// To get the selected font use `gtk.FontChooser.getFont` or
/// `gtk.FontChooser.getFontDesc`.
///
/// To change the text which is shown in the preview area, use
/// `gtk.FontChooser.setPreviewText`.
///
/// # CSS nodes
///
/// `GtkFontChooserWidget` has a single CSS node with name fontchooser.
pub const FontChooserWidget = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.FontChooser };
    pub const Class = opaque {
        pub const Instance = FontChooserWidget;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// A toggle action that can be used to switch to the tweak page
        /// of the font chooser widget, which lets the user tweak the
        /// OpenType features and variation axes of the selected font.
        ///
        /// The action will be enabled or disabled depending on whether
        /// the selected font has any features or axes.
        pub const tweak_action = struct {
            pub const name = "tweak-action";

            pub const Type = ?*gio.Action;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFontChooserWidget`.
    extern fn gtk_font_chooser_widget_new() *gtk.FontChooserWidget;
    pub const new = gtk_font_chooser_widget_new;

    extern fn gtk_font_chooser_widget_get_type() usize;
    pub const getGObjectType = gtk_font_chooser_widget_get_type;

    extern fn g_object_ref(p_self: *gtk.FontChooserWidget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FontChooserWidget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FontChooserWidget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asynchronous API to present a font chooser dialog.
///
/// `GtkFontDialog` collects the arguments that are needed to present
/// the dialog to the user, such as a title for the dialog and whether
/// it should be modal.
///
/// The dialog is shown with the `gtk.FontDialog.chooseFont`
/// function or its variants.
///
/// See `gtk.FontDialogButton` for a convenient control
/// that uses `GtkFontDialog` and presents the results.
pub const FontDialog = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.FontDialogClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// A filter to restrict what fonts are shown in the font chooser dialog.
        pub const filter = struct {
            pub const name = "filter";

            pub const Type = ?*gtk.Filter;
        };

        /// A custom font map to select fonts from.
        ///
        /// A custom font map can be used to present application-specific
        /// fonts instead of or in addition to the normal system fonts.
        pub const font_map = struct {
            pub const name = "font-map";

            pub const Type = ?*pango.FontMap;
        };

        /// The language for which the font features are selected.
        pub const language = struct {
            pub const name = "language";

            pub const Type = ?*pango.Language;
        };

        /// Whether the font chooser dialog is modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// A title that may be shown on the font chooser
        /// dialog that is presented by `gtk.FontDialog.chooseFont`.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFontDialog` object.
    extern fn gtk_font_dialog_new() *gtk.FontDialog;
    pub const new = gtk_font_dialog_new;

    /// Presents a font chooser dialog to the user.
    ///
    /// The font chooser dialog will be set up for selecting a font face.
    ///
    /// A font face represents a font family and style, but no specific font size.
    extern fn gtk_font_dialog_choose_face(p_self: *FontDialog, p_parent: ?*gtk.Window, p_initial_value: ?*pango.FontFace, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const chooseFace = gtk_font_dialog_choose_face;

    /// Finishes the `gtk.FontDialog.chooseFace` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_font_dialog_choose_face_finish(p_self: *FontDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*pango.FontFace;
    pub const chooseFaceFinish = gtk_font_dialog_choose_face_finish;

    /// Presents a font chooser dialog to the user.
    ///
    /// The font chooser dialog will be set up for selecting a font family.
    extern fn gtk_font_dialog_choose_family(p_self: *FontDialog, p_parent: ?*gtk.Window, p_initial_value: ?*pango.FontFamily, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const chooseFamily = gtk_font_dialog_choose_family;

    /// Finishes the `gtk.FontDialog.chooseFamily` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_font_dialog_choose_family_finish(p_self: *FontDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*pango.FontFamily;
    pub const chooseFamilyFinish = gtk_font_dialog_choose_family_finish;

    /// Presents a font chooser dialog to the user.
    ///
    /// The font chooser dialog will be set up for selecting a font.
    ///
    /// If you want to let the user select font features as well,
    /// use `gtk.FontDialog.chooseFontAndFeatures` instead.
    extern fn gtk_font_dialog_choose_font(p_self: *FontDialog, p_parent: ?*gtk.Window, p_initial_value: ?*pango.FontDescription, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const chooseFont = gtk_font_dialog_choose_font;

    /// Presents a font chooser dialog to the user.
    ///
    /// The font chooser dialog will be set up for selecting a font
    /// and specify features for the selected font.
    ///
    /// Font features affect how the font is rendered, for example
    /// enabling glyph variants or ligatures.
    extern fn gtk_font_dialog_choose_font_and_features(p_self: *FontDialog, p_parent: ?*gtk.Window, p_initial_value: ?*pango.FontDescription, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const chooseFontAndFeatures = gtk_font_dialog_choose_font_and_features;

    /// Finishes the `gtk.FontDialog.chooseFontAndFeatures` call.
    ///
    /// The selected font and features are returned in `font_desc` and
    /// `font_features`.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_font_dialog_choose_font_and_features_finish(p_self: *FontDialog, p_result: *gio.AsyncResult, p_font_desc: **pango.FontDescription, p_font_features: *[*:0]u8, p_language: **pango.Language, p_error: ?*?*glib.Error) c_int;
    pub const chooseFontAndFeaturesFinish = gtk_font_dialog_choose_font_and_features_finish;

    /// Finishes the `gtk.FontDialog.chooseFont` call.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_font_dialog_choose_font_finish(p_self: *FontDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*pango.FontDescription;
    pub const chooseFontFinish = gtk_font_dialog_choose_font_finish;

    /// Returns the filter that decides which fonts to display
    /// in the font chooser dialog.
    extern fn gtk_font_dialog_get_filter(p_self: *FontDialog) ?*gtk.Filter;
    pub const getFilter = gtk_font_dialog_get_filter;

    /// Returns the fontmap from which fonts are selected,
    /// or `NULL` for the default fontmap.
    extern fn gtk_font_dialog_get_font_map(p_self: *FontDialog) ?*pango.FontMap;
    pub const getFontMap = gtk_font_dialog_get_font_map;

    /// Returns the language for which font features are applied.
    extern fn gtk_font_dialog_get_language(p_self: *FontDialog) ?*pango.Language;
    pub const getLanguage = gtk_font_dialog_get_language;

    /// Returns whether the font chooser dialog blocks interaction
    /// with the parent window while it is presented.
    extern fn gtk_font_dialog_get_modal(p_self: *FontDialog) c_int;
    pub const getModal = gtk_font_dialog_get_modal;

    /// Returns the title that will be shown on the font chooser dialog.
    extern fn gtk_font_dialog_get_title(p_self: *FontDialog) [*:0]const u8;
    pub const getTitle = gtk_font_dialog_get_title;

    /// Adds a filter that decides which fonts to display
    /// in the font chooser dialog.
    ///
    /// The filter must be able to handle both `PangoFontFamily`
    /// and `PangoFontFace` objects.
    extern fn gtk_font_dialog_set_filter(p_self: *FontDialog, p_filter: ?*gtk.Filter) void;
    pub const setFilter = gtk_font_dialog_set_filter;

    /// Sets the fontmap from which fonts are selected.
    ///
    /// If `fontmap` is `NULL`, the default fontmap is used.
    extern fn gtk_font_dialog_set_font_map(p_self: *FontDialog, p_fontmap: ?*pango.FontMap) void;
    pub const setFontMap = gtk_font_dialog_set_font_map;

    /// Sets the language for which font features are applied.
    extern fn gtk_font_dialog_set_language(p_self: *FontDialog, p_language: *pango.Language) void;
    pub const setLanguage = gtk_font_dialog_set_language;

    /// Sets whether the font chooser dialog blocks interaction
    /// with the parent window while it is presented.
    extern fn gtk_font_dialog_set_modal(p_self: *FontDialog, p_modal: c_int) void;
    pub const setModal = gtk_font_dialog_set_modal;

    /// Sets the title that will be shown on the font chooser dialog.
    extern fn gtk_font_dialog_set_title(p_self: *FontDialog, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_font_dialog_set_title;

    extern fn gtk_font_dialog_get_type() usize;
    pub const getGObjectType = gtk_font_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.FontDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FontDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FontDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Opens a font chooser dialog to select a font.
///
/// <picture>
///   <source srcset="font-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkFontDialogButton" src="font-button.png">
/// </picture>
///
/// It is suitable widget for selecting a font in a preference dialog.
///
/// # CSS nodes
///
/// ```
/// fontbutton
/// ╰── button.font
///     ╰── [content]
/// ```
///
/// `GtkFontDialogButton` has a single CSS node with name fontbutton which
/// contains a button node with the .font style class.
pub const FontDialogButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.FontDialogButtonClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkFontDialog` that contains parameters for
        /// the font chooser dialog.
        pub const dialog = struct {
            pub const name = "dialog";

            pub const Type = ?*gtk.FontDialog;
        };

        /// The selected font.
        ///
        /// This property can be set to give the button its initial
        /// font, and it will be updated to reflect the users choice
        /// in the font chooser dialog.
        ///
        /// Listen to `notify::font-desc` to get informed about changes
        /// to the buttons font.
        pub const font_desc = struct {
            pub const name = "font-desc";

            pub const Type = ?*pango.FontDescription;
        };

        /// The selected font features.
        ///
        /// This property will be updated to reflect the users choice
        /// in the font chooser dialog.
        ///
        /// Listen to `notify::font-features` to get informed about changes
        /// to the buttons font features.
        pub const font_features = struct {
            pub const name = "font-features";

            pub const Type = ?[*:0]u8;
        };

        /// The selected language for font features.
        ///
        /// This property will be updated to reflect the users choice
        /// in the font chooser dialog.
        ///
        /// Listen to `notify::language` to get informed about changes
        /// to the buttons language.
        pub const language = struct {
            pub const name = "language";

            pub const Type = ?*pango.Language;
        };

        /// The level of detail for the font chooser dialog.
        pub const level = struct {
            pub const name = "level";

            pub const Type = gtk.FontLevel;
        };

        /// Whether the buttons label will be drawn in the selected font.
        pub const use_font = struct {
            pub const name = "use-font";

            pub const Type = c_int;
        };

        /// Whether the buttons label will use the selected font size.
        pub const use_size = struct {
            pub const name = "use-size";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the font dialog button is activated.
        ///
        /// The `::activate` signal on `GtkFontDialogButton` is an action signal
        /// and emitting it causes the button to pop up its dialog.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FontDialogButton, p_instance))),
                    gobject.signalLookup("activate", FontDialogButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkFontDialogButton` with the
    /// given `GtkFontDialog`.
    ///
    /// You can pass `NULL` to this function and set a `GtkFontDialog`
    /// later. The button will be insensitive until that happens.
    extern fn gtk_font_dialog_button_new(p_dialog: ?*gtk.FontDialog) *gtk.FontDialogButton;
    pub const new = gtk_font_dialog_button_new;

    /// Returns the `GtkFontDialog` of `self`.
    extern fn gtk_font_dialog_button_get_dialog(p_self: *FontDialogButton) ?*gtk.FontDialog;
    pub const getDialog = gtk_font_dialog_button_get_dialog;

    /// Returns the font of the button.
    ///
    /// This function is what should be used to obtain
    /// the font that was chosen by the user. To get
    /// informed about changes, listen to "notify::font-desc".
    extern fn gtk_font_dialog_button_get_font_desc(p_self: *FontDialogButton) ?*pango.FontDescription;
    pub const getFontDesc = gtk_font_dialog_button_get_font_desc;

    /// Returns the font features of the button.
    ///
    /// This function is what should be used to obtain the font features
    /// that were chosen by the user. To get informed about changes, listen
    /// to "notify::font-features".
    ///
    /// Note that the button will only let users choose font features
    /// if `gtk.FontDialogButton.properties.level` is set to
    /// `GTK_FONT_LEVEL_FEATURES`.
    extern fn gtk_font_dialog_button_get_font_features(p_self: *FontDialogButton) ?[*:0]const u8;
    pub const getFontFeatures = gtk_font_dialog_button_get_font_features;

    /// Returns the language that is used for font features.
    extern fn gtk_font_dialog_button_get_language(p_self: *FontDialogButton) ?*pango.Language;
    pub const getLanguage = gtk_font_dialog_button_get_language;

    /// Returns the level of detail at which this dialog
    /// lets the user select fonts.
    extern fn gtk_font_dialog_button_get_level(p_self: *FontDialogButton) gtk.FontLevel;
    pub const getLevel = gtk_font_dialog_button_get_level;

    /// Returns whether the selected font is used in the label.
    extern fn gtk_font_dialog_button_get_use_font(p_self: *FontDialogButton) c_int;
    pub const getUseFont = gtk_font_dialog_button_get_use_font;

    /// Returns whether the selected font size is used in the label.
    extern fn gtk_font_dialog_button_get_use_size(p_self: *FontDialogButton) c_int;
    pub const getUseSize = gtk_font_dialog_button_get_use_size;

    /// Sets a `GtkFontDialog` object to use for
    /// creating the font chooser dialog that is
    /// presented when the user clicks the button.
    extern fn gtk_font_dialog_button_set_dialog(p_self: *FontDialogButton, p_dialog: *gtk.FontDialog) void;
    pub const setDialog = gtk_font_dialog_button_set_dialog;

    /// Sets the font of the button.
    extern fn gtk_font_dialog_button_set_font_desc(p_self: *FontDialogButton, p_font_desc: *const pango.FontDescription) void;
    pub const setFontDesc = gtk_font_dialog_button_set_font_desc;

    /// Sets the font features of the button.
    extern fn gtk_font_dialog_button_set_font_features(p_self: *FontDialogButton, p_font_features: ?[*:0]const u8) void;
    pub const setFontFeatures = gtk_font_dialog_button_set_font_features;

    /// Sets the language to use for font features.
    extern fn gtk_font_dialog_button_set_language(p_self: *FontDialogButton, p_language: ?*pango.Language) void;
    pub const setLanguage = gtk_font_dialog_button_set_language;

    /// Sets the level of detail at which this dialog
    /// lets the user select fonts.
    extern fn gtk_font_dialog_button_set_level(p_self: *FontDialogButton, p_level: gtk.FontLevel) void;
    pub const setLevel = gtk_font_dialog_button_set_level;

    /// If `use_font` is `TRUE`, the font name will be written
    /// using the selected font.
    extern fn gtk_font_dialog_button_set_use_font(p_self: *FontDialogButton, p_use_font: c_int) void;
    pub const setUseFont = gtk_font_dialog_button_set_use_font;

    /// If `use_size` is `TRUE`, the font name will be written
    /// using the selected font size.
    extern fn gtk_font_dialog_button_set_use_size(p_self: *FontDialogButton, p_use_size: c_int) void;
    pub const setUseSize = gtk_font_dialog_button_set_use_size;

    extern fn gtk_font_dialog_button_get_type() usize;
    pub const getGObjectType = gtk_font_dialog_button_get_type;

    extern fn g_object_ref(p_self: *gtk.FontDialogButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FontDialogButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FontDialogButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Surrounds its child with a decorative frame and an optional label.
///
/// <picture>
///   <source srcset="frame-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkFrame" src="frame.png">
/// </picture>
///
/// If present, the label is drawn inside the top edge of the frame.
/// The horizontal position of the label can be controlled with
/// `gtk.Frame.setLabelAlign`.
///
/// `GtkFrame` clips its child. You can use this to add rounded corners
/// to widgets, but be aware that it also cuts off shadows.
///
/// # GtkFrame as GtkBuildable
///
/// An example of a UI definition fragment with GtkFrame:
///
/// ```xml
/// <object class="GtkFrame">
///   <property name="label-widget">
///     <object class="GtkLabel" id="frame_label"/>
///   </property>
///   <property name="child">
///     <object class="GtkEntry" id="frame_content"/>
///   </property>
/// </object>
/// ```
///
/// # CSS nodes
///
/// ```
/// frame
/// ├── <label widget>
/// ╰── <child>
/// ```
///
/// `GtkFrame` has a main CSS node with name “frame”, which is used to draw the
/// visible border. You can set the appearance of the border using CSS properties
/// like “border-style” on this node.
///
/// # Accessibility
///
/// `GtkFrame` uses the `gtk.@"AccessibleRole.group"` role.
pub const Frame = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.FrameClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const compute_child_allocation = struct {
            pub fn call(p_class: anytype, p_frame: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_allocation: *gtk.Allocation) void {
                return gobject.ext.as(Frame.Class, p_class).f_compute_child_allocation.?(gobject.ext.as(Frame, p_frame), p_allocation);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_frame: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_allocation: *gtk.Allocation) callconv(.c) void) void {
                gobject.ext.as(Frame.Class, p_class).f_compute_child_allocation = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Text of the frame's label.
        pub const label = struct {
            pub const name = "label";

            pub const Type = ?[*:0]u8;
        };

        /// Widget to display in place of the usual frame label.
        pub const label_widget = struct {
            pub const name = "label-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// The horizontal alignment of the label.
        pub const label_xalign = struct {
            pub const name = "label-xalign";

            pub const Type = f32;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkFrame`, with optional label `label`.
    ///
    /// If `label` is `NULL`, the label is omitted.
    extern fn gtk_frame_new(p_label: ?[*:0]const u8) *gtk.Frame;
    pub const new = gtk_frame_new;

    /// Gets the child widget of `frame`.
    extern fn gtk_frame_get_child(p_frame: *Frame) ?*gtk.Widget;
    pub const getChild = gtk_frame_get_child;

    /// Returns the frame labels text.
    ///
    /// If the frame's label widget is not a `GtkLabel`, `NULL`
    /// is returned.
    extern fn gtk_frame_get_label(p_frame: *Frame) ?[*:0]const u8;
    pub const getLabel = gtk_frame_get_label;

    /// Retrieves the X alignment of the frame’s label.
    extern fn gtk_frame_get_label_align(p_frame: *Frame) f32;
    pub const getLabelAlign = gtk_frame_get_label_align;

    /// Retrieves the label widget for the frame.
    extern fn gtk_frame_get_label_widget(p_frame: *Frame) ?*gtk.Widget;
    pub const getLabelWidget = gtk_frame_get_label_widget;

    /// Sets the child widget of `frame`.
    extern fn gtk_frame_set_child(p_frame: *Frame, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_frame_set_child;

    /// Creates a new `GtkLabel` with the `label` and sets it as the frame's
    /// label widget.
    extern fn gtk_frame_set_label(p_frame: *Frame, p_label: ?[*:0]const u8) void;
    pub const setLabel = gtk_frame_set_label;

    /// Sets the X alignment of the frame widget’s label.
    ///
    /// The default value for a newly created frame is 0.0.
    extern fn gtk_frame_set_label_align(p_frame: *Frame, p_xalign: f32) void;
    pub const setLabelAlign = gtk_frame_set_label_align;

    /// Sets the label widget for the frame.
    ///
    /// This is the widget that will appear embedded in the top edge
    /// of the frame as a title.
    extern fn gtk_frame_set_label_widget(p_frame: *Frame, p_label_widget: ?*gtk.Widget) void;
    pub const setLabelWidget = gtk_frame_set_label_widget;

    extern fn gtk_frame_get_type() usize;
    pub const getGObjectType = gtk_frame_get_type;

    extern fn g_object_ref(p_self: *gtk.Frame) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Frame) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Frame, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows drawing with OpenGL.
///
/// <picture>
///   <source srcset="glarea-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkGLArea" src="glarea.png">
/// </picture>
///
/// `GtkGLArea` sets up its own `gdk.GLContext`, and creates a custom
/// GL framebuffer that the widget will do GL rendering onto. It also ensures
/// that this framebuffer is the default GL rendering target when rendering.
/// The completed rendering is integrated into the larger GTK scene graph as
/// a texture.
///
/// In order to draw, you have to connect to the `gtk.GLArea.signals.render`
/// signal, or subclass `GtkGLArea` and override the GtkGLAreaClass.render
/// virtual function.
///
/// The `GtkGLArea` widget ensures that the `GdkGLContext` is associated with
/// the widget's drawing area, and it is kept updated when the size and
/// position of the drawing area changes.
///
/// ## Drawing with GtkGLArea
///
/// The simplest way to draw using OpenGL commands in a `GtkGLArea` is to
/// create a widget instance and connect to the `gtk.GLArea.signals.render` signal:
///
/// The ``render`` function will be called when the `GtkGLArea` is ready
/// for you to draw its content:
///
/// The initial contents of the framebuffer are transparent.
///
/// ```c
/// static gboolean
/// render (GtkGLArea *area, GdkGLContext *context)
/// {
///   // inside this function it's safe to use GL; the given
///   // GdkGLContext has been made current to the drawable
///   // surface used by the `GtkGLArea` and the viewport has
///   // already been set to be the size of the allocation
///
///   // we can start by clearing the buffer
///   glClearColor (0, 0, 0, 0);
///   glClear (GL_COLOR_BUFFER_BIT);
///
///   // record the active framebuffer ID, so we can return to it
///   // with `glBindFramebuffer (GL_FRAMEBUFFER, screen_fb)` should
///   // we, for instance, intend on utilizing the results of an
///   // intermediate render texture pass
///   GLuint screen_fb = 0;
///   glGetIntegerv (GL_FRAMEBUFFER_BINDING, &screen_fb);
///
///   // draw your object
///   // draw_an_object ();
///
///   // we completed our drawing; the draw commands will be
///   // flushed at the end of the signal emission chain, and
///   // the buffers will be drawn on the window
///   return TRUE;
/// }
///
/// void setup_glarea (void)
/// {
///   // create a GtkGLArea instance
///   GtkWidget *gl_area = gtk_gl_area_new ();
///
///   // connect to the "render" signal
///   g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
/// }
/// ```
///
/// If you need to initialize OpenGL state, e.g. buffer objects or
/// shaders, you should use the `gtk.Widget.signals.realize` signal;
/// you can use the `gtk.Widget.signals.unrealize` signal to clean up.
/// Since the `GdkGLContext` creation and initialization may fail, you
/// will need to check for errors, using `gtk.GLArea.getError`.
///
/// An example of how to safely initialize the GL state is:
///
/// ```c
/// static void
/// on_realize (GtkGLArea *area)
/// {
///   // We need to make the context current if we want to
///   // call GL API
///   gtk_gl_area_make_current (area);
///
///   // If there were errors during the initialization or
///   // when trying to make the context current, this
///   // function will return a GError for you to catch
///   if (gtk_gl_area_get_error (area) != NULL)
///     return;
///
///   // You can also use `gtk.GLArea.setError` in order
///   // to show eventual initialization errors on the
///   // GtkGLArea widget itself
///   GError *internal_error = NULL;
///   init_buffer_objects (&error);
///   if (error != NULL)
///     {
///       gtk_gl_area_set_error (area, error);
///       g_error_free (error);
///       return;
///     }
///
///   init_shaders (&error);
///   if (error != NULL)
///     {
///       gtk_gl_area_set_error (area, error);
///       g_error_free (error);
///       return;
///     }
/// }
/// ```
///
/// If you need to change the options for creating the `GdkGLContext`
/// you should use the `gtk.GLArea.signals.create_context` signal.
pub const GLArea = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.GLAreaClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        /// class closure for the `GtkGLArea::create-context` signal
        pub const create_context = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) *gdk.GLContext {
                return gobject.ext.as(GLArea.Class, p_class).f_create_context.?(gobject.ext.as(GLArea, p_area));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) *gdk.GLContext) void {
                gobject.ext.as(GLArea.Class, p_class).f_create_context = @ptrCast(p_implementation);
            }
        };

        /// class closure for the `GtkGLArea::render` signal
        pub const render = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gdk.GLContext) c_int {
                return gobject.ext.as(GLArea.Class, p_class).f_render.?(gobject.ext.as(GLArea, p_area), p_context);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gdk.GLContext) callconv(.c) c_int) void {
                gobject.ext.as(GLArea.Class, p_class).f_render = @ptrCast(p_implementation);
            }
        };

        /// class closeure for the `GtkGLArea::resize` signal
        pub const resize = struct {
            pub fn call(p_class: anytype, p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int) void {
                return gobject.ext.as(GLArea.Class, p_class).f_resize.?(gobject.ext.as(GLArea, p_area), p_width, p_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_area: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int) callconv(.c) void) void {
                gobject.ext.as(GLArea.Class, p_class).f_resize = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The allowed APIs.
        pub const allowed_apis = struct {
            pub const name = "allowed-apis";

            pub const Type = gdk.GLAPI;
        };

        /// The API currently in use.
        pub const api = struct {
            pub const name = "api";

            pub const Type = gdk.GLAPI;
        };

        /// If set to `TRUE` the ::render signal will be emitted every time
        /// the widget draws.
        ///
        /// This is the default and is useful if drawing the widget is faster.
        ///
        /// If set to `FALSE` the data from previous rendering is kept around and will
        /// be used for drawing the widget the next time, unless the window is resized.
        /// In order to force a rendering `gtk.GLArea.queueRender` must be called.
        /// This mode is useful when the scene changes seldom, but takes a long time
        /// to redraw.
        pub const auto_render = struct {
            pub const name = "auto-render";

            pub const Type = c_int;
        };

        /// The `GdkGLContext` used by the `GtkGLArea` widget.
        ///
        /// The `GtkGLArea` widget is responsible for creating the `GdkGLContext`
        /// instance. If you need to render with other kinds of buffers (stencil,
        /// depth, etc), use render buffers.
        pub const context = struct {
            pub const name = "context";

            pub const Type = ?*gdk.GLContext;
        };

        /// If set to `TRUE` the widget will allocate and enable a depth buffer for the
        /// target framebuffer.
        ///
        /// Setting this property will enable GL's depth testing as a side effect. If
        /// you don't need depth testing, you should call `glDisable(GL_DEPTH_TEST)`
        /// in your `GtkGLArea::render` handler.
        pub const has_depth_buffer = struct {
            pub const name = "has-depth-buffer";

            pub const Type = c_int;
        };

        /// If set to `TRUE` the widget will allocate and enable a stencil buffer for the
        /// target framebuffer.
        pub const has_stencil_buffer = struct {
            pub const name = "has-stencil-buffer";

            pub const Type = c_int;
        };

        /// If set to `TRUE` the widget will try to create a `GdkGLContext` using
        /// OpenGL ES instead of OpenGL.
        pub const use_es = struct {
            pub const name = "use-es";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the widget is being realized.
        ///
        /// This allows you to override how the GL context is created.
        /// This is useful when you want to reuse an existing GL context,
        /// or if you want to try creating different kinds of GL options.
        ///
        /// If context creation fails then the signal handler can use
        /// `gtk.GLArea.setError` to register a more detailed error
        /// of how the construction failed.
        pub const create_context = struct {
            pub const name = "create-context";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) *gdk.GLContext, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GLArea, p_instance))),
                    gobject.signalLookup("create-context", GLArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted every time the contents of the `GtkGLArea` should be redrawn.
        ///
        /// The `context` is bound to the `area` prior to emitting this function,
        /// and the buffers are painted to the window once the emission terminates.
        pub const render = struct {
            pub const name = "render";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gdk.GLContext, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GLArea, p_instance))),
                    gobject.signalLookup("render", GLArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted once when the widget is realized, and then each time the widget
        /// is changed while realized.
        ///
        /// This is useful in order to keep GL state up to date with the widget size,
        /// like for instance camera properties which may depend on the width/height
        /// ratio.
        ///
        /// The GL context for the area is guaranteed to be current when this signal
        /// is emitted.
        ///
        /// The default handler sets up the GL viewport.
        pub const resize = struct {
            pub const name = "resize";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_width: c_int, p_height: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GLArea, p_instance))),
                    gobject.signalLookup("resize", GLArea.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkGLArea` widget.
    extern fn gtk_gl_area_new() *gtk.GLArea;
    pub const new = gtk_gl_area_new;

    /// Binds buffers to the framebuffer.
    ///
    /// Ensures that the `area` framebuffer object is made the current draw
    /// and read target, and that all the required buffers for the `area`
    /// are created and bound to the framebuffer.
    ///
    /// This function is automatically called before emitting the
    /// `gtk.GLArea.signals.render` signal, and doesn't normally need to be
    /// called by application code.
    extern fn gtk_gl_area_attach_buffers(p_area: *GLArea) void;
    pub const attachBuffers = gtk_gl_area_attach_buffers;

    /// Gets the allowed APIs.
    ///
    /// See `gtk.GLArea.setAllowedApis`.
    extern fn gtk_gl_area_get_allowed_apis(p_area: *GLArea) gdk.GLAPI;
    pub const getAllowedApis = gtk_gl_area_get_allowed_apis;

    /// Gets the API that is currently in use.
    ///
    /// If the GL area has not been realized yet, 0 is returned.
    extern fn gtk_gl_area_get_api(p_area: *GLArea) gdk.GLAPI;
    pub const getApi = gtk_gl_area_get_api;

    /// Returns whether the area is in auto render mode or not.
    extern fn gtk_gl_area_get_auto_render(p_area: *GLArea) c_int;
    pub const getAutoRender = gtk_gl_area_get_auto_render;

    /// Retrieves the `GdkGLContext` used by `area`.
    extern fn gtk_gl_area_get_context(p_area: *GLArea) ?*gdk.GLContext;
    pub const getContext = gtk_gl_area_get_context;

    /// Gets the current error set on the `area`.
    extern fn gtk_gl_area_get_error(p_area: *GLArea) ?*glib.Error;
    pub const getError = gtk_gl_area_get_error;

    /// Returns whether the area has a depth buffer.
    extern fn gtk_gl_area_get_has_depth_buffer(p_area: *GLArea) c_int;
    pub const getHasDepthBuffer = gtk_gl_area_get_has_depth_buffer;

    /// Returns whether the area has a stencil buffer.
    extern fn gtk_gl_area_get_has_stencil_buffer(p_area: *GLArea) c_int;
    pub const getHasStencilBuffer = gtk_gl_area_get_has_stencil_buffer;

    /// Retrieves the required version of OpenGL.
    ///
    /// See `gtk.GLArea.setRequiredVersion`.
    extern fn gtk_gl_area_get_required_version(p_area: *GLArea, p_major: *c_int, p_minor: *c_int) void;
    pub const getRequiredVersion = gtk_gl_area_get_required_version;

    /// Returns whether the `GtkGLArea` should use OpenGL ES.
    ///
    /// See `gtk.GLArea.setUseEs`.
    extern fn gtk_gl_area_get_use_es(p_area: *GLArea) c_int;
    pub const getUseEs = gtk_gl_area_get_use_es;

    /// Ensures that the `GdkGLContext` used by `area` is associated with
    /// the `GtkGLArea`.
    ///
    /// This function is automatically called before emitting the
    /// `gtk.GLArea.signals.render` signal, and doesn't normally need
    /// to be called by application code.
    extern fn gtk_gl_area_make_current(p_area: *GLArea) void;
    pub const makeCurrent = gtk_gl_area_make_current;

    /// Marks the currently rendered data (if any) as invalid, and queues
    /// a redraw of the widget.
    ///
    /// This ensures that the `gtk.GLArea.signals.render` signal
    /// is emitted during the draw.
    ///
    /// This is only needed when `gtk.GLArea.setAutoRender` has
    /// been called with a `FALSE` value. The default behaviour is to
    /// emit `gtk.GLArea.signals.render` on each draw.
    extern fn gtk_gl_area_queue_render(p_area: *GLArea) void;
    pub const queueRender = gtk_gl_area_queue_render;

    /// Sets the allowed APIs to create a context with.
    ///
    /// You should check `gtk.GLArea.properties.api` before drawing
    /// with either API.
    ///
    /// By default, all APIs are allowed.
    extern fn gtk_gl_area_set_allowed_apis(p_area: *GLArea, p_apis: gdk.GLAPI) void;
    pub const setAllowedApis = gtk_gl_area_set_allowed_apis;

    /// Sets whether the `GtkGLArea` is in auto render mode.
    ///
    /// If `auto_render` is `TRUE` the `gtk.GLArea.signals.render` signal will
    /// be emitted every time the widget draws. This is the default and is
    /// useful if drawing the widget is faster.
    ///
    /// If `auto_render` is `FALSE` the data from previous rendering is kept
    /// around and will be used for drawing the widget the next time,
    /// unless the window is resized. In order to force a rendering
    /// `gtk.GLArea.queueRender` must be called. This mode is
    /// useful when the scene changes seldom, but takes a long time to redraw.
    extern fn gtk_gl_area_set_auto_render(p_area: *GLArea, p_auto_render: c_int) void;
    pub const setAutoRender = gtk_gl_area_set_auto_render;

    /// Sets an error on the area which will be shown instead of the
    /// GL rendering.
    ///
    /// This is useful in the `gtk.GLArea.signals.create_context`
    /// signal if GL context creation fails.
    extern fn gtk_gl_area_set_error(p_area: *GLArea, p_error: ?*const glib.Error) void;
    pub const setError = gtk_gl_area_set_error;

    /// Sets whether the `GtkGLArea` should use a depth buffer.
    ///
    /// If `has_depth_buffer` is `TRUE` the widget will allocate and
    /// enable a depth buffer for the target framebuffer. Otherwise
    /// there will be none.
    extern fn gtk_gl_area_set_has_depth_buffer(p_area: *GLArea, p_has_depth_buffer: c_int) void;
    pub const setHasDepthBuffer = gtk_gl_area_set_has_depth_buffer;

    /// Sets whether the `GtkGLArea` should use a stencil buffer.
    ///
    /// If `has_stencil_buffer` is `TRUE` the widget will allocate and
    /// enable a stencil buffer for the target framebuffer. Otherwise
    /// there will be none.
    extern fn gtk_gl_area_set_has_stencil_buffer(p_area: *GLArea, p_has_stencil_buffer: c_int) void;
    pub const setHasStencilBuffer = gtk_gl_area_set_has_stencil_buffer;

    /// Sets the required version of OpenGL to be used when creating
    /// the context for the widget.
    ///
    /// This function must be called before the area has been realized.
    extern fn gtk_gl_area_set_required_version(p_area: *GLArea, p_major: c_int, p_minor: c_int) void;
    pub const setRequiredVersion = gtk_gl_area_set_required_version;

    /// Sets whether the `area` should create an OpenGL or an OpenGL ES context.
    ///
    /// You should check the capabilities of the `GdkGLContext` before drawing
    /// with either API.
    extern fn gtk_gl_area_set_use_es(p_area: *GLArea, p_use_es: c_int) void;
    pub const setUseEs = gtk_gl_area_set_use_es;

    extern fn gtk_gl_area_get_type() usize;
    pub const getGObjectType = gtk_gl_area_get_type;

    extern fn g_object_ref(p_self: *gtk.GLArea) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GLArea) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GLArea, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The base class for gesture recognition.
///
/// Although `GtkGesture` is quite generalized to serve as a base for
/// multi-touch gestures, it is suitable to implement single-touch and
/// pointer-based gestures (using the special `NULL` `GdkEventSequence`
/// value for these).
///
/// The number of touches that a `GtkGesture` need to be recognized is
/// controlled by the `gtk.Gesture.properties.n_points` property, if a
/// gesture is keeping track of less or more than that number of sequences,
/// it won't check whether the gesture is recognized.
///
/// As soon as the gesture has the expected number of touches, it will check
/// regularly if it is recognized, the criteria to consider a gesture as
/// "recognized" is left to `GtkGesture` subclasses.
///
/// A recognized gesture will then emit the following signals:
///
/// - `gtk.Gesture.signals.begin` when the gesture is recognized.
/// - `gtk.Gesture.signals.update`, whenever an input event is processed.
/// - `gtk.Gesture.signals.end` when the gesture is no longer recognized.
///
/// ## Event propagation
///
/// In order to receive events, a gesture needs to set a propagation phase
/// through `gtk.EventController.setPropagationPhase`.
///
/// In the capture phase, events are propagated from the toplevel down
/// to the target widget, and gestures that are attached to containers
/// above the widget get a chance to interact with the event before it
/// reaches the target.
///
/// In the bubble phase, events are propagated up from the target widget
/// to the toplevel, and gestures that are attached to containers above
/// the widget get a chance to interact with events that have not been
/// handled yet.
///
/// ## States of a sequence
///
/// Whenever input interaction happens, a single event may trigger a cascade
/// of `GtkGesture`s, both across the parents of the widget receiving the
/// event and in parallel within an individual widget. It is a responsibility
/// of the widgets using those gestures to set the state of touch sequences
/// accordingly in order to enable cooperation of gestures around the
/// `GdkEventSequence`s triggering those.
///
/// Within a widget, gestures can be grouped through `gtk.Gesture.group`.
/// Grouped gestures synchronize the state of sequences, so calling
/// `gtk.Gesture.setState` on one will effectively propagate
/// the state throughout the group.
///
/// By default, all sequences start out in the `GTK_EVENT_SEQUENCE_NONE` state,
/// sequences in this state trigger the gesture event handler, but event
/// propagation will continue unstopped by gestures.
///
/// If a sequence enters into the `GTK_EVENT_SEQUENCE_DENIED` state, the gesture
/// group will effectively ignore the sequence, letting events go unstopped
/// through the gesture, but the "slot" will still remain occupied while
/// the touch is active.
///
/// If a sequence enters in the `GTK_EVENT_SEQUENCE_CLAIMED` state, the gesture
/// group will grab all interaction on the sequence, by:
///
/// - Setting the same sequence to `GTK_EVENT_SEQUENCE_DENIED` on every other
///   gesture group within the widget, and every gesture on parent widgets
///   in the propagation chain.
/// - Emitting `gtk.Gesture.signals.cancel` on every gesture in widgets
///   underneath in the propagation chain.
/// - Stopping event propagation after the gesture group handles the event.
///
/// Note: if a sequence is set early to `GTK_EVENT_SEQUENCE_CLAIMED` on
/// `GDK_TOUCH_BEGIN`/`GDK_BUTTON_PRESS` (so those events are captured before
/// reaching the event widget, this implies `GTK_PHASE_CAPTURE`), one similar
/// event will be emulated if the sequence changes to `GTK_EVENT_SEQUENCE_DENIED`.
/// This way event coherence is preserved before event propagation is unstopped
/// again.
///
/// Sequence states can't be changed freely.
/// See `gtk.Gesture.setState` to know about the possible
/// lifetimes of a `GdkEventSequence`.
///
/// ## Touchpad gestures
///
/// On the platforms that support it, `GtkGesture` will handle transparently
/// touchpad gesture events. The only precautions users of `GtkGesture` should
/// do to enable this support are:
///
/// - If the gesture has `GTK_PHASE_NONE`, ensuring events of type
///   `GDK_TOUCHPAD_SWIPE` and `GDK_TOUCHPAD_PINCH` are handled by the `GtkGesture`
pub const Gesture = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The number of touch points that trigger
        /// recognition on this gesture.
        pub const n_points = struct {
            pub const name = "n-points";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {
        /// Emitted when the gesture is recognized.
        ///
        /// This means the number of touch sequences matches
        /// `gtk.Gesture.properties.n_points`.
        ///
        /// Note: These conditions may also happen when an extra touch
        /// (eg. a third touch on a 2-touches gesture) is lifted, in that
        /// situation `sequence` won't pertain to the current set of active
        /// touches, so don't rely on this being true.
        pub const begin = struct {
            pub const name = "begin";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_sequence: ?*gdk.EventSequence, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Gesture, p_instance))),
                    gobject.signalLookup("begin", Gesture.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever a sequence is cancelled.
        ///
        /// This usually happens on active touches when
        /// `gtk.EventController.reset` is called on `gesture`
        /// (manually, due to grabs...), or the individual `sequence`
        /// was claimed by parent widgets' controllers (see
        /// `gtk.Gesture.setSequenceState`).
        ///
        /// `gesture` must forget everything about `sequence` as in
        /// response to this signal.
        pub const cancel = struct {
            pub const name = "cancel";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_sequence: ?*gdk.EventSequence, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Gesture, p_instance))),
                    gobject.signalLookup("cancel", Gesture.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when `gesture` either stopped recognizing the event
        /// sequences as something to be handled, or the number of touch
        /// sequences became higher or lower than `gtk.Gesture.properties.n_points`.
        ///
        /// Note: `sequence` might not pertain to the group of sequences that
        /// were previously triggering recognition on `gesture` (ie. a just
        /// pressed touch sequence that exceeds `gtk.Gesture.properties.n_points`).
        /// This situation may be detected by checking through
        /// `gtk.Gesture.handlesSequence`.
        pub const end = struct {
            pub const name = "end";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_sequence: ?*gdk.EventSequence, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Gesture, p_instance))),
                    gobject.signalLookup("end", Gesture.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever a sequence state changes.
        ///
        /// See `gtk.Gesture.setSequenceState` to know
        /// more about the expectable sequence lifetimes.
        pub const sequence_state_changed = struct {
            pub const name = "sequence-state-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_sequence: ?*gdk.EventSequence, p_state: gtk.EventSequenceState, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Gesture, p_instance))),
                    gobject.signalLookup("sequence-state-changed", Gesture.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever an event is handled while the gesture is recognized.
        ///
        /// `sequence` is guaranteed to pertain to the set of active touches.
        pub const update = struct {
            pub const name = "update";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_sequence: ?*gdk.EventSequence, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Gesture, p_instance))),
                    gobject.signalLookup("update", Gesture.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// If there are touch sequences being currently handled by `gesture`,
    /// returns `TRUE` and fills in `rect` with the bounding box containing
    /// all active touches.
    ///
    /// Otherwise, `FALSE` will be returned.
    ///
    /// Note: This function will yield unexpected results on touchpad
    /// gestures. Since there is no correlation between physical and
    /// pixel distances, these will look as if constrained in an
    /// infinitely small area, `rect` width and height will thus be 0
    /// regardless of the number of touchpoints.
    extern fn gtk_gesture_get_bounding_box(p_gesture: *Gesture, p_rect: *gdk.Rectangle) c_int;
    pub const getBoundingBox = gtk_gesture_get_bounding_box;

    /// If there are touch sequences being currently handled by `gesture`,
    /// returns `TRUE` and fills in `x` and `y` with the center of the bounding
    /// box containing all active touches.
    ///
    /// Otherwise, `FALSE` will be returned.
    extern fn gtk_gesture_get_bounding_box_center(p_gesture: *Gesture, p_x: *f64, p_y: *f64) c_int;
    pub const getBoundingBoxCenter = gtk_gesture_get_bounding_box_center;

    /// Returns the logical `GdkDevice` that is currently operating
    /// on `gesture`.
    ///
    /// This returns `NULL` if the gesture is not being interacted.
    extern fn gtk_gesture_get_device(p_gesture: *Gesture) ?*gdk.Device;
    pub const getDevice = gtk_gesture_get_device;

    /// Returns all gestures in the group of `gesture`
    extern fn gtk_gesture_get_group(p_gesture: *Gesture) *glib.List;
    pub const getGroup = gtk_gesture_get_group;

    /// Returns the last event that was processed for `sequence`.
    ///
    /// Note that the returned pointer is only valid as long as the
    /// `sequence` is still interpreted by the `gesture`. If in doubt,
    /// you should make a copy of the event.
    extern fn gtk_gesture_get_last_event(p_gesture: *Gesture, p_sequence: ?*gdk.EventSequence) ?*gdk.Event;
    pub const getLastEvent = gtk_gesture_get_last_event;

    /// Returns the `GdkEventSequence` that was last updated on `gesture`.
    extern fn gtk_gesture_get_last_updated_sequence(p_gesture: *Gesture) ?*gdk.EventSequence;
    pub const getLastUpdatedSequence = gtk_gesture_get_last_updated_sequence;

    /// If `sequence` is currently being interpreted by `gesture`,
    /// returns `TRUE` and fills in `x` and `y` with the last coordinates
    /// stored for that event sequence.
    ///
    /// The coordinates are always relative to the widget allocation.
    extern fn gtk_gesture_get_point(p_gesture: *Gesture, p_sequence: ?*gdk.EventSequence, p_x: ?*f64, p_y: ?*f64) c_int;
    pub const getPoint = gtk_gesture_get_point;

    /// Returns the `sequence` state, as seen by `gesture`.
    extern fn gtk_gesture_get_sequence_state(p_gesture: *Gesture, p_sequence: *gdk.EventSequence) gtk.EventSequenceState;
    pub const getSequenceState = gtk_gesture_get_sequence_state;

    /// Returns the list of `GdkEventSequences` currently being interpreted
    /// by `gesture`.
    extern fn gtk_gesture_get_sequences(p_gesture: *Gesture) *glib.List;
    pub const getSequences = gtk_gesture_get_sequences;

    /// Adds `gesture` to the same group than `group_gesture`.
    ///
    /// Gestures are by default isolated in their own groups.
    ///
    /// Both gestures must have been added to the same widget before
    /// they can be grouped.
    ///
    /// When gestures are grouped, the state of `GdkEventSequences`
    /// is kept in sync for all of those, so calling
    /// `gtk.Gesture.setSequenceState`, on one will transfer
    /// the same value to the others.
    ///
    /// Groups also perform an "implicit grabbing" of sequences, if a
    /// `GdkEventSequence` state is set to `GTK_EVENT_SEQUENCE_CLAIMED`
    /// on one group, every other gesture group attached to the same
    /// `GtkWidget` will switch the state for that sequence to
    /// `GTK_EVENT_SEQUENCE_DENIED`.
    extern fn gtk_gesture_group(p_group_gesture: *Gesture, p_gesture: *gtk.Gesture) void;
    pub const group = gtk_gesture_group;

    /// Returns `TRUE` if `gesture` is currently handling events
    /// corresponding to `sequence`.
    extern fn gtk_gesture_handles_sequence(p_gesture: *Gesture, p_sequence: ?*gdk.EventSequence) c_int;
    pub const handlesSequence = gtk_gesture_handles_sequence;

    /// Returns `TRUE` if the gesture is currently active.
    ///
    /// A gesture is active while there are touch sequences
    /// interacting with it.
    extern fn gtk_gesture_is_active(p_gesture: *Gesture) c_int;
    pub const isActive = gtk_gesture_is_active;

    /// Returns `TRUE` if both gestures pertain to the same group.
    extern fn gtk_gesture_is_grouped_with(p_gesture: *Gesture, p_other: *gtk.Gesture) c_int;
    pub const isGroupedWith = gtk_gesture_is_grouped_with;

    /// Returns `TRUE` if the gesture is currently recognized.
    ///
    /// A gesture is recognized if there are as many interacting
    /// touch sequences as required by `gesture`.
    extern fn gtk_gesture_is_recognized(p_gesture: *Gesture) c_int;
    pub const isRecognized = gtk_gesture_is_recognized;

    /// Sets the state of `sequence` in `gesture`.
    ///
    /// Sequences start in state `GTK_EVENT_SEQUENCE_NONE`, and whenever
    /// they change state, they can never go back to that state. Likewise,
    /// sequences in state `GTK_EVENT_SEQUENCE_DENIED` cannot turn back to
    /// a not denied state. With these rules, the lifetime of an event
    /// sequence is constrained to the next four:
    ///
    /// * None
    /// * None → Denied
    /// * None → Claimed
    /// * None → Claimed → Denied
    ///
    /// Note: Due to event handling ordering, it may be unsafe to set the
    /// state on another gesture within a `gtk.Gesture.signals.begin` signal
    /// handler, as the callback might be executed before the other gesture
    /// knows about the sequence. A safe way to perform this could be:
    ///
    /// ```c
    /// static void
    /// first_gesture_begin_cb (GtkGesture       *first_gesture,
    ///                         GdkEventSequence *sequence,
    ///                         gpointer          user_data)
    /// {
    ///   gtk_gesture_set_sequence_state (first_gesture, sequence, GTK_EVENT_SEQUENCE_CLAIMED);
    ///   gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
    /// }
    ///
    /// static void
    /// second_gesture_begin_cb (GtkGesture       *second_gesture,
    ///                          GdkEventSequence *sequence,
    ///                          gpointer          user_data)
    /// {
    ///   if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED)
    ///     gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
    /// }
    /// ```
    ///
    /// If both gestures are in the same group, just set the state on
    /// the gesture emitting the event, the sequence will be already
    /// be initialized to the group's global state when the second
    /// gesture processes the event.
    extern fn gtk_gesture_set_sequence_state(p_gesture: *Gesture, p_sequence: *gdk.EventSequence, p_state: gtk.EventSequenceState) c_int;
    pub const setSequenceState = gtk_gesture_set_sequence_state;

    /// Sets the state of all sequences that `gesture` is currently
    /// interacting with.
    ///
    /// Sequences start in state `GTK_EVENT_SEQUENCE_NONE`, and whenever
    /// they change state, they can never go back to that state. Likewise,
    /// sequences in state `GTK_EVENT_SEQUENCE_DENIED` cannot turn back to
    /// a not denied state. With these rules, the lifetime of an event
    /// sequence is constrained to the next four:
    ///
    /// * None
    /// * None → Denied
    /// * None → Claimed
    /// * None → Claimed → Denied
    ///
    /// Note: Due to event handling ordering, it may be unsafe to set the
    /// state on another gesture within a `gtk.Gesture.signals.begin` signal
    /// handler, as the callback might be executed before the other gesture
    /// knows about the sequence. A safe way to perform this could be:
    ///
    /// ```c
    /// static void
    /// first_gesture_begin_cb (GtkGesture       *first_gesture,
    ///                         GdkEventSequence *sequence,
    ///                         gpointer          user_data)
    /// {
    ///   gtk_gesture_set_state (first_gesture, GTK_EVENT_SEQUENCE_CLAIMED);
    ///   gtk_gesture_set_state (second_gesture, GTK_EVENT_SEQUENCE_DENIED);
    /// }
    ///
    /// static void
    /// second_gesture_begin_cb (GtkGesture       *second_gesture,
    ///                          GdkEventSequence *sequence,
    ///                          gpointer          user_data)
    /// {
    ///   if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED)
    ///     gtk_gesture_set_state (second_gesture, GTK_EVENT_SEQUENCE_DENIED);
    /// }
    /// ```
    ///
    /// If both gestures are in the same group, just set the state on
    /// the gesture emitting the event, the sequence will be already
    /// be initialized to the group's global state when the second
    /// gesture processes the event.
    extern fn gtk_gesture_set_state(p_gesture: *Gesture, p_state: gtk.EventSequenceState) c_int;
    pub const setState = gtk_gesture_set_state;

    /// Separates `gesture` into an isolated group.
    extern fn gtk_gesture_ungroup(p_gesture: *Gesture) void;
    pub const ungroup = gtk_gesture_ungroup;

    extern fn gtk_gesture_get_type() usize;
    pub const getGObjectType = gtk_gesture_get_type;

    extern fn g_object_ref(p_self: *gtk.Gesture) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Gesture) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Gesture, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes click gestures.
///
/// It is able to recognize multiple clicks on a nearby zone, which
/// can be listened for through the `gtk.GestureClick.signals.pressed`
/// signal. Whenever time or distance between clicks exceed the GTK
/// defaults, `gtk.GestureClick.signals.stopped` is emitted, and the
/// click counter is reset.
pub const GestureClick = opaque {
    pub const Parent = gtk.GestureSingle;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureClickClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever a button or touch press happens.
        pub const pressed = struct {
            pub const name = "pressed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_n_press: c_int, p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureClick, p_instance))),
                    gobject.signalLookup("pressed", GestureClick.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a button or touch is released.
        ///
        /// `n_press` will report the number of press that is paired to
        /// this event, note that `gtk.GestureClick.signals.stopped` may
        /// have been emitted between the press and its release, `n_press`
        /// will only start over at the next press.
        pub const released = struct {
            pub const name = "released";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_n_press: c_int, p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureClick, p_instance))),
                    gobject.signalLookup("released", GestureClick.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever any time/distance threshold has been exceeded.
        pub const stopped = struct {
            pub const name = "stopped";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureClick, p_instance))),
                    gobject.signalLookup("stopped", GestureClick.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever the gesture receives a release
        /// event that had no previous corresponding press.
        ///
        /// Due to implicit grabs, this can only happen on situations
        /// where input is grabbed elsewhere mid-press or the pressed
        /// widget voluntarily relinquishes its implicit grab.
        pub const unpaired_release = struct {
            pub const name = "unpaired-release";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, p_button: c_uint, p_sequence: ?*gdk.EventSequence, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureClick, p_instance))),
                    gobject.signalLookup("unpaired-release", GestureClick.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes
    /// single and multiple presses.
    extern fn gtk_gesture_click_new() *gtk.GestureClick;
    pub const new = gtk_gesture_click_new;

    extern fn gtk_gesture_click_get_type() usize;
    pub const getGObjectType = gtk_gesture_click_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureClick) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureClick) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureClick, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes drag gestures.
///
/// The drag operation itself can be tracked throughout the
/// `gtk.GestureDrag.signals.drag_begin`,
/// `gtk.GestureDrag.signals.drag_update` and
/// `gtk.GestureDrag.signals.drag_end` signals, and the relevant
/// coordinates can be extracted through
/// `gtk.GestureDrag.getOffset` and
/// `gtk.GestureDrag.getStartPoint`.
pub const GestureDrag = opaque {
    pub const Parent = gtk.GestureSingle;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureDragClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever dragging starts.
        pub const drag_begin = struct {
            pub const name = "drag-begin";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_start_x: f64, p_start_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureDrag, p_instance))),
                    gobject.signalLookup("drag-begin", GestureDrag.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever the dragging is finished.
        pub const drag_end = struct {
            pub const name = "drag-end";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_offset_x: f64, p_offset_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureDrag, p_instance))),
                    gobject.signalLookup("drag-end", GestureDrag.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever the dragging point moves.
        pub const drag_update = struct {
            pub const name = "drag-update";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_offset_x: f64, p_offset_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureDrag, p_instance))),
                    gobject.signalLookup("drag-update", GestureDrag.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes drags.
    extern fn gtk_gesture_drag_new() *gtk.GestureDrag;
    pub const new = gtk_gesture_drag_new;

    /// Gets the offset from the start point.
    ///
    /// If the `gesture` is active, this function returns `TRUE` and
    /// fills in `x` and `y` with the coordinates of the current point,
    /// as an offset to the starting drag point.
    extern fn gtk_gesture_drag_get_offset(p_gesture: *GestureDrag, p_x: ?*f64, p_y: ?*f64) c_int;
    pub const getOffset = gtk_gesture_drag_get_offset;

    /// Gets the point where the drag started.
    ///
    /// If the `gesture` is active, this function returns `TRUE`
    /// and fills in `x` and `y` with the drag start coordinates,
    /// in widget-relative coordinates.
    extern fn gtk_gesture_drag_get_start_point(p_gesture: *GestureDrag, p_x: ?*f64, p_y: ?*f64) c_int;
    pub const getStartPoint = gtk_gesture_drag_get_start_point;

    extern fn gtk_gesture_drag_get_type() usize;
    pub const getGObjectType = gtk_gesture_drag_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureDrag) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureDrag) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureDrag, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes long press gestures.
///
/// This gesture is also known as “Press and Hold”.
///
/// When the timeout is exceeded, the gesture is triggering the
/// `gtk.GestureLongPress.signals.pressed` signal.
///
/// If the touchpoint is lifted before the timeout passes, or if
/// it drifts too far of the initial press point, the
/// `gtk.GestureLongPress.signals.cancelled` signal will be emitted.
///
/// How long the timeout is before the ::pressed signal gets emitted is
/// determined by the `gtk.Settings.properties.gtk_long_press_time` setting.
/// It can be modified by the `gtk.GestureLongPress.properties.delay_factor`
/// property.
pub const GestureLongPress = opaque {
    pub const Parent = gtk.GestureSingle;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureLongPressClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Factor by which to modify the default timeout.
        pub const delay_factor = struct {
            pub const name = "delay-factor";

            pub const Type = f64;
        };
    };

    pub const signals = struct {
        /// Emitted whenever a press moved too far, or was released
        /// before `gtk.GestureLongPress.signals.pressed` happened.
        pub const cancelled = struct {
            pub const name = "cancelled";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureLongPress, p_instance))),
                    gobject.signalLookup("cancelled", GestureLongPress.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever a press goes unmoved/unreleased longer than
        /// what the GTK defaults tell.
        pub const pressed = struct {
            pub const name = "pressed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureLongPress, p_instance))),
                    gobject.signalLookup("pressed", GestureLongPress.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes long presses.
    extern fn gtk_gesture_long_press_new() *gtk.GestureLongPress;
    pub const new = gtk_gesture_long_press_new;

    /// Returns the delay factor.
    extern fn gtk_gesture_long_press_get_delay_factor(p_gesture: *GestureLongPress) f64;
    pub const getDelayFactor = gtk_gesture_long_press_get_delay_factor;

    /// Applies the given delay factor.
    ///
    /// The default long press time will be multiplied by this value.
    /// Valid values are in the range [0.5..2.0].
    extern fn gtk_gesture_long_press_set_delay_factor(p_gesture: *GestureLongPress, p_delay_factor: f64) void;
    pub const setDelayFactor = gtk_gesture_long_press_set_delay_factor;

    extern fn gtk_gesture_long_press_get_type() usize;
    pub const getGObjectType = gtk_gesture_long_press_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureLongPress) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureLongPress) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureLongPress, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes pan gestures.
///
/// These are drags that are locked to happen along one axis. The axis
/// that a `GtkGesturePan` handles is defined at construct time, and
/// can be changed through `gtk.GesturePan.setOrientation`.
///
/// When the gesture starts to be recognized, `GtkGesturePan` will
/// attempt to determine as early as possible whether the sequence
/// is moving in the expected direction, and denying the sequence if
/// this does not happen.
///
/// Once a panning gesture along the expected axis is recognized,
/// the `gtk.GesturePan.signals.pan` signal will be emitted as input
/// events are received, containing the offset in the given axis.
pub const GesturePan = opaque {
    pub const Parent = gtk.GestureDrag;
    pub const Implements = [_]type{};
    pub const Class = gtk.GesturePanClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The expected orientation of pan gestures.
        pub const orientation = struct {
            pub const name = "orientation";

            pub const Type = gtk.Orientation;
        };
    };

    pub const signals = struct {
        /// Emitted once a panning gesture along the expected axis is detected.
        pub const pan = struct {
            pub const name = "pan";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_direction: gtk.PanDirection, p_offset: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GesturePan, p_instance))),
                    gobject.signalLookup("pan", GesturePan.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes pan gestures.
    extern fn gtk_gesture_pan_new(p_orientation: gtk.Orientation) *gtk.GesturePan;
    pub const new = gtk_gesture_pan_new;

    /// Returns the orientation of the pan gestures that this `gesture` expects.
    extern fn gtk_gesture_pan_get_orientation(p_gesture: *GesturePan) gtk.Orientation;
    pub const getOrientation = gtk_gesture_pan_get_orientation;

    /// Sets the orientation to be expected on pan gestures.
    extern fn gtk_gesture_pan_set_orientation(p_gesture: *GesturePan, p_orientation: gtk.Orientation) void;
    pub const setOrientation = gtk_gesture_pan_set_orientation;

    extern fn gtk_gesture_pan_get_type() usize;
    pub const getGObjectType = gtk_gesture_pan_get_type;

    extern fn g_object_ref(p_self: *gtk.GesturePan) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GesturePan) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GesturePan, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes 2-finger rotation gestures.
///
/// Whenever the angle between both handled sequences changes, the
/// `gtk.GestureRotate.signals.angle_changed` signal is emitted.
pub const GestureRotate = opaque {
    pub const Parent = gtk.Gesture;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureRotateClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted when the angle between both tracked points changes.
        pub const angle_changed = struct {
            pub const name = "angle-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_angle: f64, p_angle_delta: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureRotate, p_instance))),
                    gobject.signalLookup("angle-changed", GestureRotate.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes 2-touch
    /// rotation gestures.
    extern fn gtk_gesture_rotate_new() *gtk.GestureRotate;
    pub const new = gtk_gesture_rotate_new;

    /// Gets the angle delta in radians.
    ///
    /// If `gesture` is active, this function returns the angle difference
    /// in radians since the gesture was first recognized. If `gesture` is
    /// not active, 0 is returned.
    extern fn gtk_gesture_rotate_get_angle_delta(p_gesture: *GestureRotate) f64;
    pub const getAngleDelta = gtk_gesture_rotate_get_angle_delta;

    extern fn gtk_gesture_rotate_get_type() usize;
    pub const getGObjectType = gtk_gesture_rotate_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureRotate) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureRotate) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureRotate, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkGesture` subclass optimized for singe-touch and mouse gestures.
///
/// Under interaction, these gestures stick to the first interacting sequence,
/// which is accessible through `gtk.GestureSingle.getCurrentSequence`
/// while the gesture is being interacted with.
///
/// By default gestures react to both `GDK_BUTTON_PRIMARY` and touch events.
/// `gtk.GestureSingle.setTouchOnly` can be used to change the
/// touch behavior. Callers may also specify a different mouse button number
/// to interact with through `gtk.GestureSingle.setButton`, or react
/// to any mouse button by setting it to 0. While the gesture is active, the
/// button being currently pressed can be known through
/// `gtk.GestureSingle.getCurrentButton`.
pub const GestureSingle = opaque {
    pub const Parent = gtk.Gesture;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureSingleClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Mouse button number to listen to, or 0 to listen for any button.
        pub const button = struct {
            pub const name = "button";

            pub const Type = c_uint;
        };

        /// Whether the gesture is exclusive.
        ///
        /// Exclusive gestures only listen to pointer and pointer emulated events.
        pub const exclusive = struct {
            pub const name = "exclusive";

            pub const Type = c_int;
        };

        /// Whether the gesture handles only touch events.
        pub const touch_only = struct {
            pub const name = "touch-only";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Returns the button number `gesture` listens for.
    ///
    /// If this is 0, the gesture reacts to any button press.
    extern fn gtk_gesture_single_get_button(p_gesture: *GestureSingle) c_uint;
    pub const getButton = gtk_gesture_single_get_button;

    /// Returns the button number currently interacting
    /// with `gesture`, or 0 if there is none.
    extern fn gtk_gesture_single_get_current_button(p_gesture: *GestureSingle) c_uint;
    pub const getCurrentButton = gtk_gesture_single_get_current_button;

    /// Returns the event sequence currently interacting with `gesture`.
    ///
    /// This is only meaningful if `gtk.Gesture.isActive`
    /// returns `TRUE`.
    extern fn gtk_gesture_single_get_current_sequence(p_gesture: *GestureSingle) ?*gdk.EventSequence;
    pub const getCurrentSequence = gtk_gesture_single_get_current_sequence;

    /// Gets whether a gesture is exclusive.
    ///
    /// For more information, see `gtk.GestureSingle.setExclusive`.
    extern fn gtk_gesture_single_get_exclusive(p_gesture: *GestureSingle) c_int;
    pub const getExclusive = gtk_gesture_single_get_exclusive;

    /// Returns `TRUE` if the gesture is only triggered by touch events.
    extern fn gtk_gesture_single_get_touch_only(p_gesture: *GestureSingle) c_int;
    pub const getTouchOnly = gtk_gesture_single_get_touch_only;

    /// Sets the button number `gesture` listens to.
    ///
    /// If non-0, every button press from a different button
    /// number will be ignored. Touch events implicitly match
    /// with button 1.
    extern fn gtk_gesture_single_set_button(p_gesture: *GestureSingle, p_button: c_uint) void;
    pub const setButton = gtk_gesture_single_set_button;

    /// Sets whether `gesture` is exclusive.
    ///
    /// An exclusive gesture will only handle pointer and "pointer emulated"
    /// touch events, so at any given time, there is only one sequence able
    /// to interact with those.
    extern fn gtk_gesture_single_set_exclusive(p_gesture: *GestureSingle, p_exclusive: c_int) void;
    pub const setExclusive = gtk_gesture_single_set_exclusive;

    /// Sets whether to handle only touch events.
    ///
    /// If `touch_only` is `TRUE`, `gesture` will only handle events of type
    /// `GDK_TOUCH_BEGIN`, `GDK_TOUCH_UPDATE` or `GDK_TOUCH_END`. If `FALSE`,
    /// mouse events will be handled too.
    extern fn gtk_gesture_single_set_touch_only(p_gesture: *GestureSingle, p_touch_only: c_int) void;
    pub const setTouchOnly = gtk_gesture_single_set_touch_only;

    extern fn gtk_gesture_single_get_type() usize;
    pub const getGObjectType = gtk_gesture_single_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureSingle) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureSingle) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureSingle, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes tablet stylus input.
///
/// The provided signals just relay the basic information of the
/// stylus events.
pub const GestureStylus = opaque {
    pub const Parent = gtk.GestureSingle;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureStylusClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If this gesture should exclusively react to stylus input devices.
        pub const stylus_only = struct {
            pub const name = "stylus-only";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the stylus touches the device.
        pub const down = struct {
            pub const name = "down";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureStylus, p_instance))),
                    gobject.signalLookup("down", GestureStylus.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the stylus moves while touching the device.
        pub const motion = struct {
            pub const name = "motion";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureStylus, p_instance))),
                    gobject.signalLookup("motion", GestureStylus.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the stylus is in proximity of the device.
        pub const proximity = struct {
            pub const name = "proximity";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureStylus, p_instance))),
                    gobject.signalLookup("proximity", GestureStylus.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the stylus no longer touches the device.
        pub const up = struct {
            pub const name = "up";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: f64, p_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureStylus, p_instance))),
                    gobject.signalLookup("up", GestureStylus.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkGestureStylus`.
    extern fn gtk_gesture_stylus_new() *gtk.GestureStylus;
    pub const new = gtk_gesture_stylus_new;

    /// Returns the current values for the requested `axes`.
    ///
    /// This function must be called from the handler of one of the
    /// `gtk.GestureStylus.signals.down`, `gtk.GestureStylus.signals.motion`,
    /// `gtk.GestureStylus.signals.up` or `gtk.GestureStylus.signals.proximity`
    /// signals.
    extern fn gtk_gesture_stylus_get_axes(p_gesture: *GestureStylus, p_axes: [*]gdk.AxisUse, p_values: *[*]f64) c_int;
    pub const getAxes = gtk_gesture_stylus_get_axes;

    /// Returns the current value for the requested `axis`.
    ///
    /// This function must be called from the handler of one of the
    /// `gtk.GestureStylus.signals.down`, `gtk.GestureStylus.signals.motion`,
    /// `gtk.GestureStylus.signals.up` or `gtk.GestureStylus.signals.proximity`
    /// signals.
    extern fn gtk_gesture_stylus_get_axis(p_gesture: *GestureStylus, p_axis: gdk.AxisUse, p_value: *f64) c_int;
    pub const getAxis = gtk_gesture_stylus_get_axis;

    /// Returns the accumulated backlog of tracking information.
    ///
    /// By default, GTK will limit rate of input events. On stylus input
    /// where accuracy of strokes is paramount, this function returns the
    /// accumulated coordinate/timing state before the emission of the
    /// current [Gtk.GestureStylus::motion] signal.
    ///
    /// This function may only be called within a `gtk.GestureStylus.signals.motion`
    /// signal handler, the state given in this signal and obtainable through
    /// `gtk.GestureStylus.getAxis` express the latest (most up-to-date)
    /// state in motion history.
    ///
    /// The `backlog` is provided in chronological order.
    extern fn gtk_gesture_stylus_get_backlog(p_gesture: *GestureStylus, p_backlog: *[*]gdk.TimeCoord, p_n_elems: *c_uint) c_int;
    pub const getBacklog = gtk_gesture_stylus_get_backlog;

    /// Returns the `GdkDeviceTool` currently driving input through this gesture.
    ///
    /// This function must be called from the handler of one of the
    /// `gtk.GestureStylus.signals.down`, `gtk.GestureStylus.signals.motion`,
    /// `gtk.GestureStylus.signals.up` or `gtk.GestureStylus.signals.proximity`
    /// signals.
    extern fn gtk_gesture_stylus_get_device_tool(p_gesture: *GestureStylus) ?*gdk.DeviceTool;
    pub const getDeviceTool = gtk_gesture_stylus_get_device_tool;

    /// Checks whether the gesture is for styluses only.
    ///
    /// Stylus-only gestures will signal events exclusively from stylus
    /// input devices.
    extern fn gtk_gesture_stylus_get_stylus_only(p_gesture: *GestureStylus) c_int;
    pub const getStylusOnly = gtk_gesture_stylus_get_stylus_only;

    /// Sets the state of stylus-only
    ///
    /// If true, the gesture will exclusively handle events from stylus input devices,
    /// otherwise it'll handle events from any pointing device.
    extern fn gtk_gesture_stylus_set_stylus_only(p_gesture: *GestureStylus, p_stylus_only: c_int) void;
    pub const setStylusOnly = gtk_gesture_stylus_set_stylus_only;

    extern fn gtk_gesture_stylus_get_type() usize;
    pub const getGObjectType = gtk_gesture_stylus_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureStylus) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureStylus) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureStylus, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes swipe gestures.
///
/// After a press/move/.../move/release sequence happens, the
/// `gtk.GestureSwipe.signals.swipe` signal will be emitted,
/// providing the velocity and directionality of the sequence
/// at the time it was lifted.
///
/// If the velocity is desired in intermediate points,
/// `gtk.GestureSwipe.getVelocity` can be called in a
/// `gtk.Gesture.signals.update` handler.
///
/// All velocities are reported in pixels/sec units.
pub const GestureSwipe = opaque {
    pub const Parent = gtk.GestureSingle;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureSwipeClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted when the recognized gesture is finished.
        ///
        /// Velocity and direction are a product of previously recorded events.
        pub const swipe = struct {
            pub const name = "swipe";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_velocity_x: f64, p_velocity_y: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureSwipe, p_instance))),
                    gobject.signalLookup("swipe", GestureSwipe.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes swipes.
    extern fn gtk_gesture_swipe_new() *gtk.GestureSwipe;
    pub const new = gtk_gesture_swipe_new;

    /// Gets the current velocity.
    ///
    /// If the gesture is recognized, this function returns `TRUE` and fills
    /// in `velocity_x` and `velocity_y` with the recorded velocity, as per the
    /// last events processed.
    extern fn gtk_gesture_swipe_get_velocity(p_gesture: *GestureSwipe, p_velocity_x: *f64, p_velocity_y: *f64) c_int;
    pub const getVelocity = gtk_gesture_swipe_get_velocity;

    extern fn gtk_gesture_swipe_get_type() usize;
    pub const getGObjectType = gtk_gesture_swipe_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureSwipe) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureSwipe) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureSwipe, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Recognizes 2-finger pinch/zoom gestures.
///
/// Whenever the distance between both tracked sequences changes, the
/// `gtk.GestureZoom.signals.scale_changed` signal is emitted to report
/// the scale factor.
pub const GestureZoom = opaque {
    pub const Parent = gtk.Gesture;
    pub const Implements = [_]type{};
    pub const Class = gtk.GestureZoomClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever the distance between both tracked sequences changes.
        pub const scale_changed = struct {
            pub const name = "scale-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_scale: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GestureZoom, p_instance))),
                    gobject.signalLookup("scale-changed", GestureZoom.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns a newly created `GtkGesture` that recognizes
    /// pinch/zoom gestures.
    extern fn gtk_gesture_zoom_new() *gtk.GestureZoom;
    pub const new = gtk_gesture_zoom_new;

    /// Gets the scale delta.
    ///
    /// If `gesture` is active, this function returns the zooming
    /// difference since the gesture was recognized (hence the
    /// starting point is considered 1:1). If `gesture` is not
    /// active, 1 is returned.
    extern fn gtk_gesture_zoom_get_scale_delta(p_gesture: *GestureZoom) f64;
    pub const getScaleDelta = gtk_gesture_zoom_get_scale_delta;

    extern fn gtk_gesture_zoom_get_type() usize;
    pub const getGObjectType = gtk_gesture_zoom_get_type;

    extern fn g_object_ref(p_self: *gtk.GestureZoom) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GestureZoom) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GestureZoom, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Bypasses gsk rendering by passing the content of its child directly to the compositor.
///
/// Graphics offload is an optimization to reduce overhead and battery use that is
/// most useful for video content. It only works on some platforms and in certain
/// situations. GTK will automatically fall back to normal rendering if it doesn't.
///
/// Graphics offload is most efficient if there are no controls drawn on top of the
/// video content.
///
/// You should consider using graphics offload for your main widget if it shows
/// frequently changing content (such as a video, or a VM display) and you provide
/// the content in the form of dmabuf textures (see `gdk.DmabufTextureBuilder`),
/// in particular if it may be fullscreen.
///
/// Numerous factors can prohibit graphics offload:
///
/// - Unsupported platforms. Currently, graphics offload only works on Linux with Wayland.
///
/// - Clipping, such as rounded corners that cause the video content to not be rectangular
///
/// - Unsupported dmabuf formats (see `gdk.Display.getDmabufFormats`)
///
/// - Translucent video content (content with an alpha channel, even if it isn't used)
///
/// - Transforms that are more complex than translations and scales
///
/// - Filters such as opacity, grayscale or similar
///
/// To investigate problems related graphics offload, GTK offers debug flags to print
/// out information about graphics offload and dmabuf use:
///
///     GDK_DEBUG=offload
///     GDK_DEBUG=dmabuf
///
/// The GTK inspector provides a visual debugging tool for graphics offload.
pub const GraphicsOffload = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.GraphicsOffloadClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to draw a black background.
        pub const black_background = struct {
            pub const name = "black-background";

            pub const Type = c_int;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether graphics offload is enabled.
        pub const enabled = struct {
            pub const name = "enabled";

            pub const Type = gtk.GraphicsOffloadEnabled;
        };
    };

    pub const signals = struct {};

    /// Creates a new GtkGraphicsOffload widget.
    extern fn gtk_graphics_offload_new(p_child: ?*gtk.Widget) *gtk.GraphicsOffload;
    pub const new = gtk_graphics_offload_new;

    /// Returns whether the widget draws a black background.
    ///
    /// See `gtk.GraphicsOffload.setBlackBackground`.
    extern fn gtk_graphics_offload_get_black_background(p_self: *GraphicsOffload) c_int;
    pub const getBlackBackground = gtk_graphics_offload_get_black_background;

    /// Gets the child of `self`.
    extern fn gtk_graphics_offload_get_child(p_self: *GraphicsOffload) ?*gtk.Widget;
    pub const getChild = gtk_graphics_offload_get_child;

    /// Returns whether offload is enabled for `self`.
    extern fn gtk_graphics_offload_get_enabled(p_self: *GraphicsOffload) gtk.GraphicsOffloadEnabled;
    pub const getEnabled = gtk_graphics_offload_get_enabled;

    /// Sets whether this GtkGraphicsOffload widget will draw a black
    /// background.
    ///
    /// A main use case for this is **_letterboxing_** where black bars are
    /// visible next to the content if the aspect ratio of the content does
    /// not match the dimensions of the monitor.
    ///
    /// Using this property for letterboxing instead of CSS allows compositors
    /// to show content with maximum efficiency, using direct scanout to avoid
    /// extra copies in the compositor.
    ///
    /// On Wayland, this is implemented using the
    /// [single-pixel buffer](https://wayland.app/protocols/single-pixel-buffer-v1)
    /// protocol.
    extern fn gtk_graphics_offload_set_black_background(p_self: *GraphicsOffload, p_value: c_int) void;
    pub const setBlackBackground = gtk_graphics_offload_set_black_background;

    /// Sets the child of `self`.
    extern fn gtk_graphics_offload_set_child(p_self: *GraphicsOffload, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_graphics_offload_set_child;

    /// Sets whether this GtkGraphicsOffload widget will attempt
    /// to offload the content of its child widget.
    extern fn gtk_graphics_offload_set_enabled(p_self: *GraphicsOffload, p_enabled: gtk.GraphicsOffloadEnabled) void;
    pub const setEnabled = gtk_graphics_offload_set_enabled;

    extern fn gtk_graphics_offload_get_type() usize;
    pub const getGObjectType = gtk_graphics_offload_get_type;

    extern fn g_object_ref(p_self: *gtk.GraphicsOffload) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GraphicsOffload) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GraphicsOffload, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Arranges its child widgets in rows and columns.
///
/// <picture>
///   <source srcset="grid-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkGrid" src="grid.png">
/// </picture>
///
/// It supports arbitrary positions and horizontal/vertical spans.
///
/// Children are added using `gtk.Grid.attach`. They can span multiple
/// rows or columns. It is also possible to add a child next to an existing
/// child, using `gtk.Grid.attachNextTo`. To remove a child from the
/// grid, use `gtk.Grid.remove`.
///
/// The behaviour of `GtkGrid` when several children occupy the same grid
/// cell is undefined.
///
/// # GtkGrid as GtkBuildable
///
/// Every child in a `GtkGrid` has access to a custom `gtk.Buildable`
/// element, called `<layout>`. It can by used to specify a position in the
/// grid and optionally spans. All properties that can be used in the `<layout>`
/// element are implemented by `gtk.GridLayoutChild`.
///
/// It is implemented by `GtkWidget` using `gtk.LayoutManager`.
///
/// To showcase it, here is a simple example:
///
/// ```xml
/// <object class="GtkGrid" id="my_grid">
///   <child>
///     <object class="GtkButton" id="button1">
///       <property name="label">Button 1</property>
///       <layout>
///         <property name="column">0</property>
///         <property name="row">0</property>
///       </layout>
///     </object>
///   </child>
///   <child>
///     <object class="GtkButton" id="button2">
///       <property name="label">Button 2</property>
///       <layout>
///         <property name="column">1</property>
///         <property name="row">0</property>
///       </layout>
///     </object>
///   </child>
///   <child>
///     <object class="GtkButton" id="button3">
///       <property name="label">Button 3</property>
///       <layout>
///         <property name="column">2</property>
///         <property name="row">0</property>
///         <property name="row-span">2</property>
///       </layout>
///     </object>
///   </child>
///   <child>
///     <object class="GtkButton" id="button4">
///       <property name="label">Button 4</property>
///       <layout>
///         <property name="column">0</property>
///         <property name="row">1</property>
///         <property name="column-span">2</property>
///       </layout>
///     </object>
///   </child>
/// </object>
/// ```
///
/// It organizes the first two buttons side-by-side in one cell each.
/// The third button is in the last column but spans across two rows.
/// This is defined by the `row-span` property. The last button is
/// located in the second row and spans across two columns, which is
/// defined by the `column-span` property.
///
/// # CSS nodes
///
/// `GtkGrid` uses a single CSS node with name `grid`.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkGrid` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkGrid` uses the `gtk.@"AccessibleRole.generic"` role.
pub const Grid = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.GridClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The row to align to the baseline when valign is using baseline alignment.
        pub const baseline_row = struct {
            pub const name = "baseline-row";

            pub const Type = c_int;
        };

        /// If `TRUE`, the columns are all the same width.
        pub const column_homogeneous = struct {
            pub const name = "column-homogeneous";

            pub const Type = c_int;
        };

        /// The amount of space between two consecutive columns.
        pub const column_spacing = struct {
            pub const name = "column-spacing";

            pub const Type = c_int;
        };

        /// If `TRUE`, the rows are all the same height.
        pub const row_homogeneous = struct {
            pub const name = "row-homogeneous";

            pub const Type = c_int;
        };

        /// The amount of space between two consecutive rows.
        pub const row_spacing = struct {
            pub const name = "row-spacing";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new grid widget.
    extern fn gtk_grid_new() *gtk.Grid;
    pub const new = gtk_grid_new;

    /// Adds a widget to the grid.
    ///
    /// The position of `child` is determined by `column` and `row`.
    /// The number of “cells” that `child` will occupy is determined
    /// by `width` and `height`.
    extern fn gtk_grid_attach(p_grid: *Grid, p_child: *gtk.Widget, p_column: c_int, p_row: c_int, p_width: c_int, p_height: c_int) void;
    pub const attach = gtk_grid_attach;

    /// Adds a widget to the grid.
    ///
    /// The widget is placed next to `sibling`, on the side determined by
    /// `side`. When `sibling` is `NULL`, the widget is placed in row (for
    /// left or right placement) or column 0 (for top or bottom placement),
    /// at the end indicated by `side`.
    ///
    /// Attaching widgets labeled `[1]`, `[2]`, `[3]` with ``sibling` == `NULL`` and
    /// ``side` == `GTK_POS_LEFT`` yields a layout of `[3][2][1]`.
    extern fn gtk_grid_attach_next_to(p_grid: *Grid, p_child: *gtk.Widget, p_sibling: ?*gtk.Widget, p_side: gtk.PositionType, p_width: c_int, p_height: c_int) void;
    pub const attachNextTo = gtk_grid_attach_next_to;

    /// Returns which row defines the global baseline of `grid`.
    extern fn gtk_grid_get_baseline_row(p_grid: *Grid) c_int;
    pub const getBaselineRow = gtk_grid_get_baseline_row;

    /// Gets the child of `grid` whose area covers the grid
    /// cell at `column`, `row`.
    extern fn gtk_grid_get_child_at(p_grid: *Grid, p_column: c_int, p_row: c_int) ?*gtk.Widget;
    pub const getChildAt = gtk_grid_get_child_at;

    /// Returns whether all columns of `grid` have the same width.
    extern fn gtk_grid_get_column_homogeneous(p_grid: *Grid) c_int;
    pub const getColumnHomogeneous = gtk_grid_get_column_homogeneous;

    /// Returns the amount of space between the columns of `grid`.
    extern fn gtk_grid_get_column_spacing(p_grid: *Grid) c_uint;
    pub const getColumnSpacing = gtk_grid_get_column_spacing;

    /// Returns the baseline position of `row`.
    ///
    /// See `gtk.Grid.setRowBaselinePosition`.
    extern fn gtk_grid_get_row_baseline_position(p_grid: *Grid, p_row: c_int) gtk.BaselinePosition;
    pub const getRowBaselinePosition = gtk_grid_get_row_baseline_position;

    /// Returns whether all rows of `grid` have the same height.
    extern fn gtk_grid_get_row_homogeneous(p_grid: *Grid) c_int;
    pub const getRowHomogeneous = gtk_grid_get_row_homogeneous;

    /// Returns the amount of space between the rows of `grid`.
    extern fn gtk_grid_get_row_spacing(p_grid: *Grid) c_uint;
    pub const getRowSpacing = gtk_grid_get_row_spacing;

    /// Inserts a column at the specified position.
    ///
    /// Children which are attached at or to the right of this position
    /// are moved one column to the right. Children which span across this
    /// position are grown to span the new column.
    extern fn gtk_grid_insert_column(p_grid: *Grid, p_position: c_int) void;
    pub const insertColumn = gtk_grid_insert_column;

    /// Inserts a row or column at the specified position.
    ///
    /// The new row or column is placed next to `sibling`, on the side
    /// determined by `side`. If `side` is `GTK_POS_TOP` or `GTK_POS_BOTTOM`,
    /// a row is inserted. If `side` is `GTK_POS_LEFT` of `GTK_POS_RIGHT`,
    /// a column is inserted.
    extern fn gtk_grid_insert_next_to(p_grid: *Grid, p_sibling: *gtk.Widget, p_side: gtk.PositionType) void;
    pub const insertNextTo = gtk_grid_insert_next_to;

    /// Inserts a row at the specified position.
    ///
    /// Children which are attached at or below this position
    /// are moved one row down. Children which span across this
    /// position are grown to span the new row.
    extern fn gtk_grid_insert_row(p_grid: *Grid, p_position: c_int) void;
    pub const insertRow = gtk_grid_insert_row;

    /// Queries the attach points and spans of `child` inside the given `GtkGrid`.
    extern fn gtk_grid_query_child(p_grid: *Grid, p_child: *gtk.Widget, p_column: ?*c_int, p_row: ?*c_int, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const queryChild = gtk_grid_query_child;

    /// Removes a child from `grid`.
    ///
    /// The child must have been added with
    /// `gtk.Grid.attach` or `gtk.Grid.attachNextTo`.
    extern fn gtk_grid_remove(p_grid: *Grid, p_child: *gtk.Widget) void;
    pub const remove = gtk_grid_remove;

    /// Removes a column from the grid.
    ///
    /// Children that are placed in this column are removed,
    /// spanning children that overlap this column have their
    /// width reduced by one, and children after the column
    /// are moved to the left.
    extern fn gtk_grid_remove_column(p_grid: *Grid, p_position: c_int) void;
    pub const removeColumn = gtk_grid_remove_column;

    /// Removes a row from the grid.
    ///
    /// Children that are placed in this row are removed,
    /// spanning children that overlap this row have their
    /// height reduced by one, and children below the row
    /// are moved up.
    extern fn gtk_grid_remove_row(p_grid: *Grid, p_position: c_int) void;
    pub const removeRow = gtk_grid_remove_row;

    /// Sets which row defines the global baseline for the entire grid.
    ///
    /// Each row in the grid can have its own local baseline, but only
    /// one of those is global, meaning it will be the baseline in the
    /// parent of the `grid`.
    extern fn gtk_grid_set_baseline_row(p_grid: *Grid, p_row: c_int) void;
    pub const setBaselineRow = gtk_grid_set_baseline_row;

    /// Sets whether all columns of `grid` will have the same width.
    extern fn gtk_grid_set_column_homogeneous(p_grid: *Grid, p_homogeneous: c_int) void;
    pub const setColumnHomogeneous = gtk_grid_set_column_homogeneous;

    /// Sets the amount of space between columns of `grid`.
    extern fn gtk_grid_set_column_spacing(p_grid: *Grid, p_spacing: c_uint) void;
    pub const setColumnSpacing = gtk_grid_set_column_spacing;

    /// Sets how the baseline should be positioned on `row` of the
    /// grid, in case that row is assigned more space than is requested.
    ///
    /// The default baseline position is `GTK_BASELINE_POSITION_CENTER`.
    extern fn gtk_grid_set_row_baseline_position(p_grid: *Grid, p_row: c_int, p_pos: gtk.BaselinePosition) void;
    pub const setRowBaselinePosition = gtk_grid_set_row_baseline_position;

    /// Sets whether all rows of `grid` will have the same height.
    extern fn gtk_grid_set_row_homogeneous(p_grid: *Grid, p_homogeneous: c_int) void;
    pub const setRowHomogeneous = gtk_grid_set_row_homogeneous;

    /// Sets the amount of space between rows of `grid`.
    extern fn gtk_grid_set_row_spacing(p_grid: *Grid, p_spacing: c_uint) void;
    pub const setRowSpacing = gtk_grid_set_row_spacing;

    extern fn gtk_grid_get_type() usize;
    pub const getGObjectType = gtk_grid_get_type;

    extern fn g_object_ref(p_self: *gtk.Grid) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Grid) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Grid, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Arranges child widgets in rows and columns.
///
/// Children have an "attach point" defined by the horizontal and vertical
/// index of the cell they occupy; children can span multiple rows or columns.
/// The layout properties for setting the attach points and spans are set
/// using the `gtk.GridLayoutChild` associated to each child widget.
///
/// The behaviour of `GtkGridLayout` when several children occupy the same
/// grid cell is undefined.
///
/// `GtkGridLayout` can be used like a `GtkBoxLayout` if all children are
/// attached to the same row or column; however, if you only ever need a
/// single row or column, you should consider using `GtkBoxLayout`.
pub const GridLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{};
    pub const Class = gtk.GridLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The row to align to the baseline, when `GtkWidget:valign` is set
        /// to `GTK_ALIGN_BASELINE`.
        pub const baseline_row = struct {
            pub const name = "baseline-row";

            pub const Type = c_int;
        };

        /// Whether all the columns in the grid have the same width.
        pub const column_homogeneous = struct {
            pub const name = "column-homogeneous";

            pub const Type = c_int;
        };

        /// The amount of space between to consecutive columns.
        pub const column_spacing = struct {
            pub const name = "column-spacing";

            pub const Type = c_int;
        };

        /// Whether all the rows in the grid have the same height.
        pub const row_homogeneous = struct {
            pub const name = "row-homogeneous";

            pub const Type = c_int;
        };

        /// The amount of space between to consecutive rows.
        pub const row_spacing = struct {
            pub const name = "row-spacing";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkGridLayout`.
    extern fn gtk_grid_layout_new() *gtk.GridLayout;
    pub const new = gtk_grid_layout_new;

    /// Retrieves the row set with `gtk.GridLayout.setBaselineRow`.
    extern fn gtk_grid_layout_get_baseline_row(p_grid: *GridLayout) c_int;
    pub const getBaselineRow = gtk_grid_layout_get_baseline_row;

    /// Checks whether all columns of `grid` should have the same width.
    extern fn gtk_grid_layout_get_column_homogeneous(p_grid: *GridLayout) c_int;
    pub const getColumnHomogeneous = gtk_grid_layout_get_column_homogeneous;

    /// Retrieves the spacing set with `gtk.GridLayout.setColumnSpacing`.
    extern fn gtk_grid_layout_get_column_spacing(p_grid: *GridLayout) c_uint;
    pub const getColumnSpacing = gtk_grid_layout_get_column_spacing;

    /// Returns the baseline position of `row`.
    ///
    /// If no value has been set with
    /// `gtk.GridLayout.setRowBaselinePosition`,
    /// the default value of `GTK_BASELINE_POSITION_CENTER`
    /// is returned.
    extern fn gtk_grid_layout_get_row_baseline_position(p_grid: *GridLayout, p_row: c_int) gtk.BaselinePosition;
    pub const getRowBaselinePosition = gtk_grid_layout_get_row_baseline_position;

    /// Checks whether all rows of `grid` should have the same height.
    extern fn gtk_grid_layout_get_row_homogeneous(p_grid: *GridLayout) c_int;
    pub const getRowHomogeneous = gtk_grid_layout_get_row_homogeneous;

    /// Retrieves the spacing set with `gtk.GridLayout.setRowSpacing`.
    extern fn gtk_grid_layout_get_row_spacing(p_grid: *GridLayout) c_uint;
    pub const getRowSpacing = gtk_grid_layout_get_row_spacing;

    /// Sets which row defines the global baseline for the entire grid.
    ///
    /// Each row in the grid can have its own local baseline, but only
    /// one of those is global, meaning it will be the baseline in the
    /// parent of the `grid`.
    extern fn gtk_grid_layout_set_baseline_row(p_grid: *GridLayout, p_row: c_int) void;
    pub const setBaselineRow = gtk_grid_layout_set_baseline_row;

    /// Sets whether all columns of `grid` should have the same width.
    extern fn gtk_grid_layout_set_column_homogeneous(p_grid: *GridLayout, p_homogeneous: c_int) void;
    pub const setColumnHomogeneous = gtk_grid_layout_set_column_homogeneous;

    /// Sets the amount of space to insert between consecutive columns.
    extern fn gtk_grid_layout_set_column_spacing(p_grid: *GridLayout, p_spacing: c_uint) void;
    pub const setColumnSpacing = gtk_grid_layout_set_column_spacing;

    /// Sets how the baseline should be positioned on `row` of the
    /// grid, in case that row is assigned more space than is requested.
    extern fn gtk_grid_layout_set_row_baseline_position(p_grid: *GridLayout, p_row: c_int, p_pos: gtk.BaselinePosition) void;
    pub const setRowBaselinePosition = gtk_grid_layout_set_row_baseline_position;

    /// Sets whether all rows of `grid` should have the same height.
    extern fn gtk_grid_layout_set_row_homogeneous(p_grid: *GridLayout, p_homogeneous: c_int) void;
    pub const setRowHomogeneous = gtk_grid_layout_set_row_homogeneous;

    /// Sets the amount of space to insert between consecutive rows.
    extern fn gtk_grid_layout_set_row_spacing(p_grid: *GridLayout, p_spacing: c_uint) void;
    pub const setRowSpacing = gtk_grid_layout_set_row_spacing;

    extern fn gtk_grid_layout_get_type() usize;
    pub const getGObjectType = gtk_grid_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.GridLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GridLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GridLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkLayoutChild` subclass for children in a `GtkGridLayout`.
pub const GridLayoutChild = opaque {
    pub const Parent = gtk.LayoutChild;
    pub const Implements = [_]type{};
    pub const Class = gtk.GridLayoutChildClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The column to place the child in.
        pub const column = struct {
            pub const name = "column";

            pub const Type = c_int;
        };

        /// The number of columns the child spans to.
        pub const column_span = struct {
            pub const name = "column-span";

            pub const Type = c_int;
        };

        /// The row to place the child in.
        pub const row = struct {
            pub const name = "row";

            pub const Type = c_int;
        };

        /// The number of rows the child spans to.
        pub const row_span = struct {
            pub const name = "row-span";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Retrieves the column number to which `child` attaches its left side.
    extern fn gtk_grid_layout_child_get_column(p_child: *GridLayoutChild) c_int;
    pub const getColumn = gtk_grid_layout_child_get_column;

    /// Retrieves the number of columns that `child` spans to.
    extern fn gtk_grid_layout_child_get_column_span(p_child: *GridLayoutChild) c_int;
    pub const getColumnSpan = gtk_grid_layout_child_get_column_span;

    /// Retrieves the row number to which `child` attaches its top side.
    extern fn gtk_grid_layout_child_get_row(p_child: *GridLayoutChild) c_int;
    pub const getRow = gtk_grid_layout_child_get_row;

    /// Retrieves the number of rows that `child` spans to.
    extern fn gtk_grid_layout_child_get_row_span(p_child: *GridLayoutChild) c_int;
    pub const getRowSpan = gtk_grid_layout_child_get_row_span;

    /// Sets the column number to attach the left side of `child`.
    extern fn gtk_grid_layout_child_set_column(p_child: *GridLayoutChild, p_column: c_int) void;
    pub const setColumn = gtk_grid_layout_child_set_column;

    /// Sets the number of columns `child` spans to.
    extern fn gtk_grid_layout_child_set_column_span(p_child: *GridLayoutChild, p_span: c_int) void;
    pub const setColumnSpan = gtk_grid_layout_child_set_column_span;

    /// Sets the row to place `child` in.
    extern fn gtk_grid_layout_child_set_row(p_child: *GridLayoutChild, p_row: c_int) void;
    pub const setRow = gtk_grid_layout_child_set_row;

    /// Sets the number of rows `child` spans to.
    extern fn gtk_grid_layout_child_set_row_span(p_child: *GridLayoutChild, p_span: c_int) void;
    pub const setRowSpan = gtk_grid_layout_child_set_row_span;

    extern fn gtk_grid_layout_child_get_type() usize;
    pub const getGObjectType = gtk_grid_layout_child_get_type;

    extern fn g_object_ref(p_self: *gtk.GridLayoutChild) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GridLayoutChild) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GridLayoutChild, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents a large dynamic grid of items.
///
/// `GtkGridView` uses its factory to generate one child widget for each
/// visible item and shows them in a grid. The orientation of the grid view
/// determines if the grid reflows vertically or horizontally.
///
/// `GtkGridView` allows the user to select items according to the selection
/// characteristics of the model. For models that allow multiple selected items,
/// it is possible to turn on _rubberband selection_, using
/// `gtk.GridView.properties.enable_rubberband`.
///
/// To learn more about the list widget framework, see the
/// [overview](section-list-widget.html).
///
/// # Actions
///
/// `GtkGridView` defines a set of built-in actions:
///
/// - `list.activate-item` activates the item at given position by emitting the
///   the `gtk.GridView.signals.activate` signal.
///
/// # CSS nodes
///
/// ```
/// gridview
/// ├── child[.activatable]
/// │
/// ├── child[.activatable]
/// │
/// ┊
/// ╰── [rubberband]
/// ```
///
/// `GtkGridView` uses a single CSS node with name `gridview`. Each child uses
/// a single CSS node with name `child`. If the `gtk.ListItem.properties.activatable`
/// property is set, the corresponding row will have the `.activatable` style
/// class. For rubberband selection, a subnode with name `rubberband` is used.
///
/// # Accessibility
///
/// `GtkGridView` uses the `gtk.@"AccessibleRole.grid"` role, and the items
/// use the `gtk.@"AccessibleRole.grid_cell"` role.
pub const GridView = opaque {
    pub const Parent = gtk.ListBase;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable, gtk.Scrollable };
    pub const Class = gtk.GridViewClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Allow rubberband selection.
        pub const enable_rubberband = struct {
            pub const name = "enable-rubberband";

            pub const Type = c_int;
        };

        /// Factory for populating list items.
        ///
        /// The factory must be for configuring `gtk.ListItem` objects.
        pub const factory = struct {
            pub const name = "factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// Maximum number of columns per row.
        ///
        /// If this number is smaller than `gtk.GridView.properties.min_columns`,
        /// that value is used instead.
        pub const max_columns = struct {
            pub const name = "max-columns";

            pub const Type = c_uint;
        };

        /// Minimum number of columns per row.
        pub const min_columns = struct {
            pub const name = "min-columns";

            pub const Type = c_uint;
        };

        /// Model for the items displayed.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.SelectionModel;
        };

        /// Activate rows on single click and select them on hover.
        pub const single_click_activate = struct {
            pub const name = "single-click-activate";

            pub const Type = c_int;
        };

        /// Behavior of the <kbd>Tab</kbd> key
        pub const tab_behavior = struct {
            pub const name = "tab-behavior";

            pub const Type = gtk.ListTabBehavior;
        };
    };

    pub const signals = struct {
        /// Emitted when a cell has been activated by the user,
        /// usually via activating the GtkGridView|list.activate-item action.
        ///
        /// This allows for a convenient way to handle activation in a gridview.
        /// See `gtk.ListItem.properties.activatable` for details on how to use
        /// this signal.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(GridView, p_instance))),
                    gobject.signalLookup("activate", GridView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkGridView` that uses the given `factory` for
    /// mapping items to widgets.
    ///
    /// The function takes ownership of the
    /// arguments, so you can write code like
    /// ```c
    /// grid_view = gtk_grid_view_new (create_model (),
    ///   gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));
    /// ```
    extern fn gtk_grid_view_new(p_model: ?*gtk.SelectionModel, p_factory: ?*gtk.ListItemFactory) *gtk.GridView;
    pub const new = gtk_grid_view_new;

    /// Returns whether rows can be selected by dragging with the mouse.
    extern fn gtk_grid_view_get_enable_rubberband(p_self: *GridView) c_int;
    pub const getEnableRubberband = gtk_grid_view_get_enable_rubberband;

    /// Gets the factory that's currently used to populate list items.
    extern fn gtk_grid_view_get_factory(p_self: *GridView) ?*gtk.ListItemFactory;
    pub const getFactory = gtk_grid_view_get_factory;

    /// Gets the maximum number of columns that the grid will use.
    extern fn gtk_grid_view_get_max_columns(p_self: *GridView) c_uint;
    pub const getMaxColumns = gtk_grid_view_get_max_columns;

    /// Gets the minimum number of columns that the grid will use.
    extern fn gtk_grid_view_get_min_columns(p_self: *GridView) c_uint;
    pub const getMinColumns = gtk_grid_view_get_min_columns;

    /// Gets the model that's currently used to read the items displayed.
    extern fn gtk_grid_view_get_model(p_self: *GridView) ?*gtk.SelectionModel;
    pub const getModel = gtk_grid_view_get_model;

    /// Returns whether items will be activated on single click and
    /// selected on hover.
    extern fn gtk_grid_view_get_single_click_activate(p_self: *GridView) c_int;
    pub const getSingleClickActivate = gtk_grid_view_get_single_click_activate;

    /// Gets the behavior set for the <kbd>Tab</kbd> key.
    extern fn gtk_grid_view_get_tab_behavior(p_self: *GridView) gtk.ListTabBehavior;
    pub const getTabBehavior = gtk_grid_view_get_tab_behavior;

    /// Scrolls to the item at the given position and performs the actions
    /// specified in `flags`.
    ///
    /// This function works no matter if the gridview is shown or focused.
    /// If it isn't, then the changes will take effect once that happens.
    extern fn gtk_grid_view_scroll_to(p_self: *GridView, p_pos: c_uint, p_flags: gtk.ListScrollFlags, p_scroll: ?*gtk.ScrollInfo) void;
    pub const scrollTo = gtk_grid_view_scroll_to;

    /// Sets whether selections can be changed by dragging with the mouse.
    extern fn gtk_grid_view_set_enable_rubberband(p_self: *GridView, p_enable_rubberband: c_int) void;
    pub const setEnableRubberband = gtk_grid_view_set_enable_rubberband;

    /// Sets the `GtkListItemFactory` to use for populating list items.
    extern fn gtk_grid_view_set_factory(p_self: *GridView, p_factory: ?*gtk.ListItemFactory) void;
    pub const setFactory = gtk_grid_view_set_factory;

    /// Sets the maximum number of columns to use.
    ///
    /// This number must be at least 1.
    ///
    /// If `max_columns` is smaller than the minimum set via
    /// `gtk.GridView.setMinColumns`, that value is used instead.
    extern fn gtk_grid_view_set_max_columns(p_self: *GridView, p_max_columns: c_uint) void;
    pub const setMaxColumns = gtk_grid_view_set_max_columns;

    /// Sets the minimum number of columns to use.
    ///
    /// This number must be at least 1.
    ///
    /// If `min_columns` is smaller than the minimum set via
    /// `gtk.GridView.setMaxColumns`, that value is ignored.
    extern fn gtk_grid_view_set_min_columns(p_self: *GridView, p_min_columns: c_uint) void;
    pub const setMinColumns = gtk_grid_view_set_min_columns;

    /// Sets the model to use.
    ///
    /// This must be a `gtk.SelectionModel`.
    extern fn gtk_grid_view_set_model(p_self: *GridView, p_model: ?*gtk.SelectionModel) void;
    pub const setModel = gtk_grid_view_set_model;

    /// Sets whether items should be activated on single click and
    /// selected on hover.
    extern fn gtk_grid_view_set_single_click_activate(p_self: *GridView, p_single_click_activate: c_int) void;
    pub const setSingleClickActivate = gtk_grid_view_set_single_click_activate;

    /// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
    extern fn gtk_grid_view_set_tab_behavior(p_self: *GridView, p_tab_behavior: gtk.ListTabBehavior) void;
    pub const setTabBehavior = gtk_grid_view_set_tab_behavior;

    extern fn gtk_grid_view_get_type() usize;
    pub const getGObjectType = gtk_grid_view_get_type;

    extern fn g_object_ref(p_self: *gtk.GridView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.GridView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *GridView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Creates a custom titlebar for a window.
///
/// <picture>
///   <source srcset="headerbar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkHeaderBar" src="headerbar.png">
/// </picture>
///
/// `GtkHeaderBar` is similar to a horizontal `GtkCenterBox`. It allows
/// children to be placed at the start or the end. In addition, it allows
/// the window title to be displayed. The title will be centered with respect
/// to the width of the box, even if the children at either side take up
/// different amounts of space.
///
/// `GtkHeaderBar` can add typical window frame controls, such as minimize,
/// maximize and close buttons, or the window icon.
///
/// For these reasons, `GtkHeaderBar` is the natural choice for use as the
/// custom titlebar widget of a `GtkWindow` (see `gtk.Window.setTitlebar`),
/// as it gives features typical of titlebars while allowing the addition of
/// child widgets.
///
/// ## GtkHeaderBar as GtkBuildable
///
/// The `GtkHeaderBar` implementation of the `GtkBuildable` interface supports
/// adding children at the start or end sides by specifying “start” or “end” as
/// the “type” attribute of a `<child>` element, or setting the title widget by
/// specifying “title” value.
///
/// By default the `GtkHeaderBar` uses a `GtkLabel` displaying the title of the
/// window it is contained in as the title widget, equivalent to the following
/// UI definition:
///
/// ```xml
/// <object class="GtkHeaderBar">
///   <property name="title-widget">
///     <object class="GtkLabel">
///       <property name="label" translatable="yes">Label</property>
///       <property name="single-line-mode">True</property>
///       <property name="ellipsize">end</property>
///       <property name="width-chars">5</property>
///       <style>
///         <class name="title"/>
///       </style>
///     </object>
///   </property>
/// </object>
/// ```
///
/// # CSS nodes
///
/// ```
/// headerbar
/// ╰── windowhandle
///     ╰── box
///         ├── box.start
///         │   ├── windowcontrols.start
///         │   ╰── [other children]
///         ├── [Title Widget]
///         ╰── box.end
///             ├── [other children]
///             ╰── windowcontrols.end
/// ```
///
/// A `GtkHeaderBar`'s CSS node is called `headerbar`. It contains a `windowhandle`
/// subnode, which contains a `box` subnode, which contains two `box` subnodes at
/// the start and end of the header bar, as well as a center node that represents
/// the title.
///
/// Each of the boxes contains a `windowcontrols` subnode, see
/// `gtk.WindowControls` for details, as well as other children.
///
/// # Accessibility
///
/// `GtkHeaderBar` uses the `gtk.@"AccessibleRole.group"` role.
pub const HeaderBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = HeaderBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The decoration layout for buttons.
        ///
        /// If this property is not set, the
        /// `gtk.Settings.properties.gtk_decoration_layout` setting is used.
        pub const decoration_layout = struct {
            pub const name = "decoration-layout";

            pub const Type = ?[*:0]u8;
        };

        /// Whether to show title buttons like close, minimize, maximize.
        ///
        /// Which buttons are actually shown and where is determined
        /// by the `gtk.HeaderBar.properties.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).
        pub const show_title_buttons = struct {
            pub const name = "show-title-buttons";

            pub const Type = c_int;
        };

        /// The title widget to display.
        pub const title_widget = struct {
            pub const name = "title-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether to show platform native close/minimize/maximize buttons.
        ///
        /// For macOS, the `gtk.HeaderBar.properties.decoration_layout` property
        /// can be used to enable/disable controls.
        ///
        /// On Linux, this option has no effect.
        ///
        /// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
        pub const use_native_controls = struct {
            pub const name = "use-native-controls";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkHeaderBar` widget.
    extern fn gtk_header_bar_new() *gtk.HeaderBar;
    pub const new = gtk_header_bar_new;

    /// Gets the decoration layout of the header bar.
    extern fn gtk_header_bar_get_decoration_layout(p_bar: *HeaderBar) ?[*:0]const u8;
    pub const getDecorationLayout = gtk_header_bar_get_decoration_layout;

    /// Returns whether this header bar shows the standard window
    /// title buttons.
    extern fn gtk_header_bar_get_show_title_buttons(p_bar: *HeaderBar) c_int;
    pub const getShowTitleButtons = gtk_header_bar_get_show_title_buttons;

    /// Retrieves the title widget of the header bar.
    ///
    /// See `gtk.HeaderBar.setTitleWidget`.
    extern fn gtk_header_bar_get_title_widget(p_bar: *HeaderBar) ?*gtk.Widget;
    pub const getTitleWidget = gtk_header_bar_get_title_widget;

    /// Returns whether this header bar shows platform
    /// native window controls.
    extern fn gtk_header_bar_get_use_native_controls(p_bar: *HeaderBar) c_int;
    pub const getUseNativeControls = gtk_header_bar_get_use_native_controls;

    /// Adds a child to the header bar, packed with reference to the end.
    extern fn gtk_header_bar_pack_end(p_bar: *HeaderBar, p_child: *gtk.Widget) void;
    pub const packEnd = gtk_header_bar_pack_end;

    /// Adds a child to the header bar, packed with reference to the start.
    extern fn gtk_header_bar_pack_start(p_bar: *HeaderBar, p_child: *gtk.Widget) void;
    pub const packStart = gtk_header_bar_pack_start;

    /// Removes a child from the header bar.
    ///
    /// The child must have been added with
    /// `gtk.HeaderBar.packStart`,
    /// `gtk.HeaderBar.packEnd` or
    /// `gtk.HeaderBar.setTitleWidget`.
    extern fn gtk_header_bar_remove(p_bar: *HeaderBar, p_child: *gtk.Widget) void;
    pub const remove = gtk_header_bar_remove;

    /// Sets the decoration layout for this header bar.
    ///
    /// This property overrides the
    /// `gtk.Settings.properties.gtk_decoration_layout` setting.
    ///
    /// There can be valid reasons for overriding the setting, such
    /// as a header bar design that does not allow for buttons to take
    /// room on the right, or only offers room for a single close button.
    /// Split header bars are another example for overriding the setting.
    ///
    /// The format of the string is button names, separated by commas.
    /// A colon separates the buttons that should appear on the left
    /// from those on the right. Recognized button names are minimize,
    /// maximize, close and icon (the window icon).
    ///
    /// For example, “icon:minimize,maximize,close” specifies an icon
    /// on the left, and minimize, maximize and close buttons on the right.
    extern fn gtk_header_bar_set_decoration_layout(p_bar: *HeaderBar, p_layout: ?[*:0]const u8) void;
    pub const setDecorationLayout = gtk_header_bar_set_decoration_layout;

    /// Sets whether this header bar shows the standard window
    /// title buttons.
    extern fn gtk_header_bar_set_show_title_buttons(p_bar: *HeaderBar, p_setting: c_int) void;
    pub const setShowTitleButtons = gtk_header_bar_set_show_title_buttons;

    /// Sets the title for the header bar.
    ///
    /// When set to `NULL`, the headerbar will display the title of
    /// the window it is contained in.
    ///
    /// The title should help a user identify the current view.
    /// To achieve the same style as the builtin title, use the
    /// “title” style class.
    ///
    /// You should set the title widget to `NULL`, for the window
    /// title label to be visible again.
    extern fn gtk_header_bar_set_title_widget(p_bar: *HeaderBar, p_title_widget: ?*gtk.Widget) void;
    pub const setTitleWidget = gtk_header_bar_set_title_widget;

    /// Sets whether this header bar shows native window controls.
    ///
    /// This option shows the "stoplight" buttons on macOS.
    /// For Linux, this option has no effect.
    ///
    /// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
    extern fn gtk_header_bar_set_use_native_controls(p_bar: *HeaderBar, p_setting: c_int) void;
    pub const setUseNativeControls = gtk_header_bar_set_use_native_controls;

    extern fn gtk_header_bar_get_type() usize;
    pub const getGObjectType = gtk_header_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.HeaderBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.HeaderBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *HeaderBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The interface for GTK input methods.
///
/// `GtkIMContext` is used by GTK text input widgets like `GtkText`
/// to map from key events to Unicode character strings.
///
/// An input method may consume multiple key events in sequence before finally
/// outputting the composed result. This is called *preediting*, and an input
/// method may provide feedback about this process by displaying the intermediate
/// composition states as preedit text. To do so, the `GtkIMContext` will emit
/// `gtk.IMContext.signals.preedit_start`, `gtk.IMContext.signals.preedit_changed`
/// and `gtk.IMContext.signals.preedit_end` signals.
///
/// For instance, the built-in GTK input method `gtk.IMContextSimple`
/// implements the input of arbitrary Unicode code points by holding down the
/// <kbd>Control</kbd> and <kbd>Shift</kbd> keys and then typing <kbd>u</kbd>
/// followed by the hexadecimal digits of the code point. When releasing the
/// <kbd>Control</kbd> and <kbd>Shift</kbd> keys, preediting ends and the
/// character is inserted as text. For example,
///
///     Ctrl+Shift+u 2 0 A C
///
/// results in the € sign.
///
/// Additional input methods can be made available for use by GTK widgets as
/// loadable modules. An input method module is a small shared library which
/// provides a `GIOExtension` for the extension point named "gtk-im-module".
///
/// To connect a widget to the users preferred input method, you should use
/// `gtk.IMMulticontext`.
pub const IMContext = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.IMContextClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        pub const activate_osk = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_activate_osk.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_activate_osk = @ptrCast(p_implementation);
            }
        };

        pub const activate_osk_with_event = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: *gdk.Event) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_activate_osk_with_event.?(gobject.ext.as(IMContext, p_context), p_event);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: *gdk.Event) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_activate_osk_with_event = @ptrCast(p_implementation);
            }
        };

        /// Default handler of the `gtk.IMContext.signals.commit` signal.
        pub const commit = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: [*:0]const u8) void {
                return gobject.ext.as(IMContext.Class, p_class).f_commit.?(gobject.ext.as(IMContext, p_context), p_str);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: [*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_commit = @ptrCast(p_implementation);
            }
        };

        /// Asks the widget that the input context is attached to delete
        /// characters around the cursor position by emitting the
        /// `::delete_surrounding` signal.
        ///
        /// Note that `offset` and `n_chars` are in characters not in bytes
        /// which differs from the usage other places in `GtkIMContext`.
        ///
        /// In order to use this function, you should first call
        /// `gtk.IMContext.getSurrounding` to get the current context,
        /// and call this function immediately afterwards to make sure that you
        /// know what you are deleting. You should also account for the fact
        /// that even if the signal was handled, the input context might not
        /// have deleted all the characters that were requested to be deleted.
        ///
        /// This function is used by an input method that wants to make
        /// substitutions in the existing text in response to new input.
        /// It is not useful for applications.
        pub const delete_surrounding = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_int, p_n_chars: c_int) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_delete_surrounding.?(gobject.ext.as(IMContext, p_context), p_offset, p_n_chars);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_int, p_n_chars: c_int) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_delete_surrounding = @ptrCast(p_implementation);
            }
        };

        /// Allow an input method to internally handle key press and release
        /// events.
        ///
        /// If this function returns `TRUE`, then no further processing
        /// should be done for this key event.
        pub const filter_keypress = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: *gdk.Event) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_filter_keypress.?(gobject.ext.as(IMContext, p_context), p_event);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: *gdk.Event) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_filter_keypress = @ptrCast(p_implementation);
            }
        };

        /// Notify the input method that the widget to which this
        /// input context corresponds has gained focus.
        ///
        /// The input method may, for example, change the displayed
        /// feedback to reflect this change.
        pub const focus_in = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_focus_in.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_focus_in = @ptrCast(p_implementation);
            }
        };

        /// Notify the input method that the widget to which this
        /// input context corresponds has lost focus.
        ///
        /// The input method may, for example, change the displayed
        /// feedback or reset the contexts state to reflect this change.
        pub const focus_out = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_focus_out.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_focus_out = @ptrCast(p_implementation);
            }
        };

        /// Retrieve the current preedit string for the input context,
        /// and a list of attributes to apply to the string.
        ///
        /// This string should be displayed inserted at the insertion point.
        pub const get_preedit_string = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: *[*:0]u8, p_attrs: **pango.AttrList, p_cursor_pos: *c_int) void {
                return gobject.ext.as(IMContext.Class, p_class).f_get_preedit_string.?(gobject.ext.as(IMContext, p_context), p_str, p_attrs, p_cursor_pos);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: *[*:0]u8, p_attrs: **pango.AttrList, p_cursor_pos: *c_int) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_get_preedit_string = @ptrCast(p_implementation);
            }
        };

        /// Retrieves context around the insertion point.
        ///
        /// Input methods typically want context in order to constrain input text
        /// based on existing text; this is important for languages such as Thai
        /// where only some sequences of characters are allowed.
        ///
        /// This function is implemented by emitting the
        /// `gtk.IMContext.signals.retrieve_surrounding` signal on the input method;
        /// in response to this signal, a widget should provide as much context as
        /// is available, up to an entire paragraph, by calling
        /// `gtk.IMContext.setSurrounding`.
        ///
        /// Note that there is no obligation for a widget to respond to the
        /// `::retrieve-surrounding` signal, so input methods must be prepared to
        /// function without context.
        pub const get_surrounding = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: *[*:0]u8, p_cursor_index: *c_int) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_get_surrounding.?(gobject.ext.as(IMContext, p_context), p_text, p_cursor_index);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: *[*:0]u8, p_cursor_index: *c_int) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_get_surrounding = @ptrCast(p_implementation);
            }
        };

        /// Retrieves context around the insertion point.
        ///
        /// Input methods typically want context in order to constrain input
        /// text based on existing text; this is important for languages such
        /// as Thai where only some sequences of characters are allowed.
        ///
        /// This function is implemented by emitting the
        /// `gtk.IMContext.signals.retrieve_surrounding` signal on the input method;
        /// in response to this signal, a widget should provide as much context as
        /// is available, up to an entire paragraph, by calling
        /// `gtk.IMContext.setSurroundingWithSelection`.
        ///
        /// Note that there is no obligation for a widget to respond to the
        /// `::retrieve-surrounding` signal, so input methods must be prepared to
        /// function without context.
        pub const get_surrounding_with_selection = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: *[*:0]u8, p_cursor_index: *c_int, p_anchor_index: *c_int) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_get_surrounding_with_selection.?(gobject.ext.as(IMContext, p_context), p_text, p_cursor_index, p_anchor_index);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: *[*:0]u8, p_cursor_index: *c_int, p_anchor_index: *c_int) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_get_surrounding_with_selection = @ptrCast(p_implementation);
            }
        };

        /// Default handler of the
        ///   `gtk.IMContext.signals.invalid_composition` signal. Since: 4.22
        pub const invalid_composition = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: [*:0]const u8) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_invalid_composition.?(gobject.ext.as(IMContext, p_context), p_str);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: [*:0]const u8) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_invalid_composition = @ptrCast(p_implementation);
            }
        };

        /// Default handler of the `gtk.IMContext.signals.preedit_changed`
        ///   signal.
        pub const preedit_changed = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_preedit_changed.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_preedit_changed = @ptrCast(p_implementation);
            }
        };

        /// Default handler of the `gtk.IMContext.signals.preedit_end` signal.
        pub const preedit_end = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_preedit_end.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_preedit_end = @ptrCast(p_implementation);
            }
        };

        /// Default handler of the `gtk.IMContext.signals.preedit_start` signal.
        pub const preedit_start = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_preedit_start.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_preedit_start = @ptrCast(p_implementation);
            }
        };

        /// Notify the input method that a change such as a change in cursor
        /// position has been made.
        ///
        /// This will typically cause the input method to clear the preedit state.
        pub const reset = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(IMContext.Class, p_class).f_reset.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_reset = @ptrCast(p_implementation);
            }
        };

        /// Default handler of the
        ///   `gtk.IMContext.signals.retrieve_surrounding` signal.
        pub const retrieve_surrounding = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(IMContext.Class, p_class).f_retrieve_surrounding.?(gobject.ext.as(IMContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(IMContext.Class, p_class).f_retrieve_surrounding = @ptrCast(p_implementation);
            }
        };

        /// Set the client widget for the input context.
        ///
        /// This is the `GtkWidget` holding the input focus. This widget is
        /// used in order to correctly position status windows, and may
        /// also be used for purposes internal to the input method.
        pub const set_client_widget = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: ?*gtk.Widget) void {
                return gobject.ext.as(IMContext.Class, p_class).f_set_client_widget.?(gobject.ext.as(IMContext, p_context), p_widget);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: ?*gtk.Widget) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_set_client_widget = @ptrCast(p_implementation);
            }
        };

        /// Notify the input method that a change in cursor
        /// position has been made.
        ///
        /// The location is relative to the client widget.
        pub const set_cursor_location = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_area: *gdk.Rectangle) void {
                return gobject.ext.as(IMContext.Class, p_class).f_set_cursor_location.?(gobject.ext.as(IMContext, p_context), p_area);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_area: *gdk.Rectangle) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_set_cursor_location = @ptrCast(p_implementation);
            }
        };

        /// Sets surrounding context around the insertion point and preedit
        /// string.
        ///
        /// This function is expected to be called in response to the
        /// `gtk.IMContext.signals.retrieve_surrounding` signal, and will
        /// likely have no effect if called at other times.
        pub const set_surrounding = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int) void {
                return gobject.ext.as(IMContext.Class, p_class).f_set_surrounding.?(gobject.ext.as(IMContext, p_context), p_text, p_len, p_cursor_index);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_set_surrounding = @ptrCast(p_implementation);
            }
        };

        /// Sets surrounding context around the insertion point and preedit
        /// string. This function is expected to be called in response to the
        /// `gtk.IMContext.signals.retrieve_surrounding` signal, and will likely
        /// have no effect if called at other times.
        pub const set_surrounding_with_selection = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int, p_anchor_index: c_int) void {
                return gobject.ext.as(IMContext.Class, p_class).f_set_surrounding_with_selection.?(gobject.ext.as(IMContext, p_context), p_text, p_len, p_cursor_index, p_anchor_index);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int, p_anchor_index: c_int) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_set_surrounding_with_selection = @ptrCast(p_implementation);
            }
        };

        /// Sets whether the IM context should use the preedit string
        /// to display feedback.
        ///
        /// If `use_preedit` is `FALSE` (default is `TRUE`), then the IM context
        /// may use some other method to display feedback, such as displaying
        /// it in a child of the root window.
        pub const set_use_preedit = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_use_preedit: c_int) void {
                return gobject.ext.as(IMContext.Class, p_class).f_set_use_preedit.?(gobject.ext.as(IMContext, p_context), p_use_preedit);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_use_preedit: c_int) callconv(.c) void) void {
                gobject.ext.as(IMContext.Class, p_class).f_set_use_preedit = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Additional hints that allow input methods to fine-tune
        /// their behaviour.
        pub const input_hints = struct {
            pub const name = "input-hints";

            pub const Type = gtk.InputHints;
        };

        /// The purpose of the text field that the `GtkIMContext is connected to.
        ///
        /// This property can be used by on-screen keyboards and other input
        /// methods to adjust their behaviour.
        pub const input_purpose = struct {
            pub const name = "input-purpose";

            pub const Type = gtk.InputPurpose;
        };
    };

    pub const signals = struct {
        /// The ::commit signal is emitted when a complete input sequence
        /// has been entered by the user.
        ///
        /// If the commit comes after a preediting sequence, the
        /// ::commit signal is emitted after ::preedit-end.
        ///
        /// This can be a single character immediately after a key press or
        /// the final result of preediting.
        pub const commit = struct {
            pub const name = "commit";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_str: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("commit", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::delete-surrounding signal is emitted when the input method
        /// needs to delete all or part of the context surrounding the cursor.
        pub const delete_surrounding = struct {
            pub const name = "delete-surrounding";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_offset: c_int, p_n_chars: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("delete-surrounding", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the filtered keys do not compose to a single valid character.
        pub const invalid_composition = struct {
            pub const name = "invalid-composition";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_str: [*:0]u8, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("invalid-composition", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::preedit-changed signal is emitted whenever the preedit sequence
        /// currently being entered has changed.
        ///
        /// It is also emitted at the end of a preedit sequence, in which case
        /// `gtk.IMContext.getPreeditString` returns the empty string.
        pub const preedit_changed = struct {
            pub const name = "preedit-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("preedit-changed", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::preedit-end signal is emitted when a preediting sequence
        /// has been completed or canceled.
        pub const preedit_end = struct {
            pub const name = "preedit-end";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("preedit-end", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::preedit-start signal is emitted when a new preediting sequence
        /// starts.
        pub const preedit_start = struct {
            pub const name = "preedit-start";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("preedit-start", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::retrieve-surrounding signal is emitted when the input method
        /// requires the context surrounding the cursor.
        ///
        /// The callback should set the input method surrounding context by
        /// calling the `gtk.IMContext.setSurrounding` method.
        pub const retrieve_surrounding = struct {
            pub const name = "retrieve-surrounding";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IMContext, p_instance))),
                    gobject.signalLookup("retrieve-surrounding", IMContext.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Requests the platform to show an on-screen keyboard for user input.
    ///
    /// This method will return `TRUE` if this request was actually performed
    /// to the platform, other environmental factors may result in an on-screen
    /// keyboard effectively not showing up.
    extern fn gtk_im_context_activate_osk(p_context: *IMContext, p_event: ?*gdk.Event) c_int;
    pub const activateOsk = gtk_im_context_activate_osk;

    /// Asks the widget that the input context is attached to delete
    /// characters around the cursor position by emitting the
    /// `::delete_surrounding` signal.
    ///
    /// Note that `offset` and `n_chars` are in characters not in bytes
    /// which differs from the usage other places in `GtkIMContext`.
    ///
    /// In order to use this function, you should first call
    /// `gtk.IMContext.getSurrounding` to get the current context,
    /// and call this function immediately afterwards to make sure that you
    /// know what you are deleting. You should also account for the fact
    /// that even if the signal was handled, the input context might not
    /// have deleted all the characters that were requested to be deleted.
    ///
    /// This function is used by an input method that wants to make
    /// substitutions in the existing text in response to new input.
    /// It is not useful for applications.
    extern fn gtk_im_context_delete_surrounding(p_context: *IMContext, p_offset: c_int, p_n_chars: c_int) c_int;
    pub const deleteSurrounding = gtk_im_context_delete_surrounding;

    /// Allow an input method to forward key press and release events
    /// to another input method without necessarily having a `GdkEvent`
    /// available.
    extern fn gtk_im_context_filter_key(p_context: *IMContext, p_press: c_int, p_surface: *gdk.Surface, p_device: *gdk.Device, p_time: u32, p_keycode: c_uint, p_state: gdk.ModifierType, p_group: c_int) c_int;
    pub const filterKey = gtk_im_context_filter_key;

    /// Allow an input method to internally handle key press and release
    /// events.
    ///
    /// If this function returns `TRUE`, then no further processing
    /// should be done for this key event.
    extern fn gtk_im_context_filter_keypress(p_context: *IMContext, p_event: *gdk.Event) c_int;
    pub const filterKeypress = gtk_im_context_filter_keypress;

    /// Notify the input method that the widget to which this
    /// input context corresponds has gained focus.
    ///
    /// The input method may, for example, change the displayed
    /// feedback to reflect this change.
    extern fn gtk_im_context_focus_in(p_context: *IMContext) void;
    pub const focusIn = gtk_im_context_focus_in;

    /// Notify the input method that the widget to which this
    /// input context corresponds has lost focus.
    ///
    /// The input method may, for example, change the displayed
    /// feedback or reset the contexts state to reflect this change.
    extern fn gtk_im_context_focus_out(p_context: *IMContext) void;
    pub const focusOut = gtk_im_context_focus_out;

    /// Retrieve the current preedit string for the input context,
    /// and a list of attributes to apply to the string.
    ///
    /// This string should be displayed inserted at the insertion point.
    extern fn gtk_im_context_get_preedit_string(p_context: *IMContext, p_str: *[*:0]u8, p_attrs: **pango.AttrList, p_cursor_pos: *c_int) void;
    pub const getPreeditString = gtk_im_context_get_preedit_string;

    /// Retrieves context around the insertion point.
    ///
    /// Input methods typically want context in order to constrain input text
    /// based on existing text; this is important for languages such as Thai
    /// where only some sequences of characters are allowed.
    ///
    /// This function is implemented by emitting the
    /// `gtk.IMContext.signals.retrieve_surrounding` signal on the input method;
    /// in response to this signal, a widget should provide as much context as
    /// is available, up to an entire paragraph, by calling
    /// `gtk.IMContext.setSurrounding`.
    ///
    /// Note that there is no obligation for a widget to respond to the
    /// `::retrieve-surrounding` signal, so input methods must be prepared to
    /// function without context.
    extern fn gtk_im_context_get_surrounding(p_context: *IMContext, p_text: *[*:0]u8, p_cursor_index: *c_int) c_int;
    pub const getSurrounding = gtk_im_context_get_surrounding;

    /// Retrieves context around the insertion point.
    ///
    /// Input methods typically want context in order to constrain input
    /// text based on existing text; this is important for languages such
    /// as Thai where only some sequences of characters are allowed.
    ///
    /// This function is implemented by emitting the
    /// `gtk.IMContext.signals.retrieve_surrounding` signal on the input method;
    /// in response to this signal, a widget should provide as much context as
    /// is available, up to an entire paragraph, by calling
    /// `gtk.IMContext.setSurroundingWithSelection`.
    ///
    /// Note that there is no obligation for a widget to respond to the
    /// `::retrieve-surrounding` signal, so input methods must be prepared to
    /// function without context.
    extern fn gtk_im_context_get_surrounding_with_selection(p_context: *IMContext, p_text: *[*:0]u8, p_cursor_index: *c_int, p_anchor_index: *c_int) c_int;
    pub const getSurroundingWithSelection = gtk_im_context_get_surrounding_with_selection;

    /// Notify the input method that a change such as a change in cursor
    /// position has been made.
    ///
    /// This will typically cause the input method to clear the preedit state.
    extern fn gtk_im_context_reset(p_context: *IMContext) void;
    pub const reset = gtk_im_context_reset;

    /// Set the client widget for the input context.
    ///
    /// This is the `GtkWidget` holding the input focus. This widget is
    /// used in order to correctly position status windows, and may
    /// also be used for purposes internal to the input method.
    extern fn gtk_im_context_set_client_widget(p_context: *IMContext, p_widget: ?*gtk.Widget) void;
    pub const setClientWidget = gtk_im_context_set_client_widget;

    /// Notify the input method that a change in cursor
    /// position has been made.
    ///
    /// The location is relative to the client widget.
    extern fn gtk_im_context_set_cursor_location(p_context: *IMContext, p_area: *const gdk.Rectangle) void;
    pub const setCursorLocation = gtk_im_context_set_cursor_location;

    /// Sets surrounding context around the insertion point and preedit
    /// string.
    ///
    /// This function is expected to be called in response to the
    /// `gtk.IMContext.signals.retrieve_surrounding` signal, and will
    /// likely have no effect if called at other times.
    extern fn gtk_im_context_set_surrounding(p_context: *IMContext, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int) void;
    pub const setSurrounding = gtk_im_context_set_surrounding;

    /// Sets surrounding context around the insertion point and preedit
    /// string. This function is expected to be called in response to the
    /// `gtk.IMContext.signals.retrieve_surrounding` signal, and will likely
    /// have no effect if called at other times.
    extern fn gtk_im_context_set_surrounding_with_selection(p_context: *IMContext, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int, p_anchor_index: c_int) void;
    pub const setSurroundingWithSelection = gtk_im_context_set_surrounding_with_selection;

    /// Sets whether the IM context should use the preedit string
    /// to display feedback.
    ///
    /// If `use_preedit` is `FALSE` (default is `TRUE`), then the IM context
    /// may use some other method to display feedback, such as displaying
    /// it in a child of the root window.
    extern fn gtk_im_context_set_use_preedit(p_context: *IMContext, p_use_preedit: c_int) void;
    pub const setUsePreedit = gtk_im_context_set_use_preedit;

    extern fn gtk_im_context_get_type() usize;
    pub const getGObjectType = gtk_im_context_get_type;

    extern fn g_object_ref(p_self: *gtk.IMContext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.IMContext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *IMContext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Supports compose sequences, dead keys and numeric Unicode input.
///
/// ## Compose sequences
///
/// `GtkIMContextSimple` reads compose sequences from the first of the
/// following files that is found: ~/.config/gtk-4.0/Compose, ~/.XCompose,
/// /usr/share/X11/locale/$locale/Compose (for locales that have a nontrivial
/// Compose file). A subset of the file syntax described in the Compose(5)
/// manual page is supported. Additionally, `include "`L`"` loads GTK’s built-in
/// table of compose sequences rather than the locale-specific one from X11.
///
/// If none of these files is found, `GtkIMContextSimple` uses a built-in table
/// of compose sequences that is derived from the X11 Compose files.
///
/// Note that compose sequences typically start with the Compose_key, which is
/// often not available as a dedicated key on keyboards. Keyboard layouts may
/// map this keysym to other keys, such as the right Control key.
///
/// ## Unicode characters
///
/// `GtkIMContextSimple` also supports numeric entry of Unicode characters
/// by typing <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>u</kbd>, followed by a
/// hexadecimal Unicode codepoint.
///
/// For example,
///
///     Ctrl-Shift-u 1 2 3 Enter
///
/// yields U+0123 LATIN SMALL LETTER G WITH CEDILLA, i.e. ģ.
///
/// ## Dead keys
///
/// `GtkIMContextSimple` supports dead keys. For example, typing
///
///     dead_acute a
///
///  yields U+00E! LATIN SMALL LETTER_A WITH ACUTE, i.e. á. Note that this
///  depends on the keyboard layout including dead keys.
pub const IMContextSimple = extern struct {
    pub const Parent = gtk.IMContext;
    pub const Implements = [_]type{};
    pub const Class = gtk.IMContextSimpleClass;
    f_object: gtk.IMContext,
    f_priv: ?*gtk.IMContextSimplePrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkIMContextSimple`.
    extern fn gtk_im_context_simple_new() *gtk.IMContextSimple;
    pub const new = gtk_im_context_simple_new;

    /// Adds an additional table from the X11 compose file.
    extern fn gtk_im_context_simple_add_compose_file(p_context_simple: *IMContextSimple, p_compose_file: [*:0]const u8) void;
    pub const addComposeFile = gtk_im_context_simple_add_compose_file;

    /// Adds an additional table to search to the input context.
    /// Each row of the table consists of `max_seq_len` key symbols
    /// followed by two `guint16` interpreted as the high and low
    /// words of a `gunicode` value. Tables are searched starting
    /// from the last added.
    ///
    /// The table must be sorted in dictionary order on the
    /// numeric value of the key symbol fields. (Values beyond
    /// the length of the sequence should be zero.)
    extern fn gtk_im_context_simple_add_table(p_context_simple: *IMContextSimple, p_data: [*]u16, p_max_seq_len: c_int, p_n_seqs: c_int) void;
    pub const addTable = gtk_im_context_simple_add_table;

    extern fn gtk_im_context_simple_get_type() usize;
    pub const getGObjectType = gtk_im_context_simple_get_type;

    extern fn g_object_ref(p_self: *gtk.IMContextSimple) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.IMContextSimple) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *IMContextSimple, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Supports switching between multiple input methods.
///
/// Text widgets such as `GtkText` or `GtkTextView` use a `GtkIMMultiContext`
/// to implement their `im-module` property for switching between different
/// input methods.
pub const IMMulticontext = extern struct {
    pub const Parent = gtk.IMContext;
    pub const Implements = [_]type{};
    pub const Class = gtk.IMMulticontextClass;
    f_object: gtk.IMContext,
    f_priv: ?*gtk.IMMulticontextPrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkIMMulticontext`.
    extern fn gtk_im_multicontext_new() *gtk.IMMulticontext;
    pub const new = gtk_im_multicontext_new;

    /// Gets the id of the currently active delegate of the `context`.
    extern fn gtk_im_multicontext_get_context_id(p_context: *IMMulticontext) [*:0]const u8;
    pub const getContextId = gtk_im_multicontext_get_context_id;

    /// Sets the context id for `context`.
    ///
    /// This causes the currently active delegate of `context` to be
    /// replaced by the delegate corresponding to the new context id.
    ///
    /// Setting this to a non-`NULL` value overrides the system-wide
    /// IM module setting. See the `gtk.Settings.properties.gtk_im_module`
    /// property.
    extern fn gtk_im_multicontext_set_context_id(p_context: *IMMulticontext, p_context_id: ?[*:0]const u8) void;
    pub const setContextId = gtk_im_multicontext_set_context_id;

    extern fn gtk_im_multicontext_get_type() usize;
    pub const getGObjectType = gtk_im_multicontext_get_type;

    extern fn g_object_ref(p_self: *gtk.IMMulticontext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.IMMulticontext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *IMMulticontext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Contains information found when looking up an icon in `GtkIconTheme`
/// or loading it from a file.
///
/// `GtkIconPaintable` implements `GdkPaintable` and `GtkSymbolicPaintable`.
pub const IconPaintable = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gdk.Paintable, gtk.SymbolicPaintable };
    pub const Class = gtk.IconPaintableClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The file representing the icon, if any.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?*gio.File;
        };

        /// The icon name that was chosen during lookup.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the icon is symbolic or not.
        pub const is_symbolic = struct {
            pub const name = "is-symbolic";

            pub const Type = c_int;
        };

        pub const scale = struct {
            pub const name = "scale";

            pub const Type = c_int;
        };

        pub const size = struct {
            pub const name = "size";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkIconPaintable` for a file with a given size and scale.
    ///
    /// The icon can then be rendered by using it as a `GdkPaintable`.
    extern fn gtk_icon_paintable_new_for_file(p_file: *gio.File, p_size: c_int, p_scale: c_int) *gtk.IconPaintable;
    pub const newForFile = gtk_icon_paintable_new_for_file;

    /// Gets the `GFile` that was used to load the icon.
    ///
    /// Returns `NULL` if the icon was not loaded from a file.
    extern fn gtk_icon_paintable_get_file(p_self: *IconPaintable) ?*gio.File;
    pub const getFile = gtk_icon_paintable_get_file;

    /// Get the icon name being used for this icon.
    ///
    /// When an icon looked up in the icon theme was not available, the
    /// icon theme may use fallback icons - either those specified to
    /// `gtk.IconTheme.lookupIcon` or the always-available
    /// "image-missing". The icon chosen is returned by this function.
    ///
    /// If the icon was created without an icon theme, this function
    /// returns `NULL`.
    extern fn gtk_icon_paintable_get_icon_name(p_self: *IconPaintable) ?[*:0]const u8;
    pub const getIconName = gtk_icon_paintable_get_icon_name;

    /// Checks if the icon is symbolic or not.
    ///
    /// This currently uses only the file name and not the file contents
    /// for determining this. This behaviour may change in the future.
    extern fn gtk_icon_paintable_is_symbolic(p_self: *IconPaintable) c_int;
    pub const isSymbolic = gtk_icon_paintable_is_symbolic;

    extern fn gtk_icon_paintable_get_type() usize;
    pub const getGObjectType = gtk_icon_paintable_get_type;

    extern fn g_object_ref(p_self: *gtk.IconPaintable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.IconPaintable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *IconPaintable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Loads themed icons.
///
/// The main reason for using a name rather than simply providing a filename
/// is to allow different icons to be used depending on what “icon theme” is
/// selected by the user. The operation of icon themes on Linux and Unix
/// follows the [Icon Theme Specification](http://www.freedesktop.org/Standards/icon-theme-spec)
/// There is a fallback icon theme, named `hicolor`, where applications
/// should install their icons, but additional icon themes can be installed
/// as operating system vendors and users choose.
///
/// In many cases, named themes are used indirectly, via `gtk.Image`
/// rather than directly, but looking up icons directly is also simple. The
/// `GtkIconTheme` object acts as a database of all the icons in the current
/// theme. You can create new `GtkIconTheme` objects, but it’s much more
/// efficient to use the standard icon theme of the `GtkWidget` so that the
/// icon information is shared with other people looking up icons.
///
/// ```c
/// GtkIconTheme *icon_theme;
/// GtkIconPaintable *icon;
/// GdkPaintable *paintable;
///
/// icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (my_widget));
/// icon = gtk_icon_theme_lookup_icon (icon_theme,
///                                    "my-icon-name", // icon name
///                                    48, // icon size
///                                    1,  // scale
///                                    0,  // flags);
/// paintable = GDK_PAINTABLE (icon);
/// // Use the paintable
/// g_object_unref (icon);
/// ```
pub const IconTheme = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = IconTheme;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The display that this icon theme object is attached to.
        pub const display = struct {
            pub const name = "display";

            pub const Type = ?*gdk.Display;
        };

        /// The icon names that are supported by the icon theme.
        pub const icon_names = struct {
            pub const name = "icon-names";

            pub const Type = ?[*][*:0]u8;
        };

        /// Resource paths that will be looked at when looking for icons,
        /// similar to search paths.
        ///
        /// The resources are considered as part of the hicolor icon theme
        /// and must be located in subdirectories that are defined in the
        /// hicolor icon theme, such as ``path`/16x16/actions/run.png`.
        /// Icons that are directly placed in the resource path instead
        /// of a subdirectory are also considered as ultimate fallback.
        pub const resource_path = struct {
            pub const name = "resource-path";

            pub const Type = ?[*][*:0]u8;
        };

        /// The search path for this icon theme.
        ///
        /// When looking for icons, GTK will search for a subdirectory of
        /// one or more of the directories in the search path with the same
        /// name as the icon theme containing an index.theme file. (Themes
        /// from multiple of the path elements are combined to allow themes
        /// to be extended by adding icons in the user’s home directory.)
        pub const search_path = struct {
            pub const name = "search-path";

            pub const Type = ?[*][*:0]u8;
        };

        /// The name of the icon theme that is being used.
        ///
        /// Unless set to a different value, this will be the value of
        /// the `GtkSettings:gtk-icon-theme-name` property of the `GtkSettings`
        /// object associated to the display of the icontheme object.
        pub const theme_name = struct {
            pub const name = "theme-name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted when the icon theme changes.
        ///
        /// This can happen because current icon theme is switched or
        /// because GTK detects that a change has occurred in the
        /// contents of the current icon theme.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconTheme, p_instance))),
                    gobject.signalLookup("changed", IconTheme.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Gets the icon theme object associated with `display`.
    ///
    /// If this function has not previously been called for the given
    /// display, a new icon theme object will be created and associated
    /// with the display. Icon theme objects are fairly expensive to create,
    /// so using this function is usually a better choice than calling
    /// `gtk.IconTheme.new` and setting the display yourself; by using
    /// this function a single icon theme object will be shared between users.
    extern fn gtk_icon_theme_get_for_display(p_display: *gdk.Display) *gtk.IconTheme;
    pub const getForDisplay = gtk_icon_theme_get_for_display;

    /// Creates a new icon theme object.
    ///
    /// Icon theme objects are used to lookup up an icon by name
    /// in a particular icon theme. Usually, you’ll want to use
    /// `gtk.IconTheme.getForDisplay` rather than creating
    /// a new icon theme object for scratch.
    extern fn gtk_icon_theme_new() *gtk.IconTheme;
    pub const new = gtk_icon_theme_new;

    /// Adds a resource path that will be looked at when looking
    /// for icons, similar to search paths.
    ///
    /// See `gtk.IconTheme.setResourcePath`.
    ///
    /// This function should be used to make application-specific icons
    /// available as part of the icon theme.
    extern fn gtk_icon_theme_add_resource_path(p_self: *IconTheme, p_path: [*:0]const u8) void;
    pub const addResourcePath = gtk_icon_theme_add_resource_path;

    /// Appends a directory to the search path.
    ///
    /// See `gtk.IconTheme.setSearchPath`.
    extern fn gtk_icon_theme_add_search_path(p_self: *IconTheme, p_path: [*:0]const u8) void;
    pub const addSearchPath = gtk_icon_theme_add_search_path;

    /// Returns the display that the `GtkIconTheme` object was
    /// created for.
    extern fn gtk_icon_theme_get_display(p_self: *IconTheme) ?*gdk.Display;
    pub const getDisplay = gtk_icon_theme_get_display;

    /// Lists the names of icons in the current icon theme.
    extern fn gtk_icon_theme_get_icon_names(p_self: *IconTheme) [*][*:0]u8;
    pub const getIconNames = gtk_icon_theme_get_icon_names;

    /// Returns an array of integers describing the sizes at which
    /// the icon is available without scaling.
    ///
    /// A size of -1 means that the icon is available in a scalable
    /// format. The array is zero-terminated.
    extern fn gtk_icon_theme_get_icon_sizes(p_self: *IconTheme, p_icon_name: [*:0]const u8) [*]c_int;
    pub const getIconSizes = gtk_icon_theme_get_icon_sizes;

    /// Gets the current resource path.
    ///
    /// See `gtk.IconTheme.setResourcePath`.
    extern fn gtk_icon_theme_get_resource_path(p_self: *IconTheme) ?[*][*:0]u8;
    pub const getResourcePath = gtk_icon_theme_get_resource_path;

    /// Gets the current search path.
    ///
    /// See `gtk.IconTheme.setSearchPath`.
    extern fn gtk_icon_theme_get_search_path(p_self: *IconTheme) ?[*][*:0]u8;
    pub const getSearchPath = gtk_icon_theme_get_search_path;

    /// Gets the current icon theme name.
    extern fn gtk_icon_theme_get_theme_name(p_self: *IconTheme) [*:0]u8;
    pub const getThemeName = gtk_icon_theme_get_theme_name;

    /// Checks whether an icon theme includes an icon
    /// for a particular `GIcon`.
    extern fn gtk_icon_theme_has_gicon(p_self: *IconTheme, p_gicon: *gio.Icon) c_int;
    pub const hasGicon = gtk_icon_theme_has_gicon;

    /// Checks whether an icon theme includes an icon
    /// for a particular name.
    extern fn gtk_icon_theme_has_icon(p_self: *IconTheme, p_icon_name: [*:0]const u8) c_int;
    pub const hasIcon = gtk_icon_theme_has_icon;

    /// Looks up a icon for a desired size and window scale.
    ///
    /// The icon can then be rendered by using it as a `GdkPaintable`,
    /// or you can get information such as the filename and size.
    extern fn gtk_icon_theme_lookup_by_gicon(p_self: *IconTheme, p_icon: *gio.Icon, p_size: c_int, p_scale: c_int, p_direction: gtk.TextDirection, p_flags: gtk.IconLookupFlags) *gtk.IconPaintable;
    pub const lookupByGicon = gtk_icon_theme_lookup_by_gicon;

    /// Looks up a named icon for a desired size and window scale,
    /// returning a `GtkIconPaintable`.
    ///
    /// The icon can then be rendered by using it as a `GdkPaintable`,
    /// or you can get information such as the filename and size.
    ///
    /// If the available `icon_name` is not available and `fallbacks` are
    /// provided, they will be tried in order.
    ///
    /// If no matching icon is found, then a paintable that renders the
    /// "missing icon" icon is returned. If you need to do something else
    /// for missing icons you need to use `gtk.IconTheme.hasIcon`.
    ///
    /// Note that you probably want to listen for icon theme changes and
    /// update the icon. This is usually done by overriding the
    /// GtkWidgetClass.css-`changed` function.
    extern fn gtk_icon_theme_lookup_icon(p_self: *IconTheme, p_icon_name: [*:0]const u8, p_fallbacks: ?[*][*:0]const u8, p_size: c_int, p_scale: c_int, p_direction: gtk.TextDirection, p_flags: gtk.IconLookupFlags) *gtk.IconPaintable;
    pub const lookupIcon = gtk_icon_theme_lookup_icon;

    /// Sets the resource paths that will be looked at when
    /// looking for icons, similar to search paths.
    ///
    /// The resources are considered as part of the hicolor icon theme
    /// and must be located in subdirectories that are defined in the
    /// hicolor icon theme, such as ``path`/16x16/actions/run.png`
    /// or ``path`/scalable/actions/run.svg`.
    ///
    /// Icons that are directly placed in the resource path instead
    /// of a subdirectory are also considered as ultimate fallback,
    /// but they are treated like unthemed icons.
    extern fn gtk_icon_theme_set_resource_path(p_self: *IconTheme, p_path: ?[*]const [*:0]const u8) void;
    pub const setResourcePath = gtk_icon_theme_set_resource_path;

    /// Sets the search path for the icon theme object.
    ///
    /// When looking for an icon theme, GTK will search for a subdirectory
    /// of one or more of the directories in `path` with the same name
    /// as the icon theme containing an index.theme file. (Themes from
    /// multiple of the path elements are combined to allow themes to be
    /// extended by adding icons in the user’s home directory.)
    ///
    /// In addition if an icon found isn’t found either in the current
    /// icon theme or the default icon theme, and an image file with
    /// the right name is found directly in one of the elements of
    /// `path`, then that image will be used for the icon name.
    /// (This is legacy feature, and new icons should be put
    /// into the fallback icon theme, which is called hicolor,
    /// rather than directly on the icon path.)
    extern fn gtk_icon_theme_set_search_path(p_self: *IconTheme, p_path: ?[*]const [*:0]const u8) void;
    pub const setSearchPath = gtk_icon_theme_set_search_path;

    /// Sets the name of the icon theme that the `GtkIconTheme` object uses
    /// overriding system configuration.
    ///
    /// This function cannot be called on the icon theme objects returned
    /// from `gtk.IconTheme.getForDisplay`.
    extern fn gtk_icon_theme_set_theme_name(p_self: *IconTheme, p_theme_name: ?[*:0]const u8) void;
    pub const setThemeName = gtk_icon_theme_set_theme_name;

    extern fn gtk_icon_theme_get_type() usize;
    pub const getGObjectType = gtk_icon_theme_get_type;

    extern fn g_object_ref(p_self: *gtk.IconTheme) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.IconTheme) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *IconTheme, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkIconView` is a widget which displays data in a grid of icons.
///
/// <picture>
///   <source srcset="icon-view-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkIconView" src="icon-view.png">
/// </picture>
///
/// `GtkIconView` provides an alternative view on a `GtkTreeModel`.
/// It displays the model as a grid of icons with labels. Like
/// `gtk.TreeView`, it allows to select one or multiple items
/// (depending on the selection mode, see `gtk.IconView.setSelectionMode`).
/// In addition to selection with the arrow keys, `GtkIconView` supports
/// rubberband selection, which is controlled by dragging the pointer.
///
/// Note that if the tree model is backed by an actual tree store (as
/// opposed to a flat list where the mapping to icons is obvious),
/// `GtkIconView` will only display the first level of the tree and
/// ignore the tree’s branches.
///
/// ## CSS nodes
///
/// ```
/// iconview.view
/// ╰── [rubberband]
/// ```
///
/// `GtkIconView` has a single CSS node with name iconview and style class .view.
/// For rubberband selection, a subnode with name rubberband is used.
pub const IconView = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.CellLayout, gtk.ConstraintTarget, gtk.Scrollable };
    pub const Class = opaque {
        pub const Instance = IconView;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The activate-on-single-click property specifies whether the "item-activated" signal
        /// will be emitted after a single click.
        pub const activate_on_single_click = struct {
            pub const name = "activate-on-single-click";

            pub const Type = c_int;
        };

        /// The `GtkCellArea` used to layout cell renderers for this view.
        ///
        /// If no area is specified when creating the icon view with `gtk.IconView.newWithArea`
        /// a `GtkCellAreaBox` will be used.
        pub const cell_area = struct {
            pub const name = "cell-area";

            pub const Type = ?*gtk.CellArea;
        };

        /// The column-spacing property specifies the space which is inserted between
        /// the columns of the icon view.
        pub const column_spacing = struct {
            pub const name = "column-spacing";

            pub const Type = c_int;
        };

        /// The columns property contains the number of the columns in which the
        /// items should be displayed. If it is -1, the number of columns will
        /// be chosen automatically to fill the available area.
        pub const columns = struct {
            pub const name = "columns";

            pub const Type = c_int;
        };

        /// The item-orientation property specifies how the cells (i.e. the icon and
        /// the text) of the item are positioned relative to each other.
        pub const item_orientation = struct {
            pub const name = "item-orientation";

            pub const Type = gtk.Orientation;
        };

        /// The item-padding property specifies the padding around each
        /// of the icon view's item.
        pub const item_padding = struct {
            pub const name = "item-padding";

            pub const Type = c_int;
        };

        /// The item-width property specifies the width to use for each item.
        /// If it is set to -1, the icon view will automatically determine a
        /// suitable item size.
        pub const item_width = struct {
            pub const name = "item-width";

            pub const Type = c_int;
        };

        /// The margin property specifies the space which is inserted
        /// at the edges of the icon view.
        pub const margin = struct {
            pub const name = "margin";

            pub const Type = c_int;
        };

        /// The ::markup-column property contains the number of the model column
        /// containing markup information to be displayed. The markup column must be
        /// of type `G_TYPE_STRING`. If this property and the :text-column property
        /// are both set to column numbers, it overrides the text column.
        /// If both are set to -1, no texts are displayed.
        pub const markup_column = struct {
            pub const name = "markup-column";

            pub const Type = c_int;
        };

        /// The model of the icon view.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };

        /// The ::pixbuf-column property contains the number of the model column
        /// containing the pixbufs which are displayed. The pixbuf column must be
        /// of type `GDK_TYPE_PIXBUF`. Setting this property to -1 turns off the
        /// display of pixbufs.
        pub const pixbuf_column = struct {
            pub const name = "pixbuf-column";

            pub const Type = c_int;
        };

        /// The reorderable property specifies if the items can be reordered
        /// by DND.
        pub const reorderable = struct {
            pub const name = "reorderable";

            pub const Type = c_int;
        };

        /// The row-spacing property specifies the space which is inserted between
        /// the rows of the icon view.
        pub const row_spacing = struct {
            pub const name = "row-spacing";

            pub const Type = c_int;
        };

        /// The ::selection-mode property specifies the selection mode of
        /// icon view. If the mode is `GTK_SELECTION_MULTIPLE`, rubberband selection
        /// is enabled, for the other modes, only keyboard selection is possible.
        pub const selection_mode = struct {
            pub const name = "selection-mode";

            pub const Type = gtk.SelectionMode;
        };

        /// The spacing property specifies the space which is inserted between
        /// the cells (i.e. the icon and the text) of an item.
        pub const spacing = struct {
            pub const name = "spacing";

            pub const Type = c_int;
        };

        /// The ::text-column property contains the number of the model column
        /// containing the texts which are displayed. The text column must be
        /// of type `G_TYPE_STRING`. If this property and the :markup-column
        /// property are both set to -1, no texts are displayed.
        pub const text_column = struct {
            pub const name = "text-column";

            pub const Type = c_int;
        };

        /// The column of the icon view model which is being used for displaying
        /// tooltips on it's rows.
        pub const tooltip_column = struct {
            pub const name = "tooltip-column";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// A [keybinding signal]`gtk.SignalAction`
        /// which gets emitted when the user activates the currently
        /// focused item.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control activation
        /// programmatically.
        ///
        /// The default bindings for this signal are Space, Return and Enter.
        pub const activate_cursor_item = struct {
            pub const name = "activate-cursor-item";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("activate-cursor-item", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::item-activated signal is emitted when the method
        /// `gtk.IconView.itemActivated` is called, when the user double
        /// clicks an item with the "activate-on-single-click" property set
        /// to `FALSE`, or when the user single clicks an item when the
        /// "activate-on-single-click" property set to `TRUE`. It is also
        /// emitted when a non-editable item is selected and one of the keys:
        /// Space, Return or Enter is pressed.
        pub const item_activated = struct {
            pub const name = "item-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("item-activated", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::move-cursor signal is a
        /// [keybinding signal]`gtk.SignalAction`
        /// which gets emitted when the user initiates a cursor movement.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control the cursor
        /// programmatically.
        ///
        /// The default bindings for this signal include
        /// - Arrow keys which move by individual steps
        /// - Home/End keys which move to the first/last item
        /// - PageUp/PageDown which move by "pages"
        /// All of these will extend the selection when combined with
        /// the Shift modifier.
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, p_modify: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("move-cursor", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// A [keybinding signal]`gtk.SignalAction`
        /// which gets emitted when the user selects all items.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control selection
        /// programmatically.
        ///
        /// The default binding for this signal is Ctrl-a.
        pub const select_all = struct {
            pub const name = "select-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("select-all", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// A [keybinding signal]`gtk.SignalAction`
        /// which gets emitted when the user selects the item that is currently
        /// focused.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control selection
        /// programmatically.
        ///
        /// There is no default binding for this signal.
        pub const select_cursor_item = struct {
            pub const name = "select-cursor-item";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("select-cursor-item", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::selection-changed signal is emitted when the selection
        /// (i.e. the set of selected items) changes.
        pub const selection_changed = struct {
            pub const name = "selection-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("selection-changed", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// A [keybinding signal]`gtk.SignalAction`
        /// which gets emitted when the user toggles whether the currently
        /// focused item is selected or not. The exact effect of this
        /// depend on the selection mode.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control selection
        /// programmatically.
        ///
        /// There is no default binding for this signal is Ctrl-Space.
        pub const toggle_cursor_item = struct {
            pub const name = "toggle-cursor-item";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("toggle-cursor-item", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// A [keybinding signal]`gtk.SignalAction`
        /// which gets emitted when the user unselects all items.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control selection
        /// programmatically.
        ///
        /// The default binding for this signal is Ctrl-Shift-a.
        pub const unselect_all = struct {
            pub const name = "unselect-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(IconView, p_instance))),
                    gobject.signalLookup("unselect-all", IconView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkIconView` widget
    extern fn gtk_icon_view_new() *gtk.IconView;
    pub const new = gtk_icon_view_new;

    /// Creates a new `GtkIconView` widget using the
    /// specified `area` to layout cells inside the icons.
    extern fn gtk_icon_view_new_with_area(p_area: *gtk.CellArea) *gtk.IconView;
    pub const newWithArea = gtk_icon_view_new_with_area;

    /// Creates a new `GtkIconView` widget with the model `model`.
    extern fn gtk_icon_view_new_with_model(p_model: *gtk.TreeModel) *gtk.IconView;
    pub const newWithModel = gtk_icon_view_new_with_model;

    /// Creates a `GdkPaintable` representation of the item at `path`.
    /// This image is used for a drag icon.
    extern fn gtk_icon_view_create_drag_icon(p_icon_view: *IconView, p_path: *gtk.TreePath) ?*gdk.Paintable;
    pub const createDragIcon = gtk_icon_view_create_drag_icon;

    /// Turns `icon_view` into a drop destination for automatic DND. Calling this
    /// method sets `GtkIconView`:reorderable to `FALSE`.
    extern fn gtk_icon_view_enable_model_drag_dest(p_icon_view: *IconView, p_formats: *gdk.ContentFormats, p_actions: gdk.DragAction) void;
    pub const enableModelDragDest = gtk_icon_view_enable_model_drag_dest;

    /// Turns `icon_view` into a drag source for automatic DND. Calling this
    /// method sets `GtkIconView`:reorderable to `FALSE`.
    extern fn gtk_icon_view_enable_model_drag_source(p_icon_view: *IconView, p_start_button_mask: gdk.ModifierType, p_formats: *gdk.ContentFormats, p_actions: gdk.DragAction) void;
    pub const enableModelDragSource = gtk_icon_view_enable_model_drag_source;

    /// Gets the setting set by `gtk.IconView.setActivateOnSingleClick`.
    extern fn gtk_icon_view_get_activate_on_single_click(p_icon_view: *IconView) c_int;
    pub const getActivateOnSingleClick = gtk_icon_view_get_activate_on_single_click;

    /// Fills the bounding rectangle in widget coordinates for the cell specified by
    /// `path` and `cell`. If `cell` is `NULL` the main cell area is used.
    ///
    /// This function is only valid if `icon_view` is realized.
    extern fn gtk_icon_view_get_cell_rect(p_icon_view: *IconView, p_path: *gtk.TreePath, p_cell: ?*gtk.CellRenderer, p_rect: *gdk.Rectangle) c_int;
    pub const getCellRect = gtk_icon_view_get_cell_rect;

    /// Returns the value of the ::column-spacing property.
    extern fn gtk_icon_view_get_column_spacing(p_icon_view: *IconView) c_int;
    pub const getColumnSpacing = gtk_icon_view_get_column_spacing;

    /// Returns the value of the ::columns property.
    extern fn gtk_icon_view_get_columns(p_icon_view: *IconView) c_int;
    pub const getColumns = gtk_icon_view_get_columns;

    /// Fills in `path` and `cell` with the current cursor path and cell.
    /// If the cursor isn’t currently set, then *`path` will be `NULL`.
    /// If no cell currently has focus, then *`cell` will be `NULL`.
    ///
    /// The returned `GtkTreePath` must be freed with `gtk.TreePath.free`.
    extern fn gtk_icon_view_get_cursor(p_icon_view: *IconView, p_path: ?**gtk.TreePath, p_cell: ?**gtk.CellRenderer) c_int;
    pub const getCursor = gtk_icon_view_get_cursor;

    /// Determines the destination item for a given position.
    extern fn gtk_icon_view_get_dest_item_at_pos(p_icon_view: *IconView, p_drag_x: c_int, p_drag_y: c_int, p_path: ?**gtk.TreePath, p_pos: ?*gtk.IconViewDropPosition) c_int;
    pub const getDestItemAtPos = gtk_icon_view_get_dest_item_at_pos;

    /// Gets information about the item that is highlighted for feedback.
    extern fn gtk_icon_view_get_drag_dest_item(p_icon_view: *IconView, p_path: ?**gtk.TreePath, p_pos: ?*gtk.IconViewDropPosition) void;
    pub const getDragDestItem = gtk_icon_view_get_drag_dest_item;

    /// Gets the path and cell for the icon at the given position.
    extern fn gtk_icon_view_get_item_at_pos(p_icon_view: *IconView, p_x: c_int, p_y: c_int, p_path: ?**gtk.TreePath, p_cell: ?**gtk.CellRenderer) c_int;
    pub const getItemAtPos = gtk_icon_view_get_item_at_pos;

    /// Gets the column in which the item `path` is currently
    /// displayed. Column numbers start at 0.
    extern fn gtk_icon_view_get_item_column(p_icon_view: *IconView, p_path: *gtk.TreePath) c_int;
    pub const getItemColumn = gtk_icon_view_get_item_column;

    /// Returns the value of the ::item-orientation property which determines
    /// whether the labels are drawn beside the icons instead of below.
    extern fn gtk_icon_view_get_item_orientation(p_icon_view: *IconView) gtk.Orientation;
    pub const getItemOrientation = gtk_icon_view_get_item_orientation;

    /// Returns the value of the ::item-padding property.
    extern fn gtk_icon_view_get_item_padding(p_icon_view: *IconView) c_int;
    pub const getItemPadding = gtk_icon_view_get_item_padding;

    /// Gets the row in which the item `path` is currently
    /// displayed. Row numbers start at 0.
    extern fn gtk_icon_view_get_item_row(p_icon_view: *IconView, p_path: *gtk.TreePath) c_int;
    pub const getItemRow = gtk_icon_view_get_item_row;

    /// Returns the value of the ::item-width property.
    extern fn gtk_icon_view_get_item_width(p_icon_view: *IconView) c_int;
    pub const getItemWidth = gtk_icon_view_get_item_width;

    /// Returns the value of the ::margin property.
    extern fn gtk_icon_view_get_margin(p_icon_view: *IconView) c_int;
    pub const getMargin = gtk_icon_view_get_margin;

    /// Returns the column with markup text for `icon_view`.
    extern fn gtk_icon_view_get_markup_column(p_icon_view: *IconView) c_int;
    pub const getMarkupColumn = gtk_icon_view_get_markup_column;

    /// Returns the model the `GtkIconView` is based on.  Returns `NULL` if the
    /// model is unset.
    extern fn gtk_icon_view_get_model(p_icon_view: *IconView) ?*gtk.TreeModel;
    pub const getModel = gtk_icon_view_get_model;

    /// Gets the path for the icon at the given position.
    extern fn gtk_icon_view_get_path_at_pos(p_icon_view: *IconView, p_x: c_int, p_y: c_int) ?*gtk.TreePath;
    pub const getPathAtPos = gtk_icon_view_get_path_at_pos;

    /// Returns the column with pixbufs for `icon_view`.
    extern fn gtk_icon_view_get_pixbuf_column(p_icon_view: *IconView) c_int;
    pub const getPixbufColumn = gtk_icon_view_get_pixbuf_column;

    /// Retrieves whether the user can reorder the list via drag-and-drop.
    /// See `gtk.IconView.setReorderable`.
    extern fn gtk_icon_view_get_reorderable(p_icon_view: *IconView) c_int;
    pub const getReorderable = gtk_icon_view_get_reorderable;

    /// Returns the value of the ::row-spacing property.
    extern fn gtk_icon_view_get_row_spacing(p_icon_view: *IconView) c_int;
    pub const getRowSpacing = gtk_icon_view_get_row_spacing;

    /// Creates a list of paths of all selected items. Additionally, if you are
    /// planning on modifying the model after calling this function, you may
    /// want to convert the returned list into a list of `GtkTreeRowReferences`.
    /// To do this, you can use `gtk.TreeRowReference.new`.
    ///
    /// To free the return value, use `g_list_free_full`:
    ///
    /// ```c
    /// GtkWidget *icon_view = gtk_icon_view_new ();
    /// // Use icon_view
    ///
    /// GList *list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (icon_view));
    ///
    /// // use list
    ///
    /// g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
    /// ```
    extern fn gtk_icon_view_get_selected_items(p_icon_view: *IconView) *glib.List;
    pub const getSelectedItems = gtk_icon_view_get_selected_items;

    /// Gets the selection mode of the `icon_view`.
    extern fn gtk_icon_view_get_selection_mode(p_icon_view: *IconView) gtk.SelectionMode;
    pub const getSelectionMode = gtk_icon_view_get_selection_mode;

    /// Returns the value of the ::spacing property.
    extern fn gtk_icon_view_get_spacing(p_icon_view: *IconView) c_int;
    pub const getSpacing = gtk_icon_view_get_spacing;

    /// Returns the column with text for `icon_view`.
    extern fn gtk_icon_view_get_text_column(p_icon_view: *IconView) c_int;
    pub const getTextColumn = gtk_icon_view_get_text_column;

    /// Returns the column of `icon_view`’s model which is being used for
    /// displaying tooltips on `icon_view`’s rows.
    extern fn gtk_icon_view_get_tooltip_column(p_icon_view: *IconView) c_int;
    pub const getTooltipColumn = gtk_icon_view_get_tooltip_column;

    /// This function is supposed to be used in a `GtkWidget::query-tooltip`
    /// signal handler for `GtkIconView`. The `x`, `y` and `keyboard_tip` values
    /// which are received in the signal handler, should be passed to this
    /// function without modification.
    ///
    /// The return value indicates whether there is an icon view item at the given
    /// coordinates (`TRUE`) or not (`FALSE`) for mouse tooltips. For keyboard
    /// tooltips the item returned will be the cursor item. When `TRUE`, then any of
    /// `model`, `path` and `iter` which have been provided will be set to point to
    /// that row and the corresponding model.
    extern fn gtk_icon_view_get_tooltip_context(p_icon_view: *IconView, p_x: c_int, p_y: c_int, p_keyboard_tip: c_int, p_model: ?**gtk.TreeModel, p_path: ?**gtk.TreePath, p_iter: ?*gtk.TreeIter) c_int;
    pub const getTooltipContext = gtk_icon_view_get_tooltip_context;

    /// Sets `start_path` and `end_path` to be the first and last visible path.
    /// Note that there may be invisible paths in between.
    ///
    /// Both paths should be freed with `gtk.TreePath.free` after use.
    extern fn gtk_icon_view_get_visible_range(p_icon_view: *IconView, p_start_path: ?**gtk.TreePath, p_end_path: ?**gtk.TreePath) c_int;
    pub const getVisibleRange = gtk_icon_view_get_visible_range;

    /// Activates the item determined by `path`.
    extern fn gtk_icon_view_item_activated(p_icon_view: *IconView, p_path: *gtk.TreePath) void;
    pub const itemActivated = gtk_icon_view_item_activated;

    /// Returns `TRUE` if the icon pointed to by `path` is currently
    /// selected. If `path` does not point to a valid location, `FALSE` is returned.
    extern fn gtk_icon_view_path_is_selected(p_icon_view: *IconView, p_path: *gtk.TreePath) c_int;
    pub const pathIsSelected = gtk_icon_view_path_is_selected;

    /// Moves the alignments of `icon_view` to the position specified by `path`.
    /// `row_align` determines where the row is placed, and `col_align` determines
    /// where `column` is placed.  Both are expected to be between 0.0 and 1.0.
    /// 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means
    /// center.
    ///
    /// If `use_align` is `FALSE`, then the alignment arguments are ignored, and the
    /// tree does the minimum amount of work to scroll the item onto the screen.
    /// This means that the item will be scrolled to the edge closest to its current
    /// position.  If the item is currently visible on the screen, nothing is done.
    ///
    /// This function only works if the model is set, and `path` is a valid row on
    /// the model. If the model changes before the `icon_view` is realized, the
    /// centered path will be modified to reflect this change.
    extern fn gtk_icon_view_scroll_to_path(p_icon_view: *IconView, p_path: *gtk.TreePath, p_use_align: c_int, p_row_align: f32, p_col_align: f32) void;
    pub const scrollToPath = gtk_icon_view_scroll_to_path;

    /// Selects all the icons. `icon_view` must has its selection mode set
    /// to `GTK_SELECTION_MULTIPLE`.
    extern fn gtk_icon_view_select_all(p_icon_view: *IconView) void;
    pub const selectAll = gtk_icon_view_select_all;

    /// Selects the row at `path`.
    extern fn gtk_icon_view_select_path(p_icon_view: *IconView, p_path: *gtk.TreePath) void;
    pub const selectPath = gtk_icon_view_select_path;

    /// Calls a function for each selected icon. Note that the model or
    /// selection cannot be modified from within this function.
    extern fn gtk_icon_view_selected_foreach(p_icon_view: *IconView, p_func: gtk.IconViewForeachFunc, p_data: ?*anyopaque) void;
    pub const selectedForeach = gtk_icon_view_selected_foreach;

    /// Causes the `GtkIconView`::item-activated signal to be emitted on
    /// a single click instead of a double click.
    extern fn gtk_icon_view_set_activate_on_single_click(p_icon_view: *IconView, p_single: c_int) void;
    pub const setActivateOnSingleClick = gtk_icon_view_set_activate_on_single_click;

    /// Sets the ::column-spacing property which specifies the space
    /// which is inserted between the columns of the icon view.
    extern fn gtk_icon_view_set_column_spacing(p_icon_view: *IconView, p_column_spacing: c_int) void;
    pub const setColumnSpacing = gtk_icon_view_set_column_spacing;

    /// Sets the ::columns property which determines in how
    /// many columns the icons are arranged. If `columns` is
    /// -1, the number of columns will be chosen automatically
    /// to fill the available area.
    extern fn gtk_icon_view_set_columns(p_icon_view: *IconView, p_columns: c_int) void;
    pub const setColumns = gtk_icon_view_set_columns;

    /// Sets the current keyboard focus to be at `path`, and selects it.  This is
    /// useful when you want to focus the user’s attention on a particular item.
    /// If `cell` is not `NULL`, then focus is given to the cell specified by
    /// it. Additionally, if `start_editing` is `TRUE`, then editing should be
    /// started in the specified cell.
    ///
    /// This function is often followed by `gtk_widget_grab_focus
    /// (icon_view)` in order to give keyboard focus to the widget.
    /// Please note that editing can only happen when the widget is realized.
    extern fn gtk_icon_view_set_cursor(p_icon_view: *IconView, p_path: *gtk.TreePath, p_cell: ?*gtk.CellRenderer, p_start_editing: c_int) void;
    pub const setCursor = gtk_icon_view_set_cursor;

    /// Sets the item that is highlighted for feedback.
    extern fn gtk_icon_view_set_drag_dest_item(p_icon_view: *IconView, p_path: ?*gtk.TreePath, p_pos: gtk.IconViewDropPosition) void;
    pub const setDragDestItem = gtk_icon_view_set_drag_dest_item;

    /// Sets the ::item-orientation property which determines whether the labels
    /// are drawn beside the icons instead of below.
    extern fn gtk_icon_view_set_item_orientation(p_icon_view: *IconView, p_orientation: gtk.Orientation) void;
    pub const setItemOrientation = gtk_icon_view_set_item_orientation;

    /// Sets the `GtkIconView`:item-padding property which specifies the padding
    /// around each of the icon view’s items.
    extern fn gtk_icon_view_set_item_padding(p_icon_view: *IconView, p_item_padding: c_int) void;
    pub const setItemPadding = gtk_icon_view_set_item_padding;

    /// Sets the ::item-width property which specifies the width
    /// to use for each item. If it is set to -1, the icon view will
    /// automatically determine a suitable item size.
    extern fn gtk_icon_view_set_item_width(p_icon_view: *IconView, p_item_width: c_int) void;
    pub const setItemWidth = gtk_icon_view_set_item_width;

    /// Sets the ::margin property which specifies the space
    /// which is inserted at the top, bottom, left and right
    /// of the icon view.
    extern fn gtk_icon_view_set_margin(p_icon_view: *IconView, p_margin: c_int) void;
    pub const setMargin = gtk_icon_view_set_margin;

    /// Sets the column with markup information for `icon_view` to be
    /// `column`. The markup column must be of type `G_TYPE_STRING`.
    /// If the markup column is set to something, it overrides
    /// the text column set by `gtk.IconView.setTextColumn`.
    extern fn gtk_icon_view_set_markup_column(p_icon_view: *IconView, p_column: c_int) void;
    pub const setMarkupColumn = gtk_icon_view_set_markup_column;

    /// Sets the model for a `GtkIconView`.
    /// If the `icon_view` already has a model set, it will remove
    /// it before setting the new model.  If `model` is `NULL`, then
    /// it will unset the old model.
    extern fn gtk_icon_view_set_model(p_icon_view: *IconView, p_model: ?*gtk.TreeModel) void;
    pub const setModel = gtk_icon_view_set_model;

    /// Sets the column with pixbufs for `icon_view` to be `column`. The pixbuf
    /// column must be of type `GDK_TYPE_PIXBUF`
    extern fn gtk_icon_view_set_pixbuf_column(p_icon_view: *IconView, p_column: c_int) void;
    pub const setPixbufColumn = gtk_icon_view_set_pixbuf_column;

    /// This function is a convenience function to allow you to reorder models that
    /// support the `GtkTreeDragSourceIface` and the `GtkTreeDragDestIface`. Both
    /// `GtkTreeStore` and `GtkListStore` support these. If `reorderable` is `TRUE`, then
    /// the user can reorder the model by dragging and dropping rows.  The
    /// developer can listen to these changes by connecting to the model's
    /// row_inserted and row_deleted signals. The reordering is implemented by setting up
    /// the icon view as a drag source and destination. Therefore, drag and
    /// drop can not be used in a reorderable view for any other purpose.
    ///
    /// This function does not give you any degree of control over the order -- any
    /// reordering is allowed.  If more control is needed, you should probably
    /// handle drag and drop manually.
    extern fn gtk_icon_view_set_reorderable(p_icon_view: *IconView, p_reorderable: c_int) void;
    pub const setReorderable = gtk_icon_view_set_reorderable;

    /// Sets the ::row-spacing property which specifies the space
    /// which is inserted between the rows of the icon view.
    extern fn gtk_icon_view_set_row_spacing(p_icon_view: *IconView, p_row_spacing: c_int) void;
    pub const setRowSpacing = gtk_icon_view_set_row_spacing;

    /// Sets the selection mode of the `icon_view`.
    extern fn gtk_icon_view_set_selection_mode(p_icon_view: *IconView, p_mode: gtk.SelectionMode) void;
    pub const setSelectionMode = gtk_icon_view_set_selection_mode;

    /// Sets the ::spacing property which specifies the space
    /// which is inserted between the cells (i.e. the icon and
    /// the text) of an item.
    extern fn gtk_icon_view_set_spacing(p_icon_view: *IconView, p_spacing: c_int) void;
    pub const setSpacing = gtk_icon_view_set_spacing;

    /// Sets the column with text for `icon_view` to be `column`. The text
    /// column must be of type `G_TYPE_STRING`.
    extern fn gtk_icon_view_set_text_column(p_icon_view: *IconView, p_column: c_int) void;
    pub const setTextColumn = gtk_icon_view_set_text_column;

    /// Sets the tip area of `tooltip` to the area which `cell` occupies in
    /// the item pointed to by `path`. See also `gtk.Tooltip.setTipArea`.
    ///
    /// See also `gtk.IconView.setTooltipColumn` for a simpler alternative.
    extern fn gtk_icon_view_set_tooltip_cell(p_icon_view: *IconView, p_tooltip: *gtk.Tooltip, p_path: *gtk.TreePath, p_cell: ?*gtk.CellRenderer) void;
    pub const setTooltipCell = gtk_icon_view_set_tooltip_cell;

    /// If you only plan to have simple (text-only) tooltips on full items, you
    /// can use this function to have `GtkIconView` handle these automatically
    /// for you. `column` should be set to the column in `icon_view`’s model
    /// containing the tooltip texts, or -1 to disable this feature.
    ///
    /// When enabled, `GtkWidget:has-tooltip` will be set to `TRUE` and
    /// `icon_view` will connect a `GtkWidget::query-tooltip` signal handler.
    ///
    /// Note that the signal handler sets the text with `gtk.Tooltip.setMarkup`,
    /// so &, <, etc have to be escaped in the text.
    extern fn gtk_icon_view_set_tooltip_column(p_icon_view: *IconView, p_column: c_int) void;
    pub const setTooltipColumn = gtk_icon_view_set_tooltip_column;

    /// Sets the tip area of `tooltip` to be the area covered by the item at `path`.
    /// See also `gtk.IconView.setTooltipColumn` for a simpler alternative.
    /// See also `gtk.Tooltip.setTipArea`.
    extern fn gtk_icon_view_set_tooltip_item(p_icon_view: *IconView, p_tooltip: *gtk.Tooltip, p_path: *gtk.TreePath) void;
    pub const setTooltipItem = gtk_icon_view_set_tooltip_item;

    /// Unselects all the icons.
    extern fn gtk_icon_view_unselect_all(p_icon_view: *IconView) void;
    pub const unselectAll = gtk_icon_view_unselect_all;

    /// Unselects the row at `path`.
    extern fn gtk_icon_view_unselect_path(p_icon_view: *IconView, p_path: *gtk.TreePath) void;
    pub const unselectPath = gtk_icon_view_unselect_path;

    /// Undoes the effect of `gtk.IconView.enableModelDragDest`. Calling this
    /// method sets `GtkIconView`:reorderable to `FALSE`.
    extern fn gtk_icon_view_unset_model_drag_dest(p_icon_view: *IconView) void;
    pub const unsetModelDragDest = gtk_icon_view_unset_model_drag_dest;

    /// Undoes the effect of `gtk.IconView.enableModelDragSource`. Calling this
    /// method sets `GtkIconView`:reorderable to `FALSE`.
    extern fn gtk_icon_view_unset_model_drag_source(p_icon_view: *IconView) void;
    pub const unsetModelDragSource = gtk_icon_view_unset_model_drag_source;

    extern fn gtk_icon_view_get_type() usize;
    pub const getGObjectType = gtk_icon_view_get_type;

    extern fn g_object_ref(p_self: *gtk.IconView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.IconView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *IconView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays an image.
///
/// <picture>
///   <source srcset="image-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkImage" src="image.png">
/// </picture>
///
/// Various kinds of object can be displayed as an image; most typically,
/// you would load a `GdkTexture` from a file, using the convenience function
/// `gtk.Image.newFromFile`, for instance:
///
/// ```c
/// GtkWidget *image = gtk_image_new_from_file ("myfile.png");
/// ```
///
/// If the file isn’t loaded successfully, the image will contain a
/// “broken image” icon similar to that used in many web browsers.
///
/// If you want to handle errors in loading the file yourself, for example
/// by displaying an error message, then load the image with an image
/// loading framework such as libglycin, then create the `GtkImage` with
/// `gtk.Image.newFromPaintable`.
///
/// Sometimes an application will want to avoid depending on external data
/// files, such as image files. See the documentation of `GResource` inside
/// GIO, for details. In this case, `gtk.Image.properties.resource`,
/// `gtk.Image.newFromResource`, and `gtk.Image.setFromResource`
/// should be used.
///
/// `GtkImage` displays its image as an icon, with a size that is determined
/// by the application. See `gtk.Picture` if you want to show an image
/// at is actual size.
///
/// ## CSS nodes
///
/// `GtkImage` has a single CSS node with the name `image`. The style classes
/// `.normal-icons` or `.large-icons` may appear, depending on the
/// `gtk.Image.properties.icon_size` property.
///
/// ## Accessibility
///
/// `GtkImage` uses the `gtk.@"AccessibleRole.img"` role.
pub const Image = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Image;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// A path to the file to display.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?[*:0]u8;
        };

        /// The `GIcon` displayed in the GtkImage.
        ///
        /// For themed icons, If the icon theme is changed, the image will be updated
        /// automatically.
        pub const gicon = struct {
            pub const name = "gicon";

            pub const Type = ?*gio.Icon;
        };

        /// The name of the icon in the icon theme.
        ///
        /// If the icon theme is changed, the image will be updated automatically.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// The symbolic size to display icons at.
        pub const icon_size = struct {
            pub const name = "icon-size";

            pub const Type = gtk.IconSize;
        };

        /// The `GdkPaintable` to display.
        pub const paintable = struct {
            pub const name = "paintable";

            pub const Type = ?*gdk.Paintable;
        };

        /// The size in pixels to display icons at.
        ///
        /// If set to a value != -1, this property overrides the
        /// `gtk.Image.properties.icon_size` property for images of type
        /// `GTK_IMAGE_ICON_NAME`.
        pub const pixel_size = struct {
            pub const name = "pixel-size";

            pub const Type = c_int;
        };

        /// A path to a resource file to display.
        pub const resource = struct {
            pub const name = "resource";

            pub const Type = ?[*:0]u8;
        };

        /// The representation being used for image data.
        pub const storage_type = struct {
            pub const name = "storage-type";

            pub const Type = gtk.ImageType;
        };

        /// Whether the icon displayed in the `GtkImage` will use
        /// standard icon names fallback.
        ///
        /// The value of this property is only relevant for images of type
        /// `GTK_IMAGE_ICON_NAME` and `GTK_IMAGE_GICON`.
        pub const use_fallback = struct {
            pub const name = "use-fallback";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new empty `GtkImage` widget.
    extern fn gtk_image_new() *gtk.Image;
    pub const new = gtk_image_new;

    /// Creates a new `GtkImage` displaying the file `filename`.
    ///
    /// If the file isn’t found or can’t be loaded, the resulting `GtkImage`
    /// will display a “broken image” icon. This function never returns `NULL`,
    /// it always returns a valid `GtkImage` widget.
    ///
    /// If you need to detect failures to load the file, use an
    /// image loading framework such as libglycin to load the file
    /// yourself, then create the `GtkImage` from the texture.
    ///
    /// The storage type (see `gtk.Image.getStorageType`)
    /// of the returned image is not defined, it will be whatever
    /// is appropriate for displaying the file.
    extern fn gtk_image_new_from_file(p_filename: [*:0]const u8) *gtk.Image;
    pub const newFromFile = gtk_image_new_from_file;

    /// Creates a `GtkImage` displaying an icon from the current icon theme.
    ///
    /// If the icon name isn’t known, a “broken image” icon will be
    /// displayed instead. If the current icon theme is changed, the icon
    /// will be updated appropriately.
    extern fn gtk_image_new_from_gicon(p_icon: *gio.Icon) *gtk.Image;
    pub const newFromGicon = gtk_image_new_from_gicon;

    /// Creates a `GtkImage` displaying an icon from the current icon theme.
    ///
    /// If the icon name isn’t known, a “broken image” icon will be
    /// displayed instead. If the current icon theme is changed, the icon
    /// will be updated appropriately.
    extern fn gtk_image_new_from_icon_name(p_icon_name: ?[*:0]const u8) *gtk.Image;
    pub const newFromIconName = gtk_image_new_from_icon_name;

    /// Creates a new `GtkImage` displaying `paintable`.
    ///
    /// The `GtkImage` does not assume a reference to the paintable; you still
    /// need to unref it if you own references. `GtkImage` will add its own
    /// reference rather than adopting yours.
    ///
    /// The `GtkImage` will track changes to the `paintable` and update
    /// its size and contents in response to it.
    ///
    /// Note that paintables are still subject to the icon size that is
    /// set on the image. If you want to display a paintable at its intrinsic
    /// size, use `gtk.Picture` instead.
    ///
    /// If `paintable` is a `gtk.SymbolicPaintable`, then it will be
    /// recolored with the symbolic palette from the theme.
    extern fn gtk_image_new_from_paintable(p_paintable: ?*gdk.Paintable) *gtk.Image;
    pub const newFromPaintable = gtk_image_new_from_paintable;

    /// Creates a new `GtkImage` displaying `pixbuf`.
    ///
    /// The `GtkImage` does not assume a reference to the pixbuf; you still
    /// need to unref it if you own references. `GtkImage` will add its own
    /// reference rather than adopting yours.
    ///
    /// This is a helper for `gtk.Image.newFromPaintable`, and you can't
    /// get back the exact pixbuf once this is called, only a texture.
    ///
    /// Note that this function just creates an `GtkImage` from the pixbuf.
    /// The `GtkImage` created will not react to state changes. Should you
    /// want that, you should use `gtk.Image.newFromIconName`.
    extern fn gtk_image_new_from_pixbuf(p_pixbuf: ?*gdkpixbuf.Pixbuf) *gtk.Image;
    pub const newFromPixbuf = gtk_image_new_from_pixbuf;

    /// Creates a new `GtkImage` displaying the resource file `resource_path`.
    ///
    /// If the file isn’t found or can’t be loaded, the resulting `GtkImage` will
    /// display a “broken image” icon. This function never returns `NULL`,
    /// it always returns a valid `GtkImage` widget.
    ///
    /// If you need to detect failures to load the file, use an
    /// image loading framework such as libglycin to load the file
    /// yourself, then create the `GtkImage` from the texture.
    ///
    /// The storage type (see `gtk.Image.getStorageType`) of
    /// the returned image is not defined, it will be whatever is
    /// appropriate for displaying the file.
    extern fn gtk_image_new_from_resource(p_resource_path: [*:0]const u8) *gtk.Image;
    pub const newFromResource = gtk_image_new_from_resource;

    /// Resets the image to be empty.
    extern fn gtk_image_clear(p_image: *Image) void;
    pub const clear = gtk_image_clear;

    /// Gets the `GIcon` being displayed by the `GtkImage`.
    ///
    /// The storage type of the image must be `GTK_IMAGE_EMPTY` or
    /// `GTK_IMAGE_GICON` (see `gtk.Image.getStorageType`).
    /// The caller of this function does not own a reference to the
    /// returned `GIcon`.
    extern fn gtk_image_get_gicon(p_image: *Image) ?*gio.Icon;
    pub const getGicon = gtk_image_get_gicon;

    /// Gets the icon name and size being displayed by the `GtkImage`.
    ///
    /// The storage type of the image must be `GTK_IMAGE_EMPTY` or
    /// `GTK_IMAGE_ICON_NAME` (see `gtk.Image.getStorageType`).
    /// The returned string is owned by the `GtkImage` and should not
    /// be freed.
    extern fn gtk_image_get_icon_name(p_image: *Image) ?[*:0]const u8;
    pub const getIconName = gtk_image_get_icon_name;

    /// Gets the icon size used by the `image` when rendering icons.
    extern fn gtk_image_get_icon_size(p_image: *Image) gtk.IconSize;
    pub const getIconSize = gtk_image_get_icon_size;

    /// Gets the image `GdkPaintable` being displayed by the `GtkImage`.
    ///
    /// The storage type of the image must be `GTK_IMAGE_EMPTY` or
    /// `GTK_IMAGE_PAINTABLE` (see `gtk.Image.getStorageType`).
    /// The caller of this function does not own a reference to the
    /// returned paintable.
    extern fn gtk_image_get_paintable(p_image: *Image) ?*gdk.Paintable;
    pub const getPaintable = gtk_image_get_paintable;

    /// Gets the pixel size used for named icons.
    extern fn gtk_image_get_pixel_size(p_image: *Image) c_int;
    pub const getPixelSize = gtk_image_get_pixel_size;

    /// Gets the type of representation being used by the `GtkImage`
    /// to store image data.
    ///
    /// If the `GtkImage` has no image data, the return value will
    /// be `GTK_IMAGE_EMPTY`.
    extern fn gtk_image_get_storage_type(p_image: *Image) gtk.ImageType;
    pub const getStorageType = gtk_image_get_storage_type;

    /// Sets a `GtkImage` to show a file.
    ///
    /// See `gtk.Image.newFromFile` for details.
    ///
    /// ::: warning
    ///     Note that this function should not be used with untrusted data.
    ///     Use a proper image loading framework such as libglycin, which can
    ///     load many image formats into a `GdkTexture`, and then use
    ///     `gtk.Image.setFromPaintable`.
    extern fn gtk_image_set_from_file(p_image: *Image, p_filename: ?[*:0]const u8) void;
    pub const setFromFile = gtk_image_set_from_file;

    /// Sets a `GtkImage` to show a `GIcon`.
    ///
    /// See `gtk.Image.newFromGicon` for details.
    extern fn gtk_image_set_from_gicon(p_image: *Image, p_icon: *gio.Icon) void;
    pub const setFromGicon = gtk_image_set_from_gicon;

    /// Sets a `GtkImage` to show a named icon.
    ///
    /// See `gtk.Image.newFromIconName` for details.
    extern fn gtk_image_set_from_icon_name(p_image: *Image, p_icon_name: ?[*:0]const u8) void;
    pub const setFromIconName = gtk_image_set_from_icon_name;

    /// Sets a `GtkImage` to show a `GdkPaintable`.
    ///
    /// See `gtk.Image.newFromPaintable` for details.
    extern fn gtk_image_set_from_paintable(p_image: *Image, p_paintable: ?*gdk.Paintable) void;
    pub const setFromPaintable = gtk_image_set_from_paintable;

    /// Sets a `GtkImage` to show a `GdkPixbuf`.
    ///
    /// See `gtk.Image.newFromPixbuf` for details.
    ///
    /// Note: This is a helper for `gtk.Image.setFromPaintable`,
    /// and you can't get back the exact pixbuf once this is called,
    /// only a paintable.
    extern fn gtk_image_set_from_pixbuf(p_image: *Image, p_pixbuf: ?*gdkpixbuf.Pixbuf) void;
    pub const setFromPixbuf = gtk_image_set_from_pixbuf;

    /// Sets a `GtkImage` to show a resource.
    ///
    /// See `gtk.Image.newFromResource` for details.
    extern fn gtk_image_set_from_resource(p_image: *Image, p_resource_path: ?[*:0]const u8) void;
    pub const setFromResource = gtk_image_set_from_resource;

    /// Suggests an icon size to the theme for named icons.
    extern fn gtk_image_set_icon_size(p_image: *Image, p_icon_size: gtk.IconSize) void;
    pub const setIconSize = gtk_image_set_icon_size;

    /// Sets the pixel size to use for named icons.
    ///
    /// If the pixel size is set to a value != -1, it is used instead
    /// of the icon size set by `gtk.Image.setIconSize`.
    extern fn gtk_image_set_pixel_size(p_image: *Image, p_pixel_size: c_int) void;
    pub const setPixelSize = gtk_image_set_pixel_size;

    extern fn gtk_image_get_type() usize;
    pub const getGObjectType = gtk_image_get_type;

    extern fn g_object_ref(p_self: *gtk.Image) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Image) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Image, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkInfoBar` can be used to show messages to the user without a dialog.
///
/// <picture>
///   <source srcset="info-bar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkInfoBar" src="info-bar.png">
/// </picture>
///
/// It is often temporarily shown at the top or bottom of a document.
/// In contrast to `gtk.Dialog`, which has an action area at the
/// bottom, `GtkInfoBar` has an action area at the side.
///
/// The API of `GtkInfoBar` is very similar to `GtkDialog`, allowing you
/// to add buttons to the action area with `gtk.InfoBar.addButton`
/// or `gtk.InfoBar.newWithButtons`. The sensitivity of action widgets
/// can be controlled with `gtk.InfoBar.setResponseSensitive`.
///
/// To add widgets to the main content area of a `GtkInfoBar`, use
/// `gtk.InfoBar.addChild`.
///
/// Similar to `gtk.MessageDialog`, the contents of a `GtkInfoBar`
/// can by classified as error message, warning, informational message, etc,
/// by using `gtk.InfoBar.setMessageType`. GTK may use the message
/// type to determine how the message is displayed.
///
/// A simple example for using a `GtkInfoBar`:
/// ```c
/// GtkWidget *message_label;
/// GtkWidget *widget;
/// GtkWidget *grid;
/// GtkInfoBar *bar;
///
/// // set up info bar
/// widget = gtk_info_bar_new ();
/// bar = GTK_INFO_BAR (widget);
/// grid = gtk_grid_new ();
///
/// message_label = gtk_label_new ("");
/// gtk_info_bar_add_child (bar, message_label);
/// gtk_info_bar_add_button (bar,
///                          _("_OK"),
///                          GTK_RESPONSE_OK);
/// g_signal_connect (bar,
///                   "response",
///                   G_CALLBACK (gtk_widget_hide),
///                   NULL);
/// gtk_grid_attach (GTK_GRID (grid),
///                  widget,
///                  0, 2, 1, 1);
///
/// // ...
///
/// // show an error message
/// gtk_label_set_text (GTK_LABEL (message_label), "An error occurred!");
/// gtk_info_bar_set_message_type (bar, GTK_MESSAGE_ERROR);
/// gtk_widget_show (bar);
/// ```
///
/// # GtkInfoBar as GtkBuildable
///
/// `GtkInfoBar` supports a custom `<action-widgets>` element, which can contain
/// multiple `<action-widget>` elements. The “response” attribute specifies a
/// numeric response, and the content of the element is the id of widget
/// (which should be a child of the dialogs `action_area`).
///
/// `GtkInfoBar` supports adding action widgets by specifying “action” as
/// the “type” attribute of a `<child>` element. The widget will be added
/// either to the action area. The response id has to be associated
/// with the action widget using the `<action-widgets>` element.
///
/// # CSS nodes
///
/// `GtkInfoBar` has a single CSS node with name infobar. The node may get
/// one of the style classes .info, .warning, .error or .question, depending
/// on the message type.
/// If the info bar shows a close button, that button will have the .close
/// style class applied.
pub const InfoBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = InfoBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of the message.
        ///
        /// The type may be used to determine the appearance of the info bar.
        pub const message_type = struct {
            pub const name = "message-type";

            pub const Type = gtk.MessageType;
        };

        /// Whether the info bar shows its contents.
        pub const revealed = struct {
            pub const name = "revealed";

            pub const Type = c_int;
        };

        /// Whether to include a standard close button.
        pub const show_close_button = struct {
            pub const name = "show-close-button";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Gets emitted when the user uses a keybinding to dismiss the info bar.
        ///
        /// The ::close signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is the Escape key.
        pub const close = struct {
            pub const name = "close";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(InfoBar, p_instance))),
                    gobject.signalLookup("close", InfoBar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when an action widget is clicked.
        ///
        /// The signal is also emitted when the application programmer
        /// calls `gtk.InfoBar.response`. The `response_id` depends
        /// on which action widget was clicked.
        pub const response = struct {
            pub const name = "response";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_response_id: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(InfoBar, p_instance))),
                    gobject.signalLookup("response", InfoBar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkInfoBar` object.
    extern fn gtk_info_bar_new() *gtk.InfoBar;
    pub const new = gtk_info_bar_new;

    /// Creates a new `GtkInfoBar` with buttons.
    ///
    /// Button text/response ID pairs should be listed, with a `NULL` pointer
    /// ending the list. A response ID can be any positive number,
    /// or one of the values in the `GtkResponseType` enumeration. If the
    /// user clicks one of these dialog buttons, GtkInfoBar will emit
    /// the `gtk.InfoBar.signals.response` signal with the corresponding
    /// response ID.
    extern fn gtk_info_bar_new_with_buttons(p_first_button_text: ?[*:0]const u8, ...) *gtk.InfoBar;
    pub const newWithButtons = gtk_info_bar_new_with_buttons;

    /// Add an activatable widget to the action area of a `GtkInfoBar`.
    ///
    /// This also connects a signal handler that will emit the
    /// `gtk.InfoBar.signals.response` signal on the message area
    /// when the widget is activated. The widget is appended to the
    /// end of the message areas action area.
    extern fn gtk_info_bar_add_action_widget(p_info_bar: *InfoBar, p_child: *gtk.Widget, p_response_id: c_int) void;
    pub const addActionWidget = gtk_info_bar_add_action_widget;

    /// Adds a button with the given text.
    ///
    /// Clicking the button will emit the `gtk.InfoBar.signals.response`
    /// signal with the given response_id. The button is appended to the
    /// end of the info bar's action area. The button widget is returned,
    /// but usually you don't need it.
    extern fn gtk_info_bar_add_button(p_info_bar: *InfoBar, p_button_text: [*:0]const u8, p_response_id: c_int) *gtk.Button;
    pub const addButton = gtk_info_bar_add_button;

    /// Adds multiple buttons.
    ///
    /// This is the same as calling `gtk.InfoBar.addButton`
    /// repeatedly. The variable argument list should be `NULL`-terminated
    /// as with `gtk.InfoBar.newWithButtons`. Each button must have both
    /// text and response ID.
    extern fn gtk_info_bar_add_buttons(p_info_bar: *InfoBar, p_first_button_text: [*:0]const u8, ...) void;
    pub const addButtons = gtk_info_bar_add_buttons;

    /// Adds a widget to the content area of the info bar.
    extern fn gtk_info_bar_add_child(p_info_bar: *InfoBar, p_widget: *gtk.Widget) void;
    pub const addChild = gtk_info_bar_add_child;

    /// Returns the message type of the message area.
    extern fn gtk_info_bar_get_message_type(p_info_bar: *InfoBar) gtk.MessageType;
    pub const getMessageType = gtk_info_bar_get_message_type;

    /// Returns whether the info bar is currently revealed.
    extern fn gtk_info_bar_get_revealed(p_info_bar: *InfoBar) c_int;
    pub const getRevealed = gtk_info_bar_get_revealed;

    /// Returns whether the widget will display a standard close button.
    extern fn gtk_info_bar_get_show_close_button(p_info_bar: *InfoBar) c_int;
    pub const getShowCloseButton = gtk_info_bar_get_show_close_button;

    /// Removes a widget from the action area of `info_bar`.
    ///
    /// The widget must have been put there by a call to
    /// `gtk.InfoBar.addActionWidget` or `gtk.InfoBar.addButton`.
    extern fn gtk_info_bar_remove_action_widget(p_info_bar: *InfoBar, p_widget: *gtk.Widget) void;
    pub const removeActionWidget = gtk_info_bar_remove_action_widget;

    /// Removes a widget from the content area of the info bar.
    extern fn gtk_info_bar_remove_child(p_info_bar: *InfoBar, p_widget: *gtk.Widget) void;
    pub const removeChild = gtk_info_bar_remove_child;

    /// Emits the “response” signal with the given `response_id`.
    extern fn gtk_info_bar_response(p_info_bar: *InfoBar, p_response_id: c_int) void;
    pub const response = gtk_info_bar_response;

    /// Sets the last widget in the info bar’s action area with
    /// the given response_id as the default widget for the dialog.
    ///
    /// Pressing “Enter” normally activates the default widget.
    ///
    /// Note that this function currently requires `info_bar` to
    /// be added to a widget hierarchy.
    extern fn gtk_info_bar_set_default_response(p_info_bar: *InfoBar, p_response_id: c_int) void;
    pub const setDefaultResponse = gtk_info_bar_set_default_response;

    /// Sets the message type of the message area.
    ///
    /// GTK uses this type to determine how the message is displayed.
    extern fn gtk_info_bar_set_message_type(p_info_bar: *InfoBar, p_message_type: gtk.MessageType) void;
    pub const setMessageType = gtk_info_bar_set_message_type;

    /// Sets the sensitivity of action widgets for `response_id`.
    ///
    /// Calls `gtk_widget_set_sensitive (widget, setting)` for each
    /// widget in the info bars’s action area with the given `response_id`.
    /// A convenient way to sensitize/desensitize buttons.
    extern fn gtk_info_bar_set_response_sensitive(p_info_bar: *InfoBar, p_response_id: c_int, p_setting: c_int) void;
    pub const setResponseSensitive = gtk_info_bar_set_response_sensitive;

    /// Sets whether the `GtkInfoBar` is revealed.
    ///
    /// Changing this will make `info_bar` reveal or conceal
    /// itself via a sliding transition.
    ///
    /// Note: this does not show or hide `info_bar` in the
    /// `gtk.Widget.properties.visible` sense, so revealing has no effect
    /// if `gtk.Widget.properties.visible` is `FALSE`.
    extern fn gtk_info_bar_set_revealed(p_info_bar: *InfoBar, p_revealed: c_int) void;
    pub const setRevealed = gtk_info_bar_set_revealed;

    /// If true, a standard close button is shown.
    ///
    /// When clicked it emits the response `GTK_RESPONSE_CLOSE`.
    extern fn gtk_info_bar_set_show_close_button(p_info_bar: *InfoBar, p_setting: c_int) void;
    pub const setShowCloseButton = gtk_info_bar_set_show_close_button;

    extern fn gtk_info_bar_get_type() usize;
    pub const getGObjectType = gtk_info_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.InfoBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.InfoBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *InfoBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows text in a predefined area.
///
/// You likely want to use `GtkLabel` instead as this widget is intended only
/// for a small subset of use cases. The main scenario envisaged is inside lists
/// such as `GtkColumnView`.
///
/// While a `GtkLabel` sizes itself depending on the text that is displayed,
/// `GtkInscription` is given a size and inscribes the given text into that
/// space as well as it can.
///
/// Users of this widget should take care to plan behaviour for the common case
/// where the text doesn't fit exactly in the allocated space.
///
/// ## CSS nodes
///
/// `GtkInscription` has a single CSS node with the name label.
pub const Inscription = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleText, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.InscriptionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// A list of style attributes to apply to the text of the inscription.
        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?*pango.AttrList;
        };

        /// Utility property that sets both the `gtk.Inscription.properties.text` and
        /// `gtk.Inscription.properties.attributes` properties, mainly intended for use in
        /// GtkBuilder ui files to ease translation support and bindings.
        ///
        /// This function uses `pango.parseMarkup` to parse the markup into text and
        /// attributes. The markup must be valid. If you cannot ensure that, consider using
        /// `pango.parseMarkup` and setting the two properties yourself.
        pub const markup = struct {
            pub const name = "markup";

            pub const Type = ?[*:0]u8;
        };

        /// The number of characters that should fit into the inscription at minimum.
        ///
        /// This influences the requested width, not the width actually given to the widget,
        /// which might turn out to be larger.
        ///
        /// Note that this is an approximate character width, so some characters might be
        /// wider and some might be thinner, so do not expect the number of characters to
        /// exactly match.
        ///
        /// If you set this property to 0, the inscription will not request any width at all
        /// and its width will be determined entirely by its surroundings.
        pub const min_chars = struct {
            pub const name = "min-chars";

            pub const Type = c_uint;
        };

        /// The number of lines that should fit into the inscription at minimum.
        ///
        /// This influences the requested height, not the height actually given to the widget,
        /// which might turn out to be larger.
        ///
        /// Note that this is an approximate line height, so if the text uses things like fancy
        /// Unicode or attribute that influence the height, the text might not fit.
        ///
        /// If you set this property to 0, the inscription will not request any height at all
        /// and its height will be determined entirely by its surroundings.
        pub const min_lines = struct {
            pub const name = "min-lines";

            pub const Type = c_uint;
        };

        /// The number of characters that should ideally fit into the inscription.
        ///
        /// This influences the requested width, not the width actually given to the widget.
        /// The widget might turn out larger as well as smaller.
        ///
        /// If this property is set to a value smaller than `gtk.Inscription.properties.min_chars`,
        /// that value will be used. In particular, for the default value of 0, this will always
        /// be the case.
        pub const nat_chars = struct {
            pub const name = "nat-chars";

            pub const Type = c_uint;
        };

        /// The number of lines that should ideally fit into the inscription.
        ///
        /// This influences the requested height, not the height actually given to the widget.
        /// The widget might turn out larger as well as smaller.
        ///
        /// If this property is set to a value smaller than `gtk.Inscription.properties.min_lines`,
        /// that value will be used. In particular, for the default value of 0, this will always
        /// be the case.
        pub const nat_lines = struct {
            pub const name = "nat-lines";

            pub const Type = c_uint;
        };

        /// The displayed text.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };

        /// The overflow method to use for the text.
        pub const text_overflow = struct {
            pub const name = "text-overflow";

            pub const Type = gtk.InscriptionOverflow;
        };

        /// Controls how the line wrapping is done.
        ///
        /// Note that unlike `GtkLabel`, the default here is `PANGO_WRAP_WORD_CHAR`.
        pub const wrap_mode = struct {
            pub const name = "wrap-mode";

            pub const Type = pango.WrapMode;
        };

        /// The horizontal alignment of the text inside the allocated size.
        ///
        /// Compare this to `gtk.Widget.properties.halign`, which determines how the
        /// inscription's size allocation is positioned in the available space.
        pub const xalign = struct {
            pub const name = "xalign";

            pub const Type = f32;
        };

        /// The vertical alignment of the text inside the allocated size.
        ///
        /// Compare this to `gtk.Widget.properties.valign`, which determines how the
        /// inscription's size allocation is positioned in the available space.
        pub const yalign = struct {
            pub const name = "yalign";

            pub const Type = f32;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkInscription` with the given text.
    extern fn gtk_inscription_new(p_text: ?[*:0]const u8) *gtk.Inscription;
    pub const new = gtk_inscription_new;

    /// Gets the inscription's attribute list.
    extern fn gtk_inscription_get_attributes(p_self: *Inscription) ?*pango.AttrList;
    pub const getAttributes = gtk_inscription_get_attributes;

    /// Gets the `min-chars` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.min_chars` property.
    extern fn gtk_inscription_get_min_chars(p_self: *Inscription) c_uint;
    pub const getMinChars = gtk_inscription_get_min_chars;

    /// Gets the `min-lines` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.min_lines` property.
    extern fn gtk_inscription_get_min_lines(p_self: *Inscription) c_uint;
    pub const getMinLines = gtk_inscription_get_min_lines;

    /// Gets the `nat-chars` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.nat_chars` property.
    extern fn gtk_inscription_get_nat_chars(p_self: *Inscription) c_uint;
    pub const getNatChars = gtk_inscription_get_nat_chars;

    /// Gets the `nat-lines` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.nat_lines` property.
    extern fn gtk_inscription_get_nat_lines(p_self: *Inscription) c_uint;
    pub const getNatLines = gtk_inscription_get_nat_lines;

    /// Gets the text that is displayed.
    extern fn gtk_inscription_get_text(p_self: *Inscription) ?[*:0]const u8;
    pub const getText = gtk_inscription_get_text;

    /// Gets the inscription's overflow method.
    extern fn gtk_inscription_get_text_overflow(p_self: *Inscription) gtk.InscriptionOverflow;
    pub const getTextOverflow = gtk_inscription_get_text_overflow;

    /// Returns line wrap mode used by the inscription.
    ///
    /// See `gtk.Inscription.setWrapMode`.
    extern fn gtk_inscription_get_wrap_mode(p_self: *Inscription) pango.WrapMode;
    pub const getWrapMode = gtk_inscription_get_wrap_mode;

    /// Gets the `xalign` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.xalign` property.
    extern fn gtk_inscription_get_xalign(p_self: *Inscription) f32;
    pub const getXalign = gtk_inscription_get_xalign;

    /// Gets the `yalign` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.yalign` property.
    extern fn gtk_inscription_get_yalign(p_self: *Inscription) f32;
    pub const getYalign = gtk_inscription_get_yalign;

    /// Apply attributes to the inscription text.
    ///
    /// These attributes will not be evaluated for sizing the inscription.
    extern fn gtk_inscription_set_attributes(p_self: *Inscription, p_attrs: ?*pango.AttrList) void;
    pub const setAttributes = gtk_inscription_set_attributes;

    /// Utility function to set the text and attributes to be displayed.
    ///
    /// See the `gtk.Inscription.properties.markup` property.
    extern fn gtk_inscription_set_markup(p_self: *Inscription, p_markup: ?[*:0]const u8) void;
    pub const setMarkup = gtk_inscription_set_markup;

    /// Sets the `min-chars` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.min_chars` property.
    extern fn gtk_inscription_set_min_chars(p_self: *Inscription, p_min_chars: c_uint) void;
    pub const setMinChars = gtk_inscription_set_min_chars;

    /// Sets the `min-lines` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.min_lines` property.
    extern fn gtk_inscription_set_min_lines(p_self: *Inscription, p_min_lines: c_uint) void;
    pub const setMinLines = gtk_inscription_set_min_lines;

    /// Sets the `nat-chars` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.nat_chars` property.
    extern fn gtk_inscription_set_nat_chars(p_self: *Inscription, p_nat_chars: c_uint) void;
    pub const setNatChars = gtk_inscription_set_nat_chars;

    /// Sets the `nat-lines` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.nat_lines` property.
    extern fn gtk_inscription_set_nat_lines(p_self: *Inscription, p_nat_lines: c_uint) void;
    pub const setNatLines = gtk_inscription_set_nat_lines;

    /// Sets the text to be displayed.
    extern fn gtk_inscription_set_text(p_self: *Inscription, p_text: ?[*:0]const u8) void;
    pub const setText = gtk_inscription_set_text;

    /// Sets what to do when the text doesn't fit.
    extern fn gtk_inscription_set_text_overflow(p_self: *Inscription, p_overflow: gtk.InscriptionOverflow) void;
    pub const setTextOverflow = gtk_inscription_set_text_overflow;

    /// Controls how line wrapping is done.
    extern fn gtk_inscription_set_wrap_mode(p_self: *Inscription, p_wrap_mode: pango.WrapMode) void;
    pub const setWrapMode = gtk_inscription_set_wrap_mode;

    /// Sets the `xalign` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.xalign` property.
    extern fn gtk_inscription_set_xalign(p_self: *Inscription, p_xalign: f32) void;
    pub const setXalign = gtk_inscription_set_xalign;

    /// Sets the `yalign` of the inscription.
    ///
    /// See the `gtk.Inscription.properties.yalign` property.
    extern fn gtk_inscription_set_yalign(p_self: *Inscription, p_yalign: f32) void;
    pub const setYalign = gtk_inscription_set_yalign;

    extern fn gtk_inscription_get_type() usize;
    pub const getGObjectType = gtk_inscription_get_type;

    extern fn g_object_ref(p_self: *gtk.Inscription) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Inscription) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Inscription, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Triggers when a specific keyval and modifiers are pressed.
pub const KeyvalTrigger = opaque {
    pub const Parent = gtk.ShortcutTrigger;
    pub const Implements = [_]type{};
    pub const Class = gtk.KeyvalTriggerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The key value for the trigger.
        pub const keyval = struct {
            pub const name = "keyval";

            pub const Type = c_uint;
        };

        /// The key modifiers for the trigger.
        pub const modifiers = struct {
            pub const name = "modifiers";

            pub const Type = gdk.ModifierType;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkShortcutTrigger` that will trigger whenever
    /// the key with the given `keyval` and `modifiers` is pressed.
    extern fn gtk_keyval_trigger_new(p_keyval: c_uint, p_modifiers: gdk.ModifierType) *gtk.KeyvalTrigger;
    pub const new = gtk_keyval_trigger_new;

    /// Gets the keyval that must be pressed to succeed
    /// triggering `self`.
    extern fn gtk_keyval_trigger_get_keyval(p_self: *KeyvalTrigger) c_uint;
    pub const getKeyval = gtk_keyval_trigger_get_keyval;

    /// Gets the modifiers that must be present to succeed
    /// triggering `self`.
    extern fn gtk_keyval_trigger_get_modifiers(p_self: *KeyvalTrigger) gdk.ModifierType;
    pub const getModifiers = gtk_keyval_trigger_get_modifiers;

    extern fn gtk_keyval_trigger_get_type() usize;
    pub const getGObjectType = gtk_keyval_trigger_get_type;

    extern fn g_object_ref(p_self: *gtk.KeyvalTrigger) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.KeyvalTrigger) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *KeyvalTrigger, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays a small amount of text.
///
/// Most labels are used to label another widget (such as an `Entry`).
///
/// <picture>
///   <source srcset="label-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkLabel" src="label.png">
/// </picture>
///
/// ## Shortcuts and Gestures
///
/// `GtkLabel` supports the following keyboard shortcuts, when the cursor is
/// visible:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
/// - <kbd>Ctrl</kbd>+<kbd>A</kbd> or <kbd>Ctrl</kbd>+<kbd>&sol;</kbd>
///   selects all.
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> or
///   <kbd>Ctrl</kbd>+<kbd>&bsol;</kbd> unselects all.
///
/// Additionally, the following signals have default keybindings:
///
/// - `gtk.Label.signals.activate_current_link`
/// - `gtk.Label.signals.copy_clipboard`
/// - `gtk.Label.signals.move_cursor`
///
/// ## Actions
///
/// `GtkLabel` defines a set of built-in actions:
///
/// - `clipboard.copy` copies the text to the clipboard.
/// - `clipboard.cut` doesn't do anything, since text in labels can't be deleted.
/// - `clipboard.paste` doesn't do anything, since text in labels can't be
///   edited.
/// - `link.open` opens the link, when activated on a link inside the label.
/// - `link.copy` copies the link to the clipboard, when activated on a link
///   inside the label.
/// - `menu.popup` opens the context menu.
/// - `selection.delete` doesn't do anything, since text in labels can't be
///   deleted.
/// - `selection.select-all` selects all of the text, if the label allows
///   selection.
///
/// ## CSS nodes
///
/// ```
/// label
/// ├── [selection]
/// ├── [link]
/// ┊
/// ╰── [link]
/// ```
///
/// `GtkLabel` has a single CSS node with the name label. A wide variety
/// of style classes may be applied to labels, such as .title, .subtitle,
/// .dim-label, etc. In the `GtkShortcutsWindow`, labels are used with the
/// .keycap style class.
///
/// If the label has a selection, it gets a subnode with name selection.
///
/// If the label has links, there is one subnode per link. These subnodes
/// carry the link or visited state depending on whether they have been
/// visited. In this case, label node also gets a .link style class.
///
/// ## GtkLabel as GtkBuildable
///
/// The GtkLabel implementation of the GtkBuildable interface supports a
/// custom `<attributes>` element, which supports any number of `<attribute>`
/// elements. The `<attribute>` element has attributes named “name“, “value“,
/// “start“ and “end“ and allows you to specify `pango.Attribute`
/// values for this label.
///
/// An example of a UI definition fragment specifying Pango attributes:
///
/// ```xml
/// <object class="GtkLabel">
///   <attributes>
///     <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
///     <attribute name="background" value="red" start="5" end="10"/>
///   </attributes>
/// </object>
/// ```
///
/// The start and end attributes specify the range of characters to which the
/// Pango attribute applies. If start and end are not specified, the attribute is
/// applied to the whole text. Note that specifying ranges does not make much
/// sense with translatable attributes. Use markup embedded in the translatable
/// content instead.
///
/// ## Accessibility
///
/// `GtkLabel` uses the `gtk.@"AccessibleRole.label"` role.
///
/// ## Mnemonics
///
/// Labels may contain “mnemonics”. Mnemonics are underlined characters in the
/// label, used for keyboard navigation. Mnemonics are created by providing a
/// string with an underscore before the mnemonic character, such as `"_File"`,
/// to the functions `gtk.Label.newWithMnemonic` or
/// `gtk.Label.setTextWithMnemonic`.
///
/// Mnemonics automatically activate any activatable widget the label is
/// inside, such as a `gtk.Button`; if the label is not inside the
/// mnemonic’s target widget, you have to tell the label about the target
/// using `gtk.Label.setMnemonicWidget`.
///
/// Here’s a simple example where the label is inside a button:
///
/// ```c
/// // Pressing Alt+H will activate this button
/// GtkWidget *button = gtk_button_new ();
/// GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello");
/// gtk_button_set_child (GTK_BUTTON (button), label);
/// ```
///
/// There’s a convenience function to create buttons with a mnemonic label
/// already inside:
///
/// ```c
/// // Pressing Alt+H will activate this button
/// GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
/// ```
///
/// To create a mnemonic for a widget alongside the label, such as a
/// `gtk.Entry`, you have to point the label at the entry with
/// `gtk.Label.setMnemonicWidget`:
///
/// ```c
/// // Pressing Alt+H will focus the entry
/// GtkWidget *entry = gtk_entry_new ();
/// GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello");
/// gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
/// ```
///
/// ## Markup (styled text)
///
/// To make it easy to format text in a label (changing colors, fonts, etc.),
/// label text can be provided in a simple markup format:
///
/// Here’s how to create a label with a small font:
/// ```c
/// GtkWidget *label = gtk_label_new (NULL);
/// gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
/// ```
///
/// (See the Pango manual for complete documentation] of available
/// tags, `pango.parseMarkup`)
///
/// The markup passed to `gtk.Label.setMarkup` must be valid XML; for example,
/// literal `<`, `>` and `&` characters must be escaped as `&lt;`, `&gt;`, and `&amp;`.
/// If you pass text obtained from the user, file, or a network to
/// `gtk.Label.setMarkup`, you’ll want to escape it with
/// `glib.markupEscapeText` or `glib.markupPrintfEscaped`.
///
/// Markup strings are just a convenient way to set the `pango.AttrList`
/// on a label; `gtk.Label.setAttributes` may be a simpler way to set
/// attributes in some cases. Be careful though; `pango.AttrList` tends
/// to cause internationalization problems, unless you’re applying attributes
/// to the entire string (i.e. unless you set the range of each attribute
/// to [0, `G_MAXINT`)). The reason is that specifying the `start_index` and
/// `end_index` for a `pango.Attribute` requires knowledge of the exact
/// string being displayed, so translations will cause problems.
///
/// ## Selectable labels
///
/// Labels can be made selectable with `gtk.Label.setSelectable`.
/// Selectable labels allow the user to copy the label contents to the
/// clipboard. Only labels that contain useful-to-copy information — such
/// as error messages — should be made selectable.
///
/// ## Text layout
///
/// A label can contain any number of paragraphs, but will have
/// performance problems if it contains more than a small number.
/// Paragraphs are separated by newlines or other paragraph separators
/// understood by Pango.
///
/// Labels can automatically wrap text if you call `gtk.Label.setWrap`.
///
/// `gtk.Label.setJustify` sets how the lines in a label align
/// with one another. If you want to set how the label as a whole aligns
/// in its available space, see the `gtk.Widget.properties.halign` and
/// `gtk.Widget.properties.valign` properties.
///
/// The `gtk.Label.properties.width_chars` and `gtk.Label.properties.max_width_chars`
/// properties can be used to control the size allocation of ellipsized or
/// wrapped labels. For ellipsizing labels, if either is specified (and less
/// than the actual text size), it is used as the minimum width, and the actual
/// text size is used as the natural width of the label. For wrapping labels,
/// width-chars is used as the minimum width, if specified, and max-width-chars
/// is used as the natural width. Even if max-width-chars specified, wrapping
/// labels will be rewrapped to use all of the available width.
///
/// ## Links
///
/// GTK supports markup for clickable hyperlinks in addition to regular Pango
/// markup. The markup for links is borrowed from HTML, using the `<a>` tag
/// with “href“, “title“ and “class“ attributes. GTK renders links similar to
/// the way they appear in web browsers, with colored, underlined text. The
/// “title“ attribute is displayed as a tooltip on the link. The “class“
/// attribute is used as style class on the CSS node for the link.
///
/// An example of inline links looks like this:
///
/// ```c
/// const char *text =
/// "Go to the "
/// "<a href=\"https://www.gtk.org\" title=\"&lt;i&gt;Our&lt;/i&gt; website\">"
/// "GTK website</a> for more...";
/// GtkWidget *label = gtk_label_new (NULL);
/// gtk_label_set_markup (GTK_LABEL (label), text);
/// ```
///
/// It is possible to implement custom handling for links and their tooltips
/// with the `gtk.Label.signals.activate_link` signal and the
/// `gtk.Label.getCurrentUri` function.
pub const Label = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleHypertext, gtk.AccessibleText, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Label;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// A list of style attributes to apply to the text of the label.
        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?*pango.AttrList;
        };

        /// The preferred place to ellipsize the string, if the label does
        /// not have enough room to display the entire string.
        ///
        /// Note that setting this property to a value other than
        /// [enum.Pango.EllipsizeMode.none] has the side-effect that the label requests
        /// only enough space to display the ellipsis "...". In particular, this
        /// means that ellipsizing labels do not work well in notebook tabs, unless
        /// the `gtk.NotebookPage.properties.tab_expand` child property is set to true.
        ///
        /// Other ways to set a label's width are `gtk.Widget.setSizeRequest`
        /// and `gtk.Label.setWidthChars`.
        pub const ellipsize = struct {
            pub const name = "ellipsize";

            pub const Type = pango.EllipsizeMode;
        };

        /// A menu model whose contents will be appended to the context menu.
        pub const extra_menu = struct {
            pub const name = "extra-menu";

            pub const Type = ?*gio.MenuModel;
        };

        /// The alignment of the lines in the text of the label, relative to each other.
        ///
        /// This does *not* affect the alignment of the label within its allocation.
        /// See `gtk.Label.properties.xalign` for that.
        pub const justify = struct {
            pub const name = "justify";

            pub const Type = gtk.Justification;
        };

        /// The contents of the label.
        ///
        /// If the string contains Pango markup (see `pango.parseMarkup`),
        /// you will have to set the `gtk.Label.properties.use_markup` property to
        /// true in order for the label to display the markup attributes. See also
        /// `gtk.Label.setMarkup` for a convenience function that sets both
        /// this property and the `gtk.Label.properties.use_markup` property at the
        /// same time.
        ///
        /// If the string contains underlines acting as mnemonics, you will have to
        /// set the `gtk.Label.properties.use_underline` property to true in order
        /// for the label to display them.
        pub const label = struct {
            pub const name = "label";

            pub const Type = ?[*:0]u8;
        };

        /// The number of lines to which an ellipsized, wrapping label
        /// should display before it gets ellipsized. This both prevents the label
        /// from ellipsizing before this many lines are displayed, and limits the
        /// height request of the label to this many lines.
        ///
        /// ::: warning
        ///     Setting this property has unintuitive and unfortunate consequences
        ///     for the minimum _width_ of the label. Specifically, if the height
        ///     of the label is such that it fits a smaller number of lines than
        ///     the value of this property, the label can not be ellipsized at all,
        ///     which means it must be wide enough to fit all the text fully.
        ///
        /// This property has no effect if the label is not wrapping or ellipsized.
        ///
        /// Set this property to -1 if you don't want to limit the number of lines.
        pub const lines = struct {
            pub const name = "lines";

            pub const Type = c_int;
        };

        /// The desired maximum width of the label, in characters.
        ///
        /// If this property is set to -1, the width will be calculated automatically.
        ///
        /// See the section on [text layout](class.Label.html`text`-layout) for details
        /// of how `gtk.Label.properties.width_chars` and `gtk.Label.properties.max_width_chars`
        /// determine the width of ellipsized and wrapped labels.
        pub const max_width_chars = struct {
            pub const name = "max-width-chars";

            pub const Type = c_int;
        };

        /// The mnemonic accelerator key for the label.
        pub const mnemonic_keyval = struct {
            pub const name = "mnemonic-keyval";

            pub const Type = c_uint;
        };

        /// The widget to be activated when the labels mnemonic key is pressed.
        pub const mnemonic_widget = struct {
            pub const name = "mnemonic-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// Select the line wrapping for the natural size request.
        ///
        /// This only affects the natural size requested. For the actual wrapping
        /// used, see the `gtk.Label.properties.wrap_mode` property.
        ///
        /// The default is `gtk.@"NaturalWrapMode.inherit"`, which inherits
        /// the behavior of the `gtk.Label.properties.wrap_mode` property.
        pub const natural_wrap_mode = struct {
            pub const name = "natural-wrap-mode";

            pub const Type = gtk.NaturalWrapMode;
        };

        /// Whether the label text can be selected with the mouse.
        pub const selectable = struct {
            pub const name = "selectable";

            pub const Type = c_int;
        };

        /// Whether the label is in single line mode.
        ///
        /// In single line mode, the height of the label does not depend on the
        /// actual text, it is always set to ascent + descent of the font. This
        /// can be an advantage in situations where resizing the label because
        /// of text changes would be distracting, e.g. in a statusbar.
        pub const single_line_mode = struct {
            pub const name = "single-line-mode";

            pub const Type = c_int;
        };

        /// Custom tabs for this label.
        pub const tabs = struct {
            pub const name = "tabs";

            pub const Type = ?*pango.TabArray;
        };

        /// True if the text of the label includes Pango markup.
        ///
        /// See `pango.parseMarkup`.
        pub const use_markup = struct {
            pub const name = "use-markup";

            pub const Type = c_int;
        };

        /// True if the text of the label indicates a mnemonic with an `_`
        /// before the mnemonic character.
        pub const use_underline = struct {
            pub const name = "use-underline";

            pub const Type = c_int;
        };

        /// The desired width of the label, in characters.
        ///
        /// If this property is set to -1, the width will be calculated automatically.
        ///
        /// See the section on [text layout](class.Label.html`text`-layout) for details
        /// of how `gtk.Label.properties.width_chars` and `gtk.Label.properties.max_width_chars`
        /// determine the width of ellipsized and wrapped labels.
        pub const width_chars = struct {
            pub const name = "width-chars";

            pub const Type = c_int;
        };

        /// True if the label text will wrap if it gets too wide.
        pub const wrap = struct {
            pub const name = "wrap";

            pub const Type = c_int;
        };

        /// Controls how the line wrapping is done.
        ///
        /// This only affects the formatting if line wrapping is on (see the
        /// `gtk.Label.properties.wrap` property). The default is `pango.@"WrapMode.word"`,
        /// which means wrap on word boundaries.
        ///
        /// For sizing behavior, also consider the `gtk.Label.properties.natural_wrap_mode`
        /// property.
        pub const wrap_mode = struct {
            pub const name = "wrap-mode";

            pub const Type = pango.WrapMode;
        };

        /// The horizontal alignment of the label text inside its size allocation.
        ///
        /// Compare this to `gtk.Widget.properties.halign`, which determines how the
        /// labels size allocation is positioned in the space available for the label.
        pub const xalign = struct {
            pub const name = "xalign";

            pub const Type = f32;
        };

        /// The vertical alignment of the label text inside its size allocation.
        ///
        /// Compare this to `gtk.Widget.properties.valign`, which determines how the
        /// labels size allocation is positioned in the space available for the label.
        pub const yalign = struct {
            pub const name = "yalign";

            pub const Type = f32;
        };
    };

    pub const signals = struct {
        /// Gets emitted when the user activates a link in the label.
        ///
        /// The `::activate-current-link` is a [keybinding signal](class.SignalAction.html).
        ///
        /// Applications may also emit the signal with `gobject.signalEmitByName`
        /// if they need to control activation of URIs programmatically.
        ///
        /// The default bindings for this signal are all forms of the <kbd>Enter</kbd> key.
        pub const activate_current_link = struct {
            pub const name = "activate-current-link";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Label, p_instance))),
                    gobject.signalLookup("activate-current-link", Label.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to activate a URI.
        ///
        /// Applications may connect to it to override the default behaviour,
        /// which is to call `gtk.FileLauncher.launch`.
        pub const activate_link = struct {
            pub const name = "activate-link";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_uri: [*:0]u8, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Label, p_instance))),
                    gobject.signalLookup("activate-link", Label.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to copy the selection to the clipboard.
        ///
        /// The `::copy-clipboard` signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Ctrl</kbd>+<kbd>c</kbd>.
        pub const copy_clipboard = struct {
            pub const name = "copy-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Label, p_instance))),
                    gobject.signalLookup("copy-clipboard", Label.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when the user initiates a cursor movement.
        ///
        /// The `::move-cursor` signal is a [keybinding signal](class.SignalAction.html).
        /// If the cursor is not visible in `entry`, this signal causes the viewport to
        /// be moved instead.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control
        /// the cursor programmatically.
        ///
        /// The default bindings for this signal come in two variants, the
        /// variant with the <kbd>Shift</kbd> modifier extends the selection,
        /// the variant without the <kbd>Shift</kbd> modifier does not.
        /// There are too many key combinations to list them all here.
        ///
        /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
        ///   move by individual characters/lines
        /// - <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs
        /// - <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_count: c_int, p_extend_selection: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Label, p_instance))),
                    gobject.signalLookup("move-cursor", Label.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new label with the given text inside it.
    ///
    /// You can pass `NULL` to get an empty label widget.
    extern fn gtk_label_new(p_str: ?[*:0]const u8) *gtk.Label;
    pub const new = gtk_label_new;

    /// Creates a new label with the given text inside it, and a mnemonic.
    ///
    /// If characters in `str` are preceded by an underscore, they are
    /// underlined. If you need a literal underscore character in a label, use
    /// '__' (two underscores). The first underlined character represents a
    /// keyboard accelerator called a mnemonic. The mnemonic key can be used
    /// to activate another widget, chosen automatically, or explicitly using
    /// `gtk.Label.setMnemonicWidget`.
    ///
    /// If `gtk.Label.setMnemonicWidget` is not called, then the first
    /// activatable ancestor of the label will be chosen as the mnemonic
    /// widget. For instance, if the label is inside a button or menu item,
    /// the button or menu item will automatically become the mnemonic widget
    /// and be activated by the mnemonic.
    extern fn gtk_label_new_with_mnemonic(p_str: ?[*:0]const u8) *gtk.Label;
    pub const newWithMnemonic = gtk_label_new_with_mnemonic;

    /// Gets the label's attribute list.
    ///
    /// This is the `pango.AttrList` that was set on the label using
    /// `gtk.Label.setAttributes`, if any. This function does not
    /// reflect attributes that come from the label's markup (see
    /// `gtk.Label.setMarkup`). If you want to get the effective
    /// attributes for the label, use
    /// `pango_layout_get_attributes (gtk_label_get_layout (self))`.
    extern fn gtk_label_get_attributes(p_self: *Label) ?*pango.AttrList;
    pub const getAttributes = gtk_label_get_attributes;

    /// Returns the URI for the active link in the label.
    ///
    /// The active link is the one under the mouse pointer or, in a
    /// selectable label, the link in which the text cursor is currently
    /// positioned.
    ///
    /// This function is intended for use in a `gtk.Label.signals.activate_link`
    /// handler or for use in a `gtk.Widget.signals.query_tooltip` handler.
    extern fn gtk_label_get_current_uri(p_self: *Label) ?[*:0]const u8;
    pub const getCurrentUri = gtk_label_get_current_uri;

    /// Returns the ellipsization mode of the label.
    ///
    /// See `gtk.Label.setEllipsize`.
    extern fn gtk_label_get_ellipsize(p_self: *Label) pango.EllipsizeMode;
    pub const getEllipsize = gtk_label_get_ellipsize;

    /// Gets the extra menu model of the label.
    ///
    /// See `gtk.Label.setExtraMenu`.
    extern fn gtk_label_get_extra_menu(p_self: *Label) ?*gio.MenuModel;
    pub const getExtraMenu = gtk_label_get_extra_menu;

    /// Returns the justification of the label.
    ///
    /// See `gtk.Label.setJustify`.
    extern fn gtk_label_get_justify(p_self: *Label) gtk.Justification;
    pub const getJustify = gtk_label_get_justify;

    /// Fetches the text from a label.
    ///
    /// The returned text includes any embedded underlines indicating
    /// mnemonics and Pango markup. (See `gtk.Label.getText`).
    extern fn gtk_label_get_label(p_self: *Label) [*:0]const u8;
    pub const getLabel = gtk_label_get_label;

    /// Gets the Pango layout used to display the label.
    ///
    /// The layout is useful to e.g. convert text positions to pixel
    /// positions, in combination with `gtk.Label.getLayoutOffsets`.
    /// The returned layout is owned by the `label` so need not be
    /// freed by the caller. The `label` is free to recreate its layout
    /// at any time, so it should be considered read-only.
    extern fn gtk_label_get_layout(p_self: *Label) *pango.Layout;
    pub const getLayout = gtk_label_get_layout;

    /// Obtains the coordinates where the label will draw its Pango layout.
    ///
    /// The coordinates are useful to convert mouse events into coordinates
    /// inside the `pango.Layout`, e.g. to take some action if some part
    /// of the label is clicked. Remember when using the `pango.Layout`
    /// functions you need to convert to and from pixels using ``PANGO_PIXELS``
    /// or `pango.SCALE`.
    extern fn gtk_label_get_layout_offsets(p_self: *Label, p_x: ?*c_int, p_y: ?*c_int) void;
    pub const getLayoutOffsets = gtk_label_get_layout_offsets;

    /// Gets the number of lines to which an ellipsized, wrapping
    /// label should be limited.
    ///
    /// See `gtk.Label.setLines`.
    extern fn gtk_label_get_lines(p_self: *Label) c_int;
    pub const getLines = gtk_label_get_lines;

    /// Retrieves the maximum width of the label in characters.
    ///
    /// See `gtk.Label.setWidthChars`.
    extern fn gtk_label_get_max_width_chars(p_self: *Label) c_int;
    pub const getMaxWidthChars = gtk_label_get_max_width_chars;

    /// Return the mnemonic accelerator.
    ///
    /// If the label has been set so that it has a mnemonic key this function
    /// returns the keyval used for the mnemonic accelerator. If there is no
    /// mnemonic set up it returns `GDK_KEY_VoidSymbol`.
    extern fn gtk_label_get_mnemonic_keyval(p_self: *Label) c_uint;
    pub const getMnemonicKeyval = gtk_label_get_mnemonic_keyval;

    /// Retrieves the mnemonic target of this label.
    ///
    /// See `gtk.Label.setMnemonicWidget`.
    extern fn gtk_label_get_mnemonic_widget(p_self: *Label) ?*gtk.Widget;
    pub const getMnemonicWidget = gtk_label_get_mnemonic_widget;

    /// Returns natural line wrap mode used by the label.
    ///
    /// See `gtk.Label.setNaturalWrapMode`.
    extern fn gtk_label_get_natural_wrap_mode(p_self: *Label) gtk.NaturalWrapMode;
    pub const getNaturalWrapMode = gtk_label_get_natural_wrap_mode;

    /// Returns whether the label is selectable.
    extern fn gtk_label_get_selectable(p_self: *Label) c_int;
    pub const getSelectable = gtk_label_get_selectable;

    /// Gets the selected range of characters in the label.
    ///
    /// The returned `start` and `end` positions are in characters.
    extern fn gtk_label_get_selection_bounds(p_self: *Label, p_start: ?*c_int, p_end: ?*c_int) c_int;
    pub const getSelectionBounds = gtk_label_get_selection_bounds;

    /// Returns whether the label is in single line mode.
    extern fn gtk_label_get_single_line_mode(p_self: *Label) c_int;
    pub const getSingleLineMode = gtk_label_get_single_line_mode;

    /// Gets the tab stops for the label.
    ///
    /// The returned array will be `NULL` if “standard” (8-space) tabs are used.
    extern fn gtk_label_get_tabs(p_self: *Label) ?*pango.TabArray;
    pub const getTabs = gtk_label_get_tabs;

    /// Gets the text of the label.
    ///
    /// The returned text is as it appears on screen. This does not include
    /// any embedded underlines indicating mnemonics or Pango markup. (See
    /// `gtk.Label.getLabel`)
    extern fn gtk_label_get_text(p_self: *Label) [*:0]const u8;
    pub const getText = gtk_label_get_text;

    /// Returns whether the label’s text is interpreted as Pango markup.
    ///
    /// See `gtk.Label.setUseMarkup`.
    extern fn gtk_label_get_use_markup(p_self: *Label) c_int;
    pub const getUseMarkup = gtk_label_get_use_markup;

    /// Returns whether underlines in the label indicate mnemonics.
    ///
    /// See `gtk.Label.setUseUnderline`.
    extern fn gtk_label_get_use_underline(p_self: *Label) c_int;
    pub const getUseUnderline = gtk_label_get_use_underline;

    /// Retrieves the desired width of the label in characters.
    ///
    /// See `gtk.Label.setWidthChars`.
    extern fn gtk_label_get_width_chars(p_self: *Label) c_int;
    pub const getWidthChars = gtk_label_get_width_chars;

    /// Returns whether lines in the label are automatically wrapped.
    ///
    /// See `gtk.Label.setWrap`.
    extern fn gtk_label_get_wrap(p_self: *Label) c_int;
    pub const getWrap = gtk_label_get_wrap;

    /// Returns line wrap mode used by the label.
    ///
    /// See `gtk.Label.setWrapMode`.
    extern fn gtk_label_get_wrap_mode(p_self: *Label) pango.WrapMode;
    pub const getWrapMode = gtk_label_get_wrap_mode;

    /// Gets the `xalign` of the label.
    ///
    /// See the `gtk.Label.properties.xalign` property.
    extern fn gtk_label_get_xalign(p_self: *Label) f32;
    pub const getXalign = gtk_label_get_xalign;

    /// Gets the `yalign` of the label.
    ///
    /// See the `gtk.Label.properties.yalign` property.
    extern fn gtk_label_get_yalign(p_self: *Label) f32;
    pub const getYalign = gtk_label_get_yalign;

    /// Selects a range of characters in the label, if the label is selectable.
    ///
    /// See `gtk.Label.setSelectable`. If the label is not selectable,
    /// this function has no effect. If `start_offset` or
    /// `end_offset` are -1, then the end of the label will be substituted.
    extern fn gtk_label_select_region(p_self: *Label, p_start_offset: c_int, p_end_offset: c_int) void;
    pub const selectRegion = gtk_label_select_region;

    /// Apply attributes to the label text.
    ///
    /// The attributes set with this function will be applied and merged with
    /// any other attributes previously effected by way of the
    /// `gtk.Label.properties.use_underline` or `gtk.Label.properties.use_markup`
    /// properties
    ///
    /// While it is not recommended to mix markup strings with manually set
    /// attributes, if you must; know that the attributes will be applied
    /// to the label after the markup string is parsed.
    extern fn gtk_label_set_attributes(p_self: *Label, p_attrs: ?*pango.AttrList) void;
    pub const setAttributes = gtk_label_set_attributes;

    /// Sets the mode used to ellipsize the text.
    ///
    /// The text will be ellipsized if there is not
    /// enough space to render the entire string.
    extern fn gtk_label_set_ellipsize(p_self: *Label, p_mode: pango.EllipsizeMode) void;
    pub const setEllipsize = gtk_label_set_ellipsize;

    /// Sets a menu model to add to the context menu of the label.
    extern fn gtk_label_set_extra_menu(p_self: *Label, p_model: ?*gio.MenuModel) void;
    pub const setExtraMenu = gtk_label_set_extra_menu;

    /// Sets the alignment of lines in the label relative to each other.
    ///
    /// This function has no effect on labels containing only a single line.
    ///
    /// `gtk.@"Justification.left"` is the default value when the widget
    /// is first created with `gtk.Label.new`.
    ///
    /// If you instead want to set the alignment of the label as a whole,
    /// use `gtk.Widget.setHalign` instead.
    extern fn gtk_label_set_justify(p_self: *Label, p_jtype: gtk.Justification) void;
    pub const setJustify = gtk_label_set_justify;

    /// Sets the text of the label.
    ///
    /// The label is interpreted as including embedded underlines and/or Pango
    /// markup depending on the values of the `gtk.Label.properties.use_underline`
    /// and `gtk.Label.properties.use_markup` properties.
    extern fn gtk_label_set_label(p_self: *Label, p_str: [*:0]const u8) void;
    pub const setLabel = gtk_label_set_label;

    /// Sets the number of lines to which an ellipsized, wrapping label
    /// should be limited.
    ///
    /// This has no effect if the label is not wrapping or ellipsized.
    /// Set this to -1 if you don’t want to limit the number of lines.
    extern fn gtk_label_set_lines(p_self: *Label, p_lines: c_int) void;
    pub const setLines = gtk_label_set_lines;

    /// Sets the labels text and attributes from markup.
    ///
    /// The string must be marked up with Pango markup
    /// (see `pango.parseMarkup`).
    ///
    /// If `str` is external data, you may need to escape it
    /// with `glib.markupEscapeText` or `glib.markupPrintfEscaped`:
    ///
    /// ```c
    /// GtkWidget *self = gtk_label_new (NULL);
    /// const char *str = "...";
    /// const char *format = "<span style=\"italic\">\%s</span>";
    /// char *markup;
    ///
    /// markup = g_markup_printf_escaped (format, str);
    /// gtk_label_set_markup (GTK_LABEL (self), markup);
    /// g_free (markup);
    /// ```
    ///
    /// This function sets the `gtk.Label.properties.use_markup` property
    /// to true.
    ///
    /// Also see `gtk.Label.setText`.
    extern fn gtk_label_set_markup(p_self: *Label, p_str: [*:0]const u8) void;
    pub const setMarkup = gtk_label_set_markup;

    /// Sets the labels text, attributes and mnemonic from markup.
    ///
    /// Parses `str` which is marked up with Pango markup (see `pango.parseMarkup`),
    /// setting the label’s text and attribute list based on the parse results.
    /// If characters in `str` are preceded by an underscore, they are underlined
    /// indicating that they represent a keyboard accelerator called a mnemonic.
    ///
    /// The mnemonic key can be used to activate another widget, chosen
    /// automatically, or explicitly using `gtk.Label.setMnemonicWidget`.
    extern fn gtk_label_set_markup_with_mnemonic(p_self: *Label, p_str: [*:0]const u8) void;
    pub const setMarkupWithMnemonic = gtk_label_set_markup_with_mnemonic;

    /// Sets the maximum width of the label in characters.
    extern fn gtk_label_set_max_width_chars(p_self: *Label, p_n_chars: c_int) void;
    pub const setMaxWidthChars = gtk_label_set_max_width_chars;

    /// Associate the label with its mnemonic target.
    ///
    /// If the label has been set so that it has a mnemonic key (using
    /// i.e. `gtk.Label.setMarkupWithMnemonic`,
    /// `gtk.Label.setTextWithMnemonic`,
    /// `gtk.Label.newWithMnemonic`
    /// or the `gtk.Label.properties.use_underline` property) the label can
    /// be associated with a widget that is the target of the mnemonic.
    /// When the label is inside a widget (like a `gtk.Button` or a
    /// `gtk.Notebook` tab) it is automatically associated with the
    /// correct widget, but sometimes (i.e. when the target is a `gtk.Entry`
    /// next to the label) you need to set it explicitly using this function.
    ///
    /// The target widget will be accelerated by emitting the
    /// `gtk.Widget.signals.mnemonic_activate` signal on it. The default handler
    /// for this signal will activate the widget if there are no mnemonic
    /// collisions and toggle focus between the colliding widgets otherwise.
    extern fn gtk_label_set_mnemonic_widget(p_self: *Label, p_widget: ?*gtk.Widget) void;
    pub const setMnemonicWidget = gtk_label_set_mnemonic_widget;

    /// Selects the line wrapping for the natural size request.
    ///
    /// This only affects the natural size requested, for the actual wrapping used,
    /// see the `gtk.Label.properties.wrap_mode` property.
    extern fn gtk_label_set_natural_wrap_mode(p_self: *Label, p_wrap_mode: gtk.NaturalWrapMode) void;
    pub const setNaturalWrapMode = gtk_label_set_natural_wrap_mode;

    /// Makes text in the label selectable.
    ///
    /// Selectable labels allow the user to select text from the label,
    /// for copy-and-paste.
    extern fn gtk_label_set_selectable(p_self: *Label, p_setting: c_int) void;
    pub const setSelectable = gtk_label_set_selectable;

    /// Sets whether the label is in single line mode.
    extern fn gtk_label_set_single_line_mode(p_self: *Label, p_single_line_mode: c_int) void;
    pub const setSingleLineMode = gtk_label_set_single_line_mode;

    /// Sets tab stops for the label.
    extern fn gtk_label_set_tabs(p_self: *Label, p_tabs: ?*pango.TabArray) void;
    pub const setTabs = gtk_label_set_tabs;

    /// Sets the text for the label.
    ///
    /// It overwrites any text that was there before and clears any
    /// previously set mnemonic accelerators, and sets the
    /// `gtk.Label.properties.use_underline` and
    /// `gtk.Label.properties.use_markup` properties to false.
    ///
    /// Also see `gtk.Label.setMarkup`.
    extern fn gtk_label_set_text(p_self: *Label, p_str: [*:0]const u8) void;
    pub const setText = gtk_label_set_text;

    /// Sets the text for the label, with mnemonics.
    ///
    /// If characters in `str` are preceded by an underscore, they are underlined
    /// indicating that they represent a keyboard accelerator called a mnemonic.
    /// The mnemonic key can be used to activate another widget, chosen
    /// automatically, or explicitly using `gtk.Label.setMnemonicWidget`.
    extern fn gtk_label_set_text_with_mnemonic(p_self: *Label, p_str: [*:0]const u8) void;
    pub const setTextWithMnemonic = gtk_label_set_text_with_mnemonic;

    /// Sets whether the text of the label contains markup.
    ///
    /// See `gtk.Label.setMarkup`.
    extern fn gtk_label_set_use_markup(p_self: *Label, p_setting: c_int) void;
    pub const setUseMarkup = gtk_label_set_use_markup;

    /// Sets whether underlines in the text indicate mnemonics.
    extern fn gtk_label_set_use_underline(p_self: *Label, p_setting: c_int) void;
    pub const setUseUnderline = gtk_label_set_use_underline;

    /// Sets the desired width in characters of the label.
    extern fn gtk_label_set_width_chars(p_self: *Label, p_n_chars: c_int) void;
    pub const setWidthChars = gtk_label_set_width_chars;

    /// Toggles line wrapping within the label.
    ///
    /// True makes it break lines if text exceeds the widget’s size.
    /// false lets the text get cut off by the edge of the widget if
    /// it exceeds the widget size.
    ///
    /// Note that setting line wrapping to true does not make the label
    /// wrap at its parent widget’s width, because GTK widgets conceptually
    /// can’t make their requisition depend on the parent  widget’s size.
    /// For a label that wraps at a specific position, set the label’s width
    /// using `gtk.Widget.setSizeRequest`.
    extern fn gtk_label_set_wrap(p_self: *Label, p_wrap: c_int) void;
    pub const setWrap = gtk_label_set_wrap;

    /// Controls how line wrapping is done.
    ///
    /// This only affects the label if line wrapping is on. (See
    /// `gtk.Label.setWrap`)
    ///
    /// The default is `pango.@"WrapMode.word"`, which means
    /// wrap on word boundaries.
    ///
    /// For sizing behavior, also consider the
    /// `gtk.Label.properties.natural_wrap_mode` property.
    extern fn gtk_label_set_wrap_mode(p_self: *Label, p_wrap_mode: pango.WrapMode) void;
    pub const setWrapMode = gtk_label_set_wrap_mode;

    /// Sets the `xalign` of the label.
    ///
    /// See the `gtk.Label.properties.xalign` property.
    extern fn gtk_label_set_xalign(p_self: *Label, p_xalign: f32) void;
    pub const setXalign = gtk_label_set_xalign;

    /// Sets the `yalign` of the label.
    ///
    /// See the `gtk.Label.properties.yalign` property.
    extern fn gtk_label_set_yalign(p_self: *Label, p_yalign: f32) void;
    pub const setYalign = gtk_label_set_yalign;

    extern fn gtk_label_get_type() usize;
    pub const getGObjectType = gtk_label_get_type;

    extern fn g_object_ref(p_self: *gtk.Label) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Label) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Label, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The base class for objects that are meant to hold layout properties.
///
/// If a `GtkLayoutManager` has per-child properties, like their packing type,
/// or the horizontal and vertical span, or the icon name, then the layout
/// manager should use a `GtkLayoutChild` implementation to store those properties.
///
/// A `GtkLayoutChild` instance is only ever valid while a widget is part
/// of a layout.
pub const LayoutChild = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.LayoutChildClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The widget that is associated to the `GtkLayoutChild` instance.
        pub const child_widget = struct {
            pub const name = "child-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// The layout manager that created the `GtkLayoutChild` instance.
        pub const layout_manager = struct {
            pub const name = "layout-manager";

            pub const Type = ?*gtk.LayoutManager;
        };
    };

    pub const signals = struct {};

    /// Retrieves the `GtkWidget` associated to the given `layout_child`.
    extern fn gtk_layout_child_get_child_widget(p_layout_child: *LayoutChild) *gtk.Widget;
    pub const getChildWidget = gtk_layout_child_get_child_widget;

    /// Retrieves the `GtkLayoutManager` instance that created the
    /// given `layout_child`.
    extern fn gtk_layout_child_get_layout_manager(p_layout_child: *LayoutChild) *gtk.LayoutManager;
    pub const getLayoutManager = gtk_layout_child_get_layout_manager;

    extern fn gtk_layout_child_get_type() usize;
    pub const getGObjectType = gtk_layout_child_get_type;

    extern fn g_object_ref(p_self: *gtk.LayoutChild) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.LayoutChild) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *LayoutChild, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Handles the preferred size and allocation for children of a widget.
///
/// You typically subclass `GtkLayoutManager` if you want to implement a
/// layout policy for the children of a widget, or if you want to determine
/// the size of a widget depending on its contents.
///
/// Each `GtkWidget` can only have a `GtkLayoutManager` instance associated
/// to it at any given time; it is possible, though, to replace the layout
/// manager instance using `gtk.Widget.setLayoutManager`.
///
/// ## Layout properties
///
/// A layout manager can expose properties for controlling the layout of
/// each child, by creating an object type derived from `gtk.LayoutChild`
/// and installing the properties on it as normal `GObject` properties.
///
/// Each `GtkLayoutChild` instance storing the layout properties for a
/// specific child is created through the `gtk.LayoutManager.getLayoutChild`
/// method; a `GtkLayoutManager` controls the creation of its `GtkLayoutChild`
/// instances by overriding the GtkLayoutManagerClass.`create_layout_child`
/// virtual function. The typical implementation should look like:
///
/// ```c
/// static GtkLayoutChild *
/// create_layout_child (GtkLayoutManager *manager,
///                      GtkWidget        *container,
///                      GtkWidget        *child)
/// {
///   return g_object_new (your_layout_child_get_type (),
///                        "layout-manager", manager,
///                        "child-widget", child,
///                        NULL);
/// }
/// ```
///
/// The `gtk.LayoutChild.properties.layout_manager` and
/// `gtk.LayoutChild.properties.child_widget` properties
/// on the newly created `GtkLayoutChild` instance are mandatory. The
/// `GtkLayoutManager` will cache the newly created `GtkLayoutChild` instance
/// until the widget is removed from its parent, or the parent removes the
/// layout manager.
///
/// Each `GtkLayoutManager` instance creating a `GtkLayoutChild` should use
/// `gtk.LayoutManager.getLayoutChild` every time it needs to query
/// the layout properties; each `GtkLayoutChild` instance should call
/// `gtk.LayoutManager.layoutChanged` every time a property is
/// updated, in order to queue a new size measuring and allocation.
pub const LayoutManager = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.LayoutManagerClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Assigns the given `width`, `height`, and `baseline` to
        /// a `widget`, and computes the position and sizes of the children of
        /// the `widget` using the layout management policy of `manager`.
        pub const allocate = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_width: c_int, p_height: c_int, p_baseline: c_int) void {
                return gobject.ext.as(LayoutManager.Class, p_class).f_allocate.?(gobject.ext.as(LayoutManager, p_manager), p_widget, p_width, p_height, p_baseline);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_width: c_int, p_height: c_int, p_baseline: c_int) callconv(.c) void) void {
                gobject.ext.as(LayoutManager.Class, p_class).f_allocate = @ptrCast(p_implementation);
            }
        };

        /// Create a `GtkLayoutChild` instance for the given `for_child` widget.
        pub const create_layout_child = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_for_child: *gtk.Widget) *gtk.LayoutChild {
                return gobject.ext.as(LayoutManager.Class, p_class).f_create_layout_child.?(gobject.ext.as(LayoutManager, p_manager), p_widget, p_for_child);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_for_child: *gtk.Widget) callconv(.c) *gtk.LayoutChild) void {
                gobject.ext.as(LayoutManager.Class, p_class).f_create_layout_child = @ptrCast(p_implementation);
            }
        };

        /// a virtual function, used to return the preferred
        ///   request mode for the layout manager; for instance, "width for height"
        ///   or "height for width"; see `GtkSizeRequestMode`
        pub const get_request_mode = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget) gtk.SizeRequestMode {
                return gobject.ext.as(LayoutManager.Class, p_class).f_get_request_mode.?(gobject.ext.as(LayoutManager, p_manager), p_widget);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget) callconv(.c) gtk.SizeRequestMode) void {
                gobject.ext.as(LayoutManager.Class, p_class).f_get_request_mode = @ptrCast(p_implementation);
            }
        };

        /// Measures the size of the `widget` using `manager`, for the
        /// given `orientation` and size.
        ///
        /// See the `gtk.Widget` documentation on layout management for
        /// more details.
        pub const measure = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) void {
                return gobject.ext.as(LayoutManager.Class, p_class).f_measure.?(gobject.ext.as(LayoutManager, p_manager), p_widget, p_orientation, p_for_size, p_minimum, p_natural, p_minimum_baseline, p_natural_baseline);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(LayoutManager.Class, p_class).f_measure = @ptrCast(p_implementation);
            }
        };

        /// a virtual function, called when the widget using the layout
        ///   manager is attached to a `GtkRoot`
        pub const root = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(LayoutManager.Class, p_class).f_root.?(gobject.ext.as(LayoutManager, p_manager));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(LayoutManager.Class, p_class).f_root = @ptrCast(p_implementation);
            }
        };

        /// a virtual function, called when the widget using the layout
        ///   manager is detached from a `GtkRoot`
        pub const unroot = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(LayoutManager.Class, p_class).f_unroot.?(gobject.ext.as(LayoutManager, p_manager));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(LayoutManager.Class, p_class).f_unroot = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// Assigns the given `width`, `height`, and `baseline` to
    /// a `widget`, and computes the position and sizes of the children of
    /// the `widget` using the layout management policy of `manager`.
    extern fn gtk_layout_manager_allocate(p_manager: *LayoutManager, p_widget: *gtk.Widget, p_width: c_int, p_height: c_int, p_baseline: c_int) void;
    pub const allocate = gtk_layout_manager_allocate;

    /// Retrieves a `GtkLayoutChild` instance for the `GtkLayoutManager`,
    /// creating one if necessary.
    ///
    /// The `child` widget must be a child of the widget using `manager`.
    ///
    /// The `GtkLayoutChild` instance is owned by the `GtkLayoutManager`,
    /// and is guaranteed to exist as long as `child` is a child of the
    /// `GtkWidget` using the given `GtkLayoutManager`.
    extern fn gtk_layout_manager_get_layout_child(p_manager: *LayoutManager, p_child: *gtk.Widget) *gtk.LayoutChild;
    pub const getLayoutChild = gtk_layout_manager_get_layout_child;

    /// Retrieves the request mode of `manager`.
    extern fn gtk_layout_manager_get_request_mode(p_manager: *LayoutManager) gtk.SizeRequestMode;
    pub const getRequestMode = gtk_layout_manager_get_request_mode;

    /// Retrieves the `GtkWidget` using the given `GtkLayoutManager`.
    extern fn gtk_layout_manager_get_widget(p_manager: *LayoutManager) ?*gtk.Widget;
    pub const getWidget = gtk_layout_manager_get_widget;

    /// Queues a resize on the `GtkWidget` using `manager`, if any.
    ///
    /// This function should be called by subclasses of `GtkLayoutManager`
    /// in response to changes to their layout management policies.
    extern fn gtk_layout_manager_layout_changed(p_manager: *LayoutManager) void;
    pub const layoutChanged = gtk_layout_manager_layout_changed;

    /// Measures the size of the `widget` using `manager`, for the
    /// given `orientation` and size.
    ///
    /// See the `gtk.Widget` documentation on layout management for
    /// more details.
    extern fn gtk_layout_manager_measure(p_manager: *LayoutManager, p_widget: *gtk.Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) void;
    pub const measure = gtk_layout_manager_measure;

    extern fn gtk_layout_manager_get_type() usize;
    pub const getGObjectType = gtk_layout_manager_get_type;

    extern fn g_object_ref(p_self: *gtk.LayoutManager) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.LayoutManager) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *LayoutManager, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a level indicator.
///
/// Typical use cases are displaying the strength of a password, or
/// showing the charge level of a battery.
///
/// <picture>
///   <source srcset="levelbar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkLevelBar" src="levelbar.png">
/// </picture>
///
/// Use `gtk.LevelBar.setValue` to set the current value, and
/// `gtk.LevelBar.addOffsetValue` to set the value offsets at which
/// the bar will be considered in a different state. GTK will add a few
/// offsets by default on the level bar: `GTK_LEVEL_BAR_OFFSET_LOW`,
/// `GTK_LEVEL_BAR_OFFSET_HIGH` and `GTK_LEVEL_BAR_OFFSET_FULL`, with
/// values 0.25, 0.75 and 1.0 respectively.
///
/// Note that it is your responsibility to update preexisting offsets
/// when changing the minimum or maximum value. GTK will simply clamp
/// them to the new range.
///
/// ## Adding a custom offset on the bar
///
/// ```c
/// static GtkWidget *
/// create_level_bar (void)
/// {
///   GtkWidget *widget;
///   GtkLevelBar *bar;
///
///   widget = gtk_level_bar_new ();
///   bar = GTK_LEVEL_BAR (widget);
///
///   // This changes the value of the default low offset
///
///   gtk_level_bar_add_offset_value (bar,
///                                   GTK_LEVEL_BAR_OFFSET_LOW,
///                                   0.10);
///
///   // This adds a new offset to the bar; the application will
///   // be able to change its color CSS like this:
///   //
///   // levelbar block.my-offset {
///   //   background-color: magenta;
///   //   border-style: solid;
///   //   border-color: black;
///   //   border-width: 1px;
///   // }
///
///   gtk_level_bar_add_offset_value (bar, "my-offset", 0.60);
///
///   return widget;
/// }
/// ```
///
/// The default interval of values is between zero and one, but it’s possible
/// to modify the interval using `gtk.LevelBar.setMinValue` and
/// `gtk.LevelBar.setMaxValue`. The value will be always drawn in
/// proportion to the admissible interval, i.e. a value of 15 with a specified
/// interval between 10 and 20 is equivalent to a value of 0.5 with an interval
/// between 0 and 1. When `GTK_LEVEL_BAR_MODE_DISCRETE` is used, the bar level
/// is rendered as a finite number of separated blocks instead of a single one.
/// The number of blocks that will be rendered is equal to the number of units
/// specified by the admissible interval.
///
/// For instance, to build a bar rendered with five blocks, it’s sufficient to
/// set the minimum value to 0 and the maximum value to 5 after changing the
/// indicator mode to discrete.
///
/// # GtkLevelBar as GtkBuildable
///
/// The `GtkLevelBar` implementation of the `GtkBuildable` interface supports a
/// custom `<offsets>` element, which can contain any number of `<offset>` elements,
/// each of which must have "name" and "value" attributes.
///
/// # CSS nodes
///
/// ```
/// levelbar[.discrete]
/// ╰── trough
///     ├── block.filled.level-name
///     ┊
///     ├── block.empty
///     ┊
/// ```
///
/// `GtkLevelBar` has a main CSS node with name levelbar and one of the style
/// classes .discrete or .continuous and a subnode with name trough. Below the
/// trough node are a number of nodes with name block and style class .filled
/// or .empty. In continuous mode, there is exactly one node of each, in discrete
/// mode, the number of filled and unfilled nodes corresponds to blocks that are
/// drawn. The block.filled nodes also get a style class .level-name corresponding
/// to the level for the current value.
///
/// In horizontal orientation, the nodes are always arranged from left to right,
/// regardless of text direction.
///
/// # Accessibility
///
/// `GtkLevelBar` uses the `gtk.@"AccessibleRole.meter"` role.
pub const LevelBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = LevelBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the `GtkLeveBar` is inverted.
        ///
        /// Level bars normally grow from top to bottom or left to right.
        /// Inverted level bars grow in the opposite direction.
        pub const inverted = struct {
            pub const name = "inverted";

            pub const Type = c_int;
        };

        /// Determines the maximum value of the interval that can be displayed by the bar.
        pub const max_value = struct {
            pub const name = "max-value";

            pub const Type = f64;
        };

        /// Determines the minimum value of the interval that can be displayed by the bar.
        pub const min_value = struct {
            pub const name = "min-value";

            pub const Type = f64;
        };

        /// Determines the way `GtkLevelBar` interprets the value properties to draw the
        /// level fill area.
        ///
        /// Specifically, when the value is `GTK_LEVEL_BAR_MODE_CONTINUOUS`,
        /// `GtkLevelBar` will draw a single block representing the current value in
        /// that area; when the value is `GTK_LEVEL_BAR_MODE_DISCRETE`,
        /// the widget will draw a succession of separate blocks filling the
        /// draw area, with the number of blocks being equal to the units separating
        /// the integral roundings of `gtk.LevelBar.properties.min_value` and
        /// `gtk.LevelBar.properties.max_value`.
        pub const mode = struct {
            pub const name = "mode";

            pub const Type = gtk.LevelBarMode;
        };

        /// Determines the currently filled value of the level bar.
        pub const value = struct {
            pub const name = "value";

            pub const Type = f64;
        };
    };

    pub const signals = struct {
        /// Emitted when an offset specified on the bar changes value.
        ///
        /// This typically is the result of a `gtk.LevelBar.addOffsetValue`
        /// call.
        ///
        /// The signal supports detailed connections; you can connect to the
        /// detailed signal "changed::x" in order to only receive callbacks when
        /// the value of offset "x" changes.
        pub const offset_changed = struct {
            pub const name = "offset-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_name: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(LevelBar, p_instance))),
                    gobject.signalLookup("offset-changed", LevelBar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkLevelBar`.
    extern fn gtk_level_bar_new() *gtk.LevelBar;
    pub const new = gtk_level_bar_new;

    /// Creates a new `GtkLevelBar` for the specified interval.
    extern fn gtk_level_bar_new_for_interval(p_min_value: f64, p_max_value: f64) *gtk.LevelBar;
    pub const newForInterval = gtk_level_bar_new_for_interval;

    /// Adds a new offset marker on `self` at the position specified by `value`.
    ///
    /// When the bar value is in the interval topped by `value` (or between `value`
    /// and `gtk.LevelBar.properties.max_value` in case the offset is the last one
    /// on the bar) a style class named `level-``name` will be applied
    /// when rendering the level bar fill.
    ///
    /// If another offset marker named `name` exists, its value will be
    /// replaced by `value`.
    extern fn gtk_level_bar_add_offset_value(p_self: *LevelBar, p_name: [*:0]const u8, p_value: f64) void;
    pub const addOffsetValue = gtk_level_bar_add_offset_value;

    /// Returns whether the levelbar is inverted.
    extern fn gtk_level_bar_get_inverted(p_self: *LevelBar) c_int;
    pub const getInverted = gtk_level_bar_get_inverted;

    /// Returns the `max-value` of the `GtkLevelBar`.
    extern fn gtk_level_bar_get_max_value(p_self: *LevelBar) f64;
    pub const getMaxValue = gtk_level_bar_get_max_value;

    /// Returns the `min-value` of the `GtkLevelBar`.
    extern fn gtk_level_bar_get_min_value(p_self: *LevelBar) f64;
    pub const getMinValue = gtk_level_bar_get_min_value;

    /// Returns the `mode` of the `GtkLevelBar`.
    extern fn gtk_level_bar_get_mode(p_self: *LevelBar) gtk.LevelBarMode;
    pub const getMode = gtk_level_bar_get_mode;

    /// Fetches the value specified for the offset marker `name` in `self`.
    extern fn gtk_level_bar_get_offset_value(p_self: *LevelBar, p_name: ?[*:0]const u8, p_value: *f64) c_int;
    pub const getOffsetValue = gtk_level_bar_get_offset_value;

    /// Returns the `value` of the `GtkLevelBar`.
    extern fn gtk_level_bar_get_value(p_self: *LevelBar) f64;
    pub const getValue = gtk_level_bar_get_value;

    /// Removes an offset marker from a `GtkLevelBar`.
    ///
    /// The marker must have been previously added with
    /// `gtk.LevelBar.addOffsetValue`.
    extern fn gtk_level_bar_remove_offset_value(p_self: *LevelBar, p_name: ?[*:0]const u8) void;
    pub const removeOffsetValue = gtk_level_bar_remove_offset_value;

    /// Sets whether the `GtkLevelBar` is inverted.
    extern fn gtk_level_bar_set_inverted(p_self: *LevelBar, p_inverted: c_int) void;
    pub const setInverted = gtk_level_bar_set_inverted;

    /// Sets the `max-value` of the `GtkLevelBar`.
    ///
    /// You probably want to update preexisting level offsets after calling
    /// this function.
    extern fn gtk_level_bar_set_max_value(p_self: *LevelBar, p_value: f64) void;
    pub const setMaxValue = gtk_level_bar_set_max_value;

    /// Sets the `min-value` of the `GtkLevelBar`.
    ///
    /// You probably want to update preexisting level offsets after calling
    /// this function.
    extern fn gtk_level_bar_set_min_value(p_self: *LevelBar, p_value: f64) void;
    pub const setMinValue = gtk_level_bar_set_min_value;

    /// Sets the `mode` of the `GtkLevelBar`.
    extern fn gtk_level_bar_set_mode(p_self: *LevelBar, p_mode: gtk.LevelBarMode) void;
    pub const setMode = gtk_level_bar_set_mode;

    /// Sets the value of the `GtkLevelBar`.
    extern fn gtk_level_bar_set_value(p_self: *LevelBar, p_value: f64) void;
    pub const setValue = gtk_level_bar_set_value;

    extern fn gtk_level_bar_get_type() usize;
    pub const getGObjectType = gtk_level_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.LevelBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.LevelBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *LevelBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A button with a hyperlink.
///
/// <picture>
///   <source srcset="link-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkLinkButton" src="link-button.png">
/// </picture>
///
/// It is useful to show quick links to resources.
///
/// A link button is created by calling either `gtk.LinkButton.new` or
/// `gtk.LinkButton.newWithLabel`. If using the former, the URI you
/// pass to the constructor is used as a label for the widget.
///
/// The URI bound to a `GtkLinkButton` can be set specifically using
/// `gtk.LinkButton.setUri`.
///
/// By default, `GtkLinkButton` calls `gtk.FileLauncher.launch` when the button
/// is clicked. This behaviour can be overridden by connecting to the
/// `gtk.LinkButton.signals.activate_link` signal and returning `TRUE` from
/// the signal handler.
///
/// # Shortcuts and Gestures
///
/// `GtkLinkButton` supports the following keyboard shortcuts:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
///
/// # Actions
///
/// `GtkLinkButton` defines a set of built-in actions:
///
/// - `clipboard.copy` copies the url to the clipboard.
/// - `menu.popup` opens the context menu.
///
/// # CSS nodes
///
/// `GtkLinkButton` has a single CSS node with name button. To differentiate
/// it from a plain `GtkButton`, it gets the .link style class.
///
/// # Accessibility
///
/// `GtkLinkButton` uses the `gtk.@"AccessibleRole.link"` role.
pub const LinkButton = opaque {
    pub const Parent = gtk.Button;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = LinkButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The URI bound to this button.
        pub const uri = struct {
            pub const name = "uri";

            pub const Type = ?[*:0]u8;
        };

        /// The 'visited' state of this button.
        ///
        /// A visited link is drawn in a different color.
        pub const visited = struct {
            pub const name = "visited";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted each time the `GtkLinkButton` is clicked.
        ///
        /// The default handler will call `gtk.FileLauncher.launch` with the URI
        /// stored inside the `gtk.LinkButton.properties.uri` property.
        ///
        /// To override the default behavior, you can connect to the
        /// ::activate-link signal and stop the propagation of the signal
        /// by returning `TRUE` from your handler.
        pub const activate_link = struct {
            pub const name = "activate-link";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(LinkButton, p_instance))),
                    gobject.signalLookup("activate-link", LinkButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkLinkButton` with the URI as its text.
    extern fn gtk_link_button_new(p_uri: [*:0]const u8) *gtk.LinkButton;
    pub const new = gtk_link_button_new;

    /// Creates a new `GtkLinkButton` containing a label.
    extern fn gtk_link_button_new_with_label(p_uri: [*:0]const u8, p_label: ?[*:0]const u8) *gtk.LinkButton;
    pub const newWithLabel = gtk_link_button_new_with_label;

    /// Retrieves the URI of the `GtkLinkButton`.
    extern fn gtk_link_button_get_uri(p_link_button: *LinkButton) [*:0]const u8;
    pub const getUri = gtk_link_button_get_uri;

    /// Retrieves the “visited” state of the `GtkLinkButton`.
    ///
    /// The button becomes visited when it is clicked. If the URI
    /// is changed on the button, the “visited” state is unset again.
    ///
    /// The state may also be changed using `gtk.LinkButton.setVisited`.
    extern fn gtk_link_button_get_visited(p_link_button: *LinkButton) c_int;
    pub const getVisited = gtk_link_button_get_visited;

    /// Sets `uri` as the URI where the `GtkLinkButton` points.
    ///
    /// As a side-effect this unsets the “visited” state of the button.
    extern fn gtk_link_button_set_uri(p_link_button: *LinkButton, p_uri: [*:0]const u8) void;
    pub const setUri = gtk_link_button_set_uri;

    /// Sets the “visited” state of the `GtkLinkButton`.
    ///
    /// See `gtk.LinkButton.getVisited` for more details.
    extern fn gtk_link_button_set_visited(p_link_button: *LinkButton, p_visited: c_int) void;
    pub const setVisited = gtk_link_button_set_visited;

    extern fn gtk_link_button_get_type() usize;
    pub const getGObjectType = gtk_link_button_get_type;

    extern fn g_object_ref(p_self: *gtk.LinkButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.LinkButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *LinkButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The abstract base class for GTK's list widgets.
///
/// # Shortcuts and Gestures
///
/// `GtkListBase` supports the following keyboard shortcuts:
///
/// - <kbd>Ctrl</kbd>+<kbd>A</kbd> or <kbd>Ctrl</kbd>+<kbd>&sol;</kbd>
///   selects all items.
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> or
///   <kbd>Ctrl</kbd>+<kbd>&bsol;</kbd> unselects all items.
///
/// The focused item is controlled by the navigation keys below, combined
/// with the <kbd>Ctrl</kbd> modifier to prevent moving the selection,
/// and the <kbd>Shift</kbd> modifier to extend the current selection.
///
/// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd> move the focus
///   on the next item in the designed direction.
/// - <kbd>Home</kbd> and <kbd>End</kbd> focus the first or last item.
/// - <kbd>PgUp</kbd> and <kbd>PgDn</kbd> move the focus one page up or down.
///
/// List item widgets support the following keyboard shortcuts:
///
/// - <kbd>Enter</kbd> activates the item.
/// - <kbd>␣</kbd> selects the item, with the same <kbd>Ctrl</kbd> and
///   <kbd>Shift</kbd> modifiers combinations as the navigation keys.
///
/// # Actions
///
/// `GtkListBase` defines a set of built-in actions:
///
/// - `list.scroll-to-item` moves the visible area to the item at given position
///   with the minimum amount of scrolling required. If the item is already
///   visible, nothing happens.
/// - `list.select-item` changes the selection.
/// - `list.select-all` selects all items in the model, if the selection model
///   supports it.
/// - `list.unselect-all` unselects all items in the model, if the selection
///   model supports it.
///
/// List item widgets install the following actions:
///
/// - `listitem.select` changes selection if the item is selectable.
/// - `listitem.scroll-to` moves the visible area of the list to this item with
///   the minimum amount of scrolling required.
pub const ListBase = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable, gtk.Scrollable };
    pub const Class = gtk.ListBaseClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The orientation of the list. See GtkOrientable:orientation
        /// for details.
        pub const orientation = struct {
            pub const name = "orientation";

            pub const Type = gtk.Orientation;
        };
    };

    pub const signals = struct {};

    extern fn gtk_list_base_get_type() usize;
    pub const getGObjectType = gtk_list_base_get_type;

    extern fn g_object_ref(p_self: *gtk.ListBase) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListBase) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListBase, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a vertical list.
///
/// <picture>
///   <source srcset="list-box-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkListBox" src="list-box.png">
/// </picture>
///
/// A `GtkListBox` only contains `GtkListBoxRow` children. These rows can
/// by dynamically sorted and filtered, and headers can be added dynamically
/// depending on the row content. It also allows keyboard and mouse navigation
/// and selection like a typical list.
///
/// Using `GtkListBox` is often an alternative to `GtkTreeView`, especially
/// when the list contents has a more complicated layout than what is allowed
/// by a `GtkCellRenderer`, or when the contents is interactive (i.e. has a
/// button in it).
///
/// Although a `GtkListBox` must have only `GtkListBoxRow` children, you can
/// add any kind of widget to it via `gtk.ListBox.prepend`,
/// `gtk.ListBox.append` and `gtk.ListBox.insert` and a
/// `GtkListBoxRow` widget will automatically be inserted between the list
/// and the widget.
///
/// `GtkListBoxRows` can be marked as activatable or selectable. If a row is
/// activatable, `gtk.ListBox.signals.row_activated` will be emitted for it when
/// the user tries to activate it. If it is selectable, the row will be marked
/// as selected when the user tries to select it.
///
/// # GtkListBox as GtkBuildable
///
/// The `GtkListBox` implementation of the `GtkBuildable` interface supports
/// setting a child as the placeholder by specifying “placeholder” as the “type”
/// attribute of a `<child>` element. See `gtk.ListBox.setPlaceholder`
/// for info.
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.ListBox.signals.move_cursor`
/// - `gtk.ListBox.signals.select_all`
/// - `gtk.ListBox.signals.toggle_cursor_row`
/// - `gtk.ListBox.signals.unselect_all`
///
/// # CSS nodes
///
/// ```
/// list[.separators][.rich-list][.navigation-sidebar][.boxed-list]
/// ╰── row[.activatable]
/// ```
///
/// `GtkListBox` uses a single CSS node named list. It may carry the .separators
/// style class, when the `gtk.ListBox.properties.show_separators` property is set.
/// Each `GtkListBoxRow` uses a single CSS node named row. The row nodes get the
/// .activatable style class added when appropriate.
///
/// It may also carry the .boxed-list style class. In this case, the list will be
/// automatically surrounded by a frame and have separators.
///
/// The main list node may also carry style classes to select
/// the style of [list presentation](section-list-widget.html`list`-styles):
/// .rich-list, .navigation-sidebar or .data-table.
///
/// # Accessibility
///
/// `GtkListBox` uses the `gtk.@"AccessibleRole.list"` role and `GtkListBoxRow` uses
/// the `gtk.@"AccessibleRole.list_item"` role.
pub const ListBox = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = ListBox;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to accept unpaired release events.
        pub const accept_unpaired_release = struct {
            pub const name = "accept-unpaired-release";

            pub const Type = c_int;
        };

        /// Determines whether children can be activated with a single
        /// click, or require a double-click.
        pub const activate_on_single_click = struct {
            pub const name = "activate-on-single-click";

            pub const Type = c_int;
        };

        /// The selection mode used by the list box.
        pub const selection_mode = struct {
            pub const name = "selection-mode";

            pub const Type = gtk.SelectionMode;
        };

        /// Whether to show separators between rows.
        pub const show_separators = struct {
            pub const name = "show-separators";

            pub const Type = c_int;
        };

        /// Behavior of the <kbd>Tab</kbd> key
        pub const tab_behavior = struct {
            pub const name = "tab-behavior";

            pub const Type = gtk.ListTabBehavior;
        };
    };

    pub const signals = struct {
        /// Emitted when the cursor row is activated.
        pub const activate_cursor_row = struct {
            pub const name = "activate-cursor-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("activate-cursor-row", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a cursor movement.
        ///
        /// The default bindings for this signal come in two variants, the variant with
        /// the Shift modifier extends the selection, the variant without the Shift
        /// modifier does not. There are too many key combinations to list them all
        /// here.
        ///
        /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
        ///   move by individual children
        /// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
        /// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, p_modify: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("move-cursor", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a row has been activated by the user.
        pub const row_activated = struct {
            pub const name = "row-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_row: *gtk.ListBoxRow, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("row-activated", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a new row is selected, or (with a `NULL` `row`)
        /// when the selection is cleared.
        ///
        /// When the `box` is using `GTK_SELECTION_MULTIPLE`, this signal will not
        /// give you the full picture of selection changes, and you should use
        /// the `gtk.ListBox.signals.selected_rows_changed` signal instead.
        pub const row_selected = struct {
            pub const name = "row-selected";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_row: ?*gtk.ListBoxRow, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("row-selected", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to select all children of the box, if the selection
        /// mode permits it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
        pub const select_all = struct {
            pub const name = "select-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("select-all", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the set of selected rows changes.
        pub const selected_rows_changed = struct {
            pub const name = "selected-rows-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("selected-rows-changed", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the cursor row is toggled.
        ///
        /// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>␣</kbd>.
        pub const toggle_cursor_row = struct {
            pub const name = "toggle-cursor-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("toggle-cursor-row", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to unselect all children of the box, if the selection
        /// mode permits it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is
        /// <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
        pub const unselect_all = struct {
            pub const name = "unselect-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBox, p_instance))),
                    gobject.signalLookup("unselect-all", ListBox.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkListBox` container.
    extern fn gtk_list_box_new() *gtk.ListBox;
    pub const new = gtk_list_box_new;

    /// Append a widget to the list.
    ///
    /// If a sort function is set, the widget will
    /// actually be inserted at the calculated position.
    extern fn gtk_list_box_append(p_box: *ListBox, p_child: *gtk.Widget) void;
    pub const append = gtk_list_box_append;

    /// Binds `model` to `box`.
    ///
    /// If `box` was already bound to a model, that previous binding is
    /// destroyed.
    ///
    /// The contents of `box` are cleared and then filled with widgets that
    /// represent items from `model`. `box` is updated whenever `model` changes.
    /// If `model` is `NULL`, `box` is left empty.
    ///
    /// It is undefined to add or remove widgets directly (for example, with
    /// `gtk.ListBox.insert`) while `box` is bound to a model.
    ///
    /// Note that using a model is incompatible with the filtering and sorting
    /// functionality in `GtkListBox`. When using a model, filtering and sorting
    /// should be implemented by the model.
    extern fn gtk_list_box_bind_model(p_box: *ListBox, p_model: ?*gio.ListModel, p_create_widget_func: ?gtk.ListBoxCreateWidgetFunc, p_user_data: ?*anyopaque, p_user_data_free_func: ?glib.DestroyNotify) void;
    pub const bindModel = gtk_list_box_bind_model;

    /// Add a drag highlight to a row.
    ///
    /// This is a helper function for implementing DnD onto a `GtkListBox`.
    /// The passed in `row` will be highlighted by setting the
    /// `GTK_STATE_FLAG_DROP_ACTIVE` state and any previously highlighted
    /// row will be unhighlighted.
    ///
    /// The row will also be unhighlighted when the widget gets
    /// a drag leave event.
    extern fn gtk_list_box_drag_highlight_row(p_box: *ListBox, p_row: *gtk.ListBoxRow) void;
    pub const dragHighlightRow = gtk_list_box_drag_highlight_row;

    /// If a row has previously been highlighted via `gtk.ListBox.dragHighlightRow`,
    /// it will have the highlight removed.
    extern fn gtk_list_box_drag_unhighlight_row(p_box: *ListBox) void;
    pub const dragUnhighlightRow = gtk_list_box_drag_unhighlight_row;

    /// Returns whether rows activate on single clicks.
    extern fn gtk_list_box_get_activate_on_single_click(p_box: *ListBox) c_int;
    pub const getActivateOnSingleClick = gtk_list_box_get_activate_on_single_click;

    /// Gets the adjustment (if any) that the widget uses to
    /// for vertical scrolling.
    extern fn gtk_list_box_get_adjustment(p_box: *ListBox) ?*gtk.Adjustment;
    pub const getAdjustment = gtk_list_box_get_adjustment;

    /// Gets the n-th child in the list (not counting headers).
    ///
    /// If `index_` is negative or larger than the number of items in the
    /// list, `NULL` is returned.
    extern fn gtk_list_box_get_row_at_index(p_box: *ListBox, p_index_: c_int) ?*gtk.ListBoxRow;
    pub const getRowAtIndex = gtk_list_box_get_row_at_index;

    /// Gets the row at the `y` position.
    extern fn gtk_list_box_get_row_at_y(p_box: *ListBox, p_y: c_int) ?*gtk.ListBoxRow;
    pub const getRowAtY = gtk_list_box_get_row_at_y;

    /// Gets the selected row, or `NULL` if no rows are selected.
    ///
    /// Note that the box may allow multiple selection, in which
    /// case you should use `gtk.ListBox.selectedForeach` to
    /// find all selected rows.
    extern fn gtk_list_box_get_selected_row(p_box: *ListBox) ?*gtk.ListBoxRow;
    pub const getSelectedRow = gtk_list_box_get_selected_row;

    /// Creates a list of all selected children.
    extern fn gtk_list_box_get_selected_rows(p_box: *ListBox) *glib.List;
    pub const getSelectedRows = gtk_list_box_get_selected_rows;

    /// Gets the selection mode of the listbox.
    extern fn gtk_list_box_get_selection_mode(p_box: *ListBox) gtk.SelectionMode;
    pub const getSelectionMode = gtk_list_box_get_selection_mode;

    /// Returns whether the list box should show separators
    /// between rows.
    extern fn gtk_list_box_get_show_separators(p_box: *ListBox) c_int;
    pub const getShowSeparators = gtk_list_box_get_show_separators;

    /// Returns the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
    extern fn gtk_list_box_get_tab_behavior(p_box: *ListBox) gtk.ListTabBehavior;
    pub const getTabBehavior = gtk_list_box_get_tab_behavior;

    /// Insert the `child` into the `box` at `position`.
    ///
    /// If a sort function is
    /// set, the widget will actually be inserted at the calculated position.
    ///
    /// If `position` is -1, or larger than the total number of items in the
    /// `box`, then the `child` will be appended to the end.
    extern fn gtk_list_box_insert(p_box: *ListBox, p_child: *gtk.Widget, p_position: c_int) void;
    pub const insert = gtk_list_box_insert;

    /// Update the filtering for all rows.
    ///
    /// Call this when result
    /// of the filter function on the `box` is changed due
    /// to an external factor. For instance, this would be used
    /// if the filter function just looked for a specific search
    /// string and the entry with the search string has changed.
    extern fn gtk_list_box_invalidate_filter(p_box: *ListBox) void;
    pub const invalidateFilter = gtk_list_box_invalidate_filter;

    /// Update the separators for all rows.
    ///
    /// Call this when result
    /// of the header function on the `box` is changed due
    /// to an external factor.
    extern fn gtk_list_box_invalidate_headers(p_box: *ListBox) void;
    pub const invalidateHeaders = gtk_list_box_invalidate_headers;

    /// Update the sorting for all rows.
    ///
    /// Call this when result
    /// of the sort function on the `box` is changed due
    /// to an external factor.
    extern fn gtk_list_box_invalidate_sort(p_box: *ListBox) void;
    pub const invalidateSort = gtk_list_box_invalidate_sort;

    /// Prepend a widget to the list.
    ///
    /// If a sort function is set, the widget will
    /// actually be inserted at the calculated position.
    extern fn gtk_list_box_prepend(p_box: *ListBox, p_child: *gtk.Widget) void;
    pub const prepend = gtk_list_box_prepend;

    /// Removes a child from `box`.
    extern fn gtk_list_box_remove(p_box: *ListBox, p_child: *gtk.Widget) void;
    pub const remove = gtk_list_box_remove;

    /// Removes all rows from `box`.
    ///
    /// This function does nothing if `box` is backed by a model.
    extern fn gtk_list_box_remove_all(p_box: *ListBox) void;
    pub const removeAll = gtk_list_box_remove_all;

    /// Select all children of `box`, if the selection mode allows it.
    extern fn gtk_list_box_select_all(p_box: *ListBox) void;
    pub const selectAll = gtk_list_box_select_all;

    /// Make `row` the currently selected row.
    extern fn gtk_list_box_select_row(p_box: *ListBox, p_row: ?*gtk.ListBoxRow) void;
    pub const selectRow = gtk_list_box_select_row;

    /// Calls a function for each selected child.
    ///
    /// Note that the selection cannot be modified from within this function.
    extern fn gtk_list_box_selected_foreach(p_box: *ListBox, p_func: gtk.ListBoxForeachFunc, p_data: ?*anyopaque) void;
    pub const selectedForeach = gtk_list_box_selected_foreach;

    /// If `single` is `TRUE`, rows will be activated when you click on them,
    /// otherwise you need to double-click.
    extern fn gtk_list_box_set_activate_on_single_click(p_box: *ListBox, p_single: c_int) void;
    pub const setActivateOnSingleClick = gtk_list_box_set_activate_on_single_click;

    /// Sets the adjustment (if any) that the widget uses to
    /// for vertical scrolling.
    ///
    /// For instance, this is used to get the page size for
    /// PageUp/Down key handling.
    ///
    /// In the normal case when the `box` is packed inside
    /// a `GtkScrolledWindow` the adjustment from that will
    /// be picked up automatically, so there is no need
    /// to manually do that.
    extern fn gtk_list_box_set_adjustment(p_box: *ListBox, p_adjustment: ?*gtk.Adjustment) void;
    pub const setAdjustment = gtk_list_box_set_adjustment;

    /// By setting a filter function on the `box` one can decide dynamically which
    /// of the rows to show.
    ///
    /// For instance, to implement a search function on a list that
    /// filters the original list to only show the matching rows.
    ///
    /// The `filter_func` will be called for each row after the call, and
    /// it will continue to be called each time a row changes (via
    /// `gtk.ListBoxRow.changed`) or when `gtk.ListBox.invalidateFilter`
    /// is called.
    ///
    /// Note that using a filter function is incompatible with using a model
    /// (see `gtk.ListBox.bindModel`).
    extern fn gtk_list_box_set_filter_func(p_box: *ListBox, p_filter_func: ?gtk.ListBoxFilterFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setFilterFunc = gtk_list_box_set_filter_func;

    /// Sets a header function.
    ///
    /// By setting a header function on the `box` one can dynamically add headers
    /// in front of rows, depending on the contents of the row and its position
    /// in the list.
    ///
    /// For instance, one could use it to add headers in front of the first item
    /// of a new kind, in a list sorted by the kind.
    ///
    /// The `update_header` can look at the current header widget using
    /// `gtk.ListBoxRow.getHeader` and either update the state of the widget
    /// as needed, or set a new one using `gtk.ListBoxRow.setHeader`. If no
    /// header is needed, set the header to `NULL`.
    ///
    /// Note that you may get many calls `update_header` to this for a particular
    /// row when e.g. changing things that don’t affect the header. In this case
    /// it is important for performance to not blindly replace an existing header
    /// with an identical one.
    ///
    /// The `update_header` function will be called for each row after the call,
    /// and it will continue to be called each time a row changes (via
    /// `gtk.ListBoxRow.changed`) and when the row before changes (either
    /// by `gtk.ListBoxRow.changed` on the previous row, or when the previous
    /// row becomes a different row). It is also called for all rows when
    /// `gtk.ListBox.invalidateHeaders` is called.
    extern fn gtk_list_box_set_header_func(p_box: *ListBox, p_update_header: ?gtk.ListBoxUpdateHeaderFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setHeaderFunc = gtk_list_box_set_header_func;

    /// Sets the placeholder widget that is shown in the list when
    /// it doesn't display any visible children.
    extern fn gtk_list_box_set_placeholder(p_box: *ListBox, p_placeholder: ?*gtk.Widget) void;
    pub const setPlaceholder = gtk_list_box_set_placeholder;

    /// Sets how selection works in the listbox.
    extern fn gtk_list_box_set_selection_mode(p_box: *ListBox, p_mode: gtk.SelectionMode) void;
    pub const setSelectionMode = gtk_list_box_set_selection_mode;

    /// Sets whether the list box should show separators
    /// between rows.
    extern fn gtk_list_box_set_show_separators(p_box: *ListBox, p_show_separators: c_int) void;
    pub const setShowSeparators = gtk_list_box_set_show_separators;

    /// Sets a sort function.
    ///
    /// By setting a sort function on the `box` one can dynamically reorder
    /// the rows of the list, based on the contents of the rows.
    ///
    /// The `sort_func` will be called for each row after the call, and will
    /// continue to be called each time a row changes (via
    /// `gtk.ListBoxRow.changed`) and when `gtk.ListBox.invalidateSort`
    /// is called.
    ///
    /// Note that using a sort function is incompatible with using a model
    /// (see `gtk.ListBox.bindModel`).
    extern fn gtk_list_box_set_sort_func(p_box: *ListBox, p_sort_func: ?gtk.ListBoxSortFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setSortFunc = gtk_list_box_set_sort_func;

    /// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
    extern fn gtk_list_box_set_tab_behavior(p_box: *ListBox, p_behavior: gtk.ListTabBehavior) void;
    pub const setTabBehavior = gtk_list_box_set_tab_behavior;

    /// Unselect all children of `box`, if the selection mode allows it.
    extern fn gtk_list_box_unselect_all(p_box: *ListBox) void;
    pub const unselectAll = gtk_list_box_unselect_all;

    /// Unselects a single row of `box`, if the selection mode allows it.
    extern fn gtk_list_box_unselect_row(p_box: *ListBox, p_row: *gtk.ListBoxRow) void;
    pub const unselectRow = gtk_list_box_unselect_row;

    extern fn gtk_list_box_get_type() usize;
    pub const getGObjectType = gtk_list_box_get_type;

    extern fn g_object_ref(p_self: *gtk.ListBox) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListBox) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListBox, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The kind of widget that can be added to a `GtkListBox`.
///
/// `gtk.ListBox` will automatically wrap its children in a `GtkListboxRow`
/// when necessary.
pub const ListBoxRow = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.ListBoxRowClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const activate = struct {
            pub fn call(p_class: anytype, p_row: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(ListBoxRow.Class, p_class).f_activate.?(gobject.ext.as(ListBoxRow, p_row));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_row: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(ListBoxRow.Class, p_class).f_activate = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Determines whether the ::row-activated
        /// signal will be emitted for this row.
        pub const activatable = struct {
            pub const name = "activatable";

            pub const Type = c_int;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Determines whether this row can be selected.
        pub const selectable = struct {
            pub const name = "selectable";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// This is a keybinding signal, which will cause this row to be activated.
        ///
        /// If you want to be notified when the user activates a row (by key or not),
        /// use the `gtk.ListBox.signals.row_activated` signal on the row’s parent
        /// `GtkListBox`.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListBoxRow, p_instance))),
                    gobject.signalLookup("activate", ListBoxRow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkListBoxRow`.
    extern fn gtk_list_box_row_new() *gtk.ListBoxRow;
    pub const new = gtk_list_box_row_new;

    /// Marks `row` as changed, causing any state that depends on this
    /// to be updated.
    ///
    /// This affects sorting, filtering and headers.
    ///
    /// Note that calls to this method must be in sync with the data
    /// used for the row functions. For instance, if the list is
    /// mirroring some external data set, and *two* rows changed in the
    /// external data set then when you call `gtk.ListBoxRow.changed`
    /// on the first row the sort function must only read the new data
    /// for the first of the two changed rows, otherwise the resorting
    /// of the rows will be wrong.
    ///
    /// This generally means that if you don’t fully control the data
    /// model you have to duplicate the data that affects the listbox
    /// row functions into the row widgets themselves. Another alternative
    /// is to call `gtk.ListBox.invalidateSort` on any model change,
    /// but that is more expensive.
    extern fn gtk_list_box_row_changed(p_row: *ListBoxRow) void;
    pub const changed = gtk_list_box_row_changed;

    /// Gets whether the row is activatable.
    extern fn gtk_list_box_row_get_activatable(p_row: *ListBoxRow) c_int;
    pub const getActivatable = gtk_list_box_row_get_activatable;

    /// Gets the child widget of `row`.
    extern fn gtk_list_box_row_get_child(p_row: *ListBoxRow) ?*gtk.Widget;
    pub const getChild = gtk_list_box_row_get_child;

    /// Returns the current header of the `row`.
    ///
    /// This can be used
    /// in a `gtk.ListBoxUpdateHeaderFunc` to see if
    /// there is a header set already, and if so to update
    /// the state of it.
    extern fn gtk_list_box_row_get_header(p_row: *ListBoxRow) ?*gtk.Widget;
    pub const getHeader = gtk_list_box_row_get_header;

    /// Gets the current index of the `row` in its `GtkListBox` container.
    extern fn gtk_list_box_row_get_index(p_row: *ListBoxRow) c_int;
    pub const getIndex = gtk_list_box_row_get_index;

    /// Gets whether the row can be selected.
    extern fn gtk_list_box_row_get_selectable(p_row: *ListBoxRow) c_int;
    pub const getSelectable = gtk_list_box_row_get_selectable;

    /// Returns whether the child is currently selected in its
    /// `GtkListBox` container.
    extern fn gtk_list_box_row_is_selected(p_row: *ListBoxRow) c_int;
    pub const isSelected = gtk_list_box_row_is_selected;

    /// Set whether the row is activatable.
    extern fn gtk_list_box_row_set_activatable(p_row: *ListBoxRow, p_activatable: c_int) void;
    pub const setActivatable = gtk_list_box_row_set_activatable;

    /// Sets the child widget of `self`.
    extern fn gtk_list_box_row_set_child(p_row: *ListBoxRow, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_list_box_row_set_child;

    /// Sets the current header of the `row`.
    ///
    /// This is only allowed to be called
    /// from a `gtk.ListBoxUpdateHeaderFunc`.
    /// It will replace any existing header in the row,
    /// and be shown in front of the row in the listbox.
    extern fn gtk_list_box_row_set_header(p_row: *ListBoxRow, p_header: ?*gtk.Widget) void;
    pub const setHeader = gtk_list_box_row_set_header;

    /// Set whether the row can be selected.
    extern fn gtk_list_box_row_set_selectable(p_row: *ListBoxRow, p_selectable: c_int) void;
    pub const setSelectable = gtk_list_box_row_set_selectable;

    extern fn gtk_list_box_row_get_type() usize;
    pub const getGObjectType = gtk_list_box_row_get_type;

    extern fn g_object_ref(p_self: *gtk.ListBoxRow) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListBoxRow) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListBoxRow, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used by list widgets to represent the headers they display.
///
/// `GtkListHeader` objects are managed just like `gtk.ListItem`
/// objects via their factory, but provide a different set of properties suitable
/// for managing the header instead of individual items.
pub const ListHeader = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ListHeaderClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Widget used for display.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The first position no longer part of this section.
        pub const end = struct {
            pub const name = "end";

            pub const Type = c_uint;
        };

        /// The item at the start of the section.
        pub const item = struct {
            pub const name = "item";

            pub const Type = ?*gobject.Object;
        };

        /// Number of items in this section.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// First position of items in this section.
        pub const start = struct {
            pub const name = "start";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Gets the child previously set via `gtk.ListHeader.setChild` or
    /// `NULL` if none was set.
    extern fn gtk_list_header_get_child(p_self: *ListHeader) ?*gtk.Widget;
    pub const getChild = gtk_list_header_get_child;

    /// Gets the end position in the model of the section that `self` is
    /// currently the header for.
    ///
    /// If `self` is unbound, `GTK_INVALID_LIST_POSITION` is returned.
    extern fn gtk_list_header_get_end(p_self: *ListHeader) c_uint;
    pub const getEnd = gtk_list_header_get_end;

    /// Gets the model item at the start of the section.
    /// This is the item that occupies the list model at position
    /// `gtk.ListHeader.properties.start`.
    ///
    /// If `self` is unbound, this function returns `NULL`.
    extern fn gtk_list_header_get_item(p_self: *ListHeader) ?*gobject.Object;
    pub const getItem = gtk_list_header_get_item;

    /// Gets the the number of items in the section.
    ///
    /// If `self` is unbound, 0 is returned.
    extern fn gtk_list_header_get_n_items(p_self: *ListHeader) c_uint;
    pub const getNItems = gtk_list_header_get_n_items;

    /// Gets the start position in the model of the section that `self` is
    /// currently the header for.
    ///
    /// If `self` is unbound, `GTK_INVALID_LIST_POSITION` is returned.
    extern fn gtk_list_header_get_start(p_self: *ListHeader) c_uint;
    pub const getStart = gtk_list_header_get_start;

    /// Sets the child to be used for this listitem.
    ///
    /// This function is typically called by applications when
    /// setting up a header so that the widget can be reused when
    /// binding it multiple times.
    extern fn gtk_list_header_set_child(p_self: *ListHeader, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_list_header_set_child;

    extern fn gtk_list_header_get_type() usize;
    pub const getGObjectType = gtk_list_header_get_type;

    extern fn g_object_ref(p_self: *gtk.ListHeader) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListHeader) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListHeader, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used by list widgets to represent items in a `gio.ListModel`.
///
/// `GtkListItem` objects are managed by the list widget (with its factory)
/// and cannot be created by applications, but they need to be populated
/// by application code. This is done by calling `gtk.ListItem.setChild`.
///
/// `GtkListItem` objects exist in 2 stages:
///
/// 1. The unbound stage where the listitem is not currently connected to
///    an item in the list. In that case, the `gtk.ListItem.properties.item`
///    property is set to `NULL`.
///
/// 2. The bound stage where the listitem references an item from the list.
///    The `gtk.ListItem.properties.item` property is not `NULL`.
pub const ListItem = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ListItemClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The accessible description to set on the listitem.
        pub const accessible_description = struct {
            pub const name = "accessible-description";

            pub const Type = ?[*:0]u8;
        };

        /// The accessible label to set on the listitem.
        pub const accessible_label = struct {
            pub const name = "accessible-label";

            pub const Type = ?[*:0]u8;
        };

        /// If the item can be activated by the user.
        pub const activatable = struct {
            pub const name = "activatable";

            pub const Type = c_int;
        };

        /// Widget used for display.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// If the item can be focused with the keyboard.
        pub const focusable = struct {
            pub const name = "focusable";

            pub const Type = c_int;
        };

        /// Displayed item.
        pub const item = struct {
            pub const name = "item";

            pub const Type = ?*gobject.Object;
        };

        /// Position of the item.
        pub const position = struct {
            pub const name = "position";

            pub const Type = c_uint;
        };

        /// If the item can be selected by the user.
        pub const selectable = struct {
            pub const name = "selectable";

            pub const Type = c_int;
        };

        /// If the item is currently selected.
        pub const selected = struct {
            pub const name = "selected";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Gets the accessible description of `self`.
    extern fn gtk_list_item_get_accessible_description(p_self: *ListItem) [*:0]const u8;
    pub const getAccessibleDescription = gtk_list_item_get_accessible_description;

    /// Gets the accessible label of `self`.
    extern fn gtk_list_item_get_accessible_label(p_self: *ListItem) [*:0]const u8;
    pub const getAccessibleLabel = gtk_list_item_get_accessible_label;

    /// Checks if a listitem has been set to be activatable via
    /// `gtk.ListItem.setActivatable`.
    extern fn gtk_list_item_get_activatable(p_self: *ListItem) c_int;
    pub const getActivatable = gtk_list_item_get_activatable;

    /// Gets the child previously set via `gtk.ListItem.setChild`
    /// or `NULL` if none was set.
    extern fn gtk_list_item_get_child(p_self: *ListItem) ?*gtk.Widget;
    pub const getChild = gtk_list_item_get_child;

    /// Checks if a listitem has been set to be focusable via
    /// `gtk.ListItem.setFocusable`.
    extern fn gtk_list_item_get_focusable(p_self: *ListItem) c_int;
    pub const getFocusable = gtk_list_item_get_focusable;

    /// Gets the model item that associated with `self`.
    ///
    /// If `self` is unbound, this function returns `NULL`.
    extern fn gtk_list_item_get_item(p_self: *ListItem) ?*gobject.Object;
    pub const getItem = gtk_list_item_get_item;

    /// Gets the position in the model that `self` currently displays.
    ///
    /// If `self` is unbound, `GTK_INVALID_LIST_POSITION` is returned.
    extern fn gtk_list_item_get_position(p_self: *ListItem) c_uint;
    pub const getPosition = gtk_list_item_get_position;

    /// Checks if a listitem has been set to be selectable via
    /// `gtk.ListItem.setSelectable`.
    ///
    /// Do not confuse this function with `gtk.ListItem.getSelected`.
    extern fn gtk_list_item_get_selectable(p_self: *ListItem) c_int;
    pub const getSelectable = gtk_list_item_get_selectable;

    /// Checks if the item is displayed as selected.
    ///
    /// The selected state is maintained by the list widget and its model
    /// and cannot be set otherwise.
    extern fn gtk_list_item_get_selected(p_self: *ListItem) c_int;
    pub const getSelected = gtk_list_item_get_selected;

    /// Sets the accessible description for the listitem.
    ///
    /// The accessible description may be used by e.g. screen readers.
    extern fn gtk_list_item_set_accessible_description(p_self: *ListItem, p_description: [*:0]const u8) void;
    pub const setAccessibleDescription = gtk_list_item_set_accessible_description;

    /// Sets the accessible label for the listitem.
    ///
    /// The accessible label may be used by e.g. screen readers.
    extern fn gtk_list_item_set_accessible_label(p_self: *ListItem, p_label: [*:0]const u8) void;
    pub const setAccessibleLabel = gtk_list_item_set_accessible_label;

    /// Sets `self` to be activatable.
    ///
    /// If an item is activatable, double-clicking on the item, using
    /// the Return key or calling `gtk.Widget.activate` will activate
    /// the item. Activating instructs the containing view to handle
    /// activation. `GtkListView` for example will be emitting the
    /// `gtk.ListView.signals.activate` signal.
    ///
    /// By default, listitems are activatable.
    extern fn gtk_list_item_set_activatable(p_self: *ListItem, p_activatable: c_int) void;
    pub const setActivatable = gtk_list_item_set_activatable;

    /// Sets the child to be used for this listitem.
    ///
    /// This function is typically called by applications when
    /// setting up a listitem so that the widget can be reused when
    /// binding it multiple times.
    extern fn gtk_list_item_set_child(p_self: *ListItem, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_list_item_set_child;

    /// Sets `self` to be focusable.
    ///
    /// If an item is focusable, it can be focused using the keyboard.
    /// This works similar to `gtk.Widget.setFocusable`.
    ///
    /// Note that if items are not focusable, the keyboard cannot be used to activate
    /// them and selecting only works if one of the listitem's children is focusable.
    ///
    /// By default, listitems are focusable.
    extern fn gtk_list_item_set_focusable(p_self: *ListItem, p_focusable: c_int) void;
    pub const setFocusable = gtk_list_item_set_focusable;

    /// Sets `self` to be selectable.
    ///
    /// If an item is selectable, clicking on the item or using the keyboard
    /// will try to select or unselect the item. If this succeeds is up to
    /// the model to determine, as it is managing the selected state.
    ///
    /// Note that this means that making an item non-selectable has no
    /// influence on the selected state at all. A non-selectable item
    /// may still be selected.
    ///
    /// By default, listitems are selectable. When rebinding them to
    /// a new item, they will also be reset to be selectable by GTK.
    extern fn gtk_list_item_set_selectable(p_self: *ListItem, p_selectable: c_int) void;
    pub const setSelectable = gtk_list_item_set_selectable;

    extern fn gtk_list_item_get_type() usize;
    pub const getGObjectType = gtk_list_item_get_type;

    extern fn g_object_ref(p_self: *gtk.ListItem) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListItem) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListItem, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Creates widgets for the items taken from a `GListModel`.
///
/// This is one of the core concepts of handling list widgets such
/// as `gtk.ListView` or `gtk.GridView`.
///
/// The `GtkListItemFactory` is tasked with creating widgets for items
/// taken from the model when the views need them and updating them as
/// the items displayed by the view change.
///
/// A view is usually only able to display anything after both a factory
/// and a model have been set on the view. So it is important that you do
/// not skip this step when setting up your first view.
///
/// Because views do not display the whole list at once but only a few
/// items, they only need to maintain a few widgets at a time. They will
/// instruct the `GtkListItemFactory` to create these widgets and bind them
/// to the items that are currently displayed.
///
/// As the list model changes or the user scrolls to the list, the items will
/// change and the view will instruct the factory to bind the widgets to those
/// new items.
///
/// The actual widgets used for displaying those widgets is provided by you.
///
/// When the factory needs widgets created, it will create a `GtkListItem`
/// and hand it to your code to set up a widget for. This list item will provide
/// various properties with information about what item to display and provide
/// you with some opportunities to configure its behavior. See the
/// `gtk.ListItem` documentation for further details.
///
/// Various implementations of `GtkListItemFactory` exist to allow you different
/// ways to provide those widgets. The most common implementations are
/// `gtk.BuilderListItemFactory` which takes a `GtkBuilder` .ui file
/// and then creates widgets and manages everything automatically from the
/// information in that file and `gtk.SignalListItemFactory` which allows
/// you to connect to signals with your own code and retain full control over
/// how the widgets are setup and managed.
///
/// A `GtkListItemFactory` is supposed to be final - that means its behavior should
/// not change and the first widget created from it should behave the same way as
/// the last widget created from it.
/// If you intend to do changes to the behavior, it is recommended that you create
/// a new `GtkListItemFactory` which will allow the views to recreate its widgets.
///
/// Once you have chosen your factory and created it, you need to set it on the view
/// widget you want to use it with, such as via `gtk.ListView.setFactory`.
/// Reusing factories across different views is allowed, but very uncommon.
pub const ListItemFactory = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ListItemFactoryClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_list_item_factory_get_type() usize;
    pub const getGObjectType = gtk_list_item_factory_get_type;

    extern fn g_object_ref(p_self: *gtk.ListItemFactory) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListItemFactory) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListItemFactory, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list-like data structure that can be used with the `gtk.TreeView`.
///
/// The `GtkListStore` object is a list model for use with a `GtkTreeView`
/// widget.  It implements the `GtkTreeModel` interface, and consequentialy,
/// can use all of the methods available there.  It also implements the
/// `GtkTreeSortable` interface so it can be sorted by the view.
/// Finally, it also implements the tree
/// [drag](iface.TreeDragSource.html) and [drop](iface.TreeDragDest.html)
/// interfaces.
///
/// The `GtkListStore` can accept most `GType`s as a column type, though
/// it can’t accept all custom types.  Internally, it will keep a copy of
/// data passed in (such as a string or a boxed pointer).  Columns that
/// accept `GObject`s are handled a little differently.  The
/// `GtkListStore` will keep a reference to the object instead of copying the
/// value.  As a result, if the object is modified, it is up to the
/// application writer to call `gtk.TreeModel.rowChanged` to emit the
/// `gtk.TreeModel.signals.row_changed` signal. This most commonly affects lists
/// with `gdk.Texture`s stored.
///
/// An example for creating a simple list store:
///
/// ```c
/// enum {
///   COLUMN_STRING,
///   COLUMN_INT,
///   COLUMN_BOOLEAN,
///   N_COLUMNS
/// };
///
/// {
///   GtkListStore *list_store;
///   GtkTreePath *path;
///   GtkTreeIter iter;
///   int i;
///
///   list_store = gtk_list_store_new (N_COLUMNS,
///                                    G_TYPE_STRING,
///                                    G_TYPE_INT,
///                                    G_TYPE_BOOLEAN);
///
///   for (i = 0; i < 10; i++)
///     {
///       char *some_data;
///
///       some_data = get_some_data (i);
///
///       // Add a new row to the model
///       gtk_list_store_append (list_store, &iter);
///       gtk_list_store_set (list_store, &iter,
///                           COLUMN_STRING, some_data,
///                           COLUMN_INT, i,
///                           COLUMN_BOOLEAN,  FALSE,
///                           -1);
///
///       // As the store will keep a copy of the string internally,
///       // we free some_data.
///       g_free (some_data);
///     }
///
///   // Modify a particular row
///   path = gtk_tree_path_new_from_string ("4");
///   gtk_tree_model_get_iter (GTK_TREE_MODEL (list_store),
///                            &iter,
///                            path);
///   gtk_tree_path_free (path);
///   gtk_list_store_set (list_store, &iter,
///                       COLUMN_BOOLEAN, TRUE,
///                       -1);
/// }
/// ```
///
/// `GtkListStore` is deprecated since GTK 4.10, and should not be used in newly
/// written code. You should use `gio.ListStore` instead, and the various
/// list models provided by GTK.
///
/// ## Performance Considerations
///
/// Internally, the `GtkListStore` was originally implemented with a linked list
/// with a tail pointer.  As a result, it was fast at data insertion and deletion,
/// and not fast at random data access.  The `GtkListStore` sets the
/// `GTK_TREE_MODEL_ITERS_PERSIST` flag, which means that `GtkTreeIter`s can be
/// cached while the row exists.  Thus, if access to a particular row is needed
/// often and your code is expected to run on older versions of GTK, it is worth
/// keeping the iter around.
///
/// ## Atomic Operations
///
/// It is important to note that only the methods
/// `gtk.ListStore.insertWithValues` and `gtk.ListStore.insertWithValuesv`
/// are atomic, in the sense that the row is being appended to the store and the
/// values filled in in a single operation with regard to `GtkTreeModel` signaling.
/// In contrast, using e.g. `gtk.ListStore.append` and then `gtk.ListStore.set`
/// will first create a row, which triggers the `GtkTreeModel::row-inserted` signal
/// on `GtkListStore`. The row, however, is still empty, and any signal handler
/// connecting to `GtkTreeModel::row-inserted` on this particular store should be prepared
/// for the situation that the row might be empty. This is especially important
/// if you are wrapping the `GtkListStore` inside a `GtkTreeModel`Filter and are
/// using a `GtkTreeModel`FilterVisibleFunc. Using any of the non-atomic operations
/// to append rows to the `GtkListStore` will cause the
/// `GtkTreeModel`FilterVisibleFunc to be visited with an empty row first; the
/// function must be prepared for that.
///
/// ## GtkListStore as GtkBuildable
///
/// The GtkListStore implementation of the `gtk.Buildable` interface allows
/// to specify the model columns with a `<columns>` element that may contain
/// multiple `<column>` elements, each specifying one model column. The “type”
/// attribute specifies the data type for the column.
///
/// Additionally, it is possible to specify content for the list store
/// in the UI definition, with the `<data>` element. It can contain multiple
/// `<row>` elements, each specifying to content for one row of the list model.
/// Inside a `<row>`, the `<col>` elements specify the content for individual cells.
///
/// Note that it is probably more common to define your models in the code,
/// and one might consider it a layering violation to specify the content of
/// a list store in a UI definition, data, not presentation, and common wisdom
/// is to separate the two, as far as possible.
///
/// An example of a UI Definition fragment for a list store:
///
/// ```xml
/// <object class="GtkListStore">
///   <columns>
///     <column type="gchararray"/>
///     <column type="gchararray"/>
///     <column type="gint"/>
///   </columns>
///   <data>
///     <row>
///       <col id="0">John</col>
///       <col id="1">Doe</col>
///       <col id="2">25</col>
///     </row>
///     <row>
///       <col id="0">Johan</col>
///       <col id="1">Dahlin</col>
///       <col id="2">50</col>
///     </row>
///   </data>
/// </object>
/// ```
pub const ListStore = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gtk.Buildable, gtk.TreeDragDest, gtk.TreeDragSource, gtk.TreeModel, gtk.TreeSortable };
    pub const Class = gtk.ListStoreClass;
    f_parent: gobject.Object,
    f_priv: ?*gtk.ListStorePrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new list store.
    ///
    /// The list store will have `n_columns` columns, with each column using
    /// the given type passed to this function.
    ///
    ///
    /// Note that only types derived from standard GObject fundamental types
    /// are supported.
    ///
    /// As an example:
    ///
    /// ```c
    /// gtk_list_store_new (3, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_TEXTURE);
    /// ```
    ///
    /// will create a new `GtkListStore` with three columns, of type `int`,
    /// `gchararray` and `GdkTexture`, respectively.
    extern fn gtk_list_store_new(p_n_columns: c_int, ...) *gtk.ListStore;
    pub const new = gtk_list_store_new;

    /// Creates a new `GtkListStore`.
    ///
    /// This function is meant to be used by language bindings.
    extern fn gtk_list_store_newv(p_n_columns: c_int, p_types: [*]usize) *gtk.ListStore;
    pub const newv = gtk_list_store_newv;

    /// Appends a new row to `list_store`.  `iter` will be changed to point to this new
    /// row.  The row will be empty after this function is called.  To fill in
    /// values, you need to call `gtk.ListStore.set` or `gtk.ListStore.setValue`.
    extern fn gtk_list_store_append(p_list_store: *ListStore, p_iter: *gtk.TreeIter) void;
    pub const append = gtk_list_store_append;

    /// Removes all rows from the list store.
    extern fn gtk_list_store_clear(p_list_store: *ListStore) void;
    pub const clear = gtk_list_store_clear;

    /// Creates a new row at `position`.  `iter` will be changed to point to this new
    /// row.  If `position` is -1 or is larger than the number of rows on the list,
    /// then the new row will be appended to the list. The row will be empty after
    /// this function is called.  To fill in values, you need to call
    /// `gtk.ListStore.set` or `gtk.ListStore.setValue`.
    extern fn gtk_list_store_insert(p_list_store: *ListStore, p_iter: *gtk.TreeIter, p_position: c_int) void;
    pub const insert = gtk_list_store_insert;

    /// Inserts a new row after `sibling`. If `sibling` is `NULL`, then the row will be
    /// prepended to the beginning of the list. `iter` will be changed to point to
    /// this new row. The row will be empty after this function is called. To fill
    /// in values, you need to call `gtk.ListStore.set` or `gtk.ListStore.setValue`.
    extern fn gtk_list_store_insert_after(p_list_store: *ListStore, p_iter: *gtk.TreeIter, p_sibling: ?*gtk.TreeIter) void;
    pub const insertAfter = gtk_list_store_insert_after;

    /// Inserts a new row before `sibling`. If `sibling` is `NULL`, then the row will
    /// be appended to the end of the list. `iter` will be changed to point to this
    /// new row. The row will be empty after this function is called. To fill in
    /// values, you need to call `gtk.ListStore.set` or `gtk.ListStore.setValue`.
    extern fn gtk_list_store_insert_before(p_list_store: *ListStore, p_iter: *gtk.TreeIter, p_sibling: ?*gtk.TreeIter) void;
    pub const insertBefore = gtk_list_store_insert_before;

    /// Creates a new row at `position`. `iter` will be changed to point to this new
    /// row. If `position` is -1, or larger than the number of rows in the list, then
    /// the new row will be appended to the list. The row will be filled with the
    /// values given to this function.
    ///
    /// Calling
    /// `gtk_list_store_insert_with_values (list_store, iter, position...)`
    /// has the same effect as calling:
    ///
    /// ```c
    /// static void
    /// insert_value (GtkListStore *list_store,
    ///               GtkTreeIter  *iter,
    ///               int           position)
    /// {
    ///   gtk_list_store_insert (list_store, iter, position);
    ///   gtk_list_store_set (list_store,
    ///                       iter
    ///                       // ...
    ///                       );
    /// }
    /// ```
    ///
    /// with the difference that the former will only emit `GtkTreeModel`::row-inserted
    /// once, while the latter will emit `GtkTreeModel`::row-inserted,
    /// `GtkTreeModel`::row-changed and, if the list store is sorted,
    /// `GtkTreeModel`::rows-reordered for every inserted value.
    ///
    /// Since emitting the `GtkTreeModel::rows-reordered` signal repeatedly can
    /// affect the performance of the program, `gtk.ListStore.insertWithValues`
    /// should generally be preferred when inserting rows in a sorted list store.
    extern fn gtk_list_store_insert_with_values(p_list_store: *ListStore, p_iter: ?*gtk.TreeIter, p_position: c_int, ...) void;
    pub const insertWithValues = gtk_list_store_insert_with_values;

    /// A variant of `gtk.ListStore.insertWithValues` which
    /// takes the columns and values as two arrays, instead of
    /// varargs.
    ///
    /// This function is mainly intended for language-bindings.
    extern fn gtk_list_store_insert_with_valuesv(p_list_store: *ListStore, p_iter: ?*gtk.TreeIter, p_position: c_int, p_columns: [*]c_int, p_values: [*]gobject.Value, p_n_values: c_int) void;
    pub const insertWithValuesv = gtk_list_store_insert_with_valuesv;

    /// Checks if the given iter is a valid iter for this `GtkListStore`.
    ///
    /// This function is slow. Only use it for debugging and/or testing
    /// purposes.
    extern fn gtk_list_store_iter_is_valid(p_list_store: *ListStore, p_iter: *gtk.TreeIter) c_int;
    pub const iterIsValid = gtk_list_store_iter_is_valid;

    /// Moves `iter` in `store` to the position after `position`. Note that this
    /// function only works with unsorted stores. If `position` is `NULL`, `iter`
    /// will be moved to the start of the list.
    extern fn gtk_list_store_move_after(p_store: *ListStore, p_iter: *gtk.TreeIter, p_position: ?*gtk.TreeIter) void;
    pub const moveAfter = gtk_list_store_move_after;

    /// Moves `iter` in `store` to the position before `position`. Note that this
    /// function only works with unsorted stores. If `position` is `NULL`, `iter`
    /// will be moved to the end of the list.
    extern fn gtk_list_store_move_before(p_store: *ListStore, p_iter: *gtk.TreeIter, p_position: ?*gtk.TreeIter) void;
    pub const moveBefore = gtk_list_store_move_before;

    /// Prepends a new row to `list_store`. `iter` will be changed to point to this new
    /// row. The row will be empty after this function is called. To fill in
    /// values, you need to call `gtk.ListStore.set` or `gtk.ListStore.setValue`.
    extern fn gtk_list_store_prepend(p_list_store: *ListStore, p_iter: *gtk.TreeIter) void;
    pub const prepend = gtk_list_store_prepend;

    /// Removes the given row from the list store.  After being removed,
    /// `iter` is set to be the next valid row, or invalidated if it pointed
    /// to the last row in `list_store`.
    extern fn gtk_list_store_remove(p_list_store: *ListStore, p_iter: *gtk.TreeIter) c_int;
    pub const remove = gtk_list_store_remove;

    /// Reorders `store` to follow the order indicated by `new_order`. Note that
    /// this function only works with unsorted stores.
    extern fn gtk_list_store_reorder(p_store: *ListStore, p_new_order: [*]c_int) void;
    pub const reorder = gtk_list_store_reorder;

    /// Sets the value of one or more cells in the row referenced by `iter`.
    /// The variable argument list should contain integer column numbers,
    /// each column number followed by the value to be set.
    /// The list is terminated by a -1. For example, to set column 0 with type
    /// `G_TYPE_STRING` to “Foo”, you would write `gtk_list_store_set (store, iter,
    /// 0, "Foo", -1)`.
    ///
    /// The value will be referenced by the store if it is a `G_TYPE_OBJECT`, and it
    /// will be copied if it is a `G_TYPE_STRING` or `G_TYPE_BOXED`.
    extern fn gtk_list_store_set(p_list_store: *ListStore, p_iter: *gtk.TreeIter, ...) void;
    pub const set = gtk_list_store_set;

    /// Sets the types of the columns of a list store.
    ///
    /// This function is meant primarily for objects that inherit
    /// from `GtkListStore`, and should only be used when constructing
    /// a new instance.
    ///
    /// This function cannot be called after a row has been added, or
    /// a method on the `GtkTreeModel` interface is called.
    extern fn gtk_list_store_set_column_types(p_list_store: *ListStore, p_n_columns: c_int, p_types: [*]usize) void;
    pub const setColumnTypes = gtk_list_store_set_column_types;

    /// See `gtk.ListStore.set`; this version takes a va_list for use by language
    /// bindings.
    extern fn gtk_list_store_set_valist(p_list_store: *ListStore, p_iter: *gtk.TreeIter, p_var_args: std.builtin.VaList) void;
    pub const setValist = gtk_list_store_set_valist;

    /// Sets the data in the cell specified by `iter` and `column`.
    /// The type of `value` must be convertible to the type of the
    /// column.
    extern fn gtk_list_store_set_value(p_list_store: *ListStore, p_iter: *gtk.TreeIter, p_column: c_int, p_value: *gobject.Value) void;
    pub const setValue = gtk_list_store_set_value;

    /// A variant of `gtk.ListStore.setValist` which
    /// takes the columns and values as two arrays, instead of
    /// varargs. This function is mainly intended for
    /// language-bindings and in case the number of columns to
    /// change is not known until run-time.
    extern fn gtk_list_store_set_valuesv(p_list_store: *ListStore, p_iter: *gtk.TreeIter, p_columns: [*]c_int, p_values: [*]gobject.Value, p_n_values: c_int) void;
    pub const setValuesv = gtk_list_store_set_valuesv;

    /// Swaps `a` and `b` in `store`. Note that this function only works with
    /// unsorted stores.
    extern fn gtk_list_store_swap(p_store: *ListStore, p_a: *gtk.TreeIter, p_b: *gtk.TreeIter) void;
    pub const swap = gtk_list_store_swap;

    extern fn gtk_list_store_get_type() usize;
    pub const getGObjectType = gtk_list_store_get_type;

    extern fn g_object_ref(p_self: *gtk.ListStore) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListStore) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListStore, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents a large dynamic list of items.
///
/// `GtkListView` uses its factory to generate one row widget for each visible
/// item and shows them in a linear display, either vertically or horizontally.
///
/// The `gtk.ListView.properties.show_separators` property offers a simple way to
/// display separators between the rows.
///
/// `GtkListView` allows the user to select items according to the selection
/// characteristics of the model. For models that allow multiple selected items,
/// it is possible to turn on _rubberband selection_, using
/// `gtk.ListView.properties.enable_rubberband`.
///
/// If you need multiple columns with headers, see `gtk.ColumnView`.
///
/// To learn more about the list widget framework, see the
/// [overview](section-list-widget.html).
///
/// An example of using `GtkListView`:
/// ```c
/// static void
/// setup_listitem_cb (GtkListItemFactory *factory,
///                    GtkListItem        *list_item)
/// {
///   GtkWidget *image;
///
///   image = gtk_image_new ();
///   gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
///   gtk_list_item_set_child (list_item, image);
/// }
///
/// static void
/// bind_listitem_cb (GtkListItemFactory *factory,
///                   GtkListItem        *list_item)
/// {
///   GtkWidget *image;
///   GAppInfo *app_info;
///
///   image = gtk_list_item_get_child (list_item);
///   app_info = gtk_list_item_get_item (list_item);
///   gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
/// }
///
/// static void
/// activate_cb (GtkListView  *list,
///              guint         position,
///              gpointer      unused)
/// {
///   GAppInfo *app_info;
///
///   app_info = g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (list)), position);
///   g_app_info_launch (app_info, NULL, NULL, NULL);
///   g_object_unref (app_info);
/// }
///
/// ...
///
///   model = create_application_list ();
///
///   factory = gtk_signal_list_item_factory_new ();
///   g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
///   g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
///
///   list = gtk_list_view_new (GTK_SELECTION_MODEL (gtk_single_selection_new (model)), factory);
///
///   g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
///
///   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
/// ```
///
/// # Actions
///
/// `GtkListView` defines a set of built-in actions:
///
/// - `list.activate-item` activates the item at given position by emitting
///   the `gtk.ListView.signals.activate` signal.
///
/// # CSS nodes
///
/// ```
/// listview[.separators][.rich-list][.navigation-sidebar][.data-table]
/// ├── row[.activatable]
/// │
/// ├── row[.activatable]
/// │
/// ┊
/// ╰── [rubberband]
/// ```
///
/// `GtkListView` uses a single CSS node named `listview`. It may carry the
/// `.separators` style class, when `gtk.ListView.properties.show_separators`
/// property is set. Each child widget uses a single CSS node named `row`.
/// If the `gtk.ListItem.properties.activatable` property is set, the
/// corresponding row will have the `.activatable` style class. For
/// rubberband selection, a node with name `rubberband` is used.
///
/// The main listview node may also carry style classes to select
/// the style of [list presentation](section-list-widget.html`list`-styles):
/// .rich-list, .navigation-sidebar or .data-table.
///
/// # Accessibility
///
/// `GtkListView` uses the `gtk.@"AccessibleRole.list"` role, and the list
/// items use the `gtk.@"AccessibleRole.list_item"` role.
pub const ListView = opaque {
    pub const Parent = gtk.ListBase;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable, gtk.Scrollable };
    pub const Class = gtk.ListViewClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Allow rubberband selection.
        pub const enable_rubberband = struct {
            pub const name = "enable-rubberband";

            pub const Type = c_int;
        };

        /// Factory for populating list items.
        ///
        /// The factory must be for configuring `gtk.ListItem` objects.
        pub const factory = struct {
            pub const name = "factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// Factory for creating header widgets.
        ///
        /// The factory must be for configuring `gtk.ListHeader` objects.
        pub const header_factory = struct {
            pub const name = "header-factory";

            pub const Type = ?*gtk.ListItemFactory;
        };

        /// Model for the items displayed.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.SelectionModel;
        };

        /// Show separators between rows.
        pub const show_separators = struct {
            pub const name = "show-separators";

            pub const Type = c_int;
        };

        /// Activate rows on single click and select them on hover.
        pub const single_click_activate = struct {
            pub const name = "single-click-activate";

            pub const Type = c_int;
        };

        /// Behavior of the <kbd>Tab</kbd> key
        pub const tab_behavior = struct {
            pub const name = "tab-behavior";

            pub const Type = gtk.ListTabBehavior;
        };
    };

    pub const signals = struct {
        /// Emitted when a row has been activated by the user.
        ///
        /// Activation usually happens via the list.activate-item action of
        /// the `GtkListView`.
        ///
        /// This allows for a convenient way to handle activation in a listview.
        /// See `gtk.ListItem.setActivatable` for details on how to use
        /// this signal.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ListView, p_instance))),
                    gobject.signalLookup("activate", ListView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkListView` that uses the given `factory` for
    /// mapping items to widgets.
    ///
    /// The function takes ownership of the
    /// arguments, so you can write code like
    /// ```c
    /// list_view = gtk_list_view_new (create_model (),
    ///   gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));
    /// ```
    extern fn gtk_list_view_new(p_model: ?*gtk.SelectionModel, p_factory: ?*gtk.ListItemFactory) *gtk.ListView;
    pub const new = gtk_list_view_new;

    /// Returns whether rows can be selected by dragging with the mouse.
    extern fn gtk_list_view_get_enable_rubberband(p_self: *ListView) c_int;
    pub const getEnableRubberband = gtk_list_view_get_enable_rubberband;

    /// Gets the factory that's currently used to populate list items.
    extern fn gtk_list_view_get_factory(p_self: *ListView) ?*gtk.ListItemFactory;
    pub const getFactory = gtk_list_view_get_factory;

    /// Gets the factory that's currently used to populate section headers.
    extern fn gtk_list_view_get_header_factory(p_self: *ListView) ?*gtk.ListItemFactory;
    pub const getHeaderFactory = gtk_list_view_get_header_factory;

    /// Gets the model that's currently used to read the items displayed.
    extern fn gtk_list_view_get_model(p_self: *ListView) ?*gtk.SelectionModel;
    pub const getModel = gtk_list_view_get_model;

    /// Returns whether the listview should show separators
    /// between rows.
    extern fn gtk_list_view_get_show_separators(p_self: *ListView) c_int;
    pub const getShowSeparators = gtk_list_view_get_show_separators;

    /// Returns whether rows will be activated on single click and
    /// selected on hover.
    extern fn gtk_list_view_get_single_click_activate(p_self: *ListView) c_int;
    pub const getSingleClickActivate = gtk_list_view_get_single_click_activate;

    /// Gets the behavior set for the <kbd>Tab</kbd> key.
    extern fn gtk_list_view_get_tab_behavior(p_self: *ListView) gtk.ListTabBehavior;
    pub const getTabBehavior = gtk_list_view_get_tab_behavior;

    /// Scrolls to the item at the given position and performs the actions
    /// specified in `flags`.
    ///
    /// This function works no matter if the listview is shown or focused.
    /// If it isn't, then the changes will take effect once that happens.
    extern fn gtk_list_view_scroll_to(p_self: *ListView, p_pos: c_uint, p_flags: gtk.ListScrollFlags, p_scroll: ?*gtk.ScrollInfo) void;
    pub const scrollTo = gtk_list_view_scroll_to;

    /// Sets whether selections can be changed by dragging with the mouse.
    extern fn gtk_list_view_set_enable_rubberband(p_self: *ListView, p_enable_rubberband: c_int) void;
    pub const setEnableRubberband = gtk_list_view_set_enable_rubberband;

    /// Sets the `GtkListItemFactory` to use for populating list items.
    extern fn gtk_list_view_set_factory(p_self: *ListView, p_factory: ?*gtk.ListItemFactory) void;
    pub const setFactory = gtk_list_view_set_factory;

    /// Sets the `GtkListItemFactory` to use for populating the
    /// `gtk.ListHeader` objects used in section headers.
    ///
    /// If this factory is set to `NULL`, the list will not show
    /// section headers.
    extern fn gtk_list_view_set_header_factory(p_self: *ListView, p_factory: ?*gtk.ListItemFactory) void;
    pub const setHeaderFactory = gtk_list_view_set_header_factory;

    /// Sets the model to use.
    ///
    /// This must be a `gtk.SelectionModel` to use.
    extern fn gtk_list_view_set_model(p_self: *ListView, p_model: ?*gtk.SelectionModel) void;
    pub const setModel = gtk_list_view_set_model;

    /// Sets whether the listview should show separators
    /// between rows.
    extern fn gtk_list_view_set_show_separators(p_self: *ListView, p_show_separators: c_int) void;
    pub const setShowSeparators = gtk_list_view_set_show_separators;

    /// Sets whether rows should be activated on single click and
    /// selected on hover.
    extern fn gtk_list_view_set_single_click_activate(p_self: *ListView, p_single_click_activate: c_int) void;
    pub const setSingleClickActivate = gtk_list_view_set_single_click_activate;

    /// Sets the <kbd>Tab</kbd> key behavior.
    ///
    /// This influences how the <kbd>Tab</kbd> and
    /// <kbd>Shift</kbd>+<kbd>Tab</kbd> keys move the
    /// focus in the listview.
    extern fn gtk_list_view_set_tab_behavior(p_self: *ListView, p_tab_behavior: gtk.ListTabBehavior) void;
    pub const setTabBehavior = gtk_list_view_set_tab_behavior;

    extern fn gtk_list_view_get_type() usize;
    pub const getGObjectType = gtk_list_view_get_type;

    extern fn g_object_ref(p_self: *gtk.ListView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ListView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ListView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkLockButton` is a widget to obtain and revoke authorizations
/// needed to operate the controls.
///
/// <picture>
///   <source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkLockButton" src="lockbutton.png">
/// </picture>
///
/// It is typically used in preference dialogs or control panels.
///
/// The required authorization is represented by a `GPermission` object.
/// Concrete implementations of `GPermission` may use PolicyKit or some
/// other authorization framework. To obtain a PolicyKit-based
/// `GPermission`, use ``polkit_permission_new``.
///
/// If the user is not currently allowed to perform the action, but can
/// obtain the permission, the widget looks like this:
///
/// <picture>
///   <source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An locked GtkLockButton" src="lockbutton.png">
/// </picture>
///
/// and the user can click the button to request the permission. Depending
/// on the platform, this may pop up an authentication dialog or ask the user
/// to authenticate in some other way. Once the user has obtained the permission,
/// the widget changes to this:
///
/// <picture>
///   <source srcset="lockbutton-unlocked-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An unlocked GtkLockButton" src="lockbutton-unlocked.png">
/// </picture>
///
/// and the permission can be dropped again by clicking the button. If the user
/// is not able to obtain the permission at all, the widget looks like this:
///
/// <picture>
///   <source srcset="lockbutton-sorry-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An unobtainable GtkLockButton" src="lockbutton-sorry.png">
/// </picture>
///
/// If the user has the permission and cannot drop it, the button is hidden.
///
/// The text (and tooltips) that are shown in the various cases can be adjusted
/// with the `gtk.LockButton.properties.text_lock`,
/// `gtk.LockButton.properties.text_unlock`,
/// `gtk.LockButton.properties.tooltip_lock`,
/// `gtk.LockButton.properties.tooltip_unlock` and
/// `gtk.LockButton.properties.tooltip_not_authorized` properties.
pub const LockButton = opaque {
    pub const Parent = gtk.Button;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = LockButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GPermission object controlling this button.
        pub const permission = struct {
            pub const name = "permission";

            pub const Type = ?*gio.Permission;
        };

        /// The text to display when prompting the user to lock.
        pub const text_lock = struct {
            pub const name = "text-lock";

            pub const Type = ?[*:0]u8;
        };

        /// The text to display when prompting the user to unlock.
        pub const text_unlock = struct {
            pub const name = "text-unlock";

            pub const Type = ?[*:0]u8;
        };

        /// The tooltip to display when prompting the user to lock.
        pub const tooltip_lock = struct {
            pub const name = "tooltip-lock";

            pub const Type = ?[*:0]u8;
        };

        /// The tooltip to display when the user cannot obtain authorization.
        pub const tooltip_not_authorized = struct {
            pub const name = "tooltip-not-authorized";

            pub const Type = ?[*:0]u8;
        };

        /// The tooltip to display when prompting the user to unlock.
        pub const tooltip_unlock = struct {
            pub const name = "tooltip-unlock";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new lock button which reflects the `permission`.
    extern fn gtk_lock_button_new(p_permission: ?*gio.Permission) *gtk.LockButton;
    pub const new = gtk_lock_button_new;

    /// Obtains the `GPermission` object that controls `button`.
    extern fn gtk_lock_button_get_permission(p_button: *LockButton) ?*gio.Permission;
    pub const getPermission = gtk_lock_button_get_permission;

    /// Sets the `GPermission` object that controls `button`.
    extern fn gtk_lock_button_set_permission(p_button: *LockButton, p_permission: ?*gio.Permission) void;
    pub const setPermission = gtk_lock_button_set_permission;

    extern fn gtk_lock_button_get_type() usize;
    pub const getGObjectType = gtk_lock_button_get_type;

    extern fn g_object_ref(p_self: *gtk.LockButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.LockButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *LockButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that maps the items in another model to different items.
///
/// `GtkMapListModel` uses a `gtk.MapListModelMapFunc`.
///
/// Example: Create a list of `GtkEventControllers`
/// ```c
/// static gpointer
/// map_to_controllers (gpointer widget,
///                     gpointer data)
/// {
///   gpointer result = gtk_widget_observe_controllers (widget);
///   g_object_unref (widget);
///   return result;
/// }
///
/// widgets = gtk_widget_observe_children (widget);
///
/// controllers = gtk_map_list_model_new (widgets,
///                                       map_to_controllers,
///                                       NULL, NULL);
///
/// model = gtk_flatten_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
///                                     controllers);
/// ```
///
/// `GtkMapListModel` will attempt to discard the mapped objects as soon as
/// they are no longer needed and recreate them if necessary.
///
/// `GtkMapListModel` passes through sections from the underlying model.
pub const MapListModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel };
    pub const Class = gtk.MapListModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If a map is set for this model
        pub const has_map = struct {
            pub const name = "has-map";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being mapped.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkMapListModel` for the given arguments.
    extern fn gtk_map_list_model_new(p_model: ?*gio.ListModel, p_map_func: ?gtk.MapListModelMapFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) *gtk.MapListModel;
    pub const new = gtk_map_list_model_new;

    /// Gets the model that is currently being mapped or `NULL` if none.
    extern fn gtk_map_list_model_get_model(p_self: *MapListModel) ?*gio.ListModel;
    pub const getModel = gtk_map_list_model_get_model;

    /// Checks if a map function is currently set on `self`.
    extern fn gtk_map_list_model_has_map(p_self: *MapListModel) c_int;
    pub const hasMap = gtk_map_list_model_has_map;

    /// Sets the function used to map items.
    ///
    /// The function will be called whenever an item needs to be mapped
    /// and must return the item to use for the given input item.
    ///
    /// Note that `GtkMapListModel` may call this function multiple times
    /// on the same item, because it may delete items it doesn't need anymore.
    ///
    /// GTK makes no effort to ensure that `map_func` conforms to the item type
    /// of `self`. It assumes that the caller knows what they are doing and the map
    /// function returns items of the appropriate type.
    extern fn gtk_map_list_model_set_map_func(p_self: *MapListModel, p_map_func: ?gtk.MapListModelMapFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) void;
    pub const setMapFunc = gtk_map_list_model_set_map_func;

    /// Sets the model to be mapped.
    ///
    /// GTK makes no effort to ensure that `model` conforms to the item type
    /// expected by the map function. It assumes that the caller knows what
    /// they are doing and have set up an appropriate map function.
    extern fn gtk_map_list_model_set_model(p_self: *MapListModel, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_map_list_model_set_model;

    extern fn gtk_map_list_model_get_type() usize;
    pub const getGObjectType = gtk_map_list_model_get_type;

    extern fn g_object_ref(p_self: *gtk.MapListModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MapListModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MapListModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows controls for video playback.
///
/// <picture>
///   <source srcset="media-controls-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkMediaControls" src="media-controls.png">
/// </picture>
///
/// Usually, `GtkMediaControls` is used as part of `gtk.Video`.
pub const MediaControls = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.MediaControlsClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The media-stream managed by this object or `NULL` if none.
        pub const media_stream = struct {
            pub const name = "media-stream";

            pub const Type = ?*gtk.MediaStream;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkMediaControls` managing the `stream` passed to it.
    extern fn gtk_media_controls_new(p_stream: ?*gtk.MediaStream) *gtk.MediaControls;
    pub const new = gtk_media_controls_new;

    /// Gets the media stream managed by `controls` or `NULL` if none.
    extern fn gtk_media_controls_get_media_stream(p_controls: *MediaControls) ?*gtk.MediaStream;
    pub const getMediaStream = gtk_media_controls_get_media_stream;

    /// Sets the stream that is controlled by `controls`.
    extern fn gtk_media_controls_set_media_stream(p_controls: *MediaControls, p_stream: ?*gtk.MediaStream) void;
    pub const setMediaStream = gtk_media_controls_set_media_stream;

    extern fn gtk_media_controls_get_type() usize;
    pub const getGObjectType = gtk_media_controls_get_type;

    extern fn g_object_ref(p_self: *gtk.MediaControls) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MediaControls) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MediaControls, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Implements the `GtkMediaStream` interface for files.
///
/// This provides a simple way to play back video files with GTK.
///
/// GTK provides a GIO extension point for `GtkMediaFile` implementations
/// to allow for external implementations using various media frameworks.
///
/// GTK itself includes an implementation using GStreamer.
pub const MediaFile = extern struct {
    pub const Parent = gtk.MediaStream;
    pub const Implements = [_]type{gdk.Paintable};
    pub const Class = gtk.MediaFileClass;
    f_parent_instance: gtk.MediaStream,

    pub const virtual_methods = struct {
        pub const close = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(MediaFile.Class, p_class).f_close.?(gobject.ext.as(MediaFile, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(MediaFile.Class, p_class).f_close = @ptrCast(p_implementation);
            }
        };

        pub const open = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(MediaFile.Class, p_class).f_open.?(gobject.ext.as(MediaFile, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(MediaFile.Class, p_class).f_open = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The file being played back or `NULL` if not playing a file.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?*gio.File;
        };

        /// The stream being played back or `NULL` if not playing a stream.
        ///
        /// This is `NULL` when playing a file.
        pub const input_stream = struct {
            pub const name = "input-stream";

            pub const Type = ?*gio.InputStream;
        };
    };

    pub const signals = struct {};

    /// Creates a new empty media file.
    extern fn gtk_media_file_new() *gtk.MediaFile;
    pub const new = gtk_media_file_new;

    /// Creates a new media file to play `file`.
    extern fn gtk_media_file_new_for_file(p_file: *gio.File) *gtk.MediaFile;
    pub const newForFile = gtk_media_file_new_for_file;

    /// Creates a new media file for the given filename.
    ///
    /// This is a utility function that converts the given `filename`
    /// to a `GFile` and calls `gtk.MediaFile.newForFile`.
    extern fn gtk_media_file_new_for_filename(p_filename: [*:0]const u8) *gtk.MediaFile;
    pub const newForFilename = gtk_media_file_new_for_filename;

    /// Creates a new media file to play `stream`.
    ///
    /// If you want the resulting media to be seekable,
    /// the stream should implement the `GSeekable` interface.
    extern fn gtk_media_file_new_for_input_stream(p_stream: *gio.InputStream) *gtk.MediaFile;
    pub const newForInputStream = gtk_media_file_new_for_input_stream;

    /// Creates a new new media file for the given resource.
    ///
    /// This is a utility function that converts the given `resource`
    /// to a `GFile` and calls `gtk.MediaFile.newForFile`.
    extern fn gtk_media_file_new_for_resource(p_resource_path: [*:0]const u8) *gtk.MediaFile;
    pub const newForResource = gtk_media_file_new_for_resource;

    /// Resets the media file to be empty.
    extern fn gtk_media_file_clear(p_self: *MediaFile) void;
    pub const clear = gtk_media_file_clear;

    /// Returns the file that `self` is currently playing from.
    ///
    /// When `self` is not playing or not playing from a file,
    /// `NULL` is returned.
    extern fn gtk_media_file_get_file(p_self: *MediaFile) ?*gio.File;
    pub const getFile = gtk_media_file_get_file;

    /// Returns the stream that `self` is currently playing from.
    ///
    /// When `self` is not playing or not playing from a stream,
    /// `NULL` is returned.
    extern fn gtk_media_file_get_input_stream(p_self: *MediaFile) ?*gio.InputStream;
    pub const getInputStream = gtk_media_file_get_input_stream;

    /// Sets the `GtkMediaFile` to play the given file.
    ///
    /// If any file is still playing, stop playing it.
    extern fn gtk_media_file_set_file(p_self: *MediaFile, p_file: ?*gio.File) void;
    pub const setFile = gtk_media_file_set_file;

    /// Sets the `GtkMediaFile` to play the given file.
    ///
    /// This is a utility function that converts the given `filename`
    /// to a `GFile` and calls `gtk.MediaFile.setFile`.
    extern fn gtk_media_file_set_filename(p_self: *MediaFile, p_filename: ?[*:0]const u8) void;
    pub const setFilename = gtk_media_file_set_filename;

    /// Sets the `GtkMediaFile` to play the given stream.
    ///
    /// If anything is still playing, stop playing it.
    ///
    /// Full control about the `stream` is assumed for the duration of
    /// playback. The stream will not be closed.
    extern fn gtk_media_file_set_input_stream(p_self: *MediaFile, p_stream: ?*gio.InputStream) void;
    pub const setInputStream = gtk_media_file_set_input_stream;

    /// Sets the `GtkMediaFile` to play the given resource.
    ///
    /// This is a utility function that converts the given `resource_path`
    /// to a `GFile` and calls `gtk.MediaFile.setFile`.
    extern fn gtk_media_file_set_resource(p_self: *MediaFile, p_resource_path: ?[*:0]const u8) void;
    pub const setResource = gtk_media_file_set_resource;

    extern fn gtk_media_file_get_type() usize;
    pub const getGObjectType = gtk_media_file_get_type;

    extern fn g_object_ref(p_self: *gtk.MediaFile) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MediaFile) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MediaFile, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The integration point for media playback inside GTK.
///
/// GTK provides an implementation of the `GtkMediaStream` interface that
/// is called `gtk.MediaFile`.
///
/// Apart from application-facing API for stream playback, `GtkMediaStream`
/// has a number of APIs that are only useful for implementations and should
/// not be used in applications:
/// `gtk.MediaStream.prepared`,
/// `gtk.MediaStream.unprepared`,
/// `gtk.MediaStream.update`,
/// `gtk.MediaStream.ended`,
/// `gtk.MediaStream.seekSuccess`,
/// `gtk.MediaStream.seekFailed`,
/// `gtk.MediaStream.gerror`,
/// `gtk.MediaStream.@"error"`,
/// `gtk.MediaStream.errorValist`.
pub const MediaStream = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gdk.Paintable};
    pub const Class = gtk.MediaStreamClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Pauses playback of the stream.
        ///
        /// If the stream is not playing, do nothing.
        pub const pause = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(MediaStream.Class, p_class).f_pause.?(gobject.ext.as(MediaStream, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(MediaStream.Class, p_class).f_pause = @ptrCast(p_implementation);
            }
        };

        pub const play = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(MediaStream.Class, p_class).f_play.?(gobject.ext.as(MediaStream, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(MediaStream.Class, p_class).f_play = @ptrCast(p_implementation);
            }
        };

        /// Called by users to attach the media stream to a `GdkSurface` they manage.
        ///
        /// The stream can then access the resources of `surface` for its
        /// rendering purposes. In particular, media streams might want to
        /// create a `GdkGLContext` or sync to the `GdkFrameClock`.
        ///
        /// Whoever calls this function is responsible for calling
        /// `gtk.MediaStream.unrealize` before either the stream
        /// or `surface` get destroyed.
        ///
        /// Multiple calls to this function may happen from different
        /// users of the video, even with the same `surface`. Each of these
        /// calls must be followed by its own call to
        /// `gtk.MediaStream.unrealize`.
        ///
        /// It is not required to call this function to make a media stream work.
        pub const realize = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_surface: *gdk.Surface) void {
                return gobject.ext.as(MediaStream.Class, p_class).f_realize.?(gobject.ext.as(MediaStream, p_self), p_surface);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_surface: *gdk.Surface) callconv(.c) void) void {
                gobject.ext.as(MediaStream.Class, p_class).f_realize = @ptrCast(p_implementation);
            }
        };

        /// Start a seek operation on `self` to `timestamp`.
        ///
        /// If `timestamp` is out of range, it will be clamped.
        ///
        /// Seek operations may not finish instantly. While a
        /// seek operation is in process, the `gtk.MediaStream.properties.seeking`
        /// property will be set.
        ///
        /// When calling `gtk.MediaStream.seek` during an
        /// ongoing seek operation, the new seek will override
        /// any pending seek.
        pub const seek = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_timestamp: i64) void {
                return gobject.ext.as(MediaStream.Class, p_class).f_seek.?(gobject.ext.as(MediaStream, p_self), p_timestamp);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_timestamp: i64) callconv(.c) void) void {
                gobject.ext.as(MediaStream.Class, p_class).f_seek = @ptrCast(p_implementation);
            }
        };

        /// Undoes a previous call to `gtk.MediaStream.realize`.
        ///
        /// This causes the stream to release all resources it had
        /// allocated from `surface`.
        pub const unrealize = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_surface: *gdk.Surface) void {
                return gobject.ext.as(MediaStream.Class, p_class).f_unrealize.?(gobject.ext.as(MediaStream, p_self), p_surface);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_surface: *gdk.Surface) callconv(.c) void) void {
                gobject.ext.as(MediaStream.Class, p_class).f_unrealize = @ptrCast(p_implementation);
            }
        };

        pub const update_audio = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_muted: c_int, p_volume: f64) void {
                return gobject.ext.as(MediaStream.Class, p_class).f_update_audio.?(gobject.ext.as(MediaStream, p_self), p_muted, p_volume);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_muted: c_int, p_volume: f64) callconv(.c) void) void {
                gobject.ext.as(MediaStream.Class, p_class).f_update_audio = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The stream's duration in microseconds or 0 if unknown.
        pub const duration = struct {
            pub const name = "duration";

            pub const Type = i64;
        };

        /// Set when playback has finished.
        pub const ended = struct {
            pub const name = "ended";

            pub const Type = c_int;
        };

        /// `NULL` for a properly working stream or the `GError`
        /// that the stream is in.
        pub const @"error" = struct {
            pub const name = "error";

            pub const Type = ?*glib.Error;
        };

        /// Whether the stream contains audio.
        pub const has_audio = struct {
            pub const name = "has-audio";

            pub const Type = c_int;
        };

        /// Whether the stream contains video.
        pub const has_video = struct {
            pub const name = "has-video";

            pub const Type = c_int;
        };

        /// Try to restart the media from the beginning once it ended.
        pub const loop = struct {
            pub const name = "loop";

            pub const Type = c_int;
        };

        /// Whether the audio stream should be muted.
        pub const muted = struct {
            pub const name = "muted";

            pub const Type = c_int;
        };

        /// Whether the stream is currently playing.
        pub const playing = struct {
            pub const name = "playing";

            pub const Type = c_int;
        };

        /// Whether the stream has finished initializing and existence of
        /// audio and video is known.
        pub const prepared = struct {
            pub const name = "prepared";

            pub const Type = c_int;
        };

        /// Set unless the stream is known to not support seeking.
        pub const seekable = struct {
            pub const name = "seekable";

            pub const Type = c_int;
        };

        /// Set while a seek is in progress.
        pub const seeking = struct {
            pub const name = "seeking";

            pub const Type = c_int;
        };

        /// The current presentation timestamp in microseconds.
        pub const timestamp = struct {
            pub const name = "timestamp";

            pub const Type = i64;
        };

        /// Volume of the audio stream.
        pub const volume = struct {
            pub const name = "volume";

            pub const Type = f64;
        };
    };

    pub const signals = struct {};

    /// Pauses the media stream and marks it as ended.
    ///
    /// This is a hint only, calls to `gtk.MediaStream.play`
    /// may still happen.
    ///
    /// The media stream must be prepared when this function is called.
    extern fn gtk_media_stream_ended(p_self: *MediaStream) void;
    pub const ended = gtk_media_stream_ended;

    /// Sets `self` into an error state using a `printf`-style format string.
    ///
    /// This is a utility function that calls `gtk.MediaStream.gerror`.
    /// See that function for details.
    extern fn gtk_media_stream_error(p_self: *MediaStream, p_domain: glib.Quark, p_code: c_int, p_format: [*:0]const u8, ...) void;
    pub const @"error" = gtk_media_stream_error;

    /// Sets `self` into an error state using a `printf`-style format string.
    ///
    /// This is a utility function that calls `gtk.MediaStream.gerror`.
    /// See that function for details.
    extern fn gtk_media_stream_error_valist(p_self: *MediaStream, p_domain: glib.Quark, p_code: c_int, p_format: [*:0]const u8, p_args: std.builtin.VaList) void;
    pub const errorValist = gtk_media_stream_error_valist;

    /// Sets `self` into an error state.
    ///
    /// This will pause the stream (you can check for an error
    /// via `gtk.MediaStream.getError` in your
    /// GtkMediaStream.`pause` implementation), abort pending
    /// seeks and mark the stream as prepared.
    ///
    /// if the stream is already in an error state, this call
    /// will be ignored and the existing error will be retained.
    ///
    /// To unset an error, the stream must be reset via a call to
    /// `gtk.MediaStream.unprepared`.
    extern fn gtk_media_stream_gerror(p_self: *MediaStream, p_error: *glib.Error) void;
    pub const gerror = gtk_media_stream_gerror;

    /// Gets the duration of the stream.
    ///
    /// If the duration is not known, 0 will be returned.
    extern fn gtk_media_stream_get_duration(p_self: *MediaStream) i64;
    pub const getDuration = gtk_media_stream_get_duration;

    /// Returns whether the streams playback is finished.
    extern fn gtk_media_stream_get_ended(p_self: *MediaStream) c_int;
    pub const getEnded = gtk_media_stream_get_ended;

    /// If the stream is in an error state, returns the `GError`
    /// explaining that state.
    ///
    /// Any type of error can be reported here depending on the
    /// implementation of the media stream.
    ///
    /// A media stream in an error cannot be operated on, calls
    /// like `gtk.MediaStream.play` or
    /// `gtk.MediaStream.seek` will not have any effect.
    ///
    /// `GtkMediaStream` itself does not provide a way to unset
    /// an error, but implementations may provide options. For example,
    /// a `gtk.MediaFile` will unset errors when a new source is
    /// set, e.g. with `gtk.MediaFile.setFile`.
    extern fn gtk_media_stream_get_error(p_self: *MediaStream) ?*const glib.Error;
    pub const getError = gtk_media_stream_get_error;

    /// Returns whether the stream is set to loop.
    ///
    /// See `gtk.MediaStream.setLoop` for details.
    extern fn gtk_media_stream_get_loop(p_self: *MediaStream) c_int;
    pub const getLoop = gtk_media_stream_get_loop;

    /// Returns whether the audio for the stream is muted.
    ///
    /// See `gtk.MediaStream.setMuted` for details.
    extern fn gtk_media_stream_get_muted(p_self: *MediaStream) c_int;
    pub const getMuted = gtk_media_stream_get_muted;

    /// Return whether the stream is currently playing.
    extern fn gtk_media_stream_get_playing(p_self: *MediaStream) c_int;
    pub const getPlaying = gtk_media_stream_get_playing;

    /// Returns the current presentation timestamp in microseconds.
    extern fn gtk_media_stream_get_timestamp(p_self: *MediaStream) i64;
    pub const getTimestamp = gtk_media_stream_get_timestamp;

    /// Returns the volume of the audio for the stream.
    ///
    /// See `gtk.MediaStream.setVolume` for details.
    extern fn gtk_media_stream_get_volume(p_self: *MediaStream) f64;
    pub const getVolume = gtk_media_stream_get_volume;

    /// Returns whether the stream has audio.
    extern fn gtk_media_stream_has_audio(p_self: *MediaStream) c_int;
    pub const hasAudio = gtk_media_stream_has_audio;

    /// Returns whether the stream has video.
    extern fn gtk_media_stream_has_video(p_self: *MediaStream) c_int;
    pub const hasVideo = gtk_media_stream_has_video;

    /// Returns whether the stream has finished initializing.
    ///
    /// At this point the existence of audio and video is known.
    extern fn gtk_media_stream_is_prepared(p_self: *MediaStream) c_int;
    pub const isPrepared = gtk_media_stream_is_prepared;

    /// Checks if a stream may be seekable.
    ///
    /// This is meant to be a hint. Streams may not allow seeking even if
    /// this function returns `TRUE`. However, if this function returns
    /// `FALSE`, streams are guaranteed to not be seekable and user interfaces
    /// may hide controls that allow seeking.
    ///
    /// It is allowed to call `gtk.MediaStream.seek` on a non-seekable
    /// stream, though it will not do anything.
    extern fn gtk_media_stream_is_seekable(p_self: *MediaStream) c_int;
    pub const isSeekable = gtk_media_stream_is_seekable;

    /// Checks if there is currently a seek operation going on.
    extern fn gtk_media_stream_is_seeking(p_self: *MediaStream) c_int;
    pub const isSeeking = gtk_media_stream_is_seeking;

    /// Pauses playback of the stream.
    ///
    /// If the stream is not playing, do nothing.
    extern fn gtk_media_stream_pause(p_self: *MediaStream) void;
    pub const pause = gtk_media_stream_pause;

    /// Starts playing the stream.
    ///
    /// If the stream is in error or already playing, do nothing.
    extern fn gtk_media_stream_play(p_self: *MediaStream) void;
    pub const play = gtk_media_stream_play;

    /// Same as `gtk.MediaStream.streamPrepared`.
    extern fn gtk_media_stream_prepared(p_self: *MediaStream, p_has_audio: c_int, p_has_video: c_int, p_seekable: c_int, p_duration: i64) void;
    pub const prepared = gtk_media_stream_prepared;

    /// Called by users to attach the media stream to a `GdkSurface` they manage.
    ///
    /// The stream can then access the resources of `surface` for its
    /// rendering purposes. In particular, media streams might want to
    /// create a `GdkGLContext` or sync to the `GdkFrameClock`.
    ///
    /// Whoever calls this function is responsible for calling
    /// `gtk.MediaStream.unrealize` before either the stream
    /// or `surface` get destroyed.
    ///
    /// Multiple calls to this function may happen from different
    /// users of the video, even with the same `surface`. Each of these
    /// calls must be followed by its own call to
    /// `gtk.MediaStream.unrealize`.
    ///
    /// It is not required to call this function to make a media stream work.
    extern fn gtk_media_stream_realize(p_self: *MediaStream, p_surface: *gdk.Surface) void;
    pub const realize = gtk_media_stream_realize;

    /// Start a seek operation on `self` to `timestamp`.
    ///
    /// If `timestamp` is out of range, it will be clamped.
    ///
    /// Seek operations may not finish instantly. While a
    /// seek operation is in process, the `gtk.MediaStream.properties.seeking`
    /// property will be set.
    ///
    /// When calling `gtk.MediaStream.seek` during an
    /// ongoing seek operation, the new seek will override
    /// any pending seek.
    extern fn gtk_media_stream_seek(p_self: *MediaStream, p_timestamp: i64) void;
    pub const seek = gtk_media_stream_seek;

    /// Ends a seek operation started via GtkMediaStream.`seek` as a failure.
    ///
    /// This will not cause an error on the stream and will assume that
    /// playback continues as if no seek had happened.
    ///
    /// See `gtk.MediaStream.seekSuccess` for the other way of
    /// ending a seek.
    extern fn gtk_media_stream_seek_failed(p_self: *MediaStream) void;
    pub const seekFailed = gtk_media_stream_seek_failed;

    /// Ends a seek operation started via GtkMediaStream.`seek` successfully.
    ///
    /// This function will unset the GtkMediaStream:ended property
    /// if it was set.
    ///
    /// See `gtk.MediaStream.seekFailed` for the other way of
    /// ending a seek.
    extern fn gtk_media_stream_seek_success(p_self: *MediaStream) void;
    pub const seekSuccess = gtk_media_stream_seek_success;

    /// Sets whether the stream should loop.
    ///
    /// In this case, it will attempt to restart playback
    /// from the beginning instead of stopping at the end.
    ///
    /// Not all streams may support looping, in particular
    /// non-seekable streams. Those streams will ignore the
    /// loop setting and just end.
    extern fn gtk_media_stream_set_loop(p_self: *MediaStream, p_loop: c_int) void;
    pub const setLoop = gtk_media_stream_set_loop;

    /// Sets whether the audio stream should be muted.
    ///
    /// Muting a stream will cause no audio to be played, but it
    /// does not modify the volume. This means that muting and
    /// then unmuting the stream will restore the volume settings.
    ///
    /// If the stream has no audio, calling this function will
    /// still work but it will not have an audible effect.
    extern fn gtk_media_stream_set_muted(p_self: *MediaStream, p_muted: c_int) void;
    pub const setMuted = gtk_media_stream_set_muted;

    /// Starts or pauses playback of the stream.
    extern fn gtk_media_stream_set_playing(p_self: *MediaStream, p_playing: c_int) void;
    pub const setPlaying = gtk_media_stream_set_playing;

    /// Sets the volume of the audio stream.
    ///
    /// This function call will work even if the stream is muted.
    ///
    /// The given `volume` should range from 0.0 for silence to 1.0
    /// for as loud as possible. Values outside of this range will
    /// be clamped to the nearest value.
    ///
    /// If the stream has no audio or is muted, calling this function
    /// will still work but it will not have an immediate audible effect.
    /// When the stream is unmuted, the new volume setting will take effect.
    extern fn gtk_media_stream_set_volume(p_self: *MediaStream, p_volume: f64) void;
    pub const setVolume = gtk_media_stream_set_volume;

    /// Pauses the media stream and marks it as ended.
    ///
    /// This is a hint only, calls to `gtk.MediaStream.play`
    /// may still happen.
    ///
    /// The media stream must be prepared when this function is called.
    extern fn gtk_media_stream_stream_ended(p_self: *MediaStream) void;
    pub const streamEnded = gtk_media_stream_stream_ended;

    /// Called by `GtkMediaStream` implementations to advertise the stream
    /// being ready to play and providing details about the stream.
    ///
    /// Note that the arguments are hints. If the stream implementation
    /// cannot determine the correct values, it is better to err on the
    /// side of caution and return `TRUE`. User interfaces will use those
    /// values to determine what controls to show.
    ///
    /// This function may not be called again until the stream has been
    /// reset via `gtk.MediaStream.streamUnprepared`.
    extern fn gtk_media_stream_stream_prepared(p_self: *MediaStream, p_has_audio: c_int, p_has_video: c_int, p_seekable: c_int, p_duration: i64) void;
    pub const streamPrepared = gtk_media_stream_stream_prepared;

    /// Resets a given media stream implementation.
    ///
    /// `gtk.MediaStream.streamPrepared` can then be called again.
    ///
    /// This function will also reset any error state the stream was in.
    extern fn gtk_media_stream_stream_unprepared(p_self: *MediaStream) void;
    pub const streamUnprepared = gtk_media_stream_stream_unprepared;

    /// Same as `gtk.MediaStream.streamUnprepared`.
    extern fn gtk_media_stream_unprepared(p_self: *MediaStream) void;
    pub const unprepared = gtk_media_stream_unprepared;

    /// Undoes a previous call to `gtk.MediaStream.realize`.
    ///
    /// This causes the stream to release all resources it had
    /// allocated from `surface`.
    extern fn gtk_media_stream_unrealize(p_self: *MediaStream, p_surface: *gdk.Surface) void;
    pub const unrealize = gtk_media_stream_unrealize;

    /// Media stream implementations should regularly call this
    /// function to update the timestamp reported by the stream.
    ///
    /// It is up to implementations to call this at the frequency
    /// they deem appropriate.
    ///
    /// The media stream must be prepared when this function is called.
    extern fn gtk_media_stream_update(p_self: *MediaStream, p_timestamp: i64) void;
    pub const update = gtk_media_stream_update;

    extern fn gtk_media_stream_get_type() usize;
    pub const getGObjectType = gtk_media_stream_get_type;

    extern fn g_object_ref(p_self: *gtk.MediaStream) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MediaStream) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MediaStream, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays a popup when clicked.
///
/// <picture>
///   <source srcset="menu-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkMenuButton" src="menu-button.png">
/// </picture>
///
/// This popup can be provided either as a `GtkPopover` or as an abstract
/// `GMenuModel`.
///
/// The `GtkMenuButton` widget can show either an icon (set with the
/// `gtk.MenuButton.properties.icon_name` property) or a label (set with the
/// `gtk.MenuButton.properties.label` property). If neither is explicitly set,
/// a `gtk.Image` is automatically created, using an arrow image oriented
/// according to `gtk.MenuButton.properties.direction` or the generic
/// “open-menu-symbolic” icon if the direction is not set.
///
/// The positioning of the popup is determined by the
/// `gtk.MenuButton.properties.direction` property of the menu button.
///
/// For menus, the `gtk.Widget.properties.halign` and `gtk.Widget.properties.valign`
/// properties of the menu are also taken into account. For example, when the
/// direction is `GTK_ARROW_DOWN` and the horizontal alignment is `GTK_ALIGN_START`,
/// the menu will be positioned below the button, with the starting edge
/// (depending on the text direction) of the menu aligned with the starting
/// edge of the button. If there is not enough space below the button, the
/// menu is popped up above the button instead. If the alignment would move
/// part of the menu offscreen, it is “pushed in”.
///
/// |           | start                | center                | end                |
/// | -         | ---                  | ---                   | ---                |
/// | **down**  | ![](down-start.png)  | ![](down-center.png)  | ![](down-end.png)  |
/// | **up**    | ![](up-start.png)    | ![](up-center.png)    | ![](up-end.png)    |
/// | **left**  | ![](left-start.png)  | ![](left-center.png)  | ![](left-end.png)  |
/// | **right** | ![](right-start.png) | ![](right-center.png) | ![](right-end.png) |
///
/// # CSS nodes
///
/// ```
/// menubutton
/// ╰── button.toggle
///     ╰── <content>
///          ╰── [arrow]
/// ```
///
/// `GtkMenuButton` has a single CSS node with name `menubutton`
/// which contains a `button` node with a `.toggle` style class.
///
/// If the button contains an icon, it will have the `.image-button` style class,
/// if it contains text, it will have `.text-button` style class. If an arrow is
/// visible in addition to an icon, text or a custom child, it will also have
/// `.arrow-button` style class.
///
/// Inside the toggle button content, there is an `arrow` node for
/// the indicator, which will carry one of the `.none`, `.up`, `.down`,
/// `.left` or `.right` style classes to indicate the direction that
/// the menu will appear in. The CSS is expected to provide a suitable
/// image for each of these cases using the `-gtk-icon-source` property.
///
/// Optionally, the `menubutton` node can carry the `.circular` style class
/// to request a round appearance.
///
/// # Accessibility
///
/// `GtkMenuButton` uses the `gtk.@"AccessibleRole.button"` role.
pub const MenuButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = MenuButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the menu button is active.
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// Whether to show a dropdown arrow even when using an icon or a custom child.
        pub const always_show_arrow = struct {
            pub const name = "always-show-arrow";

            pub const Type = c_int;
        };

        /// Whether the size of the button can be made smaller than the natural
        /// size of its contents.
        pub const can_shrink = struct {
            pub const name = "can-shrink";

            pub const Type = c_int;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The `GtkArrowType` representing the direction in which the
        /// menu or popover will be popped out.
        pub const direction = struct {
            pub const name = "direction";

            pub const Type = gtk.ArrowType;
        };

        /// Whether the button has a frame.
        pub const has_frame = struct {
            pub const name = "has-frame";

            pub const Type = c_int;
        };

        /// The name of the icon used to automatically populate the button.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// The label for the button.
        pub const label = struct {
            pub const name = "label";

            pub const Type = ?[*:0]u8;
        };

        /// The `GMenuModel` from which the popup will be created.
        ///
        /// See `gtk.MenuButton.setMenuModel` for the interaction
        /// with the `gtk.MenuButton.properties.popover` property.
        pub const menu_model = struct {
            pub const name = "menu-model";

            pub const Type = ?*gio.MenuModel;
        };

        /// The `GtkPopover` that will be popped up when the button is clicked.
        pub const popover = struct {
            pub const name = "popover";

            pub const Type = ?*gtk.Popover;
        };

        /// Whether the menu button acts as a primary menu.
        ///
        /// Primary menus can be opened using the <kbd>F10</kbd> key
        pub const primary = struct {
            pub const name = "primary";

            pub const Type = c_int;
        };

        /// If set an underscore in the text indicates a mnemonic.
        pub const use_underline = struct {
            pub const name = "use-underline";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to when the menu button is activated.
        ///
        /// The `::activate` signal on `GtkMenuButton` is an action signal and
        /// emitting it causes the button to pop up its menu.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(MenuButton, p_instance))),
                    gobject.signalLookup("activate", MenuButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkMenuButton` widget with downwards-pointing
    /// arrow as the only child.
    ///
    /// You can replace the child widget with another `GtkWidget`
    /// should you wish to.
    extern fn gtk_menu_button_new() *gtk.MenuButton;
    pub const new = gtk_menu_button_new;

    /// Returns whether the menu button is active.
    extern fn gtk_menu_button_get_active(p_menu_button: *MenuButton) c_int;
    pub const getActive = gtk_menu_button_get_active;

    /// Gets whether to show a dropdown arrow even when using an icon or a custom
    /// child.
    extern fn gtk_menu_button_get_always_show_arrow(p_menu_button: *MenuButton) c_int;
    pub const getAlwaysShowArrow = gtk_menu_button_get_always_show_arrow;

    /// Retrieves whether the button can be smaller than the natural
    /// size of its contents.
    extern fn gtk_menu_button_get_can_shrink(p_menu_button: *MenuButton) c_int;
    pub const getCanShrink = gtk_menu_button_get_can_shrink;

    /// Gets the child widget of `menu_button`.
    extern fn gtk_menu_button_get_child(p_menu_button: *MenuButton) ?*gtk.Widget;
    pub const getChild = gtk_menu_button_get_child;

    /// Returns the direction the popup will be pointing at when popped up.
    extern fn gtk_menu_button_get_direction(p_menu_button: *MenuButton) gtk.ArrowType;
    pub const getDirection = gtk_menu_button_get_direction;

    /// Returns whether the button has a frame.
    extern fn gtk_menu_button_get_has_frame(p_menu_button: *MenuButton) c_int;
    pub const getHasFrame = gtk_menu_button_get_has_frame;

    /// Gets the name of the icon shown in the button.
    extern fn gtk_menu_button_get_icon_name(p_menu_button: *MenuButton) ?[*:0]const u8;
    pub const getIconName = gtk_menu_button_get_icon_name;

    /// Gets the label shown in the button
    extern fn gtk_menu_button_get_label(p_menu_button: *MenuButton) ?[*:0]const u8;
    pub const getLabel = gtk_menu_button_get_label;

    /// Returns the `GMenuModel` used to generate the popup.
    extern fn gtk_menu_button_get_menu_model(p_menu_button: *MenuButton) ?*gio.MenuModel;
    pub const getMenuModel = gtk_menu_button_get_menu_model;

    /// Returns the `GtkPopover` that pops out of the button.
    ///
    /// If the button is not using a `GtkPopover`, this function
    /// returns `NULL`.
    extern fn gtk_menu_button_get_popover(p_menu_button: *MenuButton) ?*gtk.Popover;
    pub const getPopover = gtk_menu_button_get_popover;

    /// Returns whether the menu button acts as a primary menu.
    extern fn gtk_menu_button_get_primary(p_menu_button: *MenuButton) c_int;
    pub const getPrimary = gtk_menu_button_get_primary;

    /// Returns whether an embedded underline in the text indicates a
    /// mnemonic.
    extern fn gtk_menu_button_get_use_underline(p_menu_button: *MenuButton) c_int;
    pub const getUseUnderline = gtk_menu_button_get_use_underline;

    /// Dismiss the menu.
    extern fn gtk_menu_button_popdown(p_menu_button: *MenuButton) void;
    pub const popdown = gtk_menu_button_popdown;

    /// Pop up the menu.
    extern fn gtk_menu_button_popup(p_menu_button: *MenuButton) void;
    pub const popup = gtk_menu_button_popup;

    /// Sets whether the menu button is active.
    extern fn gtk_menu_button_set_active(p_menu_button: *MenuButton, p_active: c_int) void;
    pub const setActive = gtk_menu_button_set_active;

    /// Sets whether to show a dropdown arrow even when using an icon or a custom
    /// child.
    extern fn gtk_menu_button_set_always_show_arrow(p_menu_button: *MenuButton, p_always_show_arrow: c_int) void;
    pub const setAlwaysShowArrow = gtk_menu_button_set_always_show_arrow;

    /// Sets whether the button size can be smaller than the natural size of
    /// its contents.
    ///
    /// For text buttons, setting `can_shrink` to true will ellipsize the label.
    ///
    /// For icon buttons, this function has no effect.
    extern fn gtk_menu_button_set_can_shrink(p_menu_button: *MenuButton, p_can_shrink: c_int) void;
    pub const setCanShrink = gtk_menu_button_set_can_shrink;

    /// Sets the child widget of `menu_button`.
    ///
    /// Setting a child resets `gtk.MenuButton.properties.label` and
    /// `gtk.MenuButton.properties.icon_name`.
    ///
    /// If `gtk.MenuButton.properties.always_show_arrow` is set to `TRUE` and
    /// `gtk.MenuButton.properties.direction` is not `GTK_ARROW_NONE`, a dropdown arrow
    /// will be shown next to the child.
    extern fn gtk_menu_button_set_child(p_menu_button: *MenuButton, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_menu_button_set_child;

    /// Sets `func` to be called when a popup is about to be shown.
    ///
    /// `func` should use one of
    ///
    ///  - `gtk.MenuButton.setPopover`
    ///  - `gtk.MenuButton.setMenuModel`
    ///
    /// to set a popup for `menu_button`.
    /// If `func` is non-`NULL`, `menu_button` will always be sensitive.
    ///
    /// Using this function will not reset the menu widget attached to
    /// `menu_button`. Instead, this can be done manually in `func`.
    extern fn gtk_menu_button_set_create_popup_func(p_menu_button: *MenuButton, p_func: ?gtk.MenuButtonCreatePopupFunc, p_user_data: ?*anyopaque, p_destroy_notify: ?glib.DestroyNotify) void;
    pub const setCreatePopupFunc = gtk_menu_button_set_create_popup_func;

    /// Sets the direction in which the popup will be popped up.
    ///
    /// If the button is automatically populated with an arrow icon,
    /// its direction will be changed to match.
    ///
    /// If the does not fit in the available space in the given direction,
    /// GTK will its best to keep it inside the screen and fully visible.
    ///
    /// If you pass `GTK_ARROW_NONE` for a `direction`, the popup will behave
    /// as if you passed `GTK_ARROW_DOWN` (although you won’t see any arrows).
    extern fn gtk_menu_button_set_direction(p_menu_button: *MenuButton, p_direction: gtk.ArrowType) void;
    pub const setDirection = gtk_menu_button_set_direction;

    /// Sets the style of the button.
    extern fn gtk_menu_button_set_has_frame(p_menu_button: *MenuButton, p_has_frame: c_int) void;
    pub const setHasFrame = gtk_menu_button_set_has_frame;

    /// Sets the name of an icon to show inside the menu button.
    ///
    /// Setting icon name resets `gtk.MenuButton.properties.label` and
    /// `gtk.MenuButton.properties.child`.
    ///
    /// If `gtk.MenuButton.properties.always_show_arrow` is set to `TRUE` and
    /// `gtk.MenuButton.properties.direction` is not `GTK_ARROW_NONE`, a dropdown arrow
    /// will be shown next to the icon.
    extern fn gtk_menu_button_set_icon_name(p_menu_button: *MenuButton, p_icon_name: [*:0]const u8) void;
    pub const setIconName = gtk_menu_button_set_icon_name;

    /// Sets the label to show inside the menu button.
    ///
    /// Setting a label resets `gtk.MenuButton.properties.icon_name` and
    /// `gtk.MenuButton.properties.child`.
    ///
    /// If `gtk.MenuButton.properties.direction` is not `GTK_ARROW_NONE`, a dropdown
    /// arrow will be shown next to the label.
    extern fn gtk_menu_button_set_label(p_menu_button: *MenuButton, p_label: [*:0]const u8) void;
    pub const setLabel = gtk_menu_button_set_label;

    /// Sets the `GMenuModel` from which the popup will be constructed.
    ///
    /// If `menu_model` is `NULL`, the button is disabled.
    ///
    /// A `gtk.Popover` will be created from the menu model with
    /// `gtk.PopoverMenu.newFromModel`. Actions will be connected
    /// as documented for this function.
    ///
    /// If `gtk.MenuButton.properties.popover` is already set, it will be
    /// dissociated from the `menu_button`, and the property is set to `NULL`.
    extern fn gtk_menu_button_set_menu_model(p_menu_button: *MenuButton, p_menu_model: ?*gio.MenuModel) void;
    pub const setMenuModel = gtk_menu_button_set_menu_model;

    /// Sets the `GtkPopover` that will be popped up when the `menu_button` is clicked.
    ///
    /// If `popover` is `NULL`, the button is disabled.
    ///
    /// If `gtk.MenuButton.properties.menu_model` is set, the menu model is dissociated
    /// from the `menu_button`, and the property is set to `NULL`.
    extern fn gtk_menu_button_set_popover(p_menu_button: *MenuButton, p_popover: ?*gtk.Popover) void;
    pub const setPopover = gtk_menu_button_set_popover;

    /// Sets whether menu button acts as a primary menu.
    ///
    /// Primary menus can be opened with the <kbd>F10</kbd> key.
    extern fn gtk_menu_button_set_primary(p_menu_button: *MenuButton, p_primary: c_int) void;
    pub const setPrimary = gtk_menu_button_set_primary;

    /// If true, an underline in the text indicates a mnemonic.
    extern fn gtk_menu_button_set_use_underline(p_menu_button: *MenuButton, p_use_underline: c_int) void;
    pub const setUseUnderline = gtk_menu_button_set_use_underline;

    extern fn gtk_menu_button_get_type() usize;
    pub const getGObjectType = gtk_menu_button_get_type;

    extern fn g_object_ref(p_self: *gtk.MenuButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MenuButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MenuButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkMessageDialog` presents a dialog with some message text.
///
/// <picture>
///   <source srcset="messagedialog-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkMessageDialog" src="messagedialog.png">
/// </picture>
///
/// It’s simply a convenience widget; you could construct the equivalent of
/// `GtkMessageDialog` from `GtkDialog` without too much effort, but
/// `GtkMessageDialog` saves typing.
///
/// The easiest way to do a modal message dialog is to use the `GTK_DIALOG_MODAL`
/// flag, which will call `gtk.Window.setModal` internally. The dialog will
/// prevent interaction with the parent window until it's hidden or destroyed.
/// You can use the `gtk.Dialog.signals.response` signal to know when the user
/// dismissed the dialog.
///
/// An example for using a modal dialog:
/// ```c
/// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL;
/// dialog = gtk_message_dialog_new (parent_window,
///                                  flags,
///                                  GTK_MESSAGE_ERROR,
///                                  GTK_BUTTONS_CLOSE,
///                                  "Error reading “`s`”: `s`",
///                                  filename,
///                                  g_strerror (errno));
/// // Destroy the dialog when the user responds to it
/// // (e.g. clicks a button)
///
/// g_signal_connect (dialog, "response",
///                   G_CALLBACK (gtk_window_destroy),
///                   NULL);
/// ```
///
/// You might do a non-modal `GtkMessageDialog` simply by omitting the
/// `GTK_DIALOG_MODAL` flag:
///
/// ```c
/// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
/// dialog = gtk_message_dialog_new (parent_window,
///                                  flags,
///                                  GTK_MESSAGE_ERROR,
///                                  GTK_BUTTONS_CLOSE,
///                                  "Error reading “`s`”: `s`",
///                                  filename,
///                                  g_strerror (errno));
///
/// // Destroy the dialog when the user responds to it
/// // (e.g. clicks a button)
/// g_signal_connect (dialog, "response",
///                   G_CALLBACK (gtk_window_destroy),
///                   NULL);
/// ```
///
/// # GtkMessageDialog as GtkBuildable
///
/// The `GtkMessageDialog` implementation of the `GtkBuildable` interface exposes
/// the message area as an internal child with the name “message_area”.
pub const MessageDialog = extern struct {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = gtk.MessageDialogClass;
    f_parent_instance: gtk.Dialog,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Set of buttons to display on the dialog.
        pub const buttons = struct {
            pub const name = "buttons";

            pub const Type = gtk.ButtonsType;
        };

        /// The `GtkBox` that corresponds to the message area of this dialog.
        ///
        /// See `gtk.MessageDialog.getMessageArea` for a detailed
        /// description of this area.
        pub const message_area = struct {
            pub const name = "message-area";

            pub const Type = ?*gtk.Widget;
        };

        /// The type of the message.
        pub const message_type = struct {
            pub const name = "message-type";

            pub const Type = gtk.MessageType;
        };

        /// The secondary text of the message dialog.
        pub const secondary_text = struct {
            pub const name = "secondary-text";

            pub const Type = ?[*:0]u8;
        };

        /// `TRUE` if the secondary text of the dialog includes Pango markup.
        ///
        /// See `pango.parseMarkup`.
        pub const secondary_use_markup = struct {
            pub const name = "secondary-use-markup";

            pub const Type = c_int;
        };

        /// The primary text of the message dialog.
        ///
        /// If the dialog has a secondary text, this will appear as the title.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };

        /// `TRUE` if the primary text of the dialog includes Pango markup.
        ///
        /// See `pango.parseMarkup`.
        pub const use_markup = struct {
            pub const name = "use-markup";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new message dialog.
    ///
    /// This is a simple dialog with some text the user may want to see.
    /// When the user clicks a button a “response” signal is emitted with
    /// response IDs from `gtk.ResponseType`. See `gtk.Dialog`
    /// for more details.
    extern fn gtk_message_dialog_new(p_parent: ?*gtk.Window, p_flags: gtk.DialogFlags, p_type: gtk.MessageType, p_buttons: gtk.ButtonsType, p_message_format: ?[*:0]const u8, ...) *gtk.MessageDialog;
    pub const new = gtk_message_dialog_new;

    /// Creates a new message dialog.
    ///
    /// This is a simple dialog with some text that is marked up with
    /// Pango markup. When the user clicks a button a “response” signal
    /// is emitted with response IDs from `gtk.ResponseType`. See
    /// `gtk.Dialog` for more details.
    ///
    /// Special XML characters in the `printf` arguments passed to this
    /// function will automatically be escaped as necessary.
    /// (See `glib.markupPrintfEscaped` for how this is implemented.)
    /// Usually this is what you want, but if you have an existing
    /// Pango markup string that you want to use literally as the
    /// label, then you need to use `gtk.MessageDialog.setMarkup`
    /// instead, since you can’t pass the markup string either
    /// as the format (it might contain “%” characters) or as a string
    /// argument.
    ///
    /// ```c
    /// GtkWidget *dialog;
    /// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
    /// dialog = gtk_message_dialog_new (parent_window,
    ///                                  flags,
    ///                                  GTK_MESSAGE_ERROR,
    ///                                  GTK_BUTTONS_CLOSE,
    ///                                  NULL);
    /// gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
    ///                                markup);
    /// ```
    extern fn gtk_message_dialog_new_with_markup(p_parent: ?*gtk.Window, p_flags: gtk.DialogFlags, p_type: gtk.MessageType, p_buttons: gtk.ButtonsType, p_message_format: ?[*:0]const u8, ...) *gtk.MessageDialog;
    pub const newWithMarkup = gtk_message_dialog_new_with_markup;

    /// Sets the secondary text of the message dialog.
    ///
    /// The `message_format` is assumed to contain Pango markup.
    ///
    /// Due to an oversight, this function does not escape special
    /// XML characters like `gtk.MessageDialog.newWithMarkup`
    /// does. Thus, if the arguments may contain special XML characters,
    /// you should use `glib.markupPrintfEscaped` to escape it.
    ///
    /// ```c
    /// char *msg;
    ///
    /// msg = g_markup_printf_escaped (message_format, ...);
    /// gtk_message_dialog_format_secondary_markup (message_dialog,
    ///                                             "`s`", msg);
    /// g_free (msg);
    /// ```
    extern fn gtk_message_dialog_format_secondary_markup(p_message_dialog: *MessageDialog, p_message_format: [*:0]const u8, ...) void;
    pub const formatSecondaryMarkup = gtk_message_dialog_format_secondary_markup;

    /// Sets the secondary text of the message dialog.
    extern fn gtk_message_dialog_format_secondary_text(p_message_dialog: *MessageDialog, p_message_format: ?[*:0]const u8, ...) void;
    pub const formatSecondaryText = gtk_message_dialog_format_secondary_text;

    /// Returns the message area of the dialog.
    ///
    /// This is the box where the dialog’s primary and secondary labels
    /// are packed. You can add your own extra content to that box and it
    /// will appear below those labels. See `gtk.Dialog.getContentArea`
    /// for the corresponding function in the parent `gtk.Dialog`.
    extern fn gtk_message_dialog_get_message_area(p_message_dialog: *MessageDialog) *gtk.Widget;
    pub const getMessageArea = gtk_message_dialog_get_message_area;

    /// Sets the text of the message dialog.
    extern fn gtk_message_dialog_set_markup(p_message_dialog: *MessageDialog, p_str: [*:0]const u8) void;
    pub const setMarkup = gtk_message_dialog_set_markup;

    extern fn gtk_message_dialog_get_type() usize;
    pub const getGObjectType = gtk_message_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.MessageDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MessageDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MessageDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Activates a widget with a mnemonic.
///
/// This means that `gtk.Widget.mnemonicActivate` is called.
pub const MnemonicAction = opaque {
    pub const Parent = gtk.ShortcutAction;
    pub const Implements = [_]type{};
    pub const Class = gtk.MnemonicActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Gets the mnemonic action.
    ///
    /// This is an action that calls `gtk.Widget.mnemonicActivate`
    /// on the given widget upon activation.
    extern fn gtk_mnemonic_action_get() *gtk.MnemonicAction;
    pub const get = gtk_mnemonic_action_get;

    extern fn gtk_mnemonic_action_get_type() usize;
    pub const getGObjectType = gtk_mnemonic_action_get_type;

    extern fn g_object_ref(p_self: *gtk.MnemonicAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MnemonicAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MnemonicAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Triggers when a specific mnemonic is pressed.
///
/// Mnemonics require a *mnemonic modifier* (typically <kbd>Alt</kbd>) to be
/// pressed together with the mnemonic key.
pub const MnemonicTrigger = opaque {
    pub const Parent = gtk.ShortcutTrigger;
    pub const Implements = [_]type{};
    pub const Class = gtk.MnemonicTriggerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The key value for the trigger.
        pub const keyval = struct {
            pub const name = "keyval";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkShortcutTrigger` that will trigger whenever the key with
    /// the given `keyval` is pressed and mnemonics have been activated.
    ///
    /// Mnemonics are activated by calling code when a key event with the right
    /// modifiers is detected.
    extern fn gtk_mnemonic_trigger_new(p_keyval: c_uint) *gtk.MnemonicTrigger;
    pub const new = gtk_mnemonic_trigger_new;

    /// Gets the keyval that must be pressed to succeed triggering `self`.
    extern fn gtk_mnemonic_trigger_get_keyval(p_self: *MnemonicTrigger) c_uint;
    pub const getKeyval = gtk_mnemonic_trigger_get_keyval;

    extern fn gtk_mnemonic_trigger_get_type() usize;
    pub const getGObjectType = gtk_mnemonic_trigger_get_type;

    extern fn g_object_ref(p_self: *gtk.MnemonicTrigger) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MnemonicTrigger) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MnemonicTrigger, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asks the user for passwords and other information required to
/// mount a volume.
///
/// `GtkMountOperation` is needed when mounting volumes:
/// It is an implementation of `GMountOperation` that can be used with
/// GIO functions for mounting volumes such as
/// `gio.File.mountEnclosingVolume`,
/// `gio.File.mountMountable`,
/// `gio.Volume.mount`,
/// `gio.Mount.unmountWithOperation` and others.
///
/// When necessary, `GtkMountOperation` shows dialogs to let the user
/// enter passwords, ask questions or show processes blocking unmount.
pub const MountOperation = extern struct {
    pub const Parent = gio.MountOperation;
    pub const Implements = [_]type{};
    pub const Class = gtk.MountOperationClass;
    f_parent_instance: gio.MountOperation,
    f_priv: ?*gtk.MountOperationPrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The display where dialogs will be shown.
        pub const display = struct {
            pub const name = "display";

            pub const Type = ?*gdk.Display;
        };

        /// Whether a dialog is currently shown.
        pub const is_showing = struct {
            pub const name = "is-showing";

            pub const Type = c_int;
        };

        /// The parent window.
        pub const parent = struct {
            pub const name = "parent";

            pub const Type = ?*gtk.Window;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkMountOperation`.
    extern fn gtk_mount_operation_new(p_parent: ?*gtk.Window) *gtk.MountOperation;
    pub const new = gtk_mount_operation_new;

    /// Gets the display on which windows of the `GtkMountOperation`
    /// will be shown.
    extern fn gtk_mount_operation_get_display(p_op: *MountOperation) *gdk.Display;
    pub const getDisplay = gtk_mount_operation_get_display;

    /// Gets the transient parent used by the `GtkMountOperation`.
    extern fn gtk_mount_operation_get_parent(p_op: *MountOperation) ?*gtk.Window;
    pub const getParent = gtk_mount_operation_get_parent;

    /// Returns whether the `GtkMountOperation` is currently displaying
    /// a window.
    extern fn gtk_mount_operation_is_showing(p_op: *MountOperation) c_int;
    pub const isShowing = gtk_mount_operation_is_showing;

    /// Sets the display to show windows of the `GtkMountOperation` on.
    extern fn gtk_mount_operation_set_display(p_op: *MountOperation, p_display: *gdk.Display) void;
    pub const setDisplay = gtk_mount_operation_set_display;

    /// Sets the transient parent for windows shown by the
    /// `GtkMountOperation`.
    extern fn gtk_mount_operation_set_parent(p_op: *MountOperation, p_parent: ?*gtk.Window) void;
    pub const setParent = gtk_mount_operation_set_parent;

    extern fn gtk_mount_operation_get_type() usize;
    pub const getGObjectType = gtk_mount_operation_get_type;

    extern fn g_object_ref(p_self: *gtk.MountOperation) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MountOperation) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MountOperation, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Base class for filters that combine multiple filters.
pub const MultiFilter = opaque {
    pub const Parent = gtk.Filter;
    pub const Implements = [_]type{ gio.ListModel, gtk.Buildable };
    pub const Class = gtk.MultiFilterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items.
        ///
        /// See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The number of items.
        ///
        /// See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Adds a filter.
    extern fn gtk_multi_filter_append(p_self: *MultiFilter, p_filter: *gtk.Filter) void;
    pub const append = gtk_multi_filter_append;

    /// Removes a filter.
    ///
    /// If `position` is larger than the number of filters,
    /// nothing happens.
    extern fn gtk_multi_filter_remove(p_self: *MultiFilter, p_position: c_uint) void;
    pub const remove = gtk_multi_filter_remove;

    extern fn gtk_multi_filter_get_type() usize;
    pub const getGObjectType = gtk_multi_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.MultiFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MultiFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MultiFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A selection model that allows selecting multiple elements.
pub const MultiSelection = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel, gtk.SelectionModel };
    pub const Class = gtk.MultiSelectionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The list managed by this selection.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new selection to handle `model`.
    extern fn gtk_multi_selection_new(p_model: ?*gio.ListModel) *gtk.MultiSelection;
    pub const new = gtk_multi_selection_new;

    /// Returns the underlying model of `self`.
    extern fn gtk_multi_selection_get_model(p_self: *MultiSelection) ?*gio.ListModel;
    pub const getModel = gtk_multi_selection_get_model;

    /// Sets the model that `self` should wrap.
    ///
    /// If `model` is `NULL`, `self` will be empty.
    extern fn gtk_multi_selection_set_model(p_self: *MultiSelection, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_multi_selection_set_model;

    extern fn gtk_multi_selection_get_type() usize;
    pub const getGObjectType = gtk_multi_selection_get_type;

    extern fn g_object_ref(p_self: *gtk.MultiSelection) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MultiSelection) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MultiSelection, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Combines multiple sorters by trying them in turn.
///
/// If the first sorter compares two items as equal,
/// the second is tried next, and so on.
pub const MultiSorter = opaque {
    pub const Parent = gtk.Sorter;
    pub const Implements = [_]type{ gio.ListModel, gtk.Buildable };
    pub const Class = gtk.MultiSorterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new multi sorter.
    ///
    /// This sorter compares items by trying each of the sorters
    /// in turn, until one returns non-zero. In particular, if
    /// no sorter has been added to it, it will always compare
    /// items as equal.
    extern fn gtk_multi_sorter_new() *gtk.MultiSorter;
    pub const new = gtk_multi_sorter_new;

    /// Add `sorter` to `self` to use for sorting at the end.
    ///
    /// `self` will consult all existing sorters before it will
    /// sort with the given `sorter`.
    extern fn gtk_multi_sorter_append(p_self: *MultiSorter, p_sorter: *gtk.Sorter) void;
    pub const append = gtk_multi_sorter_append;

    /// Removes the sorter at the given `position` from the list of sorter
    /// used by `self`.
    ///
    /// If `position` is larger than the number of sorters, nothing happens.
    extern fn gtk_multi_sorter_remove(p_self: *MultiSorter, p_position: c_uint) void;
    pub const remove = gtk_multi_sorter_remove;

    extern fn gtk_multi_sorter_get_type() usize;
    pub const getGObjectType = gtk_multi_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.MultiSorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.MultiSorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *MultiSorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Activates a named action.
///
/// See `gtk.WidgetClass.installAction` and
/// `gtk.Widget.insertActionGroup` for ways
/// to associate named actions with widgets.
pub const NamedAction = opaque {
    pub const Parent = gtk.ShortcutAction;
    pub const Implements = [_]type{};
    pub const Class = gtk.NamedActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The name of the action to activate.
        pub const action_name = struct {
            pub const name = "action-name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates an action that when activated, activates
    /// the named action on the widget.
    ///
    /// It also passes the given arguments to it.
    ///
    /// See `gtk.Widget.insertActionGroup` for
    /// how to add actions to widgets.
    extern fn gtk_named_action_new(p_name: [*:0]const u8) *gtk.NamedAction;
    pub const new = gtk_named_action_new;

    /// Returns the name of the action that will be activated.
    extern fn gtk_named_action_get_action_name(p_self: *NamedAction) [*:0]const u8;
    pub const getActionName = gtk_named_action_get_action_name;

    extern fn gtk_named_action_get_type() usize;
    pub const getGObjectType = gtk_named_action_get_type;

    extern fn g_object_ref(p_self: *gtk.NamedAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NamedAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NamedAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Base class for platform dialogs that don't use `GtkDialog`.
///
/// Native dialogs are used in order to integrate better with a platform,
/// by looking the same as other native applications and supporting
/// platform specific features.
///
/// The `gtk.Dialog` functions cannot be used on such objects,
/// but we need a similar API in order to drive them. The `GtkNativeDialog`
/// object is an API that allows you to do this. It allows you to set
/// various common properties on the dialog, as well as show and hide
/// it and get a `gtk.NativeDialog.signals.response` signal when the user
/// finished with the dialog.
///
/// Note that unlike `GtkDialog`, `GtkNativeDialog` objects are not
/// toplevel widgets, and GTK does not keep them alive. It is your
/// responsibility to keep a reference until you are done with the
/// object.
pub const NativeDialog = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.NativeDialogClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Hides the dialog if it is visible, aborting any interaction.
        ///
        /// Once this is called the `gtk.NativeDialog.signals.response` signal
        /// will *not* be emitted until after the next call to
        /// `gtk.NativeDialog.show`.
        ///
        /// If the dialog is not visible this does nothing.
        pub const hide = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(NativeDialog.Class, p_class).f_hide.?(gobject.ext.as(NativeDialog, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(NativeDialog.Class, p_class).f_hide = @ptrCast(p_implementation);
            }
        };

        /// class handler for the `GtkNativeDialog::response` signal
        pub const response = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_response_id: c_int) void {
                return gobject.ext.as(NativeDialog.Class, p_class).f_response.?(gobject.ext.as(NativeDialog, p_self), p_response_id);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_response_id: c_int) callconv(.c) void) void {
                gobject.ext.as(NativeDialog.Class, p_class).f_response = @ptrCast(p_implementation);
            }
        };

        /// Shows the dialog on the display.
        ///
        /// When the user accepts the state of the dialog the dialog will
        /// be automatically hidden and the `gtk.NativeDialog.signals.response`
        /// signal will be emitted.
        ///
        /// Multiple calls while the dialog is visible will be ignored.
        pub const show = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(NativeDialog.Class, p_class).f_show.?(gobject.ext.as(NativeDialog, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(NativeDialog.Class, p_class).f_show = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Whether the window should be modal with respect to its transient parent.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// The title of the dialog window
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// The transient parent of the dialog, or `NULL` for none.
        pub const transient_for = struct {
            pub const name = "transient-for";

            pub const Type = ?*gtk.Window;
        };

        /// Whether the window is currently visible.
        pub const visible = struct {
            pub const name = "visible";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the user responds to the dialog.
        ///
        /// When this is called the dialog has been hidden.
        ///
        /// If you call `gtk.NativeDialog.hide` before the user
        /// responds to the dialog this signal will not be emitted.
        pub const response = struct {
            pub const name = "response";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_response_id: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(NativeDialog, p_instance))),
                    gobject.signalLookup("response", NativeDialog.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Destroys a dialog.
    ///
    /// When a dialog is destroyed, it will break any references it holds
    /// to other objects.
    ///
    /// If it is visible it will be hidden and any underlying window system
    /// resources will be destroyed.
    ///
    /// Note that this does not release any reference to the object (as opposed
    /// to destroying a `GtkWindow`) because there is no reference from the
    /// windowing system to the `GtkNativeDialog`.
    extern fn gtk_native_dialog_destroy(p_self: *NativeDialog) void;
    pub const destroy = gtk_native_dialog_destroy;

    /// Returns whether the dialog is modal.
    extern fn gtk_native_dialog_get_modal(p_self: *NativeDialog) c_int;
    pub const getModal = gtk_native_dialog_get_modal;

    /// Gets the title of the `GtkNativeDialog`.
    extern fn gtk_native_dialog_get_title(p_self: *NativeDialog) ?[*:0]const u8;
    pub const getTitle = gtk_native_dialog_get_title;

    /// Fetches the transient parent for this window.
    extern fn gtk_native_dialog_get_transient_for(p_self: *NativeDialog) ?*gtk.Window;
    pub const getTransientFor = gtk_native_dialog_get_transient_for;

    /// Determines whether the dialog is visible.
    extern fn gtk_native_dialog_get_visible(p_self: *NativeDialog) c_int;
    pub const getVisible = gtk_native_dialog_get_visible;

    /// Hides the dialog if it is visible, aborting any interaction.
    ///
    /// Once this is called the `gtk.NativeDialog.signals.response` signal
    /// will *not* be emitted until after the next call to
    /// `gtk.NativeDialog.show`.
    ///
    /// If the dialog is not visible this does nothing.
    extern fn gtk_native_dialog_hide(p_self: *NativeDialog) void;
    pub const hide = gtk_native_dialog_hide;

    /// Sets a dialog modal or non-modal.
    ///
    /// Modal dialogs prevent interaction with other windows in the same
    /// application. To keep modal dialogs on top of main application
    /// windows, use `gtk.NativeDialog.setTransientFor` to make
    /// the dialog transient for the parent; most window managers will
    /// then disallow lowering the dialog below the parent.
    extern fn gtk_native_dialog_set_modal(p_self: *NativeDialog, p_modal: c_int) void;
    pub const setModal = gtk_native_dialog_set_modal;

    /// Sets the title of the `GtkNativeDialog.`
    extern fn gtk_native_dialog_set_title(p_self: *NativeDialog, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_native_dialog_set_title;

    /// Dialog windows should be set transient for the main application
    /// window they were spawned from.
    ///
    /// This allows window managers to e.g. keep the dialog on top of the
    /// main window, or center the dialog over the main window.
    ///
    /// Passing `NULL` for `parent` unsets the current transient window.
    extern fn gtk_native_dialog_set_transient_for(p_self: *NativeDialog, p_parent: ?*gtk.Window) void;
    pub const setTransientFor = gtk_native_dialog_set_transient_for;

    /// Shows the dialog on the display.
    ///
    /// When the user accepts the state of the dialog the dialog will
    /// be automatically hidden and the `gtk.NativeDialog.signals.response`
    /// signal will be emitted.
    ///
    /// Multiple calls while the dialog is visible will be ignored.
    extern fn gtk_native_dialog_show(p_self: *NativeDialog) void;
    pub const show = gtk_native_dialog_show;

    extern fn gtk_native_dialog_get_type() usize;
    pub const getGObjectType = gtk_native_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.NativeDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NativeDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NativeDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkShortcutTrigger` that never triggers.
pub const NeverTrigger = opaque {
    pub const Parent = gtk.ShortcutTrigger;
    pub const Implements = [_]type{};
    pub const Class = gtk.NeverTriggerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Gets the never trigger.
    ///
    /// This is a singleton for a trigger that never triggers.
    /// Use this trigger instead of `NULL` because it implements
    /// all virtual functions.
    extern fn gtk_never_trigger_get() *gtk.NeverTrigger;
    pub const get = gtk_never_trigger_get;

    extern fn gtk_never_trigger_get_type() usize;
    pub const getGObjectType = gtk_never_trigger_get_type;

    extern fn g_object_ref(p_self: *gtk.NeverTrigger) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NeverTrigger) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NeverTrigger, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A selection model that does not allow selecting anything.
///
/// This model is meant to be used as a simple wrapper around a `GListModel`
/// when a `GtkSelectionModel` is required.
///
/// `GtkNoSelection` passes through sections from the underlying model.
pub const NoSelection = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel, gtk.SelectionModel };
    pub const Class = gtk.NoSelectionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being managed.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new selection to handle `model`.
    extern fn gtk_no_selection_new(p_model: ?*gio.ListModel) *gtk.NoSelection;
    pub const new = gtk_no_selection_new;

    /// Gets the model that `self` is wrapping.
    extern fn gtk_no_selection_get_model(p_self: *NoSelection) ?*gio.ListModel;
    pub const getModel = gtk_no_selection_get_model;

    /// Sets the model that `self` should wrap.
    ///
    /// If `model` is `NULL`, this model will be empty.
    extern fn gtk_no_selection_set_model(p_self: *NoSelection, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_no_selection_set_model;

    extern fn gtk_no_selection_get_type() usize;
    pub const getGObjectType = gtk_no_selection_get_type;

    extern fn g_object_ref(p_self: *gtk.NoSelection) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NoSelection) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NoSelection, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Switches between children using tabs.
///
/// <picture>
///   <source srcset="notebook-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkNotebook" src="notebook.png">
/// </picture>
///
/// There are many configuration options for `GtkNotebook`. Among
/// other things, you can choose on which edge the tabs appear
/// (see `gtk.Notebook.setTabPos`), whether, if there are
/// too many tabs to fit the notebook should be made bigger or scrolling
/// arrows added (see `gtk.Notebook.setScrollable`), and whether
/// there will be a popup menu allowing the users to switch pages.
/// (see `gtk.Notebook.popupEnable`).
///
/// # GtkNotebook as GtkBuildable
///
/// The `GtkNotebook` implementation of the `GtkBuildable` interface
/// supports placing children into tabs by specifying “tab” as the
/// “type” attribute of a `<child>` element. Note that the content
/// of the tab must be created before the tab can be filled.
/// A tab child can be specified without specifying a `<child>`
/// type attribute.
///
/// To add a child widget in the notebooks action area, specify
/// "action-start" or “action-end” as the “type” attribute of the
/// `<child>` element.
///
/// An example of a UI definition fragment with `GtkNotebook`:
///
/// ```xml
/// <object class="GtkNotebook">
///   <child>
///     <object class="GtkLabel" id="notebook-content">
///       <property name="label">Content</property>
///     </object>
///   </child>
///   <child type="tab">
///     <object class="GtkLabel" id="notebook-tab">
///       <property name="label">Tab</property>
///     </object>
///   </child>
/// </object>
/// ```
///
/// # Shortcuts and Gestures
///
/// `GtkNotebook` supports the following keyboard shortcuts:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
/// - <kbd>Home</kbd> moves the focus to the first tab.
/// - <kbd>End</kbd> moves the focus to the last tab.
///
/// Additionally, the following signals have default keybindings:
///
/// - `gtk.Notebook.signals.change_current_page`
/// - `gtk.Notebook.signals.focus_tab`
/// - `gtk.Notebook.signals.move_focus_out`
/// - `gtk.Notebook.signals.reorder_tab`
/// - `gtk.Notebook.signals.select_page`
///
/// Tabs support drag-and-drop between notebooks sharing the same `group-name`,
/// or to new windows by handling the `::create-window` signal.
///
/// # Actions
///
/// `GtkNotebook` defines a set of built-in actions:
///
/// - `menu.popup` opens the tabs context menu.
///
/// # CSS nodes
///
/// ```
/// notebook
/// ├── header.top
/// │   ├── [<action widget>]
/// │   ├── tabs
/// │   │   ├── [arrow]
/// │   │   ├── tab
/// │   │   │   ╰── <tab label>
/// ┊   ┊   ┊
/// │   │   ├── tab[.reorderable-page]
/// │   │   │   ╰── <tab label>
/// │   │   ╰── [arrow]
/// │   ╰── [<action widget>]
/// │
/// ╰── stack
///     ├── <child>
///     ┊
///     ╰── <child>
/// ```
///
/// `GtkNotebook` has a main CSS node with name `notebook`, a subnode
/// with name `header` and below that a subnode with name `tabs` which
/// contains one subnode per tab with name `tab`.
///
/// If action widgets are present, their CSS nodes are placed next
/// to the `tabs` node. If the notebook is scrollable, CSS nodes with
/// name `arrow` are placed as first and last child of the `tabs` node.
///
/// The main node gets the `.frame` style class when the notebook
/// has a border (see `gtk.Notebook.setShowBorder`).
///
/// The header node gets one of the style class `.top`, `.bottom`,
/// `.left` or `.right`, depending on where the tabs are placed. For
/// reorderable pages, the tab node gets the `.reorderable-page` class.
///
/// A `tab` node gets the `.dnd` style class while it is moved with drag-and-drop.
///
/// The nodes are always arranged from left-to-right, regardless of text direction.
///
/// # Accessibility
///
/// `GtkNotebook` uses the following roles:
///
///  - `gtk.@"AccessibleRole.group"` for the notebook widget
///  - `gtk.@"AccessibleRole.tab_list"` for the list of tabs
///  - `gtk.@"AccessibleRole.tab"` role for each tab
///  - `gtk.@"AccessibleRole.tab_panel"` for each page
pub const Notebook = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Notebook;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If `TRUE`, pressing the right mouse button on the notebook shows a page switching menu.
        pub const enable_popup = struct {
            pub const name = "enable-popup";

            pub const Type = c_int;
        };

        /// Group name for tab drag and drop.
        pub const group_name = struct {
            pub const name = "group-name";

            pub const Type = ?[*:0]u8;
        };

        /// The index of the current page.
        pub const page = struct {
            pub const name = "page";

            pub const Type = c_int;
        };

        /// A selection model with the pages.
        pub const pages = struct {
            pub const name = "pages";

            pub const Type = ?*gio.ListModel;
        };

        /// If `TRUE`, scroll arrows are added if there are too many pages to fit.
        pub const scrollable = struct {
            pub const name = "scrollable";

            pub const Type = c_int;
        };

        /// Whether the border should be shown.
        pub const show_border = struct {
            pub const name = "show-border";

            pub const Type = c_int;
        };

        /// Whether tabs should be shown.
        pub const show_tabs = struct {
            pub const name = "show-tabs";

            pub const Type = c_int;
        };

        /// Which side of the notebook holds the tabs.
        pub const tab_pos = struct {
            pub const name = "tab-pos";

            pub const Type = gtk.PositionType;
        };
    };

    pub const signals = struct {
        /// Emitted when the current page should be changed.
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PgUp</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>PgDn</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> and <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>.
        pub const change_current_page = struct {
            pub const name = "change-current-page";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_page: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("change-current-page", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::create-window signal is emitted when a detachable
        /// tab is dropped on the root window.
        ///
        /// A handler for this signal can create a window containing
        /// a notebook where the tab will be attached. It is also
        /// responsible for moving/resizing the window and adding the
        /// necessary properties to the notebook (e.g. the
        /// `GtkNotebook`:group-name ).
        pub const create_window = struct {
            pub const name = "create-window";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_page: *gtk.Widget, P_Data) callconv(.c) ?*gtk.Notebook, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("create-window", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a tab should be focused.
        pub const focus_tab = struct {
            pub const name = "focus-tab";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_tab: gtk.NotebookTab, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("focus-tab", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when focus was moved out.
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>Ctrl</kbd>+<kbd>→</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>↑</kbd> and <kbd>Ctrl</kbd>+<kbd>↓</kbd>.
        pub const move_focus_out = struct {
            pub const name = "move-focus-out";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_direction: gtk.DirectionType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("move-focus-out", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// the ::page-added signal is emitted in the notebook
        /// right after a page is added to the notebook.
        pub const page_added = struct {
            pub const name = "page-added";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_child: *gtk.Widget, p_page_num: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("page-added", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// the ::page-removed signal is emitted in the notebook
        /// right after a page is removed from the notebook.
        pub const page_removed = struct {
            pub const name = "page-removed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_child: *gtk.Widget, p_page_num: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("page-removed", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// the ::page-reordered signal is emitted in the notebook
        /// right after a page has been reordered.
        pub const page_reordered = struct {
            pub const name = "page-reordered";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_child: *gtk.Widget, p_page_num: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("page-reordered", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the tab should be reordered.
        ///
        /// The default bindings for this signal are
        /// <kbd>Alt</kbd>+<kbd>Home</kbd>, <kbd>Alt</kbd>+<kbd>End</kbd>,
        /// <kbd>Alt</kbd>+<kbd>PgUp</kbd>, <kbd>Alt</kbd>+<kbd>PgDn</kbd>,
        /// <kbd>Alt</kbd>+<kbd>←</kbd>, <kbd>Alt</kbd>+<kbd>→</kbd>,
        /// <kbd>Alt</kbd>+<kbd>↑</kbd> and <kbd>Alt</kbd>+<kbd>↓</kbd>.
        pub const reorder_tab = struct {
            pub const name = "reorder-tab";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_direction: gtk.DirectionType, p_move_to_last: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("reorder-tab", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a page should be selected.
        ///
        /// The default binding for this signal is <kbd>␣</kbd>.
        pub const select_page = struct {
            pub const name = "select-page";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_move_focus: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("select-page", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user or a function changes the current page.
        pub const switch_page = struct {
            pub const name = "switch-page";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_page: *gtk.Widget, p_page_num: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Notebook, p_instance))),
                    gobject.signalLookup("switch-page", Notebook.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkNotebook` widget with no pages.
    extern fn gtk_notebook_new() *gtk.Notebook;
    pub const new = gtk_notebook_new;

    /// Appends a page to `notebook`.
    extern fn gtk_notebook_append_page(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget) c_int;
    pub const appendPage = gtk_notebook_append_page;

    /// Appends a page to `notebook`, specifying the widget to use as the
    /// label in the popup menu.
    extern fn gtk_notebook_append_page_menu(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget, p_menu_label: ?*gtk.Widget) c_int;
    pub const appendPageMenu = gtk_notebook_append_page_menu;

    /// Removes the child from the notebook.
    ///
    /// This function is very similar to `gtk.Notebook.removePage`,
    /// but additionally informs the notebook that the removal
    /// is happening as part of a tab DND operation, which should
    /// not be cancelled.
    extern fn gtk_notebook_detach_tab(p_notebook: *Notebook, p_child: *gtk.Widget) void;
    pub const detachTab = gtk_notebook_detach_tab;

    /// Gets one of the action widgets.
    ///
    /// See `gtk.Notebook.setActionWidget`.
    extern fn gtk_notebook_get_action_widget(p_notebook: *Notebook, p_pack_type: gtk.PackType) ?*gtk.Widget;
    pub const getActionWidget = gtk_notebook_get_action_widget;

    /// Returns the page number of the current page.
    extern fn gtk_notebook_get_current_page(p_notebook: *Notebook) c_int;
    pub const getCurrentPage = gtk_notebook_get_current_page;

    /// Gets the current group name for `notebook`.
    extern fn gtk_notebook_get_group_name(p_notebook: *Notebook) ?[*:0]const u8;
    pub const getGroupName = gtk_notebook_get_group_name;

    /// Retrieves the menu label widget of the page containing `child`.
    extern fn gtk_notebook_get_menu_label(p_notebook: *Notebook, p_child: *gtk.Widget) ?*gtk.Widget;
    pub const getMenuLabel = gtk_notebook_get_menu_label;

    /// Retrieves the text of the menu label for the page containing
    /// `child`.
    extern fn gtk_notebook_get_menu_label_text(p_notebook: *Notebook, p_child: *gtk.Widget) ?[*:0]const u8;
    pub const getMenuLabelText = gtk_notebook_get_menu_label_text;

    /// Gets the number of pages in a notebook.
    extern fn gtk_notebook_get_n_pages(p_notebook: *Notebook) c_int;
    pub const getNPages = gtk_notebook_get_n_pages;

    /// Returns the child widget contained in page number `page_num`.
    extern fn gtk_notebook_get_nth_page(p_notebook: *Notebook, p_page_num: c_int) ?*gtk.Widget;
    pub const getNthPage = gtk_notebook_get_nth_page;

    /// Returns the `GtkNotebookPage` for `child`.
    extern fn gtk_notebook_get_page(p_notebook: *Notebook, p_child: *gtk.Widget) *gtk.NotebookPage;
    pub const getPage = gtk_notebook_get_page;

    /// Returns a `GListModel` that contains the pages of the notebook.
    ///
    /// This can be used to keep an up-to-date view. The model also
    /// implements `gtk.SelectionModel` and can be used to track
    /// and modify the visible page.
    extern fn gtk_notebook_get_pages(p_notebook: *Notebook) *gio.ListModel;
    pub const getPages = gtk_notebook_get_pages;

    /// Returns whether the tab label area has arrows for scrolling.
    extern fn gtk_notebook_get_scrollable(p_notebook: *Notebook) c_int;
    pub const getScrollable = gtk_notebook_get_scrollable;

    /// Returns whether a bevel will be drawn around the notebook pages.
    extern fn gtk_notebook_get_show_border(p_notebook: *Notebook) c_int;
    pub const getShowBorder = gtk_notebook_get_show_border;

    /// Returns whether the tabs of the notebook are shown.
    extern fn gtk_notebook_get_show_tabs(p_notebook: *Notebook) c_int;
    pub const getShowTabs = gtk_notebook_get_show_tabs;

    /// Returns whether the tab contents can be detached from `notebook`.
    extern fn gtk_notebook_get_tab_detachable(p_notebook: *Notebook, p_child: *gtk.Widget) c_int;
    pub const getTabDetachable = gtk_notebook_get_tab_detachable;

    /// Returns the tab label widget for the page `child`.
    ///
    /// `NULL` is returned if `child` is not in `notebook` or
    /// if no tab label has specifically been set for `child`.
    extern fn gtk_notebook_get_tab_label(p_notebook: *Notebook, p_child: *gtk.Widget) ?*gtk.Widget;
    pub const getTabLabel = gtk_notebook_get_tab_label;

    /// Retrieves the text of the tab label for the page containing
    /// `child`.
    extern fn gtk_notebook_get_tab_label_text(p_notebook: *Notebook, p_child: *gtk.Widget) ?[*:0]const u8;
    pub const getTabLabelText = gtk_notebook_get_tab_label_text;

    /// Gets the edge at which the tabs are drawn.
    extern fn gtk_notebook_get_tab_pos(p_notebook: *Notebook) gtk.PositionType;
    pub const getTabPos = gtk_notebook_get_tab_pos;

    /// Gets whether the tab can be reordered via drag and drop or not.
    extern fn gtk_notebook_get_tab_reorderable(p_notebook: *Notebook, p_child: *gtk.Widget) c_int;
    pub const getTabReorderable = gtk_notebook_get_tab_reorderable;

    /// Insert a page into `notebook` at the given position.
    extern fn gtk_notebook_insert_page(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget, p_position: c_int) c_int;
    pub const insertPage = gtk_notebook_insert_page;

    /// Insert a page into `notebook` at the given position, specifying
    /// the widget to use as the label in the popup menu.
    extern fn gtk_notebook_insert_page_menu(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget, p_menu_label: ?*gtk.Widget, p_position: c_int) c_int;
    pub const insertPageMenu = gtk_notebook_insert_page_menu;

    /// Switches to the next page.
    ///
    /// Nothing happens if the current page is the last page.
    extern fn gtk_notebook_next_page(p_notebook: *Notebook) void;
    pub const nextPage = gtk_notebook_next_page;

    /// Finds the index of the page which contains the given child
    /// widget.
    extern fn gtk_notebook_page_num(p_notebook: *Notebook, p_child: *gtk.Widget) c_int;
    pub const pageNum = gtk_notebook_page_num;

    /// Disables the popup menu.
    extern fn gtk_notebook_popup_disable(p_notebook: *Notebook) void;
    pub const popupDisable = gtk_notebook_popup_disable;

    /// Enables the popup menu.
    ///
    /// If the user clicks with the right mouse button on the tab labels,
    /// a menu with all the pages will be popped up.
    extern fn gtk_notebook_popup_enable(p_notebook: *Notebook) void;
    pub const popupEnable = gtk_notebook_popup_enable;

    /// Prepends a page to `notebook`.
    extern fn gtk_notebook_prepend_page(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget) c_int;
    pub const prependPage = gtk_notebook_prepend_page;

    /// Prepends a page to `notebook`, specifying the widget to use as the
    /// label in the popup menu.
    extern fn gtk_notebook_prepend_page_menu(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget, p_menu_label: ?*gtk.Widget) c_int;
    pub const prependPageMenu = gtk_notebook_prepend_page_menu;

    /// Switches to the previous page.
    ///
    /// Nothing happens if the current page is the first page.
    extern fn gtk_notebook_prev_page(p_notebook: *Notebook) void;
    pub const prevPage = gtk_notebook_prev_page;

    /// Removes a page from the notebook given its index
    /// in the notebook.
    extern fn gtk_notebook_remove_page(p_notebook: *Notebook, p_page_num: c_int) void;
    pub const removePage = gtk_notebook_remove_page;

    /// Reorders the page containing `child`, so that it appears in position
    /// `position`.
    ///
    /// If `position` is greater than or equal to the number of children in
    /// the list or negative, `child` will be moved to the end of the list.
    extern fn gtk_notebook_reorder_child(p_notebook: *Notebook, p_child: *gtk.Widget, p_position: c_int) void;
    pub const reorderChild = gtk_notebook_reorder_child;

    /// Sets `widget` as one of the action widgets.
    ///
    /// Depending on the pack type the widget will be placed before
    /// or after the tabs. You can use a `GtkBox` if you need to pack
    /// more than one widget on the same side.
    extern fn gtk_notebook_set_action_widget(p_notebook: *Notebook, p_widget: *gtk.Widget, p_pack_type: gtk.PackType) void;
    pub const setActionWidget = gtk_notebook_set_action_widget;

    /// Switches to the page number `page_num`.
    ///
    /// Note that due to historical reasons, GtkNotebook refuses
    /// to switch to a page unless the child widget is visible.
    /// Therefore, it is recommended to show child widgets before
    /// adding them to a notebook.
    extern fn gtk_notebook_set_current_page(p_notebook: *Notebook, p_page_num: c_int) void;
    pub const setCurrentPage = gtk_notebook_set_current_page;

    /// Sets a group name for `notebook`.
    ///
    /// Notebooks with the same name will be able to exchange tabs
    /// via drag and drop. A notebook with a `NULL` group name will
    /// not be able to exchange tabs with any other notebook.
    extern fn gtk_notebook_set_group_name(p_notebook: *Notebook, p_group_name: ?[*:0]const u8) void;
    pub const setGroupName = gtk_notebook_set_group_name;

    /// Changes the menu label for the page containing `child`.
    extern fn gtk_notebook_set_menu_label(p_notebook: *Notebook, p_child: *gtk.Widget, p_menu_label: ?*gtk.Widget) void;
    pub const setMenuLabel = gtk_notebook_set_menu_label;

    /// Creates a new label and sets it as the menu label of `child`.
    extern fn gtk_notebook_set_menu_label_text(p_notebook: *Notebook, p_child: *gtk.Widget, p_menu_text: [*:0]const u8) void;
    pub const setMenuLabelText = gtk_notebook_set_menu_label_text;

    /// Sets whether the tab label area will have arrows for
    /// scrolling if there are too many tabs to fit in the area.
    extern fn gtk_notebook_set_scrollable(p_notebook: *Notebook, p_scrollable: c_int) void;
    pub const setScrollable = gtk_notebook_set_scrollable;

    /// Sets whether a bevel will be drawn around the notebook pages.
    ///
    /// This only has a visual effect when the tabs are not shown.
    extern fn gtk_notebook_set_show_border(p_notebook: *Notebook, p_show_border: c_int) void;
    pub const setShowBorder = gtk_notebook_set_show_border;

    /// Sets whether to show the tabs for the notebook or not.
    extern fn gtk_notebook_set_show_tabs(p_notebook: *Notebook, p_show_tabs: c_int) void;
    pub const setShowTabs = gtk_notebook_set_show_tabs;

    /// Sets whether the tab can be detached from `notebook` to another
    /// notebook or widget.
    ///
    /// Note that two notebooks must share a common group identifier
    /// (see `gtk.Notebook.setGroupName`) to allow automatic tabs
    /// interchange between them.
    ///
    /// If you want a widget to interact with a notebook through DnD
    /// (i.e.: accept dragged tabs from it) it must be set as a drop
    /// destination by adding to it a `gtk.DropTarget` controller that accepts
    /// the GType `GTK_TYPE_NOTEBOOK_PAGE`. The `:value` of said drop target will be
    /// preloaded with a `gtk.NotebookPage` object that corresponds to the
    /// dropped tab, so you can process the value via `::accept` or `::drop` signals.
    ///
    /// Note that you should use `gtk.Notebook.detachTab` instead
    /// of `gtk.Notebook.removePage` if you want to remove the tab
    /// from the source notebook as part of accepting a drop. Otherwise,
    /// the source notebook will think that the dragged tab was removed
    /// from underneath the ongoing drag operation, and will initiate a
    /// drag cancel animation.
    ///
    /// ```c
    /// static void
    /// on_drag_data_received (GtkWidget        *widget,
    ///                        GdkDrop          *drop,
    ///                        GtkSelectionData *data,
    ///                        guint             time,
    ///                        gpointer          user_data)
    /// {
    ///   GtkDrag *drag;
    ///   GtkWidget *notebook;
    ///   GtkWidget **child;
    ///
    ///   drag = gtk_drop_get_drag (drop);
    ///   notebook = g_object_get_data (drag, "gtk-notebook-drag-origin");
    ///   child = (void*) gtk_selection_data_get_data (data);
    ///
    ///   // process_widget (*child);
    ///
    ///   gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
    /// }
    /// ```
    ///
    /// If you want a notebook to accept drags from other widgets,
    /// you will have to set your own DnD code to do it.
    extern fn gtk_notebook_set_tab_detachable(p_notebook: *Notebook, p_child: *gtk.Widget, p_detachable: c_int) void;
    pub const setTabDetachable = gtk_notebook_set_tab_detachable;

    /// Changes the tab label for `child`.
    ///
    /// If `NULL` is specified for `tab_label`, then the page will
    /// have the label “page N”.
    extern fn gtk_notebook_set_tab_label(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_label: ?*gtk.Widget) void;
    pub const setTabLabel = gtk_notebook_set_tab_label;

    /// Creates a new label and sets it as the tab label for the page
    /// containing `child`.
    extern fn gtk_notebook_set_tab_label_text(p_notebook: *Notebook, p_child: *gtk.Widget, p_tab_text: [*:0]const u8) void;
    pub const setTabLabelText = gtk_notebook_set_tab_label_text;

    /// Sets the edge at which the tabs are drawn.
    extern fn gtk_notebook_set_tab_pos(p_notebook: *Notebook, p_pos: gtk.PositionType) void;
    pub const setTabPos = gtk_notebook_set_tab_pos;

    /// Sets whether the notebook tab can be reordered
    /// via drag and drop or not.
    extern fn gtk_notebook_set_tab_reorderable(p_notebook: *Notebook, p_child: *gtk.Widget, p_reorderable: c_int) void;
    pub const setTabReorderable = gtk_notebook_set_tab_reorderable;

    extern fn gtk_notebook_get_type() usize;
    pub const getGObjectType = gtk_notebook_get_type;

    extern fn g_object_ref(p_self: *gtk.Notebook) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Notebook) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Notebook, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An auxiliary object used by `GtkNotebook`.
pub const NotebookPage = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = NotebookPage;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child for this page.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the tab is detachable.
        pub const detachable = struct {
            pub const name = "detachable";

            pub const Type = c_int;
        };

        /// The label widget displayed in the child's menu entry.
        pub const menu = struct {
            pub const name = "menu";

            pub const Type = ?*gtk.Widget;
        };

        /// The text of the menu widget.
        pub const menu_label = struct {
            pub const name = "menu-label";

            pub const Type = ?[*:0]u8;
        };

        /// The index of the child in the parent.
        pub const position = struct {
            pub const name = "position";

            pub const Type = c_int;
        };

        /// Whether the tab is reorderable by user action.
        pub const reorderable = struct {
            pub const name = "reorderable";

            pub const Type = c_int;
        };

        /// The tab widget for this page.
        pub const tab = struct {
            pub const name = "tab";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether to expand the child's tab.
        pub const tab_expand = struct {
            pub const name = "tab-expand";

            pub const Type = c_int;
        };

        /// Whether the child's tab should fill the allocated area.
        pub const tab_fill = struct {
            pub const name = "tab-fill";

            pub const Type = c_int;
        };

        /// The text of the tab widget.
        pub const tab_label = struct {
            pub const name = "tab-label";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Returns the notebook child to which `page` belongs.
    extern fn gtk_notebook_page_get_child(p_page: *NotebookPage) *gtk.Widget;
    pub const getChild = gtk_notebook_page_get_child;

    extern fn gtk_notebook_page_get_type() usize;
    pub const getGObjectType = gtk_notebook_page_get_type;

    extern fn g_object_ref(p_self: *gtk.NotebookPage) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NotebookPage) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NotebookPage, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Does nothing.
pub const NothingAction = opaque {
    pub const Parent = gtk.ShortcutAction;
    pub const Implements = [_]type{};
    pub const Class = gtk.NothingActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Gets the nothing action.
    ///
    /// This is an action that does nothing and where
    /// activating it always fails.
    extern fn gtk_nothing_action_get() *gtk.NothingAction;
    pub const get = gtk_nothing_action_get;

    extern fn gtk_nothing_action_get_type() usize;
    pub const getGObjectType = gtk_nothing_action_get_type;

    extern fn g_object_ref(p_self: *gtk.NothingAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NothingAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NothingAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Sorts items numerically.
///
/// To obtain the numbers to compare, this sorter evaluates a
/// `gtk.Expression`.
pub const NumericSorter = opaque {
    pub const Parent = gtk.Sorter;
    pub const Implements = [_]type{};
    pub const Class = gtk.NumericSorterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The expression to evaluate on items to get a number to compare with.
        pub const expression = struct {
            pub const name = "expression";

            pub const Type = ?*gtk.Expression;
        };

        /// Whether the sorter will sort smaller numbers first.
        pub const sort_order = struct {
            pub const name = "sort-order";

            pub const Type = gtk.SortType;
        };
    };

    pub const signals = struct {};

    /// Creates a new numeric sorter using the given `expression`.
    ///
    /// Smaller numbers will be sorted first. You can call
    /// `gtk.NumericSorter.setSortOrder` to change this.
    extern fn gtk_numeric_sorter_new(p_expression: ?*gtk.Expression) *gtk.NumericSorter;
    pub const new = gtk_numeric_sorter_new;

    /// Gets the expression that is evaluated to obtain numbers from items.
    extern fn gtk_numeric_sorter_get_expression(p_self: *NumericSorter) ?*gtk.Expression;
    pub const getExpression = gtk_numeric_sorter_get_expression;

    /// Gets whether this sorter will sort smaller numbers first.
    extern fn gtk_numeric_sorter_get_sort_order(p_self: *NumericSorter) gtk.SortType;
    pub const getSortOrder = gtk_numeric_sorter_get_sort_order;

    /// Sets the expression that is evaluated to obtain numbers from items.
    ///
    /// Unless an expression is set on `self`, the sorter will always
    /// compare items as invalid.
    ///
    /// The expression must have a return type that can be compared
    /// numerically, such as `G_TYPE_INT` or `G_TYPE_DOUBLE`.
    extern fn gtk_numeric_sorter_set_expression(p_self: *NumericSorter, p_expression: ?*gtk.Expression) void;
    pub const setExpression = gtk_numeric_sorter_set_expression;

    /// Sets whether to sort smaller numbers before larger ones.
    extern fn gtk_numeric_sorter_set_sort_order(p_self: *NumericSorter, p_sort_order: gtk.SortType) void;
    pub const setSortOrder = gtk_numeric_sorter_set_sort_order;

    extern fn gtk_numeric_sorter_get_type() usize;
    pub const getGObjectType = gtk_numeric_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.NumericSorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.NumericSorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *NumericSorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GObject` value in a `GtkExpression`.
pub const ObjectExpression = opaque {
    pub const Parent = gtk.Expression;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = ObjectExpression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates an expression evaluating to the given `object` with a weak reference.
    ///
    /// Once the `object` is disposed, it will fail to evaluate.
    ///
    /// This expression is meant to break reference cycles.
    ///
    /// If you want to keep a reference to `object`, use `gtk.ConstantExpression.new`.
    extern fn gtk_object_expression_new(p_object: *gobject.Object) *gtk.ObjectExpression;
    pub const new = gtk_object_expression_new;

    /// Gets the object that the expression evaluates to.
    extern fn gtk_object_expression_get_object(p_expression: *ObjectExpression) ?*gobject.Object;
    pub const getObject = gtk_object_expression_get_object;

    extern fn gtk_object_expression_get_type() usize;
    pub const getGObjectType = gtk_object_expression_get_type;

    pub fn as(p_instance: *ObjectExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Places “overlay” widgets on top of a single main child.
///
/// <picture>
///   <source srcset="overlay-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkOverlay" src="overlay.png">
/// </picture>
///
/// The position of each overlay widget is determined by its
/// `gtk.Widget.properties.halign` and `gtk.Widget.properties.valign`
/// properties. E.g. a widget with both alignments set to `GTK_ALIGN_START`
/// will be placed at the top left corner of the `GtkOverlay` container,
/// whereas an overlay with halign set to `GTK_ALIGN_CENTER` and valign set
/// to `GTK_ALIGN_END` will be placed a the bottom edge of the `GtkOverlay`,
/// horizontally centered. The position can be adjusted by setting the margin
/// properties of the child to non-zero values.
///
/// More complicated placement of overlays is possible by connecting
/// to the `gtk.Overlay.signals.get_child_position` signal.
///
/// An overlay’s minimum and natural sizes are those of its main child.
/// The sizes of overlay children are not considered when measuring these
/// preferred sizes.
///
/// # GtkOverlay as GtkBuildable
///
/// The `GtkOverlay` implementation of the `GtkBuildable` interface
/// supports placing a child as an overlay by specifying “overlay” as
/// the “type” attribute of a `<child>` element.
///
/// # CSS nodes
///
/// `GtkOverlay` has a single CSS node with the name “overlay”. Overlay children
/// whose alignments cause them to be positioned at an edge get the style classes
/// “.left”, “.right”, “.top”, and/or “.bottom” according to their position.
pub const Overlay = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Overlay;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The main child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {
        /// Emitted to determine the position and size of any overlay
        /// child widgets.
        ///
        /// A handler for this signal should fill `allocation` with
        /// the desired position and size for `widget`, relative to
        /// the 'main' child of `overlay`.
        ///
        /// The default handler for this signal uses the `widget`'s
        /// halign and valign properties to determine the position
        /// and gives the widget its natural size (except that an
        /// alignment of `GTK_ALIGN_FILL` will cause the overlay to
        /// be full-width/height). If the main child is a
        /// `GtkScrolledWindow`, the overlays are placed relative
        /// to its contents.
        pub const get_child_position = struct {
            pub const name = "get-child-position";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_widget: *gtk.Widget, p_allocation: *gdk.Rectangle, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Overlay, p_instance))),
                    gobject.signalLookup("get-child-position", Overlay.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkOverlay`.
    extern fn gtk_overlay_new() *gtk.Overlay;
    pub const new = gtk_overlay_new;

    /// Adds `widget` to `overlay`.
    ///
    /// The widget will be stacked on top of the main widget
    /// added with `gtk.Overlay.setChild`.
    ///
    /// The position at which `widget` is placed is determined
    /// from its `gtk.Widget.properties.halign` and
    /// `gtk.Widget.properties.valign` properties.
    extern fn gtk_overlay_add_overlay(p_overlay: *Overlay, p_widget: *gtk.Widget) void;
    pub const addOverlay = gtk_overlay_add_overlay;

    /// Gets the child widget of `overlay`.
    extern fn gtk_overlay_get_child(p_overlay: *Overlay) ?*gtk.Widget;
    pub const getChild = gtk_overlay_get_child;

    /// Gets whether `widget` should be clipped within the parent.
    extern fn gtk_overlay_get_clip_overlay(p_overlay: *Overlay, p_widget: *gtk.Widget) c_int;
    pub const getClipOverlay = gtk_overlay_get_clip_overlay;

    /// Gets whether `widget`'s size is included in the measurement of
    /// `overlay`.
    extern fn gtk_overlay_get_measure_overlay(p_overlay: *Overlay, p_widget: *gtk.Widget) c_int;
    pub const getMeasureOverlay = gtk_overlay_get_measure_overlay;

    /// Removes an overlay that was added with `gtk.Overlay.addOverlay`.
    extern fn gtk_overlay_remove_overlay(p_overlay: *Overlay, p_widget: *gtk.Widget) void;
    pub const removeOverlay = gtk_overlay_remove_overlay;

    /// Sets the child widget of `overlay`.
    extern fn gtk_overlay_set_child(p_overlay: *Overlay, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_overlay_set_child;

    /// Sets whether `widget` should be clipped within the parent.
    extern fn gtk_overlay_set_clip_overlay(p_overlay: *Overlay, p_widget: *gtk.Widget, p_clip_overlay: c_int) void;
    pub const setClipOverlay = gtk_overlay_set_clip_overlay;

    /// Sets whether `widget` is included in the measured size of `overlay`.
    ///
    /// The overlay will request the size of the largest child that has
    /// this property set to `TRUE`. Children who are not included may
    /// be drawn outside of `overlay`'s allocation if they are too large.
    extern fn gtk_overlay_set_measure_overlay(p_overlay: *Overlay, p_widget: *gtk.Widget, p_measure: c_int) void;
    pub const setMeasureOverlay = gtk_overlay_set_measure_overlay;

    extern fn gtk_overlay_get_type() usize;
    pub const getGObjectType = gtk_overlay_get_type;

    extern fn g_object_ref(p_self: *gtk.Overlay) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Overlay) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Overlay, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The layout manager used by `gtk.Overlay`.
///
/// It places widgets as overlays on top of the main child.
///
/// This is not a reusable layout manager, since it expects its widget
/// to be a `GtkOverlay`. It is only listed here so that its layout
/// properties get documented.
pub const OverlayLayout = opaque {
    pub const Parent = gtk.LayoutManager;
    pub const Implements = [_]type{};
    pub const Class = gtk.OverlayLayoutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkOverlayLayout` instance.
    extern fn gtk_overlay_layout_new() *gtk.OverlayLayout;
    pub const new = gtk_overlay_layout_new;

    extern fn gtk_overlay_layout_get_type() usize;
    pub const getGObjectType = gtk_overlay_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.OverlayLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.OverlayLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *OverlayLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkLayoutChild` subclass for children in a `GtkOverlayLayout`.
pub const OverlayLayoutChild = opaque {
    pub const Parent = gtk.LayoutChild;
    pub const Implements = [_]type{};
    pub const Class = gtk.OverlayLayoutChildClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the child should be clipped to fit the parent's size.
        pub const clip_overlay = struct {
            pub const name = "clip-overlay";

            pub const Type = c_int;
        };

        /// Whether the child size should contribute to the `GtkOverlayLayout`'s
        /// measurement.
        pub const measure = struct {
            pub const name = "measure";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Retrieves whether the child is clipped.
    extern fn gtk_overlay_layout_child_get_clip_overlay(p_child: *OverlayLayoutChild) c_int;
    pub const getClipOverlay = gtk_overlay_layout_child_get_clip_overlay;

    /// Retrieves whether the child is measured.
    extern fn gtk_overlay_layout_child_get_measure(p_child: *OverlayLayoutChild) c_int;
    pub const getMeasure = gtk_overlay_layout_child_get_measure;

    /// Sets whether to clip this child.
    extern fn gtk_overlay_layout_child_set_clip_overlay(p_child: *OverlayLayoutChild, p_clip_overlay: c_int) void;
    pub const setClipOverlay = gtk_overlay_layout_child_set_clip_overlay;

    /// Sets whether to measure this child.
    extern fn gtk_overlay_layout_child_set_measure(p_child: *OverlayLayoutChild, p_measure: c_int) void;
    pub const setMeasure = gtk_overlay_layout_child_set_measure;

    extern fn gtk_overlay_layout_child_get_type() usize;
    pub const getGObjectType = gtk_overlay_layout_child_get_type;

    extern fn g_object_ref(p_self: *gtk.OverlayLayoutChild) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.OverlayLayoutChild) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *OverlayLayoutChild, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Handles input from the pads found in drawing tablets.
///
/// Pads are the collection of buttons and tactile sensors often found around
/// the stylus-sensitive area.
///
/// These buttons and sensors have no implicit meaning, and by default they
/// perform no action. `GtkPadController` is provided to map those to
/// `gio.Action` objects, thus letting the application give them a more
/// semantic meaning.
///
/// Buttons and sensors are not constrained to triggering a single action,
/// some `GDK_SOURCE_TABLET_PAD` devices feature multiple "modes". All these
/// input elements have one current mode, which may determine the final action
/// being triggered.
///
/// Pad devices often divide buttons and sensors into groups. All elements
/// in a group share the same current mode, but different groups may have
/// different modes. See `gdk.DevicePad.getNGroups` and
/// `gdk.DevicePad.getGroupNModes`.
///
/// Each of the actions that a given button/strip/ring performs for a given mode
/// is defined by a `gtk.PadActionEntry`. It contains an action name that
/// will be looked up in the given `gio.ActionGroup` and activated whenever
/// the specified input element and mode are triggered.
///
/// A simple example of `GtkPadController` usage: Assigning button 1 in all
/// modes and pad devices to an "invert-selection" action:
///
/// ```c
/// GtkPadActionEntry *pad_actions[] = {
///   { GTK_PAD_ACTION_BUTTON, 1, -1, "Invert selection", "pad-actions.invert-selection" },
///   …
/// };
///
/// …
/// action_group = g_simple_action_group_new ();
/// action = g_simple_action_new ("pad-actions.invert-selection", NULL);
/// g_signal_connect (action, "activate", on_invert_selection_activated, NULL);
/// g_action_map_add_action (G_ACTION_MAP (action_group), action);
/// …
/// pad_controller = gtk_pad_controller_new (action_group, NULL);
/// ```
///
/// The actions belonging to rings/strips/dials will be activated with a parameter
/// of type `G_VARIANT_TYPE_DOUBLE` bearing the value of the given axis, it
/// is required that those are made stateful and accepting this `GVariantType`.
/// For rings the value is the angle of the ring position in degrees with 0
/// facing up. For strips the value is the absolute position on the strip, normalized
/// to the [0.0, 1.0] range.
/// For dials the value is the relative movement of the dial, normalized so that the
/// value 120 represents one logical scroll wheel detent in the positive direction.
/// Devices that support high-resolution scrolling may send events with fractions of
/// 120 to signify a smaller motion.
pub const PadController = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{};
    pub const Class = gtk.PadControllerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The action group of the controller.
        pub const action_group = struct {
            pub const name = "action-group";

            pub const Type = ?*gio.ActionGroup;
        };

        /// The pad of the controller.
        pub const pad = struct {
            pub const name = "pad";

            pub const Type = ?*gdk.Device;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkPadController` that will associate events from `pad` to
    /// actions.
    ///
    /// A `NULL` pad may be provided so the controller manages all pad devices
    /// generically, it is discouraged to mix `GtkPadController` objects with
    /// `NULL` and non-`NULL` `pad` argument on the same toplevel window, as execution
    /// order is not guaranteed.
    ///
    /// The `GtkPadController` is created with no mapped actions. In order to
    /// map pad events to actions, use `gtk.PadController.setActionEntries`
    /// or `gtk.PadController.setAction`.
    ///
    /// Be aware that pad events will only be delivered to `GtkWindow`s, so adding
    /// a pad controller to any other type of widget will not have an effect.
    extern fn gtk_pad_controller_new(p_group: *gio.ActionGroup, p_pad: ?*gdk.Device) *gtk.PadController;
    pub const new = gtk_pad_controller_new;

    /// Adds an individual action to `controller`.
    ///
    /// This action will only be activated if the given button/ring/strip number
    /// in `index` is interacted while the current mode is `mode`. -1 may be used
    /// for simple cases, so the action is triggered on all modes.
    ///
    /// The given `label` should be considered user-visible, so internationalization
    /// rules apply. Some windowing systems may be able to use those for user
    /// feedback.
    extern fn gtk_pad_controller_set_action(p_controller: *PadController, p_type: gtk.PadActionType, p_index: c_int, p_mode: c_int, p_label: [*:0]const u8, p_action_name: [*:0]const u8) void;
    pub const setAction = gtk_pad_controller_set_action;

    /// A convenience function to add a group of action entries on
    /// `controller`.
    ///
    /// See `gtk.PadActionEntry` and `gtk.PadController.setAction`.
    extern fn gtk_pad_controller_set_action_entries(p_controller: *PadController, p_entries: [*]const gtk.PadActionEntry, p_n_entries: c_int) void;
    pub const setActionEntries = gtk_pad_controller_set_action_entries;

    extern fn gtk_pad_controller_get_type() usize;
    pub const getGObjectType = gtk_pad_controller_get_type;

    extern fn g_object_ref(p_self: *gtk.PadController) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PadController) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PadController, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Stores page size, orientation and margins for printing.
///
/// The idea is that you can get one of these from the page setup dialog
/// and then pass it to the `GtkPrintOperation` when printing.
/// The benefit of splitting this out of the `GtkPrintSettings` is that
/// these affect the actual layout of the page, and thus need to be set
/// long before user prints.
///
/// ## Margins
///
/// The margins specified in this object are the “print margins”, i.e. the
/// parts of the page that the printer cannot print on. These are different
/// from the layout margins that a word processor uses; they are typically
/// used to determine the minimal size for the layout margins.
///
/// To obtain a `GtkPageSetup` use `gtk.PageSetup.new` to get the defaults,
/// or use `gtk.printRunPageSetupDialog` to show the page setup dialog
/// and receive the resulting page setup.
///
/// ## A page setup dialog
///
/// ```c
/// static GtkPrintSettings *settings = NULL;
/// static GtkPageSetup *page_setup = NULL;
///
/// static void
/// do_page_setup (void)
/// {
///   GtkPageSetup *new_page_setup;
///
///   if (settings == NULL)
///     settings = gtk_print_settings_new ();
///
///   new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window),
///                                                     page_setup, settings);
///
///   if (page_setup)
///     g_object_unref (page_setup);
///
///   page_setup = new_page_setup;
/// }
/// ```
pub const PageSetup = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = PageSetup;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkPageSetup`.
    extern fn gtk_page_setup_new() *gtk.PageSetup;
    pub const new = gtk_page_setup_new;

    /// Reads the page setup from the file `file_name`.
    ///
    /// Returns a new `GtkPageSetup` object with the restored
    /// page setup, or `NULL` if an error occurred.
    /// See `gtk.PageSetup.toFile`.
    extern fn gtk_page_setup_new_from_file(p_file_name: [*:0]const u8, p_error: ?*?*glib.Error) ?*gtk.PageSetup;
    pub const newFromFile = gtk_page_setup_new_from_file;

    /// Desrialize a page setup from an a{sv} variant.
    ///
    /// The variant must be in the format produced by
    /// `gtk.PageSetup.toGvariant`.
    extern fn gtk_page_setup_new_from_gvariant(p_variant: *glib.Variant) *gtk.PageSetup;
    pub const newFromGvariant = gtk_page_setup_new_from_gvariant;

    /// Reads the page setup from the group `group_name` in the key file
    /// `key_file`.
    ///
    /// Returns a new `GtkPageSetup` object with the restored
    /// page setup, or `NULL` if an error occurred.
    extern fn gtk_page_setup_new_from_key_file(p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8, p_error: ?*?*glib.Error) ?*gtk.PageSetup;
    pub const newFromKeyFile = gtk_page_setup_new_from_key_file;

    /// Copies a `GtkPageSetup`.
    extern fn gtk_page_setup_copy(p_other: *PageSetup) *gtk.PageSetup;
    pub const copy = gtk_page_setup_copy;

    /// Gets the bottom margin in units of `unit`.
    extern fn gtk_page_setup_get_bottom_margin(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getBottomMargin = gtk_page_setup_get_bottom_margin;

    /// Gets the left margin in units of `unit`.
    extern fn gtk_page_setup_get_left_margin(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getLeftMargin = gtk_page_setup_get_left_margin;

    /// Gets the page orientation of the `GtkPageSetup`.
    extern fn gtk_page_setup_get_orientation(p_setup: *PageSetup) gtk.PageOrientation;
    pub const getOrientation = gtk_page_setup_get_orientation;

    /// Returns the page height in units of `unit`.
    ///
    /// Note that this function takes orientation
    /// and margins into consideration.
    /// See `gtk.PageSetup.getPaperHeight`.
    extern fn gtk_page_setup_get_page_height(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getPageHeight = gtk_page_setup_get_page_height;

    /// Returns the page width in units of `unit`.
    ///
    /// Note that this function takes orientation
    /// and margins into consideration.
    /// See `gtk.PageSetup.getPaperWidth`.
    extern fn gtk_page_setup_get_page_width(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getPageWidth = gtk_page_setup_get_page_width;

    /// Returns the paper height in units of `unit`.
    ///
    /// Note that this function takes orientation,
    /// but not margins into consideration.
    /// See `gtk.PageSetup.getPageHeight`.
    extern fn gtk_page_setup_get_paper_height(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getPaperHeight = gtk_page_setup_get_paper_height;

    /// Gets the paper size of the `GtkPageSetup`.
    extern fn gtk_page_setup_get_paper_size(p_setup: *PageSetup) *gtk.PaperSize;
    pub const getPaperSize = gtk_page_setup_get_paper_size;

    /// Returns the paper width in units of `unit`.
    ///
    /// Note that this function takes orientation,
    /// but not margins into consideration.
    /// See `gtk.PageSetup.getPageWidth`.
    extern fn gtk_page_setup_get_paper_width(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getPaperWidth = gtk_page_setup_get_paper_width;

    /// Gets the right margin in units of `unit`.
    extern fn gtk_page_setup_get_right_margin(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getRightMargin = gtk_page_setup_get_right_margin;

    /// Gets the top margin in units of `unit`.
    extern fn gtk_page_setup_get_top_margin(p_setup: *PageSetup, p_unit: gtk.Unit) f64;
    pub const getTopMargin = gtk_page_setup_get_top_margin;

    /// Reads the page setup from the file `file_name`.
    ///
    /// See `gtk.PageSetup.toFile`.
    extern fn gtk_page_setup_load_file(p_setup: *PageSetup, p_file_name: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const loadFile = gtk_page_setup_load_file;

    /// Reads the page setup from the group `group_name` in the key file
    /// `key_file`.
    extern fn gtk_page_setup_load_key_file(p_setup: *PageSetup, p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const loadKeyFile = gtk_page_setup_load_key_file;

    /// Sets the bottom margin of the `GtkPageSetup`.
    extern fn gtk_page_setup_set_bottom_margin(p_setup: *PageSetup, p_margin: f64, p_unit: gtk.Unit) void;
    pub const setBottomMargin = gtk_page_setup_set_bottom_margin;

    /// Sets the left margin of the `GtkPageSetup`.
    extern fn gtk_page_setup_set_left_margin(p_setup: *PageSetup, p_margin: f64, p_unit: gtk.Unit) void;
    pub const setLeftMargin = gtk_page_setup_set_left_margin;

    /// Sets the page orientation of the `GtkPageSetup`.
    extern fn gtk_page_setup_set_orientation(p_setup: *PageSetup, p_orientation: gtk.PageOrientation) void;
    pub const setOrientation = gtk_page_setup_set_orientation;

    /// Sets the paper size of the `GtkPageSetup` without
    /// changing the margins.
    ///
    /// See `gtk.PageSetup.setPaperSizeAndDefaultMargins`.
    extern fn gtk_page_setup_set_paper_size(p_setup: *PageSetup, p_size: *gtk.PaperSize) void;
    pub const setPaperSize = gtk_page_setup_set_paper_size;

    /// Sets the paper size of the `GtkPageSetup` and modifies
    /// the margins according to the new paper size.
    extern fn gtk_page_setup_set_paper_size_and_default_margins(p_setup: *PageSetup, p_size: *gtk.PaperSize) void;
    pub const setPaperSizeAndDefaultMargins = gtk_page_setup_set_paper_size_and_default_margins;

    /// Sets the right margin of the `GtkPageSetup`.
    extern fn gtk_page_setup_set_right_margin(p_setup: *PageSetup, p_margin: f64, p_unit: gtk.Unit) void;
    pub const setRightMargin = gtk_page_setup_set_right_margin;

    /// Sets the top margin of the `GtkPageSetup`.
    extern fn gtk_page_setup_set_top_margin(p_setup: *PageSetup, p_margin: f64, p_unit: gtk.Unit) void;
    pub const setTopMargin = gtk_page_setup_set_top_margin;

    /// This function saves the information from `setup` to `file_name`.
    extern fn gtk_page_setup_to_file(p_setup: *PageSetup, p_file_name: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const toFile = gtk_page_setup_to_file;

    /// Serialize page setup to an a{sv} variant.
    extern fn gtk_page_setup_to_gvariant(p_setup: *PageSetup) *glib.Variant;
    pub const toGvariant = gtk_page_setup_to_gvariant;

    /// This function adds the page setup from `setup` to `key_file`.
    extern fn gtk_page_setup_to_key_file(p_setup: *PageSetup, p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8) void;
    pub const toKeyFile = gtk_page_setup_to_key_file;

    extern fn gtk_page_setup_get_type() usize;
    pub const getGObjectType = gtk_page_setup_get_type;

    extern fn g_object_ref(p_self: *gtk.PageSetup) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PageSetup) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PageSetup, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents a page setup dialog for platforms which don’t provide
/// a native page setup dialog, like Unix.
///
/// <picture>
///   <source srcset="pagesetupdialog-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPageSetupUnixDialog" src="pagesetupdialog.png">
/// </picture>
///
/// It can be used very much like any other GTK dialog, at the
/// cost of the portability offered by the high-level printing
/// API in `gtk.PrintOperation`.
///
/// ## CSS nodes
///
/// `GtkPageSetupUnixDialog` has a single CSS node with the name `window` and
/// style class `.pagesetup`.
pub const PageSetupUnixDialog = opaque {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = PageSetupUnixDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new page setup dialog.
    extern fn gtk_page_setup_unix_dialog_new(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window) *gtk.PageSetupUnixDialog;
    pub const new = gtk_page_setup_unix_dialog_new;

    /// Gets the currently selected page setup from the dialog.
    extern fn gtk_page_setup_unix_dialog_get_page_setup(p_dialog: *PageSetupUnixDialog) *gtk.PageSetup;
    pub const getPageSetup = gtk_page_setup_unix_dialog_get_page_setup;

    /// Gets the current print settings from the dialog.
    extern fn gtk_page_setup_unix_dialog_get_print_settings(p_dialog: *PageSetupUnixDialog) ?*gtk.PrintSettings;
    pub const getPrintSettings = gtk_page_setup_unix_dialog_get_print_settings;

    /// Sets the `GtkPageSetup` from which the page setup
    /// dialog takes its values.
    extern fn gtk_page_setup_unix_dialog_set_page_setup(p_dialog: *PageSetupUnixDialog, p_page_setup: *gtk.PageSetup) void;
    pub const setPageSetup = gtk_page_setup_unix_dialog_set_page_setup;

    /// Sets the `GtkPrintSettings` from which the page setup dialog
    /// takes its values.
    extern fn gtk_page_setup_unix_dialog_set_print_settings(p_dialog: *PageSetupUnixDialog, p_print_settings: ?*gtk.PrintSettings) void;
    pub const setPrintSettings = gtk_page_setup_unix_dialog_set_print_settings;

    extern fn gtk_page_setup_unix_dialog_get_type() usize;
    pub const getGObjectType = gtk_page_setup_unix_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.PageSetupUnixDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PageSetupUnixDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PageSetupUnixDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Arranges its children in two panes, horizontally or vertically.
///
/// <picture>
///   <source srcset="panes-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPaned" src="panes.png">
/// </picture>
///
/// The division between the two panes is adjustable by the user
/// by dragging a handle.
///
/// Child widgets are added to the panes of the widget with
/// `gtk.Paned.setStartChild` and `gtk.Paned.setEndChild`.
/// The division between the two children is set by default from the size
/// requests of the children, but it can be adjusted by the user.
///
/// A paned widget draws a separator between the two child widgets and a
/// small handle that the user can drag to adjust the division. It does not
/// draw any relief around the children or around the separator. (The space
/// in which the separator is called the gutter.) Often, it is useful to put
/// each child inside a `gtk.Frame` so that the gutter appears as a
/// ridge. No separator is drawn if one of the children is missing.
///
/// Each child has two options that can be set, "resize" and "shrink". If
/// "resize" is true then, when the `GtkPaned` is resized, that child will
/// expand or shrink along with the paned widget. If "shrink" is true, then
/// that child can be made smaller than its requisition by the user.
/// Setting "shrink" to false allows the application to set a minimum size.
/// If "resize" is false for both children, then this is treated as if
/// "resize" is true for both children.
///
/// The application can set the position of the slider as if it were set
/// by the user, by calling `gtk.Paned.setPosition`.
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.Paned.signals.accept_position`
/// - `gtk.Paned.signals.cancel_position`
/// - `gtk.Paned.signals.cycle_child_focus`
/// - `gtk.Paned.signals.cycle_handle_focus`
/// - `gtk.Paned.signals.move_handle`
/// - `gtk.Paned.signals.toggle_handle_focus`
///
/// # CSS nodes
///
/// ```
/// paned
/// ├── <child>
/// ├── separator[.wide]
/// ╰── <child>
/// ```
///
/// `GtkPaned` has a main CSS node with name paned, and a subnode for
/// the separator with name separator. The subnode gets a .wide style
/// class when the paned is supposed to be wide.
///
/// In horizontal orientation, the nodes are arranged based on the text
/// direction, so in left-to-right mode, :first-child will select the
/// leftmost child, while it will select the rightmost child in
/// RTL layouts.
///
/// ## Creating a paned widget with minimum sizes.
///
/// ```c
/// GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
/// GtkWidget *frame1 = gtk_frame_new (NULL);
/// GtkWidget *frame2 = gtk_frame_new (NULL);
///
/// gtk_widget_set_size_request (hpaned, 200, -1);
///
/// gtk_paned_set_start_child (GTK_PANED (hpaned), frame1);
/// gtk_paned_set_resize_start_child (GTK_PANED (hpaned), TRUE);
/// gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
/// gtk_widget_set_size_request (frame1, 50, -1);
///
/// gtk_paned_set_end_child (GTK_PANED (hpaned), frame2);
/// gtk_paned_set_resize_end_child (GTK_PANED (hpaned), FALSE);
/// gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
/// gtk_widget_set_size_request (frame2, 50, -1);
/// ```
pub const Paned = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = Paned;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The second child.
        pub const end_child = struct {
            pub const name = "end-child";

            pub const Type = ?*gtk.Widget;
        };

        /// The largest possible value for the `gtk.Paned.properties.position`
        /// property.
        ///
        /// This property is derived from the size and shrinkability
        /// of the widget's children.
        pub const max_position = struct {
            pub const name = "max-position";

            pub const Type = c_int;
        };

        /// The smallest possible value for the `gtk.Paned.properties.position`
        /// property.
        ///
        /// This property is derived from the size and shrinkability
        /// of the widget's children.
        pub const min_position = struct {
            pub const name = "min-position";

            pub const Type = c_int;
        };

        /// Position of the separator in pixels, from the left/top.
        pub const position = struct {
            pub const name = "position";

            pub const Type = c_int;
        };

        /// Whether the `gtk.Paned.properties.position` property has been set.
        pub const position_set = struct {
            pub const name = "position-set";

            pub const Type = c_int;
        };

        /// Determines whether the second child expands and shrinks
        /// along with the paned widget.
        pub const resize_end_child = struct {
            pub const name = "resize-end-child";

            pub const Type = c_int;
        };

        /// Determines whether the first child expands and shrinks
        /// along with the paned widget.
        pub const resize_start_child = struct {
            pub const name = "resize-start-child";

            pub const Type = c_int;
        };

        /// Determines whether the second child can be made smaller
        /// than its requisition.
        pub const shrink_end_child = struct {
            pub const name = "shrink-end-child";

            pub const Type = c_int;
        };

        /// Determines whether the first child can be made smaller
        /// than its requisition.
        pub const shrink_start_child = struct {
            pub const name = "shrink-start-child";

            pub const Type = c_int;
        };

        /// The first child.
        pub const start_child = struct {
            pub const name = "start-child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the `GtkPaned` should provide a stronger visual separation.
        ///
        /// For example, this could be set when a paned contains two
        /// `gtk.Notebook`s, whose tab rows would otherwise merge visually.
        pub const wide_handle = struct {
            pub const name = "wide-handle";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to accept the current position of the handle when
        /// moving it using key bindings.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Return</kbd> or
        /// <kbd>Space</kbd>.
        pub const accept_position = struct {
            pub const name = "accept-position";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Paned, p_instance))),
                    gobject.signalLookup("accept-position", Paned.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to cancel moving the position of the handle using key
        /// bindings.
        ///
        /// The position of the handle will be reset to the value prior to
        /// moving it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Escape</kbd>.
        pub const cancel_position = struct {
            pub const name = "cancel-position";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Paned, p_instance))),
                    gobject.signalLookup("cancel-position", Paned.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to cycle the focus between the children of the paned.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding is <kbd>F6</kbd>.
        pub const cycle_child_focus = struct {
            pub const name = "cycle-child-focus";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_reversed: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Paned, p_instance))),
                    gobject.signalLookup("cycle-child-focus", Paned.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to cycle whether the paned should grab focus to allow
        /// the user to change position of the handle by using key bindings.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>F8</kbd>.
        pub const cycle_handle_focus = struct {
            pub const name = "cycle-handle-focus";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_reversed: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Paned, p_instance))),
                    gobject.signalLookup("cycle-handle-focus", Paned.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to move the handle with key bindings.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>←</kbd>, <kbd>←</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>→</kbd>, <kbd>→</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>↑</kbd>, <kbd>↑</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>↓</kbd>, <kbd>↓</kbd>,
        /// <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
        pub const move_handle = struct {
            pub const name = "move-handle";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_scroll_type: gtk.ScrollType, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Paned, p_instance))),
                    gobject.signalLookup("move-handle", Paned.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to accept the current position of the handle and then
        /// move focus to the next widget in the focus chain.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding is <kbd>Tab</kbd>.
        pub const toggle_handle_focus = struct {
            pub const name = "toggle-handle-focus";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Paned, p_instance))),
                    gobject.signalLookup("toggle-handle-focus", Paned.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkPaned` widget.
    extern fn gtk_paned_new(p_orientation: gtk.Orientation) *gtk.Paned;
    pub const new = gtk_paned_new;

    /// Retrieves the end child of the given `GtkPaned`.
    extern fn gtk_paned_get_end_child(p_paned: *Paned) ?*gtk.Widget;
    pub const getEndChild = gtk_paned_get_end_child;

    /// Obtains the position of the divider between the two panes.
    extern fn gtk_paned_get_position(p_paned: *Paned) c_int;
    pub const getPosition = gtk_paned_get_position;

    /// Returns whether the `gtk.Paned.properties.end_child` can be resized.
    extern fn gtk_paned_get_resize_end_child(p_paned: *Paned) c_int;
    pub const getResizeEndChild = gtk_paned_get_resize_end_child;

    /// Returns whether the `gtk.Paned.properties.start_child` can be resized.
    extern fn gtk_paned_get_resize_start_child(p_paned: *Paned) c_int;
    pub const getResizeStartChild = gtk_paned_get_resize_start_child;

    /// Returns whether the `gtk.Paned.properties.end_child` can shrink.
    extern fn gtk_paned_get_shrink_end_child(p_paned: *Paned) c_int;
    pub const getShrinkEndChild = gtk_paned_get_shrink_end_child;

    /// Returns whether the `gtk.Paned.properties.start_child` can shrink.
    extern fn gtk_paned_get_shrink_start_child(p_paned: *Paned) c_int;
    pub const getShrinkStartChild = gtk_paned_get_shrink_start_child;

    /// Retrieves the start child of the given `GtkPaned`.
    extern fn gtk_paned_get_start_child(p_paned: *Paned) ?*gtk.Widget;
    pub const getStartChild = gtk_paned_get_start_child;

    /// Gets whether the separator should be wide.
    extern fn gtk_paned_get_wide_handle(p_paned: *Paned) c_int;
    pub const getWideHandle = gtk_paned_get_wide_handle;

    /// Sets the end child of `paned` to `child`.
    ///
    /// If `child` is `NULL`, the existing child will be removed.
    extern fn gtk_paned_set_end_child(p_paned: *Paned, p_child: ?*gtk.Widget) void;
    pub const setEndChild = gtk_paned_set_end_child;

    /// Sets the position of the divider between the two panes.
    extern fn gtk_paned_set_position(p_paned: *Paned, p_position: c_int) void;
    pub const setPosition = gtk_paned_set_position;

    /// Sets whether the `gtk.Paned.properties.end_child` can be resized.
    extern fn gtk_paned_set_resize_end_child(p_paned: *Paned, p_resize: c_int) void;
    pub const setResizeEndChild = gtk_paned_set_resize_end_child;

    /// Sets whether the `gtk.Paned.properties.start_child` can be resized.
    extern fn gtk_paned_set_resize_start_child(p_paned: *Paned, p_resize: c_int) void;
    pub const setResizeStartChild = gtk_paned_set_resize_start_child;

    /// Sets whether the `gtk.Paned.properties.end_child` can shrink.
    extern fn gtk_paned_set_shrink_end_child(p_paned: *Paned, p_resize: c_int) void;
    pub const setShrinkEndChild = gtk_paned_set_shrink_end_child;

    /// Sets whether the `gtk.Paned.properties.start_child` can shrink.
    extern fn gtk_paned_set_shrink_start_child(p_paned: *Paned, p_resize: c_int) void;
    pub const setShrinkStartChild = gtk_paned_set_shrink_start_child;

    /// Sets the start child of `paned` to `child`.
    ///
    /// If `child` is `NULL`, the existing child will be removed.
    extern fn gtk_paned_set_start_child(p_paned: *Paned, p_child: ?*gtk.Widget) void;
    pub const setStartChild = gtk_paned_set_start_child;

    /// Sets whether the separator should be wide.
    extern fn gtk_paned_set_wide_handle(p_paned: *Paned, p_wide: c_int) void;
    pub const setWideHandle = gtk_paned_set_wide_handle;

    extern fn gtk_paned_get_type() usize;
    pub const getGObjectType = gtk_paned_get_type;

    extern fn g_object_ref(p_self: *gtk.Paned) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Paned) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Paned, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GParamSpec` for properties holding a `GtkExpression`.
pub const ParamSpecExpression = extern struct {
    pub const Parent = gobject.ParamSpec;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = ParamSpecExpression;
    };
    f_parent_instance: gobject.ParamSpec,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_param_expression_get_type() usize;
    pub const getGObjectType = gtk_param_expression_get_type;

    pub fn as(p_instance: *ParamSpecExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A single-line text entry widget for entering passwords and other secrets.
///
/// <picture>
///   <source srcset="password-entry-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPasswordEntry" src="password-entry.png">
/// </picture>
///
/// It does not show its contents in clear text, does not allow to copy it
/// to the clipboard, and it shows a warning when Caps Lock is engaged. If
/// the underlying platform allows it, `GtkPasswordEntry` will also place
/// the text in a non-pageable memory area, to avoid it being written out
/// to disk by the operating system.
///
/// Optionally, it can offer a way to reveal the contents in clear text.
///
/// `GtkPasswordEntry` provides only minimal API and should be used with
/// the `gtk.Editable` API.
///
/// # CSS Nodes
///
/// ```
/// entry.password
/// ╰── text
///     ├── image.caps-lock-indicator
///     ┊
/// ```
///
/// `GtkPasswordEntry` has a single CSS node with name entry that carries
/// a .passwordstyle class. The text Css node below it has a child with
/// name image and style class .caps-lock-indicator for the Caps Lock
/// icon, and possibly other children.
///
/// # Accessibility
///
/// `GtkPasswordEntry` uses the `gtk.@"AccessibleRole.text_box"` role.
pub const PasswordEntry = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Editable };
    pub const Class = gtk.PasswordEntryClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to activate the default widget when Enter is pressed.
        pub const activates_default = struct {
            pub const name = "activates-default";

            pub const Type = c_int;
        };

        /// A menu model whose contents will be appended to
        /// the context menu.
        pub const extra_menu = struct {
            pub const name = "extra-menu";

            pub const Type = ?*gio.MenuModel;
        };

        /// The text that will be displayed in the `GtkPasswordEntry`
        /// when it is empty and unfocused.
        pub const placeholder_text = struct {
            pub const name = "placeholder-text";

            pub const Type = ?[*:0]u8;
        };

        /// Whether to show an icon for revealing the content.
        pub const show_peek_icon = struct {
            pub const name = "show-peek-icon";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the entry is activated.
        ///
        /// The keybindings for this signal are all forms of the Enter key.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PasswordEntry, p_instance))),
                    gobject.signalLookup("activate", PasswordEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a `GtkPasswordEntry`.
    extern fn gtk_password_entry_new() *gtk.PasswordEntry;
    pub const new = gtk_password_entry_new;

    /// Gets the menu model set with `gtk.PasswordEntry.setExtraMenu`.
    extern fn gtk_password_entry_get_extra_menu(p_entry: *PasswordEntry) ?*gio.MenuModel;
    pub const getExtraMenu = gtk_password_entry_get_extra_menu;

    /// Returns whether the entry is showing an icon to
    /// reveal the contents.
    extern fn gtk_password_entry_get_show_peek_icon(p_entry: *PasswordEntry) c_int;
    pub const getShowPeekIcon = gtk_password_entry_get_show_peek_icon;

    /// Sets a menu model to add when constructing
    /// the context menu for `entry`.
    extern fn gtk_password_entry_set_extra_menu(p_entry: *PasswordEntry, p_model: ?*gio.MenuModel) void;
    pub const setExtraMenu = gtk_password_entry_set_extra_menu;

    /// Sets whether the entry should have a clickable icon
    /// to reveal the contents.
    ///
    /// Setting this to `FALSE` also hides the text again.
    extern fn gtk_password_entry_set_show_peek_icon(p_entry: *PasswordEntry, p_show_peek_icon: c_int) void;
    pub const setShowPeekIcon = gtk_password_entry_set_show_peek_icon;

    extern fn gtk_password_entry_get_type() usize;
    pub const getGObjectType = gtk_password_entry_get_type;

    extern fn g_object_ref(p_self: *gtk.PasswordEntry) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PasswordEntry) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PasswordEntry, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkEntryBuffer` that locks the underlying memory to prevent it
/// from being swapped to disk.
///
/// `GtkPasswordEntry` uses a `GtkPasswordEntryBuffer`.
pub const PasswordEntryBuffer = opaque {
    pub const Parent = gtk.EntryBuffer;
    pub const Implements = [_]type{};
    pub const Class = gtk.PasswordEntryBufferClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkEntryBuffer` using secure memory allocations.
    extern fn gtk_password_entry_buffer_new() *gtk.PasswordEntryBuffer;
    pub const new = gtk_password_entry_buffer_new;

    extern fn gtk_password_entry_buffer_get_type() usize;
    pub const getGObjectType = gtk_password_entry_buffer_get_type;

    extern fn g_object_ref(p_self: *gtk.PasswordEntryBuffer) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PasswordEntryBuffer) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PasswordEntryBuffer, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays a `GdkPaintable`.
///
/// <picture>
///   <source srcset="picture-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPicture" src="picture.png">
/// </picture>
///
/// Many convenience functions are provided to make pictures simple to use.
/// For example, if you want to load an image from a file, and then display
/// it, there’s a convenience function to do this:
///
/// ```c
/// GtkWidget *widget = gtk_picture_new_for_filename ("myfile.png");
/// ```
///
/// If the file isn’t loaded successfully, the picture will contain a
/// “broken image” icon similar to that used in many web browsers.
/// If you want to handle errors in loading the file yourself,
/// for example by displaying an error message, then load the image with
/// and image loading framework such as libglycin, then create the `GtkPicture`
/// with `gtk.Picture.newForPaintable`.
///
/// Sometimes an application will want to avoid depending on external data
/// files, such as image files. See the documentation of `GResource` for details.
/// In this case, `gtk.Picture.newForResource` and
/// `gtk.Picture.setResource` should be used.
///
/// `GtkPicture` displays an image at its natural size. See `gtk.Image`
/// if you want to display a fixed-size image, such as an icon.
///
/// ## Sizing the paintable
///
/// You can influence how the paintable is displayed inside the `GtkPicture`
/// by changing `gtk.Picture.properties.content_fit`. See `gtk.ContentFit`
/// for details. `gtk.Picture.properties.can_shrink` can be unset to make sure
/// that paintables are never made smaller than their ideal size - but
/// be careful if you do not know the size of the paintable in use (like
/// when displaying user-loaded images). This can easily cause the picture to
/// grow larger than the screen. And `gtk.Widget.properties.halign` and
/// `gtk.Widget.properties.valign` can be used to make sure the paintable doesn't
/// fill all available space but is instead displayed at its original size.
///
/// ## CSS nodes
///
/// `GtkPicture` has a single CSS node with the name `picture`.
///
/// ## Accessibility
///
/// `GtkPicture` uses the `gtk.@"AccessibleRole.img"` role.
pub const Picture = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.PictureClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The alternative textual description for the picture.
        pub const alternative_text = struct {
            pub const name = "alternative-text";

            pub const Type = ?[*:0]u8;
        };

        /// If the `GtkPicture` can be made smaller than the natural size of its contents.
        pub const can_shrink = struct {
            pub const name = "can-shrink";

            pub const Type = c_int;
        };

        /// How the content should be resized to fit inside the `GtkPicture`.
        pub const content_fit = struct {
            pub const name = "content-fit";

            pub const Type = gtk.ContentFit;
        };

        /// The `GFile` that is displayed or `NULL` if none.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?*gio.File;
        };

        /// If the rendering of the contents is isolated from the rest of the widget tree.
        pub const isolate_contents = struct {
            pub const name = "isolate-contents";

            pub const Type = c_int;
        };

        /// Whether the GtkPicture will render its contents trying to preserve the aspect
        /// ratio.
        pub const keep_aspect_ratio = struct {
            pub const name = "keep-aspect-ratio";

            pub const Type = c_int;
        };

        /// The `GdkPaintable` to be displayed by this `GtkPicture`.
        pub const paintable = struct {
            pub const name = "paintable";

            pub const Type = ?*gdk.Paintable;
        };
    };

    pub const signals = struct {};

    /// Creates a new empty `GtkPicture` widget.
    extern fn gtk_picture_new() *gtk.Picture;
    pub const new = gtk_picture_new;

    /// Creates a new `GtkPicture` displaying the given `file`.
    ///
    /// If the file isn’t found or can’t be loaded, the resulting
    /// `GtkPicture` is empty.
    ///
    /// If you need to detect failures to load the file, use an
    /// image loading framework such as libglycin to load the file
    /// yourself, then create the `GtkPicture` from the texture.
    extern fn gtk_picture_new_for_file(p_file: ?*gio.File) *gtk.Picture;
    pub const newForFile = gtk_picture_new_for_file;

    /// Creates a new `GtkPicture` displaying the file `filename`.
    ///
    /// This is a utility function that calls `gtk.Picture.newForFile`.
    /// See that function for details.
    extern fn gtk_picture_new_for_filename(p_filename: ?[*:0]const u8) *gtk.Picture;
    pub const newForFilename = gtk_picture_new_for_filename;

    /// Creates a new `GtkPicture` displaying `paintable`.
    ///
    /// The `GtkPicture` will track changes to the `paintable` and update
    /// its size and contents in response to it.
    extern fn gtk_picture_new_for_paintable(p_paintable: ?*gdk.Paintable) *gtk.Picture;
    pub const newForPaintable = gtk_picture_new_for_paintable;

    /// Creates a new `GtkPicture` displaying `pixbuf`.
    ///
    /// This is a utility function that calls `gtk.Picture.newForPaintable`,
    /// See that function for details.
    ///
    /// The pixbuf must not be modified after passing it to this function.
    extern fn gtk_picture_new_for_pixbuf(p_pixbuf: ?*gdkpixbuf.Pixbuf) *gtk.Picture;
    pub const newForPixbuf = gtk_picture_new_for_pixbuf;

    /// Creates a new `GtkPicture` displaying the resource at `resource_path`.
    ///
    /// This is a utility function that calls `gtk.Picture.newForFile`.
    /// See that function for details.
    extern fn gtk_picture_new_for_resource(p_resource_path: ?[*:0]const u8) *gtk.Picture;
    pub const newForResource = gtk_picture_new_for_resource;

    /// Gets the alternative textual description of the picture.
    ///
    /// The returned string will be `NULL` if the picture cannot be described textually.
    extern fn gtk_picture_get_alternative_text(p_self: *Picture) ?[*:0]const u8;
    pub const getAlternativeText = gtk_picture_get_alternative_text;

    /// Returns whether the `GtkPicture` respects its contents size.
    extern fn gtk_picture_get_can_shrink(p_self: *Picture) c_int;
    pub const getCanShrink = gtk_picture_get_can_shrink;

    /// Returns the fit mode for the content of the `GtkPicture`.
    ///
    /// See `gtk.ContentFit` for details.
    extern fn gtk_picture_get_content_fit(p_self: *Picture) gtk.ContentFit;
    pub const getContentFit = gtk_picture_get_content_fit;

    /// Gets the `GFile` currently displayed if `self` is displaying a file.
    ///
    /// If `self` is not displaying a file, for example when
    /// `gtk.Picture.setPaintable` was used, then `NULL` is returned.
    extern fn gtk_picture_get_file(p_self: *Picture) ?*gio.File;
    pub const getFile = gtk_picture_get_file;

    /// Returns whether the contents are isolated.
    extern fn gtk_picture_get_isolate_contents(p_self: *Picture) c_int;
    pub const getIsolateContents = gtk_picture_get_isolate_contents;

    /// Returns whether the `GtkPicture` preserves its contents aspect ratio.
    extern fn gtk_picture_get_keep_aspect_ratio(p_self: *Picture) c_int;
    pub const getKeepAspectRatio = gtk_picture_get_keep_aspect_ratio;

    /// Gets the `GdkPaintable` being displayed by the `GtkPicture`.
    extern fn gtk_picture_get_paintable(p_self: *Picture) ?*gdk.Paintable;
    pub const getPaintable = gtk_picture_get_paintable;

    /// Sets an alternative textual description for the picture contents.
    ///
    /// It is equivalent to the "alt" attribute for images on websites.
    ///
    /// This text will be made available to accessibility tools.
    ///
    /// If the picture cannot be described textually, set this property to `NULL`.
    extern fn gtk_picture_set_alternative_text(p_self: *Picture, p_alternative_text: ?[*:0]const u8) void;
    pub const setAlternativeText = gtk_picture_set_alternative_text;

    /// If set to `TRUE`, then `self` can be made smaller than its contents.
    ///
    /// The contents will then be scaled down when rendering.
    ///
    /// If you want to still force a minimum size manually, consider using
    /// `gtk.Widget.setSizeRequest`.
    ///
    /// Also of note is that a similar function for growing does not exist
    /// because the grow behavior can be controlled via
    /// `gtk.Widget.setHalign` and `gtk.Widget.setValign`.
    extern fn gtk_picture_set_can_shrink(p_self: *Picture, p_can_shrink: c_int) void;
    pub const setCanShrink = gtk_picture_set_can_shrink;

    /// Sets how the content should be resized to fit the `GtkPicture`.
    ///
    /// See `gtk.ContentFit` for details.
    extern fn gtk_picture_set_content_fit(p_self: *Picture, p_content_fit: gtk.ContentFit) void;
    pub const setContentFit = gtk_picture_set_content_fit;

    /// Makes `self` load and display `file`.
    ///
    /// See `gtk.Picture.newForFile` for details.
    ///
    /// ::: warning
    ///     Note that this function should not be used with untrusted data.
    ///     Use a proper image loading framework such as libglycin, which can
    ///     load many image formats into a `GdkTexture`, and then use
    ///     `gtk.Image.setFromPaintable`.
    extern fn gtk_picture_set_file(p_self: *Picture, p_file: ?*gio.File) void;
    pub const setFile = gtk_picture_set_file;

    /// Makes `self` load and display the given `filename`.
    ///
    /// This is a utility function that calls `gtk.Picture.setFile`.
    ///
    /// ::: warning
    ///     Note that this function should not be used with untrusted data.
    ///     Use a proper image loading framework such as libglycin, which can
    ///     load many image formats into a `GdkTexture`, and then use
    ///     `gtk.Image.setFromPaintable`.
    extern fn gtk_picture_set_filename(p_self: *Picture, p_filename: ?[*:0]const u8) void;
    pub const setFilename = gtk_picture_set_filename;

    /// If set to true, then the contents will be rendered individually.
    ///
    /// If set to false they will be able to erase or otherwise mix with
    /// the background.
    ///
    /// GTK supports finer grained isolation, in rare cases where you need
    /// this, you can use `gtk.Snapshot.pushIsolation` yourself to
    /// achieve this.
    ///
    /// By default contents are isolated.
    extern fn gtk_picture_set_isolate_contents(p_self: *Picture, p_isolate_contents: c_int) void;
    pub const setIsolateContents = gtk_picture_set_isolate_contents;

    /// If set to `TRUE`, the `self` will render its contents according to
    /// their aspect ratio.
    ///
    /// That means that empty space may show up at the top/bottom or
    /// left/right of `self`.
    ///
    /// If set to `FALSE` or if the contents provide no aspect ratio,
    /// the contents will be stretched over the picture's whole area.
    extern fn gtk_picture_set_keep_aspect_ratio(p_self: *Picture, p_keep_aspect_ratio: c_int) void;
    pub const setKeepAspectRatio = gtk_picture_set_keep_aspect_ratio;

    /// Makes `self` display the given `paintable`.
    ///
    /// If `paintable` is `NULL`, nothing will be displayed.
    ///
    /// See `gtk.Picture.newForPaintable` for details.
    extern fn gtk_picture_set_paintable(p_self: *Picture, p_paintable: ?*gdk.Paintable) void;
    pub const setPaintable = gtk_picture_set_paintable;

    /// Sets a `GtkPicture` to show a `GdkPixbuf`.
    ///
    /// See `gtk.Picture.newForPixbuf` for details.
    ///
    /// This is a utility function that calls `gtk.Picture.setPaintable`.
    extern fn gtk_picture_set_pixbuf(p_self: *Picture, p_pixbuf: ?*gdkpixbuf.Pixbuf) void;
    pub const setPixbuf = gtk_picture_set_pixbuf;

    /// Makes `self` load and display the resource at the given
    /// `resource_path`.
    ///
    /// This is a utility function that calls `gtk.Picture.setFile`.
    extern fn gtk_picture_set_resource(p_self: *Picture, p_resource_path: ?[*:0]const u8) void;
    pub const setResource = gtk_picture_set_resource;

    extern fn gtk_picture_get_type() usize;
    pub const getGObjectType = gtk_picture_get_type;

    extern fn g_object_ref(p_self: *gtk.Picture) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Picture) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Picture, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents a bubble-like popup.
///
/// <picture>
///   <source srcset="popover-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPopover" src="popover.png">
/// </picture>
///
/// It is primarily meant to provide context-dependent information
/// or options. Popovers are attached to a parent widget. The parent widget
/// must support popover children, as `gtk.MenuButton` and
/// `gtk.PopoverMenuBar` do. If you want to make a custom widget that
/// has an attached popover, you need to call `gtk.Popover.present`
/// in your `gtk.Widget.virtual_methods.size_allocate` vfunc, in order to update the
/// positioning of the popover.
///
/// The position of a popover relative to the widget it is attached to
/// can also be changed with `gtk.Popover.setPosition`. By default,
/// it points to the whole widget area, but it can be made to point to
/// a specific area using `gtk.Popover.setPointingTo`.
///
/// By default, `GtkPopover` performs a grab, in order to ensure input
/// events get redirected to it while it is shown, and also so the popover
/// is dismissed in the expected situations (clicks outside the popover,
/// or the Escape key being pressed). If no such modal behavior is desired
/// on a popover, `gtk.Popover.setAutohide` may be called on it to
/// tweak its behavior.
///
/// ## GtkPopover as menu replacement
///
/// `GtkPopover` is often used to replace menus. The best way to do this
/// is to use the `gtk.PopoverMenu` subclass which supports being
/// populated from a `GMenuModel` with `gtk.PopoverMenu.newFromModel`.
///
/// ```xml
/// <section>
///   <attribute name="display-hint">horizontal-buttons</attribute>
///   <item>
///     <attribute name="label">Cut</attribute>
///     <attribute name="action">app.cut</attribute>
///     <attribute name="verb-icon">edit-cut-symbolic</attribute>
///   </item>
///   <item>
///     <attribute name="label">Copy</attribute>
///     <attribute name="action">app.copy</attribute>
///     <attribute name="verb-icon">edit-copy-symbolic</attribute>
///   </item>
///   <item>
///     <attribute name="label">Paste</attribute>
///     <attribute name="action">app.paste</attribute>
///     <attribute name="verb-icon">edit-paste-symbolic</attribute>
///   </item>
/// </section>
/// ```
///
/// # Shortcuts and Gestures
///
/// `GtkPopover` supports the following keyboard shortcuts:
///
/// - <kbd>Escape</kbd> closes the popover.
/// - <kbd>Alt</kbd> makes the mnemonics visible.
///
/// The following signals have default keybindings:
///
/// - `gtk.Popover.signals.activate_default`
///
/// # CSS nodes
///
/// ```
/// popover.background[.menu]
/// ├── arrow
/// ╰── contents
///     ╰── <child>
/// ```
///
/// `GtkPopover` has a main node with name `popover`, an arrow with name `arrow`,
/// and another node for the content named `contents`. The `popover` node always
/// gets the `.background` style class. It also gets the `.menu` style class
/// if the popover is menu-like, e.g. is a `gtk.PopoverMenu`.
///
/// Particular uses of `GtkPopover`, such as touch selection popups or
/// magnifiers in `GtkEntry` or `GtkTextView` get style classes like
/// `.touch-selection` or `.magnifier` to differentiate from plain popovers.
///
/// When styling a popover directly, the `popover` node should usually
/// not have any background. The visible part of the popover can have
/// a shadow. To specify it in CSS, set the box-shadow of the `contents` node.
///
/// Note that, in order to accomplish appropriate arrow visuals, `GtkPopover`
/// uses custom drawing for the `arrow` node. This makes it possible for the
/// arrow to change its shape dynamically, but it also limits the possibilities
/// of styling it using CSS. In particular, the `arrow` gets drawn over the
/// `content` node's border and shadow, so they look like one shape, which
/// means that the border width of the `content` node and the `arrow` node should
/// be the same. The arrow also does not support any border shape other than
/// solid, no border-radius, only one border width (border-bottom-width is
/// used) and no box-shadow.
pub const Popover = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.ShortcutManager };
    pub const Class = gtk.PopoverClass;
    f_parent: gtk.Widget,

    pub const virtual_methods = struct {
        pub const activate_default = struct {
            pub fn call(p_class: anytype, p_popover: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Popover.Class, p_class).f_activate_default.?(gobject.ext.as(Popover, p_popover));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_popover: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Popover.Class, p_class).f_activate_default = @ptrCast(p_implementation);
            }
        };

        pub const closed = struct {
            pub fn call(p_class: anytype, p_popover: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Popover.Class, p_class).f_closed.?(gobject.ext.as(Popover, p_popover));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_popover: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Popover.Class, p_class).f_closed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Whether to dismiss the popover on outside clicks.
        pub const autohide = struct {
            pub const name = "autohide";

            pub const Type = c_int;
        };

        /// Whether the popover pops down after a child popover.
        ///
        /// This is used to implement the expected behavior of submenus.
        pub const cascade_popdown = struct {
            pub const name = "cascade-popdown";

            pub const Type = c_int;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The default widget inside the popover.
        pub const default_widget = struct {
            pub const name = "default-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether to draw an arrow.
        pub const has_arrow = struct {
            pub const name = "has-arrow";

            pub const Type = c_int;
        };

        /// Whether mnemonics are currently visible in this popover.
        pub const mnemonics_visible = struct {
            pub const name = "mnemonics-visible";

            pub const Type = c_int;
        };

        /// Rectangle in the parent widget that the popover points to.
        pub const pointing_to = struct {
            pub const name = "pointing-to";

            pub const Type = ?*gdk.Rectangle;
        };

        /// How to place the popover, relative to its parent.
        pub const position = struct {
            pub const name = "position";

            pub const Type = gtk.PositionType;
        };
    };

    pub const signals = struct {
        /// Emitted whend the user activates the default widget.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Enter</kbd>.
        pub const activate_default = struct {
            pub const name = "activate-default";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Popover, p_instance))),
                    gobject.signalLookup("activate-default", Popover.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the popover is closed.
        pub const closed = struct {
            pub const name = "closed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Popover, p_instance))),
                    gobject.signalLookup("closed", Popover.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkPopover`.
    extern fn gtk_popover_new() *gtk.Popover;
    pub const new = gtk_popover_new;

    /// Returns whether the popover is modal.
    ///
    /// See `gtk.Popover.setAutohide` for the
    /// implications of this.
    extern fn gtk_popover_get_autohide(p_popover: *Popover) c_int;
    pub const getAutohide = gtk_popover_get_autohide;

    /// Returns whether the popover will close after a modal child is closed.
    extern fn gtk_popover_get_cascade_popdown(p_popover: *Popover) c_int;
    pub const getCascadePopdown = gtk_popover_get_cascade_popdown;

    /// Gets the child widget of `popover`.
    extern fn gtk_popover_get_child(p_popover: *Popover) ?*gtk.Widget;
    pub const getChild = gtk_popover_get_child;

    /// Gets whether this popover is showing an arrow
    /// pointing at the widget that it is relative to.
    extern fn gtk_popover_get_has_arrow(p_popover: *Popover) c_int;
    pub const getHasArrow = gtk_popover_get_has_arrow;

    /// Gets whether mnemonics are visible.
    extern fn gtk_popover_get_mnemonics_visible(p_popover: *Popover) c_int;
    pub const getMnemonicsVisible = gtk_popover_get_mnemonics_visible;

    /// Gets the offset previous set with `gtk.Popover.setOffset`.
    extern fn gtk_popover_get_offset(p_popover: *Popover, p_x_offset: ?*c_int, p_y_offset: ?*c_int) void;
    pub const getOffset = gtk_popover_get_offset;

    /// Gets the rectangle that the popover points to.
    ///
    /// If a rectangle to point to has been set, this function will
    /// return `TRUE` and fill in `rect` with such rectangle, otherwise
    /// it will return `FALSE` and fill in `rect` with the parent
    /// widget coordinates.
    extern fn gtk_popover_get_pointing_to(p_popover: *Popover, p_rect: *gdk.Rectangle) c_int;
    pub const getPointingTo = gtk_popover_get_pointing_to;

    /// Returns the preferred position of `popover`.
    extern fn gtk_popover_get_position(p_popover: *Popover) gtk.PositionType;
    pub const getPosition = gtk_popover_get_position;

    /// Pops `popover` down.
    ///
    /// This may have the side-effect of closing a parent popover
    /// as well. See `gtk.Popover.properties.cascade_popdown`.
    extern fn gtk_popover_popdown(p_popover: *Popover) void;
    pub const popdown = gtk_popover_popdown;

    /// Pops `popover` up.
    extern fn gtk_popover_popup(p_popover: *Popover) void;
    pub const popup = gtk_popover_popup;

    /// Allocate a size for the `GtkPopover`.
    ///
    /// This function needs to be called in size-allocate by widgets
    /// who have a `GtkPopover` as child. When using a layout manager,
    /// this is happening automatically.
    ///
    /// To make a popover appear on screen, use `gtk.Popover.popup`.
    extern fn gtk_popover_present(p_popover: *Popover) void;
    pub const present = gtk_popover_present;

    /// Sets whether `popover` is modal.
    ///
    /// A modal popover will grab the keyboard focus on it when being
    /// displayed. Focus will wrap around within the popover. Clicking
    /// outside the popover area or pressing Esc will dismiss the popover.
    ///
    /// Called this function on an already showing popup with a new
    /// autohide value different from the current one, will cause the
    /// popup to be hidden.
    extern fn gtk_popover_set_autohide(p_popover: *Popover, p_autohide: c_int) void;
    pub const setAutohide = gtk_popover_set_autohide;

    /// If `cascade_popdown` is `TRUE`, the popover will be
    /// closed when a child modal popover is closed.
    ///
    /// If `FALSE`, `popover` will stay visible.
    extern fn gtk_popover_set_cascade_popdown(p_popover: *Popover, p_cascade_popdown: c_int) void;
    pub const setCascadePopdown = gtk_popover_set_cascade_popdown;

    /// Sets the child widget of `popover`.
    extern fn gtk_popover_set_child(p_popover: *Popover, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_popover_set_child;

    /// Sets the default widget of a `GtkPopover`.
    ///
    /// The default widget is the widget that’s activated when the user
    /// presses Enter in a dialog (for example). This function sets or
    /// unsets the default widget for a `GtkPopover`.
    extern fn gtk_popover_set_default_widget(p_popover: *Popover, p_widget: ?*gtk.Widget) void;
    pub const setDefaultWidget = gtk_popover_set_default_widget;

    /// Sets whether this popover should draw an arrow
    /// pointing at the widget it is relative to.
    extern fn gtk_popover_set_has_arrow(p_popover: *Popover, p_has_arrow: c_int) void;
    pub const setHasArrow = gtk_popover_set_has_arrow;

    /// Sets whether mnemonics should be visible.
    extern fn gtk_popover_set_mnemonics_visible(p_popover: *Popover, p_mnemonics_visible: c_int) void;
    pub const setMnemonicsVisible = gtk_popover_set_mnemonics_visible;

    /// Sets the offset to use when calculating the position
    /// of the popover.
    ///
    /// These values are used when preparing the `gdk.PopupLayout`
    /// for positioning the popover.
    extern fn gtk_popover_set_offset(p_popover: *Popover, p_x_offset: c_int, p_y_offset: c_int) void;
    pub const setOffset = gtk_popover_set_offset;

    /// Sets the rectangle that `popover` points to.
    ///
    /// This is in the coordinate space of the `popover` parent.
    extern fn gtk_popover_set_pointing_to(p_popover: *Popover, p_rect: ?*const gdk.Rectangle) void;
    pub const setPointingTo = gtk_popover_set_pointing_to;

    /// Sets the preferred position for `popover` to appear.
    ///
    /// If the `popover` is currently visible, it will be immediately
    /// updated.
    ///
    /// This preference will be respected where possible, although
    /// on lack of space (eg. if close to the window edges), the
    /// `GtkPopover` may choose to appear on the opposite side.
    extern fn gtk_popover_set_position(p_popover: *Popover, p_position: gtk.PositionType) void;
    pub const setPosition = gtk_popover_set_position;

    extern fn gtk_popover_get_type() usize;
    pub const getGObjectType = gtk_popover_get_type;

    extern fn g_object_ref(p_self: *gtk.Popover) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Popover) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Popover, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A single child container with a popover.
///
/// You should use `GtkPopoverBin` whenever you need to present a `gtk.Popover`
/// to the user.
///
/// ## Actions
///
/// `GtkPopoverBin` defines the `menu.popup` action, which can be activated
/// to present the popover to the user.
///
/// ## CSS nodes
///
/// `GtkPopoverBin` has a single CSS node with the name `popoverbin`.
pub const PopoverBin = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.PopoverBinClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget of the popover bin.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the popover bin will handle input
        /// to trigger the popup.
        pub const handle_input = struct {
            pub const name = "handle-input";

            pub const Type = c_int;
        };

        /// The `GMenuModel` from which the popup will be created.
        ///
        /// See `gtk.PopoverBin.setMenuModel` for the interaction
        /// with the `gtk.PopoverBin.properties.popover` property.
        pub const menu_model = struct {
            pub const name = "menu-model";

            pub const Type = ?*gio.MenuModel;
        };

        /// The `GtkPopover` that will be popped up when calling
        /// `gtk.PopoverBin.popup`.
        pub const popover = struct {
            pub const name = "popover";

            pub const Type = ?*gtk.Popover;
        };
    };

    pub const signals = struct {};

    /// Creates a new popover bin widget.
    extern fn gtk_popover_bin_new() *gtk.PopoverBin;
    pub const new = gtk_popover_bin_new;

    /// Retrieves the child widget of the popover bin.
    extern fn gtk_popover_bin_get_child(p_self: *PopoverBin) ?*gtk.Widget;
    pub const getChild = gtk_popover_bin_get_child;

    extern fn gtk_popover_bin_get_handle_input(p_self: *PopoverBin) c_int;
    pub const getHandleInput = gtk_popover_bin_get_handle_input;

    /// Retrieves the menu model set using `gtk.PopoverBin.setMenuModel`.
    extern fn gtk_popover_bin_get_menu_model(p_self: *PopoverBin) ?*gio.MenuModel;
    pub const getMenuModel = gtk_popover_bin_get_menu_model;

    /// Retrieves the `GtkPopover` set using `gtk.PopoverBin.setPopover`.
    extern fn gtk_popover_bin_get_popover(p_self: *PopoverBin) ?*gtk.Popover;
    pub const getPopover = gtk_popover_bin_get_popover;

    /// Hides the popover from the user.
    ///
    /// See: `gtk.PopoverBin.popup`
    extern fn gtk_popover_bin_popdown(p_self: *PopoverBin) void;
    pub const popdown = gtk_popover_bin_popdown;

    /// Presents the popover to the user.
    ///
    /// Use `gtk.PopoverBin.setPopover` or
    /// `gtk.PopoverBin.setMenuModel` to define the popover.
    ///
    /// See: `gtk.PopoverBin.popdown`
    extern fn gtk_popover_bin_popup(p_self: *PopoverBin) void;
    pub const popup = gtk_popover_bin_popup;

    /// Sets the child of the popover bin.
    extern fn gtk_popover_bin_set_child(p_self: *PopoverBin, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_popover_bin_set_child;

    /// Enables or disables input handling.
    ///
    /// If enabled, the popover bin will pop up the
    /// popover on right-click or long press, as expected
    /// for a context menu.
    extern fn gtk_popover_bin_set_handle_input(p_self: *PopoverBin, p_handle_input: c_int) void;
    pub const setHandleInput = gtk_popover_bin_set_handle_input;

    /// Sets the menu model used to create the popover that will be
    /// presented when calling `gtk.PopoverBin.popup`.
    ///
    /// If `model` is `NULL`, the popover will be unset.
    ///
    /// A `gtk.Popover` will be created from the menu model with
    /// `gtk.PopoverMenu.newFromModel`. Actions will be connected
    /// as documented for this function.
    ///
    /// If `gtk.PopoverBin.properties.popover` is already set, it will be
    /// dissociated from the popover bin, and the property is set to `NULL`.
    ///
    /// See: `gtk.PopoverBin.setPopover`
    extern fn gtk_popover_bin_set_menu_model(p_self: *PopoverBin, p_model: ?*gio.MenuModel) void;
    pub const setMenuModel = gtk_popover_bin_set_menu_model;

    /// Sets the `GtkPopover` that will be presented when calling
    /// `gtk.PopoverBin.popup`.
    ///
    /// If `popover` is `NULL`, the popover will be unset.
    ///
    /// If `gtk.PopoverBin.properties.menu_model` is set before calling
    /// this function, then the menu model property will be unset.
    ///
    /// See: `gtk.PopoverBin.setMenuModel`
    extern fn gtk_popover_bin_set_popover(p_self: *PopoverBin, p_popover: ?*gtk.Popover) void;
    pub const setPopover = gtk_popover_bin_set_popover;

    extern fn gtk_popover_bin_get_type() usize;
    pub const getGObjectType = gtk_popover_bin_get_type;

    extern fn g_object_ref(p_self: *gtk.PopoverBin) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PopoverBin) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PopoverBin, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A subclass of `GtkPopover` that implements menu behavior.
///
/// <picture>
///   <source srcset="menu-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPopoverMenu" src="menu.png">
/// </picture>
///
/// `GtkPopoverMenu` treats its children like menus and allows switching
/// between them. It can open submenus as traditional, nested submenus,
/// or in a more touch-friendly sliding fashion.
/// The property `gtk.PopoverMenu.properties.flags` controls this appearance.
///
/// `GtkPopoverMenu` is meant to be used primarily with menu models,
/// using `gtk.PopoverMenu.newFromModel`. If you need to put
/// other widgets such as a `GtkSpinButton` or a `GtkSwitch` into a popover,
/// you can use `gtk.PopoverMenu.addChild`.
///
/// For more dialog-like behavior, use a plain `GtkPopover`.
///
/// ## Menu models
///
/// The XML format understood by `GtkBuilder` for `GMenuModel` consists
/// of a toplevel `<menu>` element, which contains one or more `<item>`
/// elements. Each `<item>` element contains `<attribute>` and `<link>`
/// elements with a mandatory name attribute. `<link>` elements have the
/// same content model as `<menu>`. Instead of `<link name="submenu">`
/// or `<link name="section">`, you can use `<submenu>` or `<section>`
/// elements.
///
/// ```xml
/// <menu id='app-menu'>
///   <section>
///     <item>
///       <attribute name='label' translatable='yes'>_New Window</attribute>
///       <attribute name='action'>app.new</attribute>
///     </item>
///     <item>
///       <attribute name='label' translatable='yes'>_About Sunny</attribute>
///       <attribute name='action'>app.about</attribute>
///     </item>
///     <item>
///       <attribute name='label' translatable='yes'>_Quit</attribute>
///       <attribute name='action'>app.quit</attribute>
///     </item>
///   </section>
/// </menu>
/// ```
///
/// Attribute values can be translated using gettext, like other `GtkBuilder`
/// content. `<attribute>` elements can be marked for translation with a
/// `translatable="yes"` attribute. It is also possible to specify message
/// context and translator comments, using the context and comments attributes.
/// To make use of this, the `GtkBuilder` must have been given the gettext
/// domain to use.
///
/// The following attributes are used when constructing menu items:
///
/// - "label": a user-visible string to display
/// - "use-markup": whether the text in the menu item includes [Pango markup](https://docs.gtk.org/Pango/pango_markup.html)
/// - "action": the prefixed name of the action to trigger
/// - "target": the parameter to use when activating the action
/// - "icon" and "verb-icon": names of icons that may be displayed
/// - "submenu-action": name of an action that may be used to track
///      whether a submenu is open
/// - "hidden-when": a string used to determine when the item will be hidden.
///      Possible values include "action-disabled", "action-missing", "macos-menubar".
///      This is mainly useful for exported menus, see `gtk.Application.setMenubar`.
/// - "custom": a string used to match against the ID of a custom child added with
///      `gtk.PopoverMenu.addChild`, `gtk.PopoverMenuBar.addChild`,
///      or in the ui file with `<child type="ID">`.
///
/// The following attributes are used when constructing sections:
///
/// - "label": a user-visible string to use as section heading
/// - "display-hint": a string used to determine special formatting for the section.
///     Possible values include "horizontal-buttons", "circular-buttons" and
///     "inline-buttons". They all indicate that section should be
///     displayed as a horizontal row of buttons.
/// - "text-direction": a string used to determine the `GtkTextDirection` to use
///     when "display-hint" is set to "horizontal-buttons". Possible values
///     include "rtl", "ltr", and "none".
///
/// The following attributes are used when constructing submenus:
///
/// - "label": a user-visible string to display
/// - "icon": icon name to display
/// - "gtk-macos-special": (macOS only, ignored by others) Add special meaning to a menu
///     in the macOS menu bar. See [Using GTK on Apple macOS](osx.html).
///
/// Menu items will also show accelerators, which are usually associated
/// with actions via `gtk.Application.setAccelsForAction`,
/// `WidgetClass.addBindingAction` or
/// `gtk.ShortcutController.addShortcut`.
///
/// # Shortcuts and Gestures
///
/// `GtkPopoverMenu` supports the following keyboard shortcuts:
///
/// - <kbd>Space</kbd> activates the default widget.
///
/// # CSS Nodes
///
/// `GtkPopoverMenu` is just a subclass of `GtkPopover` that adds custom content
/// to it, therefore it has the same CSS nodes. It is one of the cases that add
/// a `.menu` style class to the main `popover` node.
///
/// Menu items have nodes with name `button` and class `.model`. If a section
/// display-hint is set, the section gets a node `box` with class `horizontal`
/// plus a class with the same text as the display hint. Note that said box may
/// not be the direct ancestor of the item `button`s. Thus, for example, to style
/// items in an `inline-buttons` section, select `.inline-buttons button.model`.
/// Other things that may be of interest to style in menus include `label` nodes.
///
/// # Accessibility
///
/// `GtkPopoverMenu` uses the `gtk.@"AccessibleRole.menu"` role, and its
/// items use the `gtk.@"AccessibleRole.menu_item"`,
/// `gtk.@"AccessibleRole.checkbox"` or `gtk.@"AccessibleRole.menu_item_radio"`
/// roles, depending on the action they are connected to.
pub const PopoverMenu = opaque {
    pub const Parent = gtk.Popover;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = PopoverMenu;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The flags that `popover` uses to create/display a menu from its model.
        ///
        /// If a model is set and the flags change, contents are rebuilt, so if setting
        /// properties individually, set flags before model to avoid a redundant rebuild.
        pub const flags = struct {
            pub const name = "flags";

            pub const Type = gtk.PopoverMenuFlags;
        };

        /// The model from which the menu is made.
        pub const menu_model = struct {
            pub const name = "menu-model";

            pub const Type = ?*gio.MenuModel;
        };

        /// The name of the visible submenu.
        pub const visible_submenu = struct {
            pub const name = "visible-submenu";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkPopoverMenu` and populates it according to `model`.
    ///
    /// The created buttons are connected to actions found in the
    /// `GtkApplicationWindow` to which the popover belongs - typically
    /// by means of being attached to a widget that is contained within
    /// the `GtkApplicationWindow`s widget hierarchy.
    ///
    /// Actions can also be added using `gtk.Widget.insertActionGroup`
    /// on the menus attach widget or on any of its parent widgets.
    ///
    /// This function creates menus with sliding submenus.
    /// See `gtk.PopoverMenu.newFromModelFull` for a way
    /// to control this.
    extern fn gtk_popover_menu_new_from_model(p_model: ?*gio.MenuModel) *gtk.PopoverMenu;
    pub const newFromModel = gtk_popover_menu_new_from_model;

    /// Creates a `GtkPopoverMenu` and populates it according to `model`.
    ///
    /// The created buttons are connected to actions found in the
    /// action groups that are accessible from the parent widget.
    /// This includes the `GtkApplicationWindow` to which the popover
    /// belongs. Actions can also be added using `gtk.Widget.insertActionGroup`
    /// on the parent widget or on any of its parent widgets.
    extern fn gtk_popover_menu_new_from_model_full(p_model: *gio.MenuModel, p_flags: gtk.PopoverMenuFlags) *gtk.PopoverMenu;
    pub const newFromModelFull = gtk_popover_menu_new_from_model_full;

    /// Adds a custom widget to a generated menu.
    ///
    /// For this to work, the menu model of `popover` must have
    /// an item with a `custom` attribute that matches `id`.
    extern fn gtk_popover_menu_add_child(p_popover: *PopoverMenu, p_child: *gtk.Widget, p_id: [*:0]const u8) c_int;
    pub const addChild = gtk_popover_menu_add_child;

    /// Returns the flags that `popover` uses to create/display a menu from its model.
    extern fn gtk_popover_menu_get_flags(p_popover: *PopoverMenu) gtk.PopoverMenuFlags;
    pub const getFlags = gtk_popover_menu_get_flags;

    /// Returns the menu model used to populate the popover.
    extern fn gtk_popover_menu_get_menu_model(p_popover: *PopoverMenu) ?*gio.MenuModel;
    pub const getMenuModel = gtk_popover_menu_get_menu_model;

    /// Removes a widget that has previously been added with
    /// `gtk.PopoverMenu.addChild`
    extern fn gtk_popover_menu_remove_child(p_popover: *PopoverMenu, p_child: *gtk.Widget) c_int;
    pub const removeChild = gtk_popover_menu_remove_child;

    /// Sets the flags that `popover` uses to create/display a menu from its model.
    ///
    /// If a model is set and the flags change, contents are rebuilt, so if setting
    /// properties individually, set flags before model to avoid a redundant rebuild.
    extern fn gtk_popover_menu_set_flags(p_popover: *PopoverMenu, p_flags: gtk.PopoverMenuFlags) void;
    pub const setFlags = gtk_popover_menu_set_flags;

    /// Sets a new menu model on `popover`.
    ///
    /// The existing contents of `popover` are removed, and
    /// the `popover` is populated with new contents according
    /// to `model`.
    extern fn gtk_popover_menu_set_menu_model(p_popover: *PopoverMenu, p_model: ?*gio.MenuModel) void;
    pub const setMenuModel = gtk_popover_menu_set_menu_model;

    extern fn gtk_popover_menu_get_type() usize;
    pub const getGObjectType = gtk_popover_menu_get_type;

    extern fn g_object_ref(p_self: *gtk.PopoverMenu) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PopoverMenu) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PopoverMenu, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Presents a horizontal bar of items that pop up menus when clicked.
///
/// <picture>
///   <source srcset="menubar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPopoverMenuBar" src="menubar.png">
/// </picture>
///
/// The only way to create instances of `GtkPopoverMenuBar` is
/// from a `GMenuModel`.
///
/// # CSS nodes
///
/// ```
/// menubar
/// ├── item[.active]
/// ┊   ╰── popover
/// ╰── item
///     ╰── popover
/// ```
///
/// `GtkPopoverMenuBar` has a single CSS node with name menubar, below which
/// each item has its CSS node, and below that the corresponding popover.
///
/// The item whose popover is currently open gets the .active
/// style class.
///
/// # Accessibility
///
/// `GtkPopoverMenuBar` uses the `gtk.@"AccessibleRole.menu_bar"` role,
/// the menu items use the `gtk.@"AccessibleRole.menu_item"` role and
/// the menus use the `gtk.@"AccessibleRole.menu"` role.
pub const PopoverMenuBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = PopoverMenuBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GMenuModel` from which the menu bar is created.
        ///
        /// The model should only contain submenus as toplevel elements.
        pub const menu_model = struct {
            pub const name = "menu-model";

            pub const Type = ?*gio.MenuModel;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkPopoverMenuBar` from a `GMenuModel`.
    extern fn gtk_popover_menu_bar_new_from_model(p_model: ?*gio.MenuModel) *gtk.PopoverMenuBar;
    pub const newFromModel = gtk_popover_menu_bar_new_from_model;

    /// Adds a custom widget to a generated menubar.
    ///
    /// For this to work, the menu model of `bar` must have an
    /// item with a `custom` attribute that matches `id`.
    extern fn gtk_popover_menu_bar_add_child(p_bar: *PopoverMenuBar, p_child: *gtk.Widget, p_id: [*:0]const u8) c_int;
    pub const addChild = gtk_popover_menu_bar_add_child;

    /// Returns the model from which the contents of `bar` are taken.
    extern fn gtk_popover_menu_bar_get_menu_model(p_bar: *PopoverMenuBar) ?*gio.MenuModel;
    pub const getMenuModel = gtk_popover_menu_bar_get_menu_model;

    /// Removes a widget that has previously been added with
    /// `gtk.PopoverMenuBar.addChild`.
    extern fn gtk_popover_menu_bar_remove_child(p_bar: *PopoverMenuBar, p_child: *gtk.Widget) c_int;
    pub const removeChild = gtk_popover_menu_bar_remove_child;

    /// Sets a menu model from which `bar` should take
    /// its contents.
    extern fn gtk_popover_menu_bar_set_menu_model(p_bar: *PopoverMenuBar, p_model: ?*gio.MenuModel) void;
    pub const setMenuModel = gtk_popover_menu_bar_set_menu_model;

    extern fn gtk_popover_menu_bar_get_type() usize;
    pub const getGObjectType = gtk_popover_menu_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.PopoverMenuBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PopoverMenuBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PopoverMenuBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Encapsulates context information that is required when
/// drawing pages for printing.
///
/// This includes the cairo context and important parameters like page size
/// and resolution. It also lets you easily create `pango.Layout` and
/// `pango.Context` objects that match the font metrics of the cairo surface.
///
/// `GtkPrintContext` objects get passed to the
/// `gtk.PrintOperation.signals.begin_print`,
/// `gtk.PrintOperation.signals.end_print`,
/// `gtk.PrintOperation.signals.request_page_setup` and
/// `gtk.PrintOperation.signals.draw_page` signals on the
/// `gtk.PrintOperation` object.
///
/// ## Using GtkPrintContext in a ::draw-page callback
///
/// ```c
/// static void
/// draw_page (GtkPrintOperation *operation,
///            GtkPrintContext   *context,
///            int                page_nr)
/// {
///   cairo_t *cr;
///   PangoLayout *layout;
///   PangoFontDescription *desc;
///
///   cr = gtk_print_context_get_cairo_context (context);
///
///   // Draw a red rectangle, as wide as the paper (inside the margins)
///   cairo_set_source_rgb (cr, 1.0, 0, 0);
///   cairo_rectangle (cr, 0, 0, gtk_print_context_get_width (context), 50);
///
///   cairo_fill (cr);
///
///   // Draw some lines
///   cairo_move_to (cr, 20, 10);
///   cairo_line_to (cr, 40, 20);
///   cairo_arc (cr, 60, 60, 20, 0, M_PI);
///   cairo_line_to (cr, 80, 20);
///
///   cairo_set_source_rgb (cr, 0, 0, 0);
///   cairo_set_line_width (cr, 5);
///   cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
///   cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
///
///   cairo_stroke (cr);
///
///   // Draw some text
///   layout = gtk_print_context_create_pango_layout (context);
///   pango_layout_set_text (layout, "Hello World! Printing is easy", -1);
///   desc = pango_font_description_from_string ("sans 28");
///   pango_layout_set_font_description (layout, desc);
///   pango_font_description_free (desc);
///
///   cairo_move_to (cr, 30, 20);
///   pango_cairo_layout_path (cr, layout);
///
///   // Font Outline
///   cairo_set_source_rgb (cr, 0.93, 1.0, 0.47);
///   cairo_set_line_width (cr, 0.5);
///   cairo_stroke_preserve (cr);
///
///   // Font Fill
///   cairo_set_source_rgb (cr, 0, 0.0, 1.0);
///   cairo_fill (cr);
///
///   g_object_unref (layout);
/// }
/// ```
pub const PrintContext = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = PrintContext;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `PangoContext` that can be used with the
    /// `GtkPrintContext`.
    extern fn gtk_print_context_create_pango_context(p_context: *PrintContext) *pango.Context;
    pub const createPangoContext = gtk_print_context_create_pango_context;

    /// Creates a new `PangoLayout` that is suitable for use
    /// with the `GtkPrintContext`.
    extern fn gtk_print_context_create_pango_layout(p_context: *PrintContext) *pango.Layout;
    pub const createPangoLayout = gtk_print_context_create_pango_layout;

    /// Obtains the cairo context that is associated with the
    /// `GtkPrintContext`.
    extern fn gtk_print_context_get_cairo_context(p_context: *PrintContext) *cairo.Context;
    pub const getCairoContext = gtk_print_context_get_cairo_context;

    /// Obtains the horizontal resolution of the `GtkPrintContext`,
    /// in dots per inch.
    extern fn gtk_print_context_get_dpi_x(p_context: *PrintContext) f64;
    pub const getDpiX = gtk_print_context_get_dpi_x;

    /// Obtains the vertical resolution of the `GtkPrintContext`,
    /// in dots per inch.
    extern fn gtk_print_context_get_dpi_y(p_context: *PrintContext) f64;
    pub const getDpiY = gtk_print_context_get_dpi_y;

    /// Obtains the hardware printer margins of the `GtkPrintContext`,
    /// in units.
    extern fn gtk_print_context_get_hard_margins(p_context: *PrintContext, p_top: *f64, p_bottom: *f64, p_left: *f64, p_right: *f64) c_int;
    pub const getHardMargins = gtk_print_context_get_hard_margins;

    /// Obtains the height of the `GtkPrintContext`, in pixels.
    extern fn gtk_print_context_get_height(p_context: *PrintContext) f64;
    pub const getHeight = gtk_print_context_get_height;

    /// Obtains the `GtkPageSetup` that determines the page
    /// dimensions of the `GtkPrintContext`.
    extern fn gtk_print_context_get_page_setup(p_context: *PrintContext) *gtk.PageSetup;
    pub const getPageSetup = gtk_print_context_get_page_setup;

    /// Returns a `PangoFontMap` that is suitable for use
    /// with the `GtkPrintContext`.
    extern fn gtk_print_context_get_pango_fontmap(p_context: *PrintContext) *pango.FontMap;
    pub const getPangoFontmap = gtk_print_context_get_pango_fontmap;

    /// Obtains the width of the `GtkPrintContext`, in pixels.
    extern fn gtk_print_context_get_width(p_context: *PrintContext) f64;
    pub const getWidth = gtk_print_context_get_width;

    /// Sets a new cairo context on a print context.
    ///
    /// This function is intended to be used when implementing
    /// an internal print preview, it is not needed for printing,
    /// since GTK itself creates a suitable cairo context in that
    /// case.
    extern fn gtk_print_context_set_cairo_context(p_context: *PrintContext, p_cr: *cairo.Context, p_dpi_x: f64, p_dpi_y: f64) void;
    pub const setCairoContext = gtk_print_context_set_cairo_context;

    extern fn gtk_print_context_get_type() usize;
    pub const getGObjectType = gtk_print_context_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintContext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintContext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintContext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asynchronous API to present a print dialog to the user.
///
/// `GtkPrintDialog` collects the arguments that are needed to present
///  the dialog, such as a title for the dialog and whether it should
///  be modal.
///
/// The dialog is shown with the `gtk.PrintDialog.setup` function.
///
/// The actual printing can be done with `gtk.PrintDialog.print` or
/// `gtk.PrintDialog.printFile`. These APIs follows the GIO async pattern,
/// and the results can be obtained by calling the corresponding finish methods.
pub const PrintDialog = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.PrintDialogClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// A label that may be shown on the accept button of a print dialog
        /// that is presented by `gtk.PrintDialog.setup`.
        pub const accept_label = struct {
            pub const name = "accept-label";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the print dialog is modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// The page setup to use.
        pub const page_setup = struct {
            pub const name = "page-setup";

            pub const Type = ?*gtk.PageSetup;
        };

        /// The print settings to use.
        pub const print_settings = struct {
            pub const name = "print-settings";

            pub const Type = ?*gtk.PrintSettings;
        };

        /// A title that may be shown on the print dialog that is
        /// presented by `gtk.PrintDialog.setup`.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkPrintDialog` object.
    extern fn gtk_print_dialog_new() *gtk.PrintDialog;
    pub const new = gtk_print_dialog_new;

    /// Returns the label that will be shown on the
    /// accept button of the print dialog.
    extern fn gtk_print_dialog_get_accept_label(p_self: *PrintDialog) [*:0]const u8;
    pub const getAcceptLabel = gtk_print_dialog_get_accept_label;

    /// Returns whether the print dialog blocks
    /// interaction with the parent window while
    /// it is presented.
    extern fn gtk_print_dialog_get_modal(p_self: *PrintDialog) c_int;
    pub const getModal = gtk_print_dialog_get_modal;

    /// Returns the page setup.
    extern fn gtk_print_dialog_get_page_setup(p_self: *PrintDialog) ?*gtk.PageSetup;
    pub const getPageSetup = gtk_print_dialog_get_page_setup;

    /// Returns the print settings for the print dialog.
    extern fn gtk_print_dialog_get_print_settings(p_self: *PrintDialog) ?*gtk.PrintSettings;
    pub const getPrintSettings = gtk_print_dialog_get_print_settings;

    /// Returns the title that will be shown on the
    /// print dialog.
    extern fn gtk_print_dialog_get_title(p_self: *PrintDialog) [*:0]const u8;
    pub const getTitle = gtk_print_dialog_get_title;

    /// This function prints content from a stream.
    ///
    /// If you pass `NULL` as `setup`, then this method will present a print dialog.
    /// Otherwise, it will attempt to print directly, without user interaction.
    ///
    /// The `callback` will be called when the printing is done.
    extern fn gtk_print_dialog_print(p_self: *PrintDialog, p_parent: ?*gtk.Window, p_setup: ?*gtk.PrintSetup, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const print = gtk_print_dialog_print;

    /// This function prints a file.
    ///
    /// If you pass `NULL` as `setup`, then this method will present a print dialog.
    /// Otherwise, it will attempt to print directly, without user interaction.
    extern fn gtk_print_dialog_print_file(p_self: *PrintDialog, p_parent: ?*gtk.Window, p_setup: ?*gtk.PrintSetup, p_file: *gio.File, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const printFile = gtk_print_dialog_print_file;

    /// Finishes the `gtk.PrintDialog.printFile` call and
    /// returns the results.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_print_dialog_print_file_finish(p_self: *PrintDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) c_int;
    pub const printFileFinish = gtk_print_dialog_print_file_finish;

    /// Finishes the `gtk.PrintDialog.print` call and
    /// returns the results.
    ///
    /// If the call was successful, the content to be printed should be
    /// written to the returned output stream. Otherwise, `NULL` is returned.
    ///
    /// The overall results of the print operation will be returned in the
    /// `gio.OutputStream.close` call, so if you are interested in the
    /// results, you need to explicitly close the output stream (it will be
    /// closed automatically if you just unref it). Be aware that the close
    /// call may not be instant as it operation will for the printer to finish
    /// printing.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_print_dialog_print_finish(p_self: *PrintDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gio.OutputStream;
    pub const printFinish = gtk_print_dialog_print_finish;

    /// Sets the label that will be shown on the
    /// accept button of the print dialog shown for
    /// `gtk.PrintDialog.setup`.
    extern fn gtk_print_dialog_set_accept_label(p_self: *PrintDialog, p_accept_label: [*:0]const u8) void;
    pub const setAcceptLabel = gtk_print_dialog_set_accept_label;

    /// Sets whether the print dialog blocks
    /// interaction with the parent window while
    /// it is presented.
    extern fn gtk_print_dialog_set_modal(p_self: *PrintDialog, p_modal: c_int) void;
    pub const setModal = gtk_print_dialog_set_modal;

    /// Set the page setup for the print dialog.
    extern fn gtk_print_dialog_set_page_setup(p_self: *PrintDialog, p_page_setup: *gtk.PageSetup) void;
    pub const setPageSetup = gtk_print_dialog_set_page_setup;

    /// Sets the print settings for the print dialog.
    extern fn gtk_print_dialog_set_print_settings(p_self: *PrintDialog, p_print_settings: *gtk.PrintSettings) void;
    pub const setPrintSettings = gtk_print_dialog_set_print_settings;

    /// Sets the title that will be shown on the print dialog.
    extern fn gtk_print_dialog_set_title(p_self: *PrintDialog, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_print_dialog_set_title;

    /// This function presents a print dialog to let the user select a printer,
    /// and set up print settings and page setup.
    ///
    /// The `callback` will be called when the dialog is dismissed.
    /// The obtained `gtk.PrintSetup` can then be passed
    /// to `gtk.PrintDialog.print` or `gtk.PrintDialog.printFile`.
    ///
    /// One possible use for this method is to have the user select a printer,
    /// then show a page setup UI in the application (e.g. to arrange images
    /// on a page), then call `gtk.PrintDialog.print` on `self`
    /// to do the printing without further user interaction.
    extern fn gtk_print_dialog_setup(p_self: *PrintDialog, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const setup = gtk_print_dialog_setup;

    /// Finishes the `gtk.PrintDialog.setup` call.
    ///
    /// If the call was successful, it returns a `gtk.PrintSetup`
    /// which contains the print settings and page setup information that
    /// will be used to print.
    ///
    /// Note that this function returns a `gtk.@"DialogError.DISMISSED"`
    /// error if the user cancels the dialog.
    extern fn gtk_print_dialog_setup_finish(p_self: *PrintDialog, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) ?*gtk.PrintSetup;
    pub const setupFinish = gtk_print_dialog_setup_finish;

    extern fn gtk_print_dialog_get_type() usize;
    pub const getGObjectType = gtk_print_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents a job that is sent to a printer.
///
/// You only need to deal directly with print jobs if you use the
/// non-portable `gtk.PrintUnixDialog` API.
///
/// Use `gtk.PrintJob.getSurface` to obtain the cairo surface
/// onto which the pages must be drawn. Use `gtk.PrintJob.send`
/// to send the finished job to the printer. If you don’t use cairo
/// `GtkPrintJob` also supports printing of manually generated PostScript,
/// via `gtk.PrintJob.setSourceFile`.
pub const PrintJob = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = PrintJob;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Page setup.
        pub const page_setup = struct {
            pub const name = "page-setup";

            pub const Type = ?*gtk.PageSetup;
        };

        /// The printer to send the job to.
        pub const printer = struct {
            pub const name = "printer";

            pub const Type = ?*gtk.Printer;
        };

        /// Printer settings.
        pub const settings = struct {
            pub const name = "settings";

            pub const Type = ?*gtk.PrintSettings;
        };

        /// The title of the print job.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// `TRUE` if the print job will continue to emit status-changed
        /// signals after the print data has been setn to the printer.
        pub const track_print_status = struct {
            pub const name = "track-print-status";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the status of a job changes.
        ///
        /// The signal handler can use `gtk.PrintJob.getStatus`
        /// to obtain the new status.
        pub const status_changed = struct {
            pub const name = "status-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintJob, p_instance))),
                    gobject.signalLookup("status-changed", PrintJob.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkPrintJob`.
    extern fn gtk_print_job_new(p_title: [*:0]const u8, p_printer: *gtk.Printer, p_settings: *gtk.PrintSettings, p_page_setup: *gtk.PageSetup) *gtk.PrintJob;
    pub const new = gtk_print_job_new;

    /// Gets whether this job is printed collated.
    extern fn gtk_print_job_get_collate(p_job: *PrintJob) c_int;
    pub const getCollate = gtk_print_job_get_collate;

    /// Gets the n-up setting for this job.
    extern fn gtk_print_job_get_n_up(p_job: *PrintJob) c_uint;
    pub const getNUp = gtk_print_job_get_n_up;

    /// Gets the n-up layout setting for this job.
    extern fn gtk_print_job_get_n_up_layout(p_job: *PrintJob) gtk.NumberUpLayout;
    pub const getNUpLayout = gtk_print_job_get_n_up_layout;

    /// Gets the number of copies of this job.
    extern fn gtk_print_job_get_num_copies(p_job: *PrintJob) c_int;
    pub const getNumCopies = gtk_print_job_get_num_copies;

    /// Gets the page ranges for this job.
    extern fn gtk_print_job_get_page_ranges(p_job: *PrintJob, p_n_ranges: *c_int) [*]gtk.PageRange;
    pub const getPageRanges = gtk_print_job_get_page_ranges;

    /// Gets the `GtkPageSet` setting for this job.
    extern fn gtk_print_job_get_page_set(p_job: *PrintJob) gtk.PageSet;
    pub const getPageSet = gtk_print_job_get_page_set;

    /// Gets the `GtkPrintPages` setting for this job.
    extern fn gtk_print_job_get_pages(p_job: *PrintJob) gtk.PrintPages;
    pub const getPages = gtk_print_job_get_pages;

    /// Gets the `GtkPrinter` of the print job.
    extern fn gtk_print_job_get_printer(p_job: *PrintJob) *gtk.Printer;
    pub const getPrinter = gtk_print_job_get_printer;

    /// Gets whether this job is printed reversed.
    extern fn gtk_print_job_get_reverse(p_job: *PrintJob) c_int;
    pub const getReverse = gtk_print_job_get_reverse;

    /// Gets whether the job is printed rotated.
    extern fn gtk_print_job_get_rotate(p_job: *PrintJob) c_int;
    pub const getRotate = gtk_print_job_get_rotate;

    /// Gets the scale for this job.
    extern fn gtk_print_job_get_scale(p_job: *PrintJob) f64;
    pub const getScale = gtk_print_job_get_scale;

    /// Gets the `GtkPrintSettings` of the print job.
    extern fn gtk_print_job_get_settings(p_job: *PrintJob) *gtk.PrintSettings;
    pub const getSettings = gtk_print_job_get_settings;

    /// Gets the status of the print job.
    extern fn gtk_print_job_get_status(p_job: *PrintJob) gtk.PrintStatus;
    pub const getStatus = gtk_print_job_get_status;

    /// Gets a cairo surface onto which the pages of
    /// the print job should be rendered.
    extern fn gtk_print_job_get_surface(p_job: *PrintJob, p_error: ?*?*glib.Error) ?*cairo.Surface;
    pub const getSurface = gtk_print_job_get_surface;

    /// Gets the job title.
    extern fn gtk_print_job_get_title(p_job: *PrintJob) [*:0]const u8;
    pub const getTitle = gtk_print_job_get_title;

    /// Returns whether jobs will be tracked after printing.
    ///
    /// For details, see `gtk.PrintJob.setTrackPrintStatus`.
    extern fn gtk_print_job_get_track_print_status(p_job: *PrintJob) c_int;
    pub const getTrackPrintStatus = gtk_print_job_get_track_print_status;

    /// Sends the print job off to the printer.
    extern fn gtk_print_job_send(p_job: *PrintJob, p_callback: gtk.PrintJobCompleteFunc, p_user_data: ?*anyopaque, p_dnotify: ?glib.DestroyNotify) void;
    pub const send = gtk_print_job_send;

    /// Sets whether this job is printed collated.
    extern fn gtk_print_job_set_collate(p_job: *PrintJob, p_collate: c_int) void;
    pub const setCollate = gtk_print_job_set_collate;

    /// Sets the n-up setting for this job.
    extern fn gtk_print_job_set_n_up(p_job: *PrintJob, p_n_up: c_uint) void;
    pub const setNUp = gtk_print_job_set_n_up;

    /// Sets the n-up layout setting for this job.
    extern fn gtk_print_job_set_n_up_layout(p_job: *PrintJob, p_layout: gtk.NumberUpLayout) void;
    pub const setNUpLayout = gtk_print_job_set_n_up_layout;

    /// Sets the number of copies for this job.
    extern fn gtk_print_job_set_num_copies(p_job: *PrintJob, p_num_copies: c_int) void;
    pub const setNumCopies = gtk_print_job_set_num_copies;

    /// Sets the page ranges for this job.
    extern fn gtk_print_job_set_page_ranges(p_job: *PrintJob, p_ranges: [*]gtk.PageRange, p_n_ranges: c_int) void;
    pub const setPageRanges = gtk_print_job_set_page_ranges;

    /// Sets the `GtkPageSet` setting for this job.
    extern fn gtk_print_job_set_page_set(p_job: *PrintJob, p_page_set: gtk.PageSet) void;
    pub const setPageSet = gtk_print_job_set_page_set;

    /// Sets the `GtkPrintPages` setting for this job.
    extern fn gtk_print_job_set_pages(p_job: *PrintJob, p_pages: gtk.PrintPages) void;
    pub const setPages = gtk_print_job_set_pages;

    /// Sets whether this job is printed reversed.
    extern fn gtk_print_job_set_reverse(p_job: *PrintJob, p_reverse: c_int) void;
    pub const setReverse = gtk_print_job_set_reverse;

    /// Sets whether this job is printed rotated.
    extern fn gtk_print_job_set_rotate(p_job: *PrintJob, p_rotate: c_int) void;
    pub const setRotate = gtk_print_job_set_rotate;

    /// Sets the scale for this job.
    ///
    /// 1.0 means unscaled.
    extern fn gtk_print_job_set_scale(p_job: *PrintJob, p_scale: f64) void;
    pub const setScale = gtk_print_job_set_scale;

    /// Make the `GtkPrintJob` send an existing document to the
    /// printing system.
    ///
    /// The file can be in any format understood by the platforms
    /// printing system (typically PostScript, but on many platforms
    /// PDF may work too). See `gtk.Printer.acceptsPdf` and
    /// `gtk.Printer.acceptsPs`.
    ///
    /// This is similar to `gtk.PrintJob.setSourceFile`,
    /// but takes expects an open file descriptor for the file,
    /// instead of a filename.
    extern fn gtk_print_job_set_source_fd(p_job: *PrintJob, p_fd: c_int, p_error: ?*?*glib.Error) c_int;
    pub const setSourceFd = gtk_print_job_set_source_fd;

    /// Make the `GtkPrintJob` send an existing document to the
    /// printing system.
    ///
    /// The file can be in any format understood by the platforms
    /// printing system (typically PostScript, but on many platforms
    /// PDF may work too). See `gtk.Printer.acceptsPdf` and
    /// `gtk.Printer.acceptsPs`.
    extern fn gtk_print_job_set_source_file(p_job: *PrintJob, p_filename: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const setSourceFile = gtk_print_job_set_source_file;

    /// If track_status is `TRUE`, the print job will try to continue report
    /// on the status of the print job in the printer queues and printer.
    ///
    /// This can allow your application to show things like “out of paper”
    /// issues, and when the print job actually reaches the printer.
    ///
    /// This function is often implemented using some form of polling,
    /// so it should not be enabled unless needed.
    extern fn gtk_print_job_set_track_print_status(p_job: *PrintJob, p_track_status: c_int) void;
    pub const setTrackPrintStatus = gtk_print_job_set_track_print_status;

    extern fn gtk_print_job_get_type() usize;
    pub const getGObjectType = gtk_print_job_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintJob) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintJob) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintJob, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// High-level, portable printing API.
///
/// It looks a bit different than other GTK dialogs such as the
/// `GtkFileChooser`, since some platforms don’t expose enough
/// infrastructure to implement a good print dialog. On such
/// platforms, `GtkPrintOperation` uses the native print dialog.
/// On platforms which do not provide a native print dialog, GTK
/// uses its own, see `gtk.PrintUnixDialog`.
///
/// The typical way to use the high-level printing API is to create
/// a `GtkPrintOperation` object with `gtk.PrintOperation.new`
/// when the user selects to print. Then you set some properties on it,
/// e.g. the page size, any `gtk.PrintSettings` from previous print
/// operations, the number of pages, the current page, etc.
///
/// Then you start the print operation by calling `gtk.PrintOperation.run`.
/// It will then show a dialog, let the user select a printer and options.
/// When the user finished the dialog, various signals will be emitted on
/// the `GtkPrintOperation`, the main one being
/// `gtk.PrintOperation.signals.draw_page`, which you are supposed to handle
/// and render the page on the provided `gtk.PrintContext` using Cairo.
///
/// # The high-level printing API
///
/// ```c
/// static GtkPrintSettings *settings = NULL;
///
/// static void
/// do_print (void)
/// {
///   GtkPrintOperation *print;
///   GtkPrintOperationResult res;
///
///   print = gtk_print_operation_new ();
///
///   if (settings != NULL)
///     gtk_print_operation_set_print_settings (print, settings);
///
///   g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
///   g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
///
///   res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
///                                  GTK_WINDOW (main_window), NULL);
///
///   if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
///     {
///       if (settings != NULL)
///         g_object_unref (settings);
///       settings = g_object_ref (gtk_print_operation_get_print_settings (print));
///     }
///
///   g_object_unref (print);
/// }
/// ```
///
/// By default `GtkPrintOperation` uses an external application to do
/// print preview. To implement a custom print preview, an application
/// must connect to the preview signal. The functions
/// `gtk.PrintOperationPreview.renderPage`,
/// `gtk.PrintOperationPreview.endPreview` and
/// `gtk.PrintOperationPreview.isSelected`
/// are useful when implementing a print preview.
pub const PrintOperation = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.PrintOperationPreview};
    pub const Class = gtk.PrintOperationClass;
    f_parent_instance: gobject.Object,
    f_priv: ?*gtk.PrintOperationPrivate,

    pub const virtual_methods = struct {
        /// Signal emitted after the user has finished changing
        ///    print settings in the dialog, before the actual rendering starts.
        pub const begin_print = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_begin_print.?(gobject.ext.as(PrintOperation, p_operation), p_context);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_begin_print = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when displaying the print dialog.
        pub const create_custom_widget = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) *gtk.Widget {
                return gobject.ext.as(PrintOperation.Class, p_class).f_create_custom_widget.?(gobject.ext.as(PrintOperation, p_operation));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) *gtk.Widget) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_create_custom_widget = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted right before “begin-print” if
        ///    you added a custom widget in the “create-custom-widget” handler.
        pub const custom_widget_apply = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_custom_widget_apply.?(gobject.ext.as(PrintOperation, p_operation), p_widget);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_custom_widget_apply = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when the print operation run has finished
        ///    doing everything required for printing.
        pub const done = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_result: gtk.PrintOperationResult) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_done.?(gobject.ext.as(PrintOperation, p_operation), p_result);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_result: gtk.PrintOperationResult) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_done = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted for every page that is printed.
        pub const draw_page = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext, p_page_nr: c_int) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_draw_page.?(gobject.ext.as(PrintOperation, p_operation), p_context, p_page_nr);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext, p_page_nr: c_int) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_draw_page = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted after all pages have been rendered.
        pub const end_print = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_end_print.?(gobject.ext.as(PrintOperation, p_operation), p_context);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_end_print = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted after the “begin-print” signal, but
        ///    before the actual rendering starts.
        pub const paginate = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) c_int {
                return gobject.ext.as(PrintOperation.Class, p_class).f_paginate.?(gobject.ext.as(PrintOperation, p_operation), p_context);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) callconv(.c) c_int) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_paginate = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when a preview is requested from the
        ///    native dialog.
        pub const preview = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_preview: *gtk.PrintOperationPreview, p_context: *gtk.PrintContext, p_parent: *gtk.Window) c_int {
                return gobject.ext.as(PrintOperation.Class, p_class).f_preview.?(gobject.ext.as(PrintOperation, p_operation), p_preview, p_context, p_parent);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_preview: *gtk.PrintOperationPreview, p_context: *gtk.PrintContext, p_parent: *gtk.Window) callconv(.c) c_int) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_preview = @ptrCast(p_implementation);
            }
        };

        /// Emitted once for every page that is printed,
        ///    to give the application a chance to modify the page setup.
        pub const request_page_setup = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext, p_page_nr: c_int, p_setup: *gtk.PageSetup) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_request_page_setup.?(gobject.ext.as(PrintOperation, p_operation), p_context, p_page_nr, p_setup);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext, p_page_nr: c_int, p_setup: *gtk.PageSetup) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_request_page_setup = @ptrCast(p_implementation);
            }
        };

        /// Emitted at between the various phases of the print
        ///    operation.
        pub const status_changed = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_status_changed.?(gobject.ext.as(PrintOperation, p_operation));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_status_changed = @ptrCast(p_implementation);
            }
        };

        /// Emitted after change of selected printer.
        pub const update_custom_widget = struct {
            pub fn call(p_class: anytype, p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_setup: *gtk.PageSetup, p_settings: *gtk.PrintSettings) void {
                return gobject.ext.as(PrintOperation.Class, p_class).f_update_custom_widget.?(gobject.ext.as(PrintOperation, p_operation), p_widget, p_setup, p_settings);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_operation: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_widget: *gtk.Widget, p_setup: *gtk.PageSetup, p_settings: *gtk.PrintSettings) callconv(.c) void) void {
                gobject.ext.as(PrintOperation.Class, p_class).f_update_custom_widget = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Determines whether the print operation may run asynchronously or not.
        ///
        /// Some systems don't support asynchronous printing, but those that do
        /// will return `GTK_PRINT_OPERATION_RESULT_IN_PROGRESS` as the status, and
        /// emit the `gtk.PrintOperation.signals.done` signal when the operation
        /// is actually done.
        ///
        /// The Windows port does not support asynchronous operation at all (this
        /// is unlikely to change). On other platforms, all actions except for
        /// `GTK_PRINT_OPERATION_ACTION_EXPORT` support asynchronous operation.
        pub const allow_async = struct {
            pub const name = "allow-async";

            pub const Type = c_int;
        };

        /// The current page in the document.
        ///
        /// If this is set before `gtk.PrintOperation.run`,
        /// the user will be able to select to print only the current page.
        ///
        /// Note that this only makes sense for pre-paginated documents.
        pub const current_page = struct {
            pub const name = "current-page";

            pub const Type = c_int;
        };

        /// Used as the label of the tab containing custom widgets.
        ///
        /// Note that this property may be ignored on some platforms.
        ///
        /// If this is `NULL`, GTK uses a default label.
        pub const custom_tab_label = struct {
            pub const name = "custom-tab-label";

            pub const Type = ?[*:0]u8;
        };

        /// The `GtkPageSetup` used by default.
        ///
        /// This page setup will be used by `gtk.PrintOperation.run`,
        /// but it can be overridden on a per-page basis by connecting
        /// to the `gtk.PrintOperation.signals.request_page_setup` signal.
        pub const default_page_setup = struct {
            pub const name = "default-page-setup";

            pub const Type = ?*gtk.PageSetup;
        };

        /// If `TRUE`, page size combo box and orientation combo box
        /// are embedded into page setup page.
        pub const embed_page_setup = struct {
            pub const name = "embed-page-setup";

            pub const Type = c_int;
        };

        /// The name of a file to generate instead of showing the print dialog.
        ///
        /// Currently, PDF is the only supported format.
        ///
        /// The intended use of this property is for implementing
        /// “Export to PDF” actions.
        ///
        /// “Print to PDF” support is independent of this and is done
        /// by letting the user pick the “Print to PDF” item from the
        /// list of printers in the print dialog.
        pub const export_filename = struct {
            pub const name = "export-filename";

            pub const Type = ?[*:0]u8;
        };

        /// Determines whether there is a selection in your application.
        ///
        /// This can allow your application to print the selection.
        /// This is typically used to make a "Selection" button sensitive.
        pub const has_selection = struct {
            pub const name = "has-selection";

            pub const Type = c_int;
        };

        /// A string used to identify the job (e.g. in monitoring
        /// applications like eggcups).
        ///
        /// If you don't set a job name, GTK picks a default one
        /// by numbering successive print jobs.
        pub const job_name = struct {
            pub const name = "job-name";

            pub const Type = ?[*:0]u8;
        };

        /// The number of pages in the document.
        ///
        /// This must be set to a positive number before the rendering
        /// starts. It may be set in a `gtk.PrintOperation.signals.begin_print`
        /// signal handler.
        ///
        /// Note that the page numbers passed to the
        /// `gtk.PrintOperation.signals.request_page_setup` and
        /// `gtk.PrintOperation.signals.draw_page` signals are 0-based, i.e.
        /// if the user chooses to print all pages, the last ::draw-page signal
        /// will be for page `n_pages` - 1.
        pub const n_pages = struct {
            pub const name = "n-pages";

            pub const Type = c_int;
        };

        /// The number of pages that will be printed.
        ///
        /// Note that this value is set during print preparation phase
        /// (`GTK_PRINT_STATUS_PREPARING`), so this value should never be
        /// get before the data generation phase (`GTK_PRINT_STATUS_GENERATING_DATA`).
        /// You can connect to the `gtk.PrintOperation.signals.status_changed` signal
        /// and call `gtk.PrintOperation.getNPagesToPrint` when
        /// print status is `GTK_PRINT_STATUS_GENERATING_DATA`.
        ///
        /// This is typically used to track the progress of print operation.
        pub const n_pages_to_print = struct {
            pub const name = "n-pages-to-print";

            pub const Type = c_int;
        };

        /// The `GtkPrintSettings` used for initializing the dialog.
        ///
        /// Setting this property is typically used to re-establish
        /// print settings from a previous print operation, see
        /// `gtk.PrintOperation.run`.
        pub const print_settings = struct {
            pub const name = "print-settings";

            pub const Type = ?*gtk.PrintSettings;
        };

        /// Determines whether to show a progress dialog during the
        /// print operation.
        pub const show_progress = struct {
            pub const name = "show-progress";

            pub const Type = c_int;
        };

        /// The status of the print operation.
        pub const status = struct {
            pub const name = "status";

            pub const Type = gtk.PrintStatus;
        };

        /// A string representation of the status of the print operation.
        ///
        /// The string is translated and suitable for displaying the print
        /// status e.g. in a `GtkStatusbar`.
        ///
        /// See the `gtk.PrintOperation.properties.status` property for a status
        /// value that is suitable for programmatic use.
        pub const status_string = struct {
            pub const name = "status-string";

            pub const Type = ?[*:0]u8;
        };

        /// If `TRUE`, the print operation will support print of selection.
        ///
        /// This allows the print dialog to show a "Selection" button.
        pub const support_selection = struct {
            pub const name = "support-selection";

            pub const Type = c_int;
        };

        /// If `TRUE`, the print operation will try to continue report on
        /// the status of the print job in the printer queues and printer.
        ///
        /// This can allow your application to show things like “out of paper”
        /// issues, and when the print job actually reaches the printer.
        /// However, this is often implemented using polling, and should
        /// not be enabled unless needed.
        pub const track_print_status = struct {
            pub const name = "track-print-status";

            pub const Type = c_int;
        };

        /// The transformation for the cairo context obtained from
        /// `GtkPrintContext` is set up in such a way that distances
        /// are measured in units of `unit`.
        pub const unit = struct {
            pub const name = "unit";

            pub const Type = gtk.Unit;
        };

        /// If `TRUE`, the transformation for the cairo context obtained
        /// from `GtkPrintContext` puts the origin at the top left corner
        /// of the page.
        ///
        /// This may not be the top left corner of the sheet, depending on
        /// page orientation and the number of pages per sheet. Otherwise,
        /// the origin is at the top left corner of the imageable area (i.e.
        /// inside the margins).
        pub const use_full_page = struct {
            pub const name = "use-full-page";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted after the user has finished changing print settings
        /// in the dialog, before the actual rendering starts.
        ///
        /// A typical use for ::begin-print is to use the parameters from the
        /// `gtk.PrintContext` and paginate the document accordingly,
        /// and then set the number of pages with
        /// `gtk.PrintOperation.setNPages`.
        pub const begin_print = struct {
            pub const name = "begin-print";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("begin-print", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when displaying the print dialog.
        ///
        /// If you return a widget in a handler for this signal it will be
        /// added to a custom tab in the print dialog. You typically return a
        /// container widget with multiple widgets in it.
        ///
        /// The print dialog owns the returned widget, and its lifetime is not
        /// controlled by the application. However, the widget is guaranteed
        /// to stay around until the `gtk.PrintOperation.signals.custom_widget_apply`
        /// signal is emitted on the operation. Then you can read out any
        /// information you need from the widgets.
        pub const create_custom_widget = struct {
            pub const name = "create-custom-widget";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) ?*gobject.Object, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("create-custom-widget", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted right before ::begin-print if you added
        /// a custom widget in the ::create-custom-widget handler.
        ///
        /// When you get this signal you should read the information from the
        /// custom widgets, as the widgets are not guaranteed to be around at a
        /// later time.
        pub const custom_widget_apply = struct {
            pub const name = "custom-widget-apply";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_widget: *gtk.Widget, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("custom-widget-apply", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the print operation run has finished doing
        /// everything required for printing.
        ///
        /// `result` gives you information about what happened during the run.
        /// If `result` is `GTK_PRINT_OPERATION_RESULT_ERROR` then you can call
        /// `gtk.PrintOperation.getError` for more information.
        ///
        /// If you enabled print status tracking then
        /// `gtk.PrintOperation.isFinished` may still return `FALSE`
        /// after the ::done signal was emitted.
        pub const done = struct {
            pub const name = "done";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_result: gtk.PrintOperationResult, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("done", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted for every page that is printed.
        ///
        /// The signal handler must render the `page_nr`'s page onto the cairo
        /// context obtained from `context` using
        /// `gtk.PrintContext.getCairoContext`.
        ///
        /// ```c
        /// static void
        /// draw_page (GtkPrintOperation *operation,
        ///            GtkPrintContext   *context,
        ///            int                page_nr,
        ///            gpointer           user_data)
        /// {
        ///   cairo_t *cr;
        ///   PangoLayout *layout;
        ///   double width, text_height;
        ///   int layout_height;
        ///   PangoFontDescription *desc;
        ///
        ///   cr = gtk_print_context_get_cairo_context (context);
        ///   width = gtk_print_context_get_width (context);
        ///
        ///   cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
        ///
        ///   cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
        ///   cairo_fill (cr);
        ///
        ///   layout = gtk_print_context_create_pango_layout (context);
        ///
        ///   desc = pango_font_description_from_string ("sans 14");
        ///   pango_layout_set_font_description (layout, desc);
        ///   pango_font_description_free (desc);
        ///
        ///   pango_layout_set_text (layout, "some text", -1);
        ///   pango_layout_set_width (layout, width * PANGO_SCALE);
        ///   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
        ///
        ///   pango_layout_get_size (layout, NULL, &layout_height);
        ///   text_height = (double)layout_height / PANGO_SCALE;
        ///
        ///   cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
        ///   pango_cairo_show_layout (cr, layout);
        ///
        ///   g_object_unref (layout);
        /// }
        /// ```
        ///
        /// Use `gtk.PrintOperation.setUseFullPage` and
        /// `gtk.PrintOperation.setUnit` before starting the print
        /// operation to set up the transformation of the cairo context
        /// according to your needs.
        pub const draw_page = struct {
            pub const name = "draw-page";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, p_page_nr: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("draw-page", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted after all pages have been rendered.
        ///
        /// A handler for this signal can clean up any resources that have
        /// been allocated in the `gtk.PrintOperation.signals.begin_print` handler.
        pub const end_print = struct {
            pub const name = "end-print";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("end-print", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted after the ::begin-print signal, but before the actual rendering
        /// starts.
        ///
        /// It keeps getting emitted until a connected signal handler returns `TRUE`.
        ///
        /// The ::paginate signal is intended to be used for paginating a document
        /// in small chunks, to avoid blocking the user interface for a long
        /// time. The signal handler should update the number of pages using
        /// `gtk.PrintOperation.setNPages`, and return `TRUE` if the document
        /// has been completely paginated.
        ///
        /// If you don't need to do pagination in chunks, you can simply do
        /// it all in the ::begin-print handler, and set the number of pages
        /// from there.
        pub const paginate = struct {
            pub const name = "paginate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("paginate", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when a preview is requested from the native dialog.
        ///
        /// The default handler for this signal uses an external viewer
        /// application to preview.
        ///
        /// To implement a custom print preview, an application must return
        /// `TRUE` from its handler for this signal. In order to use the
        /// provided `context` for the preview implementation, it must be
        /// given a suitable cairo context with
        /// `gtk.PrintContext.setCairoContext`.
        ///
        /// The custom preview implementation can use
        /// `gtk.PrintOperationPreview.isSelected` and
        /// `gtk.PrintOperationPreview.renderPage` to find pages which
        /// are selected for print and render them. The preview must be
        /// finished by calling `gtk.PrintOperationPreview.endPreview`
        /// (typically in response to the user clicking a close button).
        pub const preview = struct {
            pub const name = "preview";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_preview: *gtk.PrintOperationPreview, p_context: *gtk.PrintContext, p_parent: ?*gtk.Window, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("preview", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted once for every page that is printed.
        ///
        /// This gives the application a chance to modify the page setup.
        /// Any changes done to `setup` will be in force only for printing
        /// this page.
        pub const request_page_setup = struct {
            pub const name = "request-page-setup";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, p_page_nr: c_int, p_setup: *gtk.PageSetup, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("request-page-setup", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted at between the various phases of the print operation.
        ///
        /// See `gtk.PrintStatus` for the phases that are being discriminated.
        /// Use `gtk.PrintOperation.getStatus` to find out the current
        /// status.
        pub const status_changed = struct {
            pub const name = "status-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("status-changed", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted after change of selected printer.
        ///
        /// The actual page setup and print settings are passed to the custom
        /// widget, which can actualize itself according to this change.
        pub const update_custom_widget = struct {
            pub const name = "update-custom-widget";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_widget: *gtk.Widget, p_setup: *gtk.PageSetup, p_settings: *gtk.PrintSettings, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperation, p_instance))),
                    gobject.signalLookup("update-custom-widget", PrintOperation.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkPrintOperation`.
    extern fn gtk_print_operation_new() *gtk.PrintOperation;
    pub const new = gtk_print_operation_new;

    /// Cancels a running print operation.
    ///
    /// This function may be called from a `gtk.PrintOperation.signals.begin_print`,
    /// `gtk.PrintOperation.signals.paginate` or `gtk.PrintOperation.signals.draw_page`
    /// signal handler to stop the currently running print operation.
    extern fn gtk_print_operation_cancel(p_op: *PrintOperation) void;
    pub const cancel = gtk_print_operation_cancel;

    /// Signal that drawing of particular page is complete.
    ///
    /// It is called after completion of page drawing (e.g. drawing
    /// in another thread). If `gtk.PrintOperation.setDeferDrawing`
    /// was called before, then this function has to be called by application.
    /// Otherwise it is called by GTK itself.
    extern fn gtk_print_operation_draw_page_finish(p_op: *PrintOperation) void;
    pub const drawPageFinish = gtk_print_operation_draw_page_finish;

    /// Returns the default page setup.
    extern fn gtk_print_operation_get_default_page_setup(p_op: *PrintOperation) *gtk.PageSetup;
    pub const getDefaultPageSetup = gtk_print_operation_get_default_page_setup;

    /// Gets whether page setup selection combos are embedded
    extern fn gtk_print_operation_get_embed_page_setup(p_op: *PrintOperation) c_int;
    pub const getEmbedPageSetup = gtk_print_operation_get_embed_page_setup;

    /// Call this when the result of a print operation is
    /// `GTK_PRINT_OPERATION_RESULT_ERROR`.
    ///
    /// It can be called either after `gtk.PrintOperation.run`
    /// returns, or in the `gtk.PrintOperation.signals.done` signal
    /// handler.
    ///
    /// The returned `GError` will contain more details on what went wrong.
    extern fn gtk_print_operation_get_error(p_op: *PrintOperation, p_error: ?*?*glib.Error) void;
    pub const getError = gtk_print_operation_get_error;

    /// Gets whether there is a selection.
    extern fn gtk_print_operation_get_has_selection(p_op: *PrintOperation) c_int;
    pub const getHasSelection = gtk_print_operation_get_has_selection;

    /// Returns the number of pages that will be printed.
    ///
    /// Note that this value is set during print preparation phase
    /// (`GTK_PRINT_STATUS_PREPARING`), so this function should never be
    /// called before the data generation phase (`GTK_PRINT_STATUS_GENERATING_DATA`).
    /// You can connect to the `gtk.PrintOperation.signals.status_changed`
    /// signal and call `gtk.PrintOperation.getNPagesToPrint` when
    /// print status is `GTK_PRINT_STATUS_GENERATING_DATA`.
    ///
    /// This is typically used to track the progress of print operation.
    extern fn gtk_print_operation_get_n_pages_to_print(p_op: *PrintOperation) c_int;
    pub const getNPagesToPrint = gtk_print_operation_get_n_pages_to_print;

    /// Returns the current print settings.
    ///
    /// Note that the return value is `NULL` until either
    /// `gtk.PrintOperation.setPrintSettings` or
    /// `gtk.PrintOperation.run` have been called.
    extern fn gtk_print_operation_get_print_settings(p_op: *PrintOperation) ?*gtk.PrintSettings;
    pub const getPrintSettings = gtk_print_operation_get_print_settings;

    /// Returns the status of the print operation.
    ///
    /// Also see `gtk.PrintOperation.getStatusString`.
    extern fn gtk_print_operation_get_status(p_op: *PrintOperation) gtk.PrintStatus;
    pub const getStatus = gtk_print_operation_get_status;

    /// Returns a string representation of the status of the
    /// print operation.
    ///
    /// The string is translated and suitable for displaying
    /// the print status e.g. in a `GtkStatusbar`.
    ///
    /// Use `gtk.PrintOperation.getStatus` to obtain
    /// a status value that is suitable for programmatic use.
    extern fn gtk_print_operation_get_status_string(p_op: *PrintOperation) [*:0]const u8;
    pub const getStatusString = gtk_print_operation_get_status_string;

    /// Gets whether the application supports print of selection
    extern fn gtk_print_operation_get_support_selection(p_op: *PrintOperation) c_int;
    pub const getSupportSelection = gtk_print_operation_get_support_selection;

    /// A convenience function to find out if the print operation
    /// is finished.
    ///
    /// a print operation is finished if its status is either
    /// `GTK_PRINT_STATUS_FINISHED` or `GTK_PRINT_STATUS_FINISHED_ABORTED`.
    ///
    /// Note: when you enable print status tracking the print operation
    /// can be in a non-finished state even after done has been called, as
    /// the operation status then tracks the print job status on the printer.
    extern fn gtk_print_operation_is_finished(p_op: *PrintOperation) c_int;
    pub const isFinished = gtk_print_operation_is_finished;

    /// Runs the print operation.
    ///
    /// Normally that this function does not return until the rendering
    /// of all pages is complete. You can connect to the
    /// `gtk.PrintOperation.signals.status_changed` signal on `op` to obtain
    /// some information about the progress of the print operation.
    ///
    /// Furthermore, it may use a recursive mainloop to show the print dialog.
    ///
    /// If you set the [Gtk.PrintOperation:allow-async] property, the operation
    /// will run asynchronously if this is supported on the platform. The
    /// `gtk.PrintOperation.signals.done` signal will be emitted with the result
    /// of the operation when the it is done (i.e. when the dialog is canceled,
    /// or when the print succeeds or fails).
    ///
    /// ```c
    /// if (settings != NULL)
    ///   gtk_print_operation_set_print_settings (print, settings);
    ///
    /// if (page_setup != NULL)
    ///   gtk_print_operation_set_default_page_setup (print, page_setup);
    ///
    /// g_signal_connect (print, "begin-print",
    ///                   G_CALLBACK (begin_print), &data);
    /// g_signal_connect (print, "draw-page",
    ///                   G_CALLBACK (draw_page), &data);
    ///
    /// res = gtk_print_operation_run (print,
    ///                                GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
    ///                                parent,
    ///                                &error);
    ///
    /// if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
    ///  {
    ///    error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
    ///                                    GTK_DIALOG_DESTROY_WITH_PARENT,
    ///                          GTK_MESSAGE_ERROR,
    ///                          GTK_BUTTONS_CLOSE,
    ///                          "Error printing file:\n`s`",
    ///                          error->message);
    ///    g_signal_connect (error_dialog, "response",
    ///                      G_CALLBACK (gtk_window_destroy), NULL);
    ///    gtk_window_present (GTK_WINDOW (error_dialog));
    ///    g_error_free (error);
    ///  }
    /// else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
    ///  {
    ///    if (settings != NULL)
    /// g_object_unref (settings);
    ///    settings = g_object_ref (gtk_print_operation_get_print_settings (print));
    ///  }
    /// ```
    ///
    /// Note that `gtk.PrintOperation.run` can only be called once on a
    /// given `GtkPrintOperation`.
    extern fn gtk_print_operation_run(p_op: *PrintOperation, p_action: gtk.PrintOperationAction, p_parent: ?*gtk.Window, p_error: ?*?*glib.Error) gtk.PrintOperationResult;
    pub const run = gtk_print_operation_run;

    /// Sets whether `gtk.PrintOperation.run` may return
    /// before the print operation is completed.
    ///
    /// Note that some platforms may not allow asynchronous
    /// operation.
    extern fn gtk_print_operation_set_allow_async(p_op: *PrintOperation, p_allow_async: c_int) void;
    pub const setAllowAsync = gtk_print_operation_set_allow_async;

    /// Sets the current page.
    ///
    /// If this is called before `gtk.PrintOperation.run`,
    /// the user will be able to select to print only the current page.
    ///
    /// Note that this only makes sense for pre-paginated documents.
    extern fn gtk_print_operation_set_current_page(p_op: *PrintOperation, p_current_page: c_int) void;
    pub const setCurrentPage = gtk_print_operation_set_current_page;

    /// Sets the label for the tab holding custom widgets.
    extern fn gtk_print_operation_set_custom_tab_label(p_op: *PrintOperation, p_label: ?[*:0]const u8) void;
    pub const setCustomTabLabel = gtk_print_operation_set_custom_tab_label;

    /// Makes `default_page_setup` the default page setup for `op`.
    ///
    /// This page setup will be used by `gtk.PrintOperation.run`,
    /// but it can be overridden on a per-page basis by connecting
    /// to the `gtk.PrintOperation.signals.request_page_setup` signal.
    extern fn gtk_print_operation_set_default_page_setup(p_op: *PrintOperation, p_default_page_setup: ?*gtk.PageSetup) void;
    pub const setDefaultPageSetup = gtk_print_operation_set_default_page_setup;

    /// Sets up the `GtkPrintOperation` to wait for calling of
    /// [method`Gtk`.PrintOperation.draw_page_finish from application.
    ///
    /// This can be used for drawing page in another thread.
    ///
    /// This function must be called in the callback of the
    /// `gtk.PrintOperation.signals.draw_page` signal.
    extern fn gtk_print_operation_set_defer_drawing(p_op: *PrintOperation) void;
    pub const setDeferDrawing = gtk_print_operation_set_defer_drawing;

    /// Embed page size combo box and orientation combo box into page setup page.
    ///
    /// Selected page setup is stored as default page setup in `GtkPrintOperation`.
    extern fn gtk_print_operation_set_embed_page_setup(p_op: *PrintOperation, p_embed: c_int) void;
    pub const setEmbedPageSetup = gtk_print_operation_set_embed_page_setup;

    /// Sets up the `GtkPrintOperation` to generate a file instead
    /// of showing the print dialog.
    ///
    /// The intended use of this function is for implementing
    /// “Export to PDF” actions. Currently, PDF is the only supported
    /// format.
    ///
    /// “Print to PDF” support is independent of this and is done
    /// by letting the user pick the “Print to PDF” item from the list
    /// of printers in the print dialog.
    extern fn gtk_print_operation_set_export_filename(p_op: *PrintOperation, p_filename: [*:0]const u8) void;
    pub const setExportFilename = gtk_print_operation_set_export_filename;

    /// Sets whether there is a selection to print.
    ///
    /// Application has to set number of pages to which the selection
    /// will draw by `gtk.PrintOperation.setNPages` in a handler
    /// for the `gtk.PrintOperation.signals.begin_print` signal.
    extern fn gtk_print_operation_set_has_selection(p_op: *PrintOperation, p_has_selection: c_int) void;
    pub const setHasSelection = gtk_print_operation_set_has_selection;

    /// Sets the name of the print job.
    ///
    /// The name is used to identify the job (e.g. in monitoring
    /// applications like eggcups).
    ///
    /// If you don’t set a job name, GTK picks a default one by
    /// numbering successive print jobs.
    extern fn gtk_print_operation_set_job_name(p_op: *PrintOperation, p_job_name: [*:0]const u8) void;
    pub const setJobName = gtk_print_operation_set_job_name;

    /// Sets the number of pages in the document.
    ///
    /// This must be set to a positive number before the rendering
    /// starts. It may be set in a `gtk.PrintOperation.signals.begin_print`
    /// signal handler.
    ///
    /// Note that the page numbers passed to the
    /// `gtk.PrintOperation.signals.request_page_setup`
    /// and `gtk.PrintOperation.signals.draw_page` signals are 0-based, i.e.
    /// if the user chooses to print all pages, the last ::draw-page signal
    /// will be for page `n_pages` - 1.
    extern fn gtk_print_operation_set_n_pages(p_op: *PrintOperation, p_n_pages: c_int) void;
    pub const setNPages = gtk_print_operation_set_n_pages;

    /// Sets the print settings for `op`.
    ///
    /// This is typically used to re-establish print settings
    /// from a previous print operation, see `gtk.PrintOperation.run`.
    extern fn gtk_print_operation_set_print_settings(p_op: *PrintOperation, p_print_settings: ?*gtk.PrintSettings) void;
    pub const setPrintSettings = gtk_print_operation_set_print_settings;

    /// If `show_progress` is `TRUE`, the print operation will show
    /// a progress dialog during the print operation.
    extern fn gtk_print_operation_set_show_progress(p_op: *PrintOperation, p_show_progress: c_int) void;
    pub const setShowProgress = gtk_print_operation_set_show_progress;

    /// Sets whether selection is supported by `GtkPrintOperation`.
    extern fn gtk_print_operation_set_support_selection(p_op: *PrintOperation, p_support_selection: c_int) void;
    pub const setSupportSelection = gtk_print_operation_set_support_selection;

    /// If track_status is `TRUE`, the print operation will try to continue
    /// report on the status of the print job in the printer queues and printer.
    ///
    /// This can allow your application to show things like “out of paper”
    /// issues, and when the print job actually reaches the printer.
    ///
    /// This function is often implemented using some form of polling,
    /// so it should not be enabled unless needed.
    extern fn gtk_print_operation_set_track_print_status(p_op: *PrintOperation, p_track_status: c_int) void;
    pub const setTrackPrintStatus = gtk_print_operation_set_track_print_status;

    /// Sets up the transformation for the cairo context obtained from
    /// `GtkPrintContext` in such a way that distances are measured in
    /// units of `unit`.
    extern fn gtk_print_operation_set_unit(p_op: *PrintOperation, p_unit: gtk.Unit) void;
    pub const setUnit = gtk_print_operation_set_unit;

    /// If `full_page` is `TRUE`, the transformation for the cairo context
    /// obtained from `GtkPrintContext` puts the origin at the top left
    /// corner of the page.
    ///
    /// This may not be the top left corner of the sheet, depending on page
    /// orientation and the number of pages per sheet). Otherwise, the origin
    /// is at the top left corner of the imageable area (i.e. inside the margins).
    extern fn gtk_print_operation_set_use_full_page(p_op: *PrintOperation, p_full_page: c_int) void;
    pub const setUseFullPage = gtk_print_operation_set_use_full_page;

    extern fn gtk_print_operation_get_type() usize;
    pub const getGObjectType = gtk_print_operation_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintOperation) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintOperation) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintOperation, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Collects the settings of a print dialog in a system-independent way.
///
/// The main use for this object is that once you’ve printed you can get a
/// settings object that represents the settings the user chose, and the next
/// time you print you can pass that object in so that the user doesn’t have
/// to re-set all his settings.
///
/// Its also possible to enumerate the settings so that you can easily save
/// the settings for the next time your app runs, or even store them in a
/// document. The predefined keys try to use shared values as much as possible
/// so that moving such a document between systems still works.
pub const PrintSettings = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = PrintSettings;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkPrintSettings` object.
    extern fn gtk_print_settings_new() *gtk.PrintSettings;
    pub const new = gtk_print_settings_new;

    /// Reads the print settings from `file_name`.
    ///
    /// Returns a new `GtkPrintSettings` object with the restored settings,
    /// or `NULL` if an error occurred. If the file could not be loaded then
    /// error is set to either a `GFileError` or `GKeyFileError`.
    ///
    /// See `gtk.PrintSettings.toFile`.
    extern fn gtk_print_settings_new_from_file(p_file_name: [*:0]const u8, p_error: ?*?*glib.Error) ?*gtk.PrintSettings;
    pub const newFromFile = gtk_print_settings_new_from_file;

    /// Deserialize print settings from an a{sv} variant.
    ///
    /// The variant must be in the format produced by
    /// `gtk.PrintSettings.toGvariant`.
    extern fn gtk_print_settings_new_from_gvariant(p_variant: *glib.Variant) *gtk.PrintSettings;
    pub const newFromGvariant = gtk_print_settings_new_from_gvariant;

    /// Reads the print settings from the group `group_name` in `key_file`.
    ///
    /// Returns a new `GtkPrintSettings` object with the restored settings,
    /// or `NULL` if an error occurred. If the file could not be loaded then
    /// error is set to either `GFileError` or `GKeyFileError`.
    extern fn gtk_print_settings_new_from_key_file(p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8, p_error: ?*?*glib.Error) ?*gtk.PrintSettings;
    pub const newFromKeyFile = gtk_print_settings_new_from_key_file;

    /// Copies a `GtkPrintSettings` object.
    extern fn gtk_print_settings_copy(p_other: *PrintSettings) *gtk.PrintSettings;
    pub const copy = gtk_print_settings_copy;

    /// Calls `func` for each key-value pair of `settings`.
    extern fn gtk_print_settings_foreach(p_settings: *PrintSettings, p_func: gtk.PrintSettingsFunc, p_user_data: ?*anyopaque) void;
    pub const foreach = gtk_print_settings_foreach;

    /// Looks up the string value associated with `key`.
    extern fn gtk_print_settings_get(p_settings: *PrintSettings, p_key: [*:0]const u8) ?[*:0]const u8;
    pub const get = gtk_print_settings_get;

    /// Returns the boolean represented by the value
    /// that is associated with `key`.
    ///
    /// The string “true” represents `TRUE`, any other
    /// string `FALSE`.
    extern fn gtk_print_settings_get_bool(p_settings: *PrintSettings, p_key: [*:0]const u8) c_int;
    pub const getBool = gtk_print_settings_get_bool;

    /// Gets the value of `GTK_PRINT_SETTINGS_COLLATE`.
    extern fn gtk_print_settings_get_collate(p_settings: *PrintSettings) c_int;
    pub const getCollate = gtk_print_settings_get_collate;

    /// Gets the value of `GTK_PRINT_SETTINGS_DEFAULT_SOURCE`.
    extern fn gtk_print_settings_get_default_source(p_settings: *PrintSettings) ?[*:0]const u8;
    pub const getDefaultSource = gtk_print_settings_get_default_source;

    /// Gets the value of `GTK_PRINT_SETTINGS_DITHER`.
    extern fn gtk_print_settings_get_dither(p_settings: *PrintSettings) ?[*:0]const u8;
    pub const getDither = gtk_print_settings_get_dither;

    /// Returns the double value associated with `key`, or 0.
    extern fn gtk_print_settings_get_double(p_settings: *PrintSettings, p_key: [*:0]const u8) f64;
    pub const getDouble = gtk_print_settings_get_double;

    /// Returns the floating point number represented by
    /// the value that is associated with `key`, or `default_val`
    /// if the value does not represent a floating point number.
    ///
    /// Floating point numbers are parsed with `glib.asciiStrtod`.
    extern fn gtk_print_settings_get_double_with_default(p_settings: *PrintSettings, p_key: [*:0]const u8, p_def: f64) f64;
    pub const getDoubleWithDefault = gtk_print_settings_get_double_with_default;

    /// Gets the value of `GTK_PRINT_SETTINGS_DUPLEX`.
    extern fn gtk_print_settings_get_duplex(p_settings: *PrintSettings) gtk.PrintDuplex;
    pub const getDuplex = gtk_print_settings_get_duplex;

    /// Gets the value of `GTK_PRINT_SETTINGS_FINISHINGS`.
    extern fn gtk_print_settings_get_finishings(p_settings: *PrintSettings) ?[*:0]const u8;
    pub const getFinishings = gtk_print_settings_get_finishings;

    /// Returns the integer value of `key`, or 0.
    extern fn gtk_print_settings_get_int(p_settings: *PrintSettings, p_key: [*:0]const u8) c_int;
    pub const getInt = gtk_print_settings_get_int;

    /// Returns the value of `key`, interpreted as
    /// an integer, or the default value.
    extern fn gtk_print_settings_get_int_with_default(p_settings: *PrintSettings, p_key: [*:0]const u8, p_def: c_int) c_int;
    pub const getIntWithDefault = gtk_print_settings_get_int_with_default;

    /// Returns the value associated with `key`, interpreted
    /// as a length.
    ///
    /// The returned value is converted to `units`.
    extern fn gtk_print_settings_get_length(p_settings: *PrintSettings, p_key: [*:0]const u8, p_unit: gtk.Unit) f64;
    pub const getLength = gtk_print_settings_get_length;

    /// Gets the value of `GTK_PRINT_SETTINGS_MEDIA_TYPE`.
    ///
    /// The set of media types is defined in PWG 5101.1-2002 PWG.
    extern fn gtk_print_settings_get_media_type(p_settings: *PrintSettings) ?[*:0]const u8;
    pub const getMediaType = gtk_print_settings_get_media_type;

    /// Gets the value of `GTK_PRINT_SETTINGS_N_COPIES`.
    extern fn gtk_print_settings_get_n_copies(p_settings: *PrintSettings) c_int;
    pub const getNCopies = gtk_print_settings_get_n_copies;

    /// Gets the value of `GTK_PRINT_SETTINGS_NUMBER_UP`.
    extern fn gtk_print_settings_get_number_up(p_settings: *PrintSettings) c_int;
    pub const getNumberUp = gtk_print_settings_get_number_up;

    /// Gets the value of `GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT`.
    extern fn gtk_print_settings_get_number_up_layout(p_settings: *PrintSettings) gtk.NumberUpLayout;
    pub const getNumberUpLayout = gtk_print_settings_get_number_up_layout;

    /// Get the value of `GTK_PRINT_SETTINGS_ORIENTATION`,
    /// converted to a `GtkPageOrientation`.
    extern fn gtk_print_settings_get_orientation(p_settings: *PrintSettings) gtk.PageOrientation;
    pub const getOrientation = gtk_print_settings_get_orientation;

    /// Gets the value of `GTK_PRINT_SETTINGS_OUTPUT_BIN`.
    extern fn gtk_print_settings_get_output_bin(p_settings: *PrintSettings) ?[*:0]const u8;
    pub const getOutputBin = gtk_print_settings_get_output_bin;

    /// Gets the value of `GTK_PRINT_SETTINGS_PAGE_RANGES`.
    extern fn gtk_print_settings_get_page_ranges(p_settings: *PrintSettings, p_num_ranges: *c_int) [*]gtk.PageRange;
    pub const getPageRanges = gtk_print_settings_get_page_ranges;

    /// Gets the value of `GTK_PRINT_SETTINGS_PAGE_SET`.
    extern fn gtk_print_settings_get_page_set(p_settings: *PrintSettings) gtk.PageSet;
    pub const getPageSet = gtk_print_settings_get_page_set;

    /// Gets the value of `GTK_PRINT_SETTINGS_PAPER_HEIGHT`,
    /// converted to `unit`.
    extern fn gtk_print_settings_get_paper_height(p_settings: *PrintSettings, p_unit: gtk.Unit) f64;
    pub const getPaperHeight = gtk_print_settings_get_paper_height;

    /// Gets the value of `GTK_PRINT_SETTINGS_PAPER_FORMAT`,
    /// converted to a `GtkPaperSize`.
    extern fn gtk_print_settings_get_paper_size(p_settings: *PrintSettings) ?*gtk.PaperSize;
    pub const getPaperSize = gtk_print_settings_get_paper_size;

    /// Gets the value of `GTK_PRINT_SETTINGS_PAPER_WIDTH`,
    /// converted to `unit`.
    extern fn gtk_print_settings_get_paper_width(p_settings: *PrintSettings, p_unit: gtk.Unit) f64;
    pub const getPaperWidth = gtk_print_settings_get_paper_width;

    /// Gets the value of `GTK_PRINT_SETTINGS_PRINT_PAGES`.
    extern fn gtk_print_settings_get_print_pages(p_settings: *PrintSettings) gtk.PrintPages;
    pub const getPrintPages = gtk_print_settings_get_print_pages;

    /// Convenience function to obtain the value of
    /// `GTK_PRINT_SETTINGS_PRINTER`.
    extern fn gtk_print_settings_get_printer(p_settings: *PrintSettings) ?[*:0]const u8;
    pub const getPrinter = gtk_print_settings_get_printer;

    /// Gets the value of `GTK_PRINT_SETTINGS_PRINTER_LPI`.
    extern fn gtk_print_settings_get_printer_lpi(p_settings: *PrintSettings) f64;
    pub const getPrinterLpi = gtk_print_settings_get_printer_lpi;

    /// Gets the value of `GTK_PRINT_SETTINGS_QUALITY`.
    extern fn gtk_print_settings_get_quality(p_settings: *PrintSettings) gtk.PrintQuality;
    pub const getQuality = gtk_print_settings_get_quality;

    /// Gets the value of `GTK_PRINT_SETTINGS_RESOLUTION`.
    extern fn gtk_print_settings_get_resolution(p_settings: *PrintSettings) c_int;
    pub const getResolution = gtk_print_settings_get_resolution;

    /// Gets the value of `GTK_PRINT_SETTINGS_RESOLUTION_X`.
    extern fn gtk_print_settings_get_resolution_x(p_settings: *PrintSettings) c_int;
    pub const getResolutionX = gtk_print_settings_get_resolution_x;

    /// Gets the value of `GTK_PRINT_SETTINGS_RESOLUTION_Y`.
    extern fn gtk_print_settings_get_resolution_y(p_settings: *PrintSettings) c_int;
    pub const getResolutionY = gtk_print_settings_get_resolution_y;

    /// Gets the value of `GTK_PRINT_SETTINGS_REVERSE`.
    extern fn gtk_print_settings_get_reverse(p_settings: *PrintSettings) c_int;
    pub const getReverse = gtk_print_settings_get_reverse;

    /// Gets the value of `GTK_PRINT_SETTINGS_SCALE`.
    extern fn gtk_print_settings_get_scale(p_settings: *PrintSettings) f64;
    pub const getScale = gtk_print_settings_get_scale;

    /// Gets the value of `GTK_PRINT_SETTINGS_USE_COLOR`.
    extern fn gtk_print_settings_get_use_color(p_settings: *PrintSettings) c_int;
    pub const getUseColor = gtk_print_settings_get_use_color;

    /// Returns `TRUE`, if a value is associated with `key`.
    extern fn gtk_print_settings_has_key(p_settings: *PrintSettings, p_key: [*:0]const u8) c_int;
    pub const hasKey = gtk_print_settings_has_key;

    /// Reads the print settings from `file_name`.
    ///
    /// If the file could not be loaded then error is set to either
    /// a `GFileError` or `GKeyFileError`.
    ///
    /// See `gtk.PrintSettings.toFile`.
    extern fn gtk_print_settings_load_file(p_settings: *PrintSettings, p_file_name: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const loadFile = gtk_print_settings_load_file;

    /// Reads the print settings from the group `group_name` in `key_file`.
    ///
    /// If the file could not be loaded then error is set to either a
    /// `GFileError` or `GKeyFileError`.
    extern fn gtk_print_settings_load_key_file(p_settings: *PrintSettings, p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const loadKeyFile = gtk_print_settings_load_key_file;

    /// Associates `value` with `key`.
    extern fn gtk_print_settings_set(p_settings: *PrintSettings, p_key: [*:0]const u8, p_value: ?[*:0]const u8) void;
    pub const set = gtk_print_settings_set;

    /// Sets `key` to a boolean value.
    extern fn gtk_print_settings_set_bool(p_settings: *PrintSettings, p_key: [*:0]const u8, p_value: c_int) void;
    pub const setBool = gtk_print_settings_set_bool;

    /// Sets the value of `GTK_PRINT_SETTINGS_COLLATE`.
    extern fn gtk_print_settings_set_collate(p_settings: *PrintSettings, p_collate: c_int) void;
    pub const setCollate = gtk_print_settings_set_collate;

    /// Sets the value of `GTK_PRINT_SETTINGS_DEFAULT_SOURCE`.
    extern fn gtk_print_settings_set_default_source(p_settings: *PrintSettings, p_default_source: [*:0]const u8) void;
    pub const setDefaultSource = gtk_print_settings_set_default_source;

    /// Sets the value of `GTK_PRINT_SETTINGS_DITHER`.
    extern fn gtk_print_settings_set_dither(p_settings: *PrintSettings, p_dither: [*:0]const u8) void;
    pub const setDither = gtk_print_settings_set_dither;

    /// Sets `key` to a double value.
    extern fn gtk_print_settings_set_double(p_settings: *PrintSettings, p_key: [*:0]const u8, p_value: f64) void;
    pub const setDouble = gtk_print_settings_set_double;

    /// Sets the value of `GTK_PRINT_SETTINGS_DUPLEX`.
    extern fn gtk_print_settings_set_duplex(p_settings: *PrintSettings, p_duplex: gtk.PrintDuplex) void;
    pub const setDuplex = gtk_print_settings_set_duplex;

    /// Sets the value of `GTK_PRINT_SETTINGS_FINISHINGS`.
    extern fn gtk_print_settings_set_finishings(p_settings: *PrintSettings, p_finishings: [*:0]const u8) void;
    pub const setFinishings = gtk_print_settings_set_finishings;

    /// Sets `key` to an integer value.
    extern fn gtk_print_settings_set_int(p_settings: *PrintSettings, p_key: [*:0]const u8, p_value: c_int) void;
    pub const setInt = gtk_print_settings_set_int;

    /// Associates a length in units of `unit` with `key`.
    extern fn gtk_print_settings_set_length(p_settings: *PrintSettings, p_key: [*:0]const u8, p_value: f64, p_unit: gtk.Unit) void;
    pub const setLength = gtk_print_settings_set_length;

    /// Sets the value of `GTK_PRINT_SETTINGS_MEDIA_TYPE`.
    ///
    /// The set of media types is defined in PWG 5101.1-2002 PWG.
    extern fn gtk_print_settings_set_media_type(p_settings: *PrintSettings, p_media_type: [*:0]const u8) void;
    pub const setMediaType = gtk_print_settings_set_media_type;

    /// Sets the value of `GTK_PRINT_SETTINGS_N_COPIES`.
    extern fn gtk_print_settings_set_n_copies(p_settings: *PrintSettings, p_num_copies: c_int) void;
    pub const setNCopies = gtk_print_settings_set_n_copies;

    /// Sets the value of `GTK_PRINT_SETTINGS_NUMBER_UP`.
    extern fn gtk_print_settings_set_number_up(p_settings: *PrintSettings, p_number_up: c_int) void;
    pub const setNumberUp = gtk_print_settings_set_number_up;

    /// Sets the value of `GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT`.
    extern fn gtk_print_settings_set_number_up_layout(p_settings: *PrintSettings, p_number_up_layout: gtk.NumberUpLayout) void;
    pub const setNumberUpLayout = gtk_print_settings_set_number_up_layout;

    /// Sets the value of `GTK_PRINT_SETTINGS_ORIENTATION`.
    extern fn gtk_print_settings_set_orientation(p_settings: *PrintSettings, p_orientation: gtk.PageOrientation) void;
    pub const setOrientation = gtk_print_settings_set_orientation;

    /// Sets the value of `GTK_PRINT_SETTINGS_OUTPUT_BIN`.
    extern fn gtk_print_settings_set_output_bin(p_settings: *PrintSettings, p_output_bin: [*:0]const u8) void;
    pub const setOutputBin = gtk_print_settings_set_output_bin;

    /// Sets the value of `GTK_PRINT_SETTINGS_PAGE_RANGES`.
    extern fn gtk_print_settings_set_page_ranges(p_settings: *PrintSettings, p_page_ranges: [*]gtk.PageRange, p_num_ranges: c_int) void;
    pub const setPageRanges = gtk_print_settings_set_page_ranges;

    /// Sets the value of `GTK_PRINT_SETTINGS_PAGE_SET`.
    extern fn gtk_print_settings_set_page_set(p_settings: *PrintSettings, p_page_set: gtk.PageSet) void;
    pub const setPageSet = gtk_print_settings_set_page_set;

    /// Sets the value of `GTK_PRINT_SETTINGS_PAPER_HEIGHT`.
    extern fn gtk_print_settings_set_paper_height(p_settings: *PrintSettings, p_height: f64, p_unit: gtk.Unit) void;
    pub const setPaperHeight = gtk_print_settings_set_paper_height;

    /// Sets the value of `GTK_PRINT_SETTINGS_PAPER_FORMAT`,
    /// `GTK_PRINT_SETTINGS_PAPER_WIDTH` and
    /// `GTK_PRINT_SETTINGS_PAPER_HEIGHT`.
    extern fn gtk_print_settings_set_paper_size(p_settings: *PrintSettings, p_paper_size: *gtk.PaperSize) void;
    pub const setPaperSize = gtk_print_settings_set_paper_size;

    /// Sets the value of `GTK_PRINT_SETTINGS_PAPER_WIDTH`.
    extern fn gtk_print_settings_set_paper_width(p_settings: *PrintSettings, p_width: f64, p_unit: gtk.Unit) void;
    pub const setPaperWidth = gtk_print_settings_set_paper_width;

    /// Sets the value of `GTK_PRINT_SETTINGS_PRINT_PAGES`.
    extern fn gtk_print_settings_set_print_pages(p_settings: *PrintSettings, p_pages: gtk.PrintPages) void;
    pub const setPrintPages = gtk_print_settings_set_print_pages;

    /// Convenience function to set `GTK_PRINT_SETTINGS_PRINTER`
    /// to `printer`.
    extern fn gtk_print_settings_set_printer(p_settings: *PrintSettings, p_printer: [*:0]const u8) void;
    pub const setPrinter = gtk_print_settings_set_printer;

    /// Sets the value of `GTK_PRINT_SETTINGS_PRINTER_LPI`.
    extern fn gtk_print_settings_set_printer_lpi(p_settings: *PrintSettings, p_lpi: f64) void;
    pub const setPrinterLpi = gtk_print_settings_set_printer_lpi;

    /// Sets the value of `GTK_PRINT_SETTINGS_QUALITY`.
    extern fn gtk_print_settings_set_quality(p_settings: *PrintSettings, p_quality: gtk.PrintQuality) void;
    pub const setQuality = gtk_print_settings_set_quality;

    /// Sets the values of `GTK_PRINT_SETTINGS_RESOLUTION`,
    /// `GTK_PRINT_SETTINGS_RESOLUTION_X` and
    /// `GTK_PRINT_SETTINGS_RESOLUTION_Y`.
    extern fn gtk_print_settings_set_resolution(p_settings: *PrintSettings, p_resolution: c_int) void;
    pub const setResolution = gtk_print_settings_set_resolution;

    /// Sets the values of `GTK_PRINT_SETTINGS_RESOLUTION`,
    /// `GTK_PRINT_SETTINGS_RESOLUTION_X` and
    /// `GTK_PRINT_SETTINGS_RESOLUTION_Y`.
    extern fn gtk_print_settings_set_resolution_xy(p_settings: *PrintSettings, p_resolution_x: c_int, p_resolution_y: c_int) void;
    pub const setResolutionXy = gtk_print_settings_set_resolution_xy;

    /// Sets the value of `GTK_PRINT_SETTINGS_REVERSE`.
    extern fn gtk_print_settings_set_reverse(p_settings: *PrintSettings, p_reverse: c_int) void;
    pub const setReverse = gtk_print_settings_set_reverse;

    /// Sets the value of `GTK_PRINT_SETTINGS_SCALE`.
    extern fn gtk_print_settings_set_scale(p_settings: *PrintSettings, p_scale: f64) void;
    pub const setScale = gtk_print_settings_set_scale;

    /// Sets the value of `GTK_PRINT_SETTINGS_USE_COLOR`.
    extern fn gtk_print_settings_set_use_color(p_settings: *PrintSettings, p_use_color: c_int) void;
    pub const setUseColor = gtk_print_settings_set_use_color;

    /// This function saves the print settings from `settings` to `file_name`.
    ///
    /// If the file could not be written then error is set to either a
    /// `GFileError` or `GKeyFileError`.
    extern fn gtk_print_settings_to_file(p_settings: *PrintSettings, p_file_name: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const toFile = gtk_print_settings_to_file;

    /// Serialize print settings to an a{sv} variant.
    extern fn gtk_print_settings_to_gvariant(p_settings: *PrintSettings) *glib.Variant;
    pub const toGvariant = gtk_print_settings_to_gvariant;

    /// This function adds the print settings from `settings` to `key_file`.
    extern fn gtk_print_settings_to_key_file(p_settings: *PrintSettings, p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8) void;
    pub const toKeyFile = gtk_print_settings_to_key_file;

    /// Removes any value associated with `key`.
    ///
    /// This has the same effect as setting the value to `NULL`.
    extern fn gtk_print_settings_unset(p_settings: *PrintSettings, p_key: [*:0]const u8) void;
    pub const unset = gtk_print_settings_unset;

    extern fn gtk_print_settings_get_type() usize;
    pub const getGObjectType = gtk_print_settings_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintSettings) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintSettings) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintSettings, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A print dialog for platforms which don’t provide a native
/// print dialog, like Unix.
///
/// <picture>
///   <source srcset="printdialog-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkPrintUnixDialog" src="printdialog.png">
/// </picture>
///
/// It can be used very much like any other GTK dialog, at the cost of
/// the portability offered by the high-level printing API with
/// `gtk.PrintOperation`.
///
/// In order to print something with `GtkPrintUnixDialog`, you need to
/// use `gtk.PrintUnixDialog.getSelectedPrinter` to obtain a
/// `gtk.Printer` object and use it to construct a `gtk.PrintJob`
/// using `gtk.PrintJob.new`.
///
/// `GtkPrintUnixDialog` uses the following response values:
///
/// - `GTK_RESPONSE_OK`: for the “Print” button
/// - `GTK_RESPONSE_APPLY`: for the “Preview” button
/// - `GTK_RESPONSE_CANCEL`: for the “Cancel” button
///
/// # GtkPrintUnixDialog as GtkBuildable
///
/// The `GtkPrintUnixDialog` implementation of the `GtkBuildable` interface
/// exposes its `notebook` internal children with the name “notebook”.
///
/// An example of a `GtkPrintUnixDialog` UI definition fragment:
///
/// ```xml
/// <object class="GtkPrintUnixDialog" id="dialog1">
///   <child internal-child="notebook">
///     <object class="GtkNotebook" id="notebook">
///       <child>
///         <object type="GtkNotebookPage">
///           <property name="tab_expand">False</property>
///           <property name="tab_fill">False</property>
///           <property name="tab">
///             <object class="GtkLabel" id="tablabel">
///               <property name="label">Tab label</property>
///             </object>
///           </property>
///           <property name="child">
///             <object class="GtkLabel" id="tabcontent">
///               <property name="label">Content on notebook tab</property>
///             </object>
///           </property>
///         </object>
///       </child>
///     </object>
///   </child>
/// </object>
/// ```
///
/// # CSS nodes
///
/// `GtkPrintUnixDialog` has a single CSS node with name window. The style classes
/// dialog and print are added.
pub const PrintUnixDialog = opaque {
    pub const Parent = gtk.Dialog;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = PrintUnixDialog;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The current page in the document.
        pub const current_page = struct {
            pub const name = "current-page";

            pub const Type = c_int;
        };

        /// `TRUE` if the page setup controls are embedded.
        pub const embed_page_setup = struct {
            pub const name = "embed-page-setup";

            pub const Type = c_int;
        };

        /// Whether the application has a selection.
        pub const has_selection = struct {
            pub const name = "has-selection";

            pub const Type = c_int;
        };

        /// Capabilities the application can handle.
        pub const manual_capabilities = struct {
            pub const name = "manual-capabilities";

            pub const Type = gtk.PrintCapabilities;
        };

        /// The `GtkPageSetup` object to use.
        pub const page_setup = struct {
            pub const name = "page-setup";

            pub const Type = ?*gtk.PageSetup;
        };

        /// The `GtkPrintSettings` object used for this dialog.
        pub const print_settings = struct {
            pub const name = "print-settings";

            pub const Type = ?*gtk.PrintSettings;
        };

        /// The `GtkPrinter` which is selected.
        pub const selected_printer = struct {
            pub const name = "selected-printer";

            pub const Type = ?*gtk.Printer;
        };

        /// Whether the dialog supports selection.
        pub const support_selection = struct {
            pub const name = "support-selection";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkPrintUnixDialog`.
    extern fn gtk_print_unix_dialog_new(p_title: ?[*:0]const u8, p_parent: ?*gtk.Window) *gtk.PrintUnixDialog;
    pub const new = gtk_print_unix_dialog_new;

    /// Adds a custom tab to the print dialog.
    extern fn gtk_print_unix_dialog_add_custom_tab(p_dialog: *PrintUnixDialog, p_child: *gtk.Widget, p_tab_label: *gtk.Widget) void;
    pub const addCustomTab = gtk_print_unix_dialog_add_custom_tab;

    /// Gets the current page of the `GtkPrintUnixDialog`.
    extern fn gtk_print_unix_dialog_get_current_page(p_dialog: *PrintUnixDialog) c_int;
    pub const getCurrentPage = gtk_print_unix_dialog_get_current_page;

    /// Gets whether to embed the page setup.
    extern fn gtk_print_unix_dialog_get_embed_page_setup(p_dialog: *PrintUnixDialog) c_int;
    pub const getEmbedPageSetup = gtk_print_unix_dialog_get_embed_page_setup;

    /// Gets whether there is a selection.
    extern fn gtk_print_unix_dialog_get_has_selection(p_dialog: *PrintUnixDialog) c_int;
    pub const getHasSelection = gtk_print_unix_dialog_get_has_selection;

    /// Gets the capabilities that have been set on this `GtkPrintUnixDialog`.
    extern fn gtk_print_unix_dialog_get_manual_capabilities(p_dialog: *PrintUnixDialog) gtk.PrintCapabilities;
    pub const getManualCapabilities = gtk_print_unix_dialog_get_manual_capabilities;

    /// Gets the page setup that is used by the `GtkPrintUnixDialog`.
    extern fn gtk_print_unix_dialog_get_page_setup(p_dialog: *PrintUnixDialog) *gtk.PageSetup;
    pub const getPageSetup = gtk_print_unix_dialog_get_page_setup;

    /// Gets whether a page setup was set by the user.
    extern fn gtk_print_unix_dialog_get_page_setup_set(p_dialog: *PrintUnixDialog) c_int;
    pub const getPageSetupSet = gtk_print_unix_dialog_get_page_setup_set;

    /// Gets the currently selected printer.
    extern fn gtk_print_unix_dialog_get_selected_printer(p_dialog: *PrintUnixDialog) ?*gtk.Printer;
    pub const getSelectedPrinter = gtk_print_unix_dialog_get_selected_printer;

    /// Gets a new `GtkPrintSettings` object that represents the
    /// current values in the print dialog.
    ///
    /// Note that this creates a new object, and you need to unref
    /// it if don’t want to keep it.
    extern fn gtk_print_unix_dialog_get_settings(p_dialog: *PrintUnixDialog) *gtk.PrintSettings;
    pub const getSettings = gtk_print_unix_dialog_get_settings;

    /// Gets whether the print dialog allows user to print a selection.
    extern fn gtk_print_unix_dialog_get_support_selection(p_dialog: *PrintUnixDialog) c_int;
    pub const getSupportSelection = gtk_print_unix_dialog_get_support_selection;

    /// Sets the current page number.
    ///
    /// If `current_page` is not -1, this enables the current page choice
    /// for the range of pages to print.
    extern fn gtk_print_unix_dialog_set_current_page(p_dialog: *PrintUnixDialog, p_current_page: c_int) void;
    pub const setCurrentPage = gtk_print_unix_dialog_set_current_page;

    /// Embed page size combo box and orientation combo box into page setup page.
    extern fn gtk_print_unix_dialog_set_embed_page_setup(p_dialog: *PrintUnixDialog, p_embed: c_int) void;
    pub const setEmbedPageSetup = gtk_print_unix_dialog_set_embed_page_setup;

    /// Sets whether a selection exists.
    extern fn gtk_print_unix_dialog_set_has_selection(p_dialog: *PrintUnixDialog, p_has_selection: c_int) void;
    pub const setHasSelection = gtk_print_unix_dialog_set_has_selection;

    /// This lets you specify the printing capabilities your application
    /// supports.
    ///
    /// For instance, if you can handle scaling the output then you pass
    /// `GTK_PRINT_CAPABILITY_SCALE`. If you don’t pass that, then the dialog
    /// will only let you select the scale if the printing system automatically
    /// handles scaling.
    extern fn gtk_print_unix_dialog_set_manual_capabilities(p_dialog: *PrintUnixDialog, p_capabilities: gtk.PrintCapabilities) void;
    pub const setManualCapabilities = gtk_print_unix_dialog_set_manual_capabilities;

    /// Sets the page setup of the `GtkPrintUnixDialog`.
    extern fn gtk_print_unix_dialog_set_page_setup(p_dialog: *PrintUnixDialog, p_page_setup: *gtk.PageSetup) void;
    pub const setPageSetup = gtk_print_unix_dialog_set_page_setup;

    /// Sets the `GtkPrintSettings` for the `GtkPrintUnixDialog`.
    ///
    /// Typically, this is used to restore saved print settings
    /// from a previous print operation before the print dialog
    /// is shown.
    extern fn gtk_print_unix_dialog_set_settings(p_dialog: *PrintUnixDialog, p_settings: ?*gtk.PrintSettings) void;
    pub const setSettings = gtk_print_unix_dialog_set_settings;

    /// Sets whether the print dialog allows user to print a selection.
    extern fn gtk_print_unix_dialog_set_support_selection(p_dialog: *PrintUnixDialog, p_support_selection: c_int) void;
    pub const setSupportSelection = gtk_print_unix_dialog_set_support_selection;

    extern fn gtk_print_unix_dialog_get_type() usize;
    pub const getGObjectType = gtk_print_unix_dialog_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintUnixDialog) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintUnixDialog) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintUnixDialog, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents a printer.
///
/// You only need to deal directly with printers if you use the
/// non-portable `gtk.PrintUnixDialog` API.
///
/// A `GtkPrinter` allows to get status information about the printer,
/// such as its description, its location, the number of queued jobs,
/// etc. Most importantly, a `GtkPrinter` object can be used to create
/// a `gtk.PrintJob` object, which lets you print to the printer.
pub const Printer = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = Printer;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// `TRUE` if the printer is accepting jobs.
        pub const accepting_jobs = struct {
            pub const name = "accepting-jobs";

            pub const Type = c_int;
        };

        /// `TRUE` if this printer can accept PDF.
        pub const accepts_pdf = struct {
            pub const name = "accepts-pdf";

            pub const Type = c_int;
        };

        /// `TRUE` if this printer can accept PostScript.
        pub const accepts_ps = struct {
            pub const name = "accepts-ps";

            pub const Type = c_int;
        };

        /// The backend for the printer.
        pub const backend = struct {
            pub const name = "backend";

            pub const Type = @compileError("no type information available");
        };

        /// Icon name to use for the printer.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// `FALSE` if this represents a real hardware device.
        pub const is_virtual = struct {
            pub const name = "is-virtual";

            pub const Type = c_int;
        };

        /// Number of jobs queued in the printer.
        pub const job_count = struct {
            pub const name = "job-count";

            pub const Type = c_int;
        };

        /// Information about the location of the printer.
        pub const location = struct {
            pub const name = "location";

            pub const Type = ?[*:0]u8;
        };

        /// The name of the printer.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// `TRUE` if this printer is paused.
        ///
        /// A paused printer still accepts jobs, but it does
        /// not print them.
        pub const paused = struct {
            pub const name = "paused";

            pub const Type = c_int;
        };

        /// String giving the current status of the printer.
        pub const state_message = struct {
            pub const name = "state-message";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted in response to a request for detailed information
        /// about a printer from the print backend.
        ///
        /// The `success` parameter indicates if the information was
        /// actually obtained.
        pub const details_acquired = struct {
            pub const name = "details-acquired";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_success: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Printer, p_instance))),
                    gobject.signalLookup("details-acquired", Printer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkPrinter`.
    extern fn gtk_printer_new(p_name: [*:0]const u8, p_backend: *gtk.PrintBackend, p_virtual_: c_int) *gtk.Printer;
    pub const new = gtk_printer_new;

    /// Returns whether the printer accepts input in
    /// PDF format.
    extern fn gtk_printer_accepts_pdf(p_printer: *Printer) c_int;
    pub const acceptsPdf = gtk_printer_accepts_pdf;

    /// Returns whether the printer accepts input in
    /// PostScript format.
    extern fn gtk_printer_accepts_ps(p_printer: *Printer) c_int;
    pub const acceptsPs = gtk_printer_accepts_ps;

    /// Compares two printers.
    extern fn gtk_printer_compare(p_a: *Printer, p_b: *gtk.Printer) c_int;
    pub const compare = gtk_printer_compare;

    /// Returns the backend of the printer.
    extern fn gtk_printer_get_backend(p_printer: *Printer) *gtk.PrintBackend;
    pub const getBackend = gtk_printer_get_backend;

    /// Returns the printer’s capabilities.
    ///
    /// This is useful when you’re using `GtkPrintUnixDialog`’s
    /// manual-capabilities setting and need to know which settings
    /// the printer can handle and which you must handle yourself.
    ///
    /// This will return 0 unless the printer’s details are
    /// available, see `gtk.Printer.hasDetails` and
    /// `gtk.Printer.requestDetails`.
    extern fn gtk_printer_get_capabilities(p_printer: *Printer) gtk.PrintCapabilities;
    pub const getCapabilities = gtk_printer_get_capabilities;

    /// Returns default page size of `printer`.
    extern fn gtk_printer_get_default_page_size(p_printer: *Printer) *gtk.PageSetup;
    pub const getDefaultPageSize = gtk_printer_get_default_page_size;

    /// Gets the description of the printer.
    extern fn gtk_printer_get_description(p_printer: *Printer) [*:0]const u8;
    pub const getDescription = gtk_printer_get_description;

    /// Retrieve the hard margins of `printer`.
    ///
    /// These are the margins that define the area at the borders
    /// of the paper that the printer cannot print to.
    ///
    /// Note: This will not succeed unless the printer’s details are
    /// available, see `gtk.Printer.hasDetails` and
    /// `gtk.Printer.requestDetails`.
    extern fn gtk_printer_get_hard_margins(p_printer: *Printer, p_top: *f64, p_bottom: *f64, p_left: *f64, p_right: *f64) c_int;
    pub const getHardMargins = gtk_printer_get_hard_margins;

    /// Retrieve the hard margins of `printer` for `paper_size`.
    ///
    /// These are the margins that define the area at the borders
    /// of the paper that the printer cannot print to.
    ///
    /// Note: This will not succeed unless the printer’s details are
    /// available, see `gtk.Printer.hasDetails` and
    /// `gtk.Printer.requestDetails`.
    extern fn gtk_printer_get_hard_margins_for_paper_size(p_printer: *Printer, p_paper_size: *gtk.PaperSize, p_top: *f64, p_bottom: *f64, p_left: *f64, p_right: *f64) c_int;
    pub const getHardMarginsForPaperSize = gtk_printer_get_hard_margins_for_paper_size;

    /// Gets the name of the icon to use for the printer.
    extern fn gtk_printer_get_icon_name(p_printer: *Printer) [*:0]const u8;
    pub const getIconName = gtk_printer_get_icon_name;

    /// Gets the number of jobs currently queued on the printer.
    extern fn gtk_printer_get_job_count(p_printer: *Printer) c_int;
    pub const getJobCount = gtk_printer_get_job_count;

    /// Returns a description of the location of the printer.
    extern fn gtk_printer_get_location(p_printer: *Printer) [*:0]const u8;
    pub const getLocation = gtk_printer_get_location;

    /// Returns the name of the printer.
    extern fn gtk_printer_get_name(p_printer: *Printer) [*:0]const u8;
    pub const getName = gtk_printer_get_name;

    /// Returns the state message describing the current state
    /// of the printer.
    extern fn gtk_printer_get_state_message(p_printer: *Printer) [*:0]const u8;
    pub const getStateMessage = gtk_printer_get_state_message;

    /// Returns whether the printer details are available.
    extern fn gtk_printer_has_details(p_printer: *Printer) c_int;
    pub const hasDetails = gtk_printer_has_details;

    /// Returns whether the printer is accepting jobs
    extern fn gtk_printer_is_accepting_jobs(p_printer: *Printer) c_int;
    pub const isAcceptingJobs = gtk_printer_is_accepting_jobs;

    /// Returns whether the printer is currently active (i.e.
    /// accepts new jobs).
    extern fn gtk_printer_is_active(p_printer: *Printer) c_int;
    pub const isActive = gtk_printer_is_active;

    /// Returns whether the printer is the default printer.
    extern fn gtk_printer_is_default(p_printer: *Printer) c_int;
    pub const isDefault = gtk_printer_is_default;

    /// Returns whether the printer is currently paused.
    ///
    /// A paused printer still accepts jobs, but it is not
    /// printing them.
    extern fn gtk_printer_is_paused(p_printer: *Printer) c_int;
    pub const isPaused = gtk_printer_is_paused;

    /// Returns whether the printer is virtual (i.e. does not
    /// represent actual printer hardware, but something like
    /// a CUPS class).
    extern fn gtk_printer_is_virtual(p_printer: *Printer) c_int;
    pub const isVirtual = gtk_printer_is_virtual;

    /// Lists all the paper sizes `printer` supports.
    ///
    /// This will return and empty list unless the printer’s details
    /// are available, see `gtk.Printer.hasDetails` and
    /// `gtk.Printer.requestDetails`.
    extern fn gtk_printer_list_papers(p_printer: *Printer) *glib.List;
    pub const listPapers = gtk_printer_list_papers;

    /// Requests the printer details.
    ///
    /// When the details are available, the
    /// `gtk.Printer.signals.details_acquired` signal
    /// will be emitted on `printer`.
    extern fn gtk_printer_request_details(p_printer: *Printer) void;
    pub const requestDetails = gtk_printer_request_details;

    extern fn gtk_printer_get_type() usize;
    pub const getGObjectType = gtk_printer_get_type;

    extern fn g_object_ref(p_self: *gtk.Printer) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Printer) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Printer, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays the progress of a long-running operation.
///
/// `GtkProgressBar` provides a visual clue that processing is underway.
/// It can be used in two different modes: percentage mode and activity mode.
///
/// <picture>
///   <source srcset="progressbar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkProgressBar" src="progressbar.png">
/// </picture>
///
/// When an application can determine how much work needs to take place
/// (e.g. read a fixed number of bytes from a file) and can monitor its
/// progress, it can use the `GtkProgressBar` in percentage mode and the
/// user sees a growing bar indicating the percentage of the work that
/// has been completed. In this mode, the application is required to call
/// `gtk.ProgressBar.setFraction` periodically to update the progress bar.
///
/// When an application has no accurate way of knowing the amount of work
/// to do, it can use the `GtkProgressBar` in activity mode, which shows
/// activity by a block moving back and forth within the progress area. In
/// this mode, the application is required to call `gtk.ProgressBar.pulse`
/// periodically to update the progress bar.
///
/// There is quite a bit of flexibility provided to control the appearance
/// of the `GtkProgressBar`. Functions are provided to control the orientation
/// of the bar, optional text can be displayed along with the bar, and the
/// step size used in activity mode can be set.
///
/// # CSS nodes
///
/// ```
/// progressbar[.osd]
/// ├── [text]
/// ╰── trough[.empty][.full]
///     ╰── progress[.pulse]
/// ```
///
/// `GtkProgressBar` has a main CSS node with name progressbar and subnodes with
/// names text and trough, of which the latter has a subnode named progress. The
/// text subnode is only present if text is shown. The progress subnode has the
/// style class .pulse when in activity mode. It gets the style classes .left,
/// .right, .top or .bottom added when the progress 'touches' the corresponding
/// end of the GtkProgressBar. The .osd class on the progressbar node is for use
/// in overlays like the one Epiphany has for page loading progress.
///
/// # Accessibility
///
/// `GtkProgressBar` uses the `gtk.@"AccessibleRole.progress_bar"` role
/// and sets the `gtk.@"AccessibleProperty.value_min"`, `gtk.@"AccessibleProperty.value_max"` and `gtk.@"AccessibleProperty.value_now"` properties to reflect
/// the progress.
pub const ProgressBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = ProgressBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The preferred place to ellipsize the string.
        ///
        /// The text will be ellipsized if the progress bar does not have enough room
        /// to display the entire string, specified as a `PangoEllipsizeMode`.
        ///
        /// Note that setting this property to a value other than
        /// `PANGO_ELLIPSIZE_NONE` has the side-effect that the progress bar requests
        /// only enough space to display the ellipsis ("..."). Another means to set a
        /// progress bar's width is `gtk.Widget.setSizeRequest`.
        pub const ellipsize = struct {
            pub const name = "ellipsize";

            pub const Type = pango.EllipsizeMode;
        };

        /// The fraction of total work that has been completed.
        pub const fraction = struct {
            pub const name = "fraction";

            pub const Type = f64;
        };

        /// Invert the direction in which the progress bar grows.
        pub const inverted = struct {
            pub const name = "inverted";

            pub const Type = c_int;
        };

        /// The fraction of total progress to move the bounding block when pulsed.
        pub const pulse_step = struct {
            pub const name = "pulse-step";

            pub const Type = f64;
        };

        /// Sets whether the progress bar will show a text in addition
        /// to the bar itself.
        ///
        /// The shown text is either the value of the `gtk.ProgressBar.properties.text`
        /// property or, if that is `NULL`, the `gtk.ProgressBar.properties.fraction`
        /// value, as a percentage.
        ///
        /// To make a progress bar that is styled and sized suitably for showing text
        /// (even if the actual text is blank), set `gtk.ProgressBar.properties.show_text`
        /// to `TRUE` and `gtk.ProgressBar.properties.text` to the empty string (not `NULL`).
        pub const show_text = struct {
            pub const name = "show-text";

            pub const Type = c_int;
        };

        /// Text to be displayed in the progress bar.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkProgressBar`.
    extern fn gtk_progress_bar_new() *gtk.ProgressBar;
    pub const new = gtk_progress_bar_new;

    /// Returns the ellipsizing position of the progress bar.
    ///
    /// See `gtk.ProgressBar.setEllipsize`.
    extern fn gtk_progress_bar_get_ellipsize(p_pbar: *ProgressBar) pango.EllipsizeMode;
    pub const getEllipsize = gtk_progress_bar_get_ellipsize;

    /// Returns the current fraction of the task that’s been completed.
    extern fn gtk_progress_bar_get_fraction(p_pbar: *ProgressBar) f64;
    pub const getFraction = gtk_progress_bar_get_fraction;

    /// Returns whether the progress bar is inverted.
    extern fn gtk_progress_bar_get_inverted(p_pbar: *ProgressBar) c_int;
    pub const getInverted = gtk_progress_bar_get_inverted;

    /// Retrieves the pulse step.
    ///
    /// See `gtk.ProgressBar.setPulseStep`.
    extern fn gtk_progress_bar_get_pulse_step(p_pbar: *ProgressBar) f64;
    pub const getPulseStep = gtk_progress_bar_get_pulse_step;

    /// Returns whether the `GtkProgressBar` shows text.
    ///
    /// See `gtk.ProgressBar.setShowText`.
    extern fn gtk_progress_bar_get_show_text(p_pbar: *ProgressBar) c_int;
    pub const getShowText = gtk_progress_bar_get_show_text;

    /// Retrieves the text that is displayed with the progress bar.
    ///
    /// The return value is a reference to the text, not a copy of it,
    /// so will become invalid if you change the text in the progress bar.
    extern fn gtk_progress_bar_get_text(p_pbar: *ProgressBar) ?[*:0]const u8;
    pub const getText = gtk_progress_bar_get_text;

    /// Indicates that some progress has been made, but you don’t know how much.
    ///
    /// Causes the progress bar to enter “activity mode,” where a block
    /// bounces back and forth. Each call to `gtk.ProgressBar.pulse`
    /// causes the block to move by a little bit (the amount of movement
    /// per pulse is determined by `gtk.ProgressBar.setPulseStep`).
    extern fn gtk_progress_bar_pulse(p_pbar: *ProgressBar) void;
    pub const pulse = gtk_progress_bar_pulse;

    /// Sets the mode used to ellipsize the text.
    ///
    /// The text is ellipsized if there is not enough space
    /// to render the entire string.
    extern fn gtk_progress_bar_set_ellipsize(p_pbar: *ProgressBar, p_mode: pango.EllipsizeMode) void;
    pub const setEllipsize = gtk_progress_bar_set_ellipsize;

    /// Causes the progress bar to “fill in” the given fraction
    /// of the bar.
    ///
    /// The fraction should be between 0.0 and 1.0, inclusive.
    extern fn gtk_progress_bar_set_fraction(p_pbar: *ProgressBar, p_fraction: f64) void;
    pub const setFraction = gtk_progress_bar_set_fraction;

    /// Sets whether the progress bar is inverted.
    ///
    /// Progress bars normally grow from top to bottom or left to right.
    /// Inverted progress bars grow in the opposite direction.
    extern fn gtk_progress_bar_set_inverted(p_pbar: *ProgressBar, p_inverted: c_int) void;
    pub const setInverted = gtk_progress_bar_set_inverted;

    /// Sets the fraction of total progress bar length to move the
    /// bouncing block.
    ///
    /// The bouncing block is moved when `gtk.ProgressBar.pulse`
    /// is called.
    extern fn gtk_progress_bar_set_pulse_step(p_pbar: *ProgressBar, p_fraction: f64) void;
    pub const setPulseStep = gtk_progress_bar_set_pulse_step;

    /// Sets whether the progress bar will show text next to the bar.
    ///
    /// The shown text is either the value of the `gtk.ProgressBar.properties.text`
    /// property or, if that is `NULL`, the `gtk.ProgressBar.properties.fraction` value,
    /// as a percentage.
    ///
    /// To make a progress bar that is styled and sized suitably for containing
    /// text (even if the actual text is blank), set `gtk.ProgressBar.properties.show_text`
    /// to `TRUE` and `gtk.ProgressBar.properties.text` to the empty string (not `NULL`).
    extern fn gtk_progress_bar_set_show_text(p_pbar: *ProgressBar, p_show_text: c_int) void;
    pub const setShowText = gtk_progress_bar_set_show_text;

    /// Causes the given `text` to appear next to the progress bar.
    ///
    /// If `text` is `NULL` and `gtk.ProgressBar.properties.show_text` is `TRUE`,
    /// the current value of `gtk.ProgressBar.properties.fraction` will be displayed
    /// as a percentage.
    ///
    /// If `text` is non-`NULL` and `gtk.ProgressBar.properties.show_text` is `TRUE`,
    /// the text will be displayed. In this case, it will not display the progress
    /// percentage. If `text` is the empty string, the progress bar will still
    /// be styled and sized suitably for containing text, as long as
    /// `gtk.ProgressBar.properties.show_text` is `TRUE`.
    extern fn gtk_progress_bar_set_text(p_pbar: *ProgressBar, p_text: ?[*:0]const u8) void;
    pub const setText = gtk_progress_bar_set_text;

    extern fn gtk_progress_bar_get_type() usize;
    pub const getGObjectType = gtk_progress_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.ProgressBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ProgressBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ProgressBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GObject` property value in a `GtkExpression`.
pub const PropertyExpression = opaque {
    pub const Parent = gtk.Expression;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = PropertyExpression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates an expression that looks up a property.
    ///
    /// The object to use is found by evaluating the `expression`,
    /// or using the `this` argument when `expression` is `NULL`.
    ///
    /// If the resulting object conforms to `this_type`, its property named
    /// `property_name` will be queried. Otherwise, this expression's
    /// evaluation will fail.
    ///
    /// The given `this_type` must have a property with `property_name`.
    extern fn gtk_property_expression_new(p_this_type: usize, p_expression: ?*gtk.Expression, p_property_name: [*:0]const u8) *gtk.PropertyExpression;
    pub const new = gtk_property_expression_new;

    /// Creates an expression that looks up a property.
    ///
    /// The object to use is found by evaluating the `expression`,
    /// or using the `this` argument when `expression` is `NULL`.
    ///
    /// If the resulting object conforms to `this_type`, its
    /// property specified by `pspec` will be queried.
    /// Otherwise, this expression's evaluation will fail.
    extern fn gtk_property_expression_new_for_pspec(p_expression: ?*gtk.Expression, p_pspec: *gobject.ParamSpec) *gtk.PropertyExpression;
    pub const newForPspec = gtk_property_expression_new_for_pspec;

    /// Gets the expression specifying the object of
    /// a property expression.
    extern fn gtk_property_expression_get_expression(p_expression: *PropertyExpression) ?*gtk.Expression;
    pub const getExpression = gtk_property_expression_get_expression;

    /// Gets the `GParamSpec` specifying the property of
    /// a property expression.
    extern fn gtk_property_expression_get_pspec(p_expression: *PropertyExpression) *gobject.ParamSpec;
    pub const getPspec = gtk_property_expression_get_pspec;

    extern fn gtk_property_expression_get_type() usize;
    pub const getGObjectType = gtk_property_expression_get_type;

    pub fn as(p_instance: *PropertyExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Base class for widgets which visualize an adjustment.
///
/// Widgets that are derived from `GtkRange` include
/// `gtk.Scale` and `gtk.Scrollbar`.
///
/// Apart from signals for monitoring the parameters of the adjustment,
/// `GtkRange` provides properties and methods for setting a
/// “fill level” on range widgets. See `gtk.Range.setFillLevel`.
///
/// # Shortcuts and Gestures
///
/// The `GtkRange` slider is draggable. Holding the <kbd>Shift</kbd> key while
/// dragging, or initiating the drag with a long-press will enable the
/// fine-tuning mode.
pub const Range = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.RangeClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const adjust_bounds = struct {
            pub fn call(p_class: anytype, p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_new_value: f64) void {
                return gobject.ext.as(Range.Class, p_class).f_adjust_bounds.?(gobject.ext.as(Range, p_range), p_new_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_new_value: f64) callconv(.c) void) void {
                gobject.ext.as(Range.Class, p_class).f_adjust_bounds = @ptrCast(p_implementation);
            }
        };

        pub const change_value = struct {
            pub fn call(p_class: anytype, p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_scroll: gtk.ScrollType, p_new_value: f64) c_int {
                return gobject.ext.as(Range.Class, p_class).f_change_value.?(gobject.ext.as(Range, p_range), p_scroll, p_new_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_scroll: gtk.ScrollType, p_new_value: f64) callconv(.c) c_int) void {
                gobject.ext.as(Range.Class, p_class).f_change_value = @ptrCast(p_implementation);
            }
        };

        pub const get_range_border = struct {
            pub fn call(p_class: anytype, p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_border_: *gtk.Border) void {
                return gobject.ext.as(Range.Class, p_class).f_get_range_border.?(gobject.ext.as(Range, p_range), p_border_);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_border_: *gtk.Border) callconv(.c) void) void {
                gobject.ext.as(Range.Class, p_class).f_get_range_border = @ptrCast(p_implementation);
            }
        };

        pub const move_slider = struct {
            pub fn call(p_class: anytype, p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_scroll: gtk.ScrollType) void {
                return gobject.ext.as(Range.Class, p_class).f_move_slider.?(gobject.ext.as(Range, p_range), p_scroll);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_scroll: gtk.ScrollType) callconv(.c) void) void {
                gobject.ext.as(Range.Class, p_class).f_move_slider = @ptrCast(p_implementation);
            }
        };

        pub const value_changed = struct {
            pub fn call(p_class: anytype, p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Range.Class, p_class).f_value_changed.?(gobject.ext.as(Range, p_range));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_range: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Range.Class, p_class).f_value_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The adjustment that is controlled by the range.
        pub const adjustment = struct {
            pub const name = "adjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// The fill level (e.g. prebuffering of a network stream).
        pub const fill_level = struct {
            pub const name = "fill-level";

            pub const Type = f64;
        };

        /// If `TRUE`, the direction in which the slider moves is inverted.
        pub const inverted = struct {
            pub const name = "inverted";

            pub const Type = c_int;
        };

        /// Controls whether slider movement is restricted to an
        /// upper boundary set by the fill level.
        pub const restrict_to_fill_level = struct {
            pub const name = "restrict-to-fill-level";

            pub const Type = c_int;
        };

        /// The number of digits to round the value to when
        /// it changes.
        ///
        /// See `gtk.Range.signals.change_value`.
        pub const round_digits = struct {
            pub const name = "round-digits";

            pub const Type = c_int;
        };

        /// Controls whether fill level indicator graphics are displayed
        /// on the trough.
        pub const show_fill_level = struct {
            pub const name = "show-fill-level";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted before clamping a value, to give the application a
        /// chance to adjust the bounds.
        pub const adjust_bounds = struct {
            pub const name = "adjust-bounds";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_value: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Range, p_instance))),
                    gobject.signalLookup("adjust-bounds", Range.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a scroll action is performed on a range.
        ///
        /// It allows an application to determine the type of scroll event
        /// that occurred and the resultant new value. The application can
        /// handle the event itself and return `TRUE` to prevent further
        /// processing. Or, by returning `FALSE`, it can pass the event to
        /// other handlers until the default GTK handler is reached.
        ///
        /// The value parameter is unrounded. An application that overrides
        /// the ::change-value signal is responsible for clamping the value
        /// to the desired number of decimal digits; the default GTK
        /// handler clamps the value based on `gtk.Range.properties.round_digits`.
        pub const change_value = struct {
            pub const name = "change-value";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_scroll: gtk.ScrollType, p_value: f64, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Range, p_instance))),
                    gobject.signalLookup("change-value", Range.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Virtual function that moves the slider.
        ///
        /// Used for keybindings.
        pub const move_slider = struct {
            pub const name = "move-slider";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.ScrollType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Range, p_instance))),
                    gobject.signalLookup("move-slider", Range.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the range value changes.
        pub const value_changed = struct {
            pub const name = "value-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Range, p_instance))),
                    gobject.signalLookup("value-changed", Range.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Get the adjustment which is the “model” object for `GtkRange`.
    extern fn gtk_range_get_adjustment(p_range: *Range) *gtk.Adjustment;
    pub const getAdjustment = gtk_range_get_adjustment;

    /// Gets the current position of the fill level indicator.
    extern fn gtk_range_get_fill_level(p_range: *Range) f64;
    pub const getFillLevel = gtk_range_get_fill_level;

    /// Gets whether the `GtkRange` respects text direction.
    ///
    /// See `gtk.Range.setFlippable`.
    extern fn gtk_range_get_flippable(p_range: *Range) c_int;
    pub const getFlippable = gtk_range_get_flippable;

    /// Gets whether the range is inverted.
    ///
    /// See `gtk.Range.setInverted`.
    extern fn gtk_range_get_inverted(p_range: *Range) c_int;
    pub const getInverted = gtk_range_get_inverted;

    /// This function returns the area that contains the range’s trough,
    /// in coordinates relative to `range`'s origin.
    ///
    /// This function is useful mainly for `GtkRange` subclasses.
    extern fn gtk_range_get_range_rect(p_range: *Range, p_range_rect: *gdk.Rectangle) void;
    pub const getRangeRect = gtk_range_get_range_rect;

    /// Gets whether the range is restricted to the fill level.
    extern fn gtk_range_get_restrict_to_fill_level(p_range: *Range) c_int;
    pub const getRestrictToFillLevel = gtk_range_get_restrict_to_fill_level;

    /// Gets the number of digits to round the value to when
    /// it changes.
    ///
    /// See `gtk.Range.signals.change_value`.
    extern fn gtk_range_get_round_digits(p_range: *Range) c_int;
    pub const getRoundDigits = gtk_range_get_round_digits;

    /// Gets whether the range displays the fill level graphically.
    extern fn gtk_range_get_show_fill_level(p_range: *Range) c_int;
    pub const getShowFillLevel = gtk_range_get_show_fill_level;

    /// This function returns sliders range along the long dimension,
    /// in widget->window coordinates.
    ///
    /// This function is useful mainly for `GtkRange` subclasses.
    extern fn gtk_range_get_slider_range(p_range: *Range, p_slider_start: ?*c_int, p_slider_end: ?*c_int) void;
    pub const getSliderRange = gtk_range_get_slider_range;

    /// This function is useful mainly for `GtkRange` subclasses.
    ///
    /// See `gtk.Range.setSliderSizeFixed`.
    extern fn gtk_range_get_slider_size_fixed(p_range: *Range) c_int;
    pub const getSliderSizeFixed = gtk_range_get_slider_size_fixed;

    /// Gets the current value of the range.
    extern fn gtk_range_get_value(p_range: *Range) f64;
    pub const getValue = gtk_range_get_value;

    /// Sets the adjustment to be used as the “model” object for the `GtkRange`
    ///
    /// The adjustment indicates the current range value, the minimum and
    /// maximum range values, the step/page increments used for keybindings
    /// and scrolling, and the page size.
    ///
    /// The page size is normally 0 for `GtkScale` and nonzero for `GtkScrollbar`,
    /// and indicates the size of the visible area of the widget being scrolled.
    /// The page size affects the size of the scrollbar slider.
    extern fn gtk_range_set_adjustment(p_range: *Range, p_adjustment: *gtk.Adjustment) void;
    pub const setAdjustment = gtk_range_set_adjustment;

    /// Set the new position of the fill level indicator.
    ///
    /// The “fill level” is probably best described by its most prominent
    /// use case, which is an indicator for the amount of pre-buffering in
    /// a streaming media player. In that use case, the value of the range
    /// would indicate the current play position, and the fill level would
    /// be the position up to which the file/stream has been downloaded.
    ///
    /// This amount of prebuffering can be displayed on the range’s trough
    /// and is themeable separately from the trough. To enable fill level
    /// display, use `gtk.Range.setShowFillLevel`. The range defaults
    /// to not showing the fill level.
    ///
    /// Additionally, it’s possible to restrict the range’s slider position
    /// to values which are smaller than the fill level. This is controlled
    /// by `gtk.Range.setRestrictToFillLevel` and is by default
    /// enabled.
    extern fn gtk_range_set_fill_level(p_range: *Range, p_fill_level: f64) void;
    pub const setFillLevel = gtk_range_set_fill_level;

    /// Sets whether the `GtkRange` respects text direction.
    ///
    /// If a range is flippable, it will switch its direction
    /// if it is horizontal and its direction is `GTK_TEXT_DIR_RTL`.
    ///
    /// See `gtk.Widget.getDirection`.
    extern fn gtk_range_set_flippable(p_range: *Range, p_flippable: c_int) void;
    pub const setFlippable = gtk_range_set_flippable;

    /// Sets the step and page sizes for the range.
    ///
    /// The step size is used when the user clicks the `GtkScrollbar`
    /// arrows or moves a `GtkScale` via arrow keys. The page size
    /// is used for example when moving via Page Up or Page Down keys.
    extern fn gtk_range_set_increments(p_range: *Range, p_step: f64, p_page: f64) void;
    pub const setIncrements = gtk_range_set_increments;

    /// Sets whether to invert the range.
    ///
    /// Ranges normally move from lower to higher values as the
    /// slider moves from top to bottom or left to right. Inverted
    /// ranges have higher values at the top or on the right rather
    /// than on the bottom or left.
    extern fn gtk_range_set_inverted(p_range: *Range, p_setting: c_int) void;
    pub const setInverted = gtk_range_set_inverted;

    /// Sets the allowable values in the `GtkRange`.
    ///
    /// The range value is clamped to be between `min` and `max`.
    /// (If the range has a non-zero page size, it is clamped
    /// between `min` and `max` - page-size.)
    extern fn gtk_range_set_range(p_range: *Range, p_min: f64, p_max: f64) void;
    pub const setRange = gtk_range_set_range;

    /// Sets whether the slider is restricted to the fill level.
    ///
    /// See `gtk.Range.setFillLevel` for a general description
    /// of the fill level concept.
    extern fn gtk_range_set_restrict_to_fill_level(p_range: *Range, p_restrict_to_fill_level: c_int) void;
    pub const setRestrictToFillLevel = gtk_range_set_restrict_to_fill_level;

    /// Sets the number of digits to round the value to when
    /// it changes.
    ///
    /// See `gtk.Range.signals.change_value`.
    extern fn gtk_range_set_round_digits(p_range: *Range, p_round_digits: c_int) void;
    pub const setRoundDigits = gtk_range_set_round_digits;

    /// Sets whether a graphical fill level is show on the trough.
    ///
    /// See `gtk.Range.setFillLevel` for a general description
    /// of the fill level concept.
    extern fn gtk_range_set_show_fill_level(p_range: *Range, p_show_fill_level: c_int) void;
    pub const setShowFillLevel = gtk_range_set_show_fill_level;

    /// Sets whether the range’s slider has a fixed size, or a size that
    /// depends on its adjustment’s page size.
    ///
    /// This function is useful mainly for `GtkRange` subclasses.
    extern fn gtk_range_set_slider_size_fixed(p_range: *Range, p_size_fixed: c_int) void;
    pub const setSliderSizeFixed = gtk_range_set_slider_size_fixed;

    /// Sets the current value of the range.
    ///
    /// If the value is outside the minimum or maximum range values,
    /// it will be clamped to fit inside them. The range emits the
    /// `gtk.Range.signals.value_changed` signal if the value changes.
    extern fn gtk_range_set_value(p_range: *Range, p_value: f64) void;
    pub const setValue = gtk_range_set_value;

    extern fn gtk_range_get_type() usize;
    pub const getGObjectType = gtk_range_get_type;

    extern fn g_object_ref(p_self: *gtk.Range) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Range) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Range, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Manages and looks up recently used files.
///
/// Each recently used file is identified by its URI, and has meta-data
/// associated to it, like the names and command lines of the applications
/// that have registered it, the number of time each application has
/// registered the same file, the mime type of the file and whether
/// the file should be displayed only by the applications that have
/// registered it.
///
/// The recently used files list is per user.
///
/// `GtkRecentManager` acts like a database of all the recently
/// used files. You can create new `GtkRecentManager` objects, but
/// it is more efficient to use the default manager created by GTK.
///
/// Adding a new recently used file is as simple as:
///
/// ```c
/// GtkRecentManager *manager;
///
/// manager = gtk_recent_manager_get_default ();
/// gtk_recent_manager_add_item (manager, file_uri);
/// ```
///
/// The `GtkRecentManager` will try to gather all the needed information
/// from the file itself through GIO.
///
/// Looking up the meta-data associated with a recently used file
/// given its URI requires calling `gtk.RecentManager.lookupItem`:
///
/// ```c
/// GtkRecentManager *manager;
/// GtkRecentInfo *info;
/// GError *error = NULL;
///
/// manager = gtk_recent_manager_get_default ();
/// info = gtk_recent_manager_lookup_item (manager, file_uri, &error);
/// if (error)
///   {
///     g_warning ("Could not find the file: `s`", error->message);
///     g_error_free (error);
///   }
/// else
///  {
///    // Use the info object
///    gtk_recent_info_unref (info);
///  }
/// ```
///
/// In order to retrieve the list of recently used files, you can use
/// `gtk.RecentManager.getItems`, which returns a list of
/// `gtk.RecentInfo`.
///
/// Note that the maximum age of the recently used files list is
/// controllable through the `gtk.Settings.properties.gtk_recent_files_max_age`
/// property.
pub const RecentManager = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.RecentManagerClass;
    f_parent_instance: gobject.Object,
    f_priv: ?*gtk.RecentManagerPrivate,

    pub const virtual_methods = struct {
        pub const changed = struct {
            pub fn call(p_class: anytype, p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(RecentManager.Class, p_class).f_changed.?(gobject.ext.as(RecentManager, p_manager));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_manager: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(RecentManager.Class, p_class).f_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The full path to the file to be used to store and read the
        /// recently used resources list
        pub const filename = struct {
            pub const name = "filename";

            pub const Type = ?[*:0]u8;
        };

        /// The size of the recently used resources list.
        pub const size = struct {
            pub const name = "size";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the current recently used resources manager changes
        /// its contents.
        ///
        /// This can happen either by calling `gtk.RecentManager.addItem`
        /// or by another application.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(RecentManager, p_instance))),
                    gobject.signalLookup("changed", RecentManager.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Gets a unique instance of `GtkRecentManager` that you can share
    /// in your application without caring about memory management.
    extern fn gtk_recent_manager_get_default() *gtk.RecentManager;
    pub const getDefault = gtk_recent_manager_get_default;

    /// Creates a new recent manager object.
    ///
    /// Recent manager objects are used to handle the list of recently used
    /// resources. A `GtkRecentManager` object monitors the recently used
    /// resources list, and emits the `gtk.RecentManager.signals.changed`
    /// signal each time something inside the list changes.
    ///
    /// `GtkRecentManager` objects are expensive: be sure to create them
    /// only when needed. You should use `gtk.RecentManager.getDefault`
    /// instead.
    extern fn gtk_recent_manager_new() *gtk.RecentManager;
    pub const new = gtk_recent_manager_new;

    /// Adds a new resource, pointed by `uri`, into the recently used
    /// resources list, using the metadata specified inside the
    /// `GtkRecentData` passed in `recent_data`.
    ///
    /// The passed URI will be used to identify this resource inside the
    /// list.
    ///
    /// In order to register the new recently used resource, metadata about
    /// the resource must be passed as well as the URI; the metadata is
    /// stored in a `GtkRecentData`, which must contain the MIME
    /// type of the resource pointed by the URI; the name of the application
    /// that is registering the item, and a command line to be used when
    /// launching the item.
    ///
    /// Optionally, a `GtkRecentData` might contain a UTF-8 string
    /// to be used when viewing the item instead of the last component of
    /// the URI; a short description of the item; whether the item should
    /// be considered private - that is, should be displayed only by the
    /// applications that have registered it.
    extern fn gtk_recent_manager_add_full(p_manager: *RecentManager, p_uri: [*:0]const u8, p_recent_data: *const gtk.RecentData) c_int;
    pub const addFull = gtk_recent_manager_add_full;

    /// Adds a new resource, pointed by `uri`, into the recently used
    /// resources list.
    ///
    /// This function automatically retrieves some of the needed
    /// metadata and setting other metadata to common default values;
    /// it then feeds the data to `gtk.RecentManager.addFull`.
    ///
    /// See `gtk.RecentManager.addFull` if you want to explicitly
    /// define the metadata for the resource pointed by `uri`.
    extern fn gtk_recent_manager_add_item(p_manager: *RecentManager, p_uri: [*:0]const u8) c_int;
    pub const addItem = gtk_recent_manager_add_item;

    /// Gets the list of recently used resources.
    extern fn gtk_recent_manager_get_items(p_manager: *RecentManager) *glib.List;
    pub const getItems = gtk_recent_manager_get_items;

    /// Checks whether there is a recently used resource registered
    /// with `uri` inside the recent manager.
    extern fn gtk_recent_manager_has_item(p_manager: *RecentManager, p_uri: [*:0]const u8) c_int;
    pub const hasItem = gtk_recent_manager_has_item;

    /// Searches for a URI inside the recently used resources list, and
    /// returns a `GtkRecentInfo` containing information about the resource
    /// like its MIME type, or its display name.
    extern fn gtk_recent_manager_lookup_item(p_manager: *RecentManager, p_uri: [*:0]const u8, p_error: ?*?*glib.Error) ?*gtk.RecentInfo;
    pub const lookupItem = gtk_recent_manager_lookup_item;

    /// Changes the location of a recently used resource from `uri` to `new_uri`.
    ///
    /// Please note that this function will not affect the resource pointed
    /// by the URIs, but only the URI used in the recently used resources list.
    extern fn gtk_recent_manager_move_item(p_manager: *RecentManager, p_uri: [*:0]const u8, p_new_uri: ?[*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const moveItem = gtk_recent_manager_move_item;

    /// Purges every item from the recently used resources list.
    extern fn gtk_recent_manager_purge_items(p_manager: *RecentManager, p_error: ?*?*glib.Error) c_int;
    pub const purgeItems = gtk_recent_manager_purge_items;

    /// Removes a resource pointed by `uri` from the recently used resources
    /// list handled by a recent manager.
    extern fn gtk_recent_manager_remove_item(p_manager: *RecentManager, p_uri: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const removeItem = gtk_recent_manager_remove_item;

    extern fn gtk_recent_manager_get_type() usize;
    pub const getGObjectType = gtk_recent_manager_get_type;

    extern fn g_object_ref(p_self: *gtk.RecentManager) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.RecentManager) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *RecentManager, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Animates the transition of its child from invisible to visible.
///
/// The style of transition can be controlled with
/// `gtk.Revealer.setTransitionType`.
///
/// These animations respect the `gtk.Settings.properties.gtk_enable_animations`
/// setting.
///
/// # CSS nodes
///
/// `GtkRevealer` has a single CSS node with name revealer.
/// When styling `GtkRevealer` using CSS, remember that it only hides its contents,
/// not itself. That means applied margin, padding and borders will be visible even
/// when the `gtk.Revealer.properties.reveal_child` property is set to `FALSE`.
///
/// # Accessibility
///
/// `GtkRevealer` uses the `gtk.@"AccessibleRole.group"` role.
///
/// The child of `GtkRevealer`, if set, is always available in the accessibility
/// tree, regardless of the state of the revealer widget.
pub const Revealer = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Revealer;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the child is revealed and the animation target reached.
        pub const child_revealed = struct {
            pub const name = "child-revealed";

            pub const Type = c_int;
        };

        /// Whether the revealer should reveal the child.
        pub const reveal_child = struct {
            pub const name = "reveal-child";

            pub const Type = c_int;
        };

        /// The animation duration, in milliseconds.
        pub const transition_duration = struct {
            pub const name = "transition-duration";

            pub const Type = c_uint;
        };

        /// The type of animation used to transition.
        pub const transition_type = struct {
            pub const name = "transition-type";

            pub const Type = gtk.RevealerTransitionType;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkRevealer`.
    extern fn gtk_revealer_new() *gtk.Revealer;
    pub const new = gtk_revealer_new;

    /// Gets the child widget of `revealer`.
    extern fn gtk_revealer_get_child(p_revealer: *Revealer) ?*gtk.Widget;
    pub const getChild = gtk_revealer_get_child;

    /// Returns whether the child is fully revealed.
    ///
    /// In other words, this returns whether the transition
    /// to the revealed state is completed.
    extern fn gtk_revealer_get_child_revealed(p_revealer: *Revealer) c_int;
    pub const getChildRevealed = gtk_revealer_get_child_revealed;

    /// Returns whether the child is currently revealed.
    ///
    /// This function returns `TRUE` as soon as the transition
    /// is to the revealed state is started. To learn whether
    /// the child is fully revealed (ie the transition is completed),
    /// use `gtk.Revealer.getChildRevealed`.
    extern fn gtk_revealer_get_reveal_child(p_revealer: *Revealer) c_int;
    pub const getRevealChild = gtk_revealer_get_reveal_child;

    /// Returns the amount of time (in milliseconds) that
    /// transitions will take.
    extern fn gtk_revealer_get_transition_duration(p_revealer: *Revealer) c_uint;
    pub const getTransitionDuration = gtk_revealer_get_transition_duration;

    /// Gets the type of animation that will be used
    /// for transitions in `revealer`.
    extern fn gtk_revealer_get_transition_type(p_revealer: *Revealer) gtk.RevealerTransitionType;
    pub const getTransitionType = gtk_revealer_get_transition_type;

    /// Sets the child widget of `revealer`.
    extern fn gtk_revealer_set_child(p_revealer: *Revealer, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_revealer_set_child;

    /// Tells the `GtkRevealer` to reveal or conceal its child.
    ///
    /// The transition will be animated with the current
    /// transition type of `revealer`.
    extern fn gtk_revealer_set_reveal_child(p_revealer: *Revealer, p_reveal_child: c_int) void;
    pub const setRevealChild = gtk_revealer_set_reveal_child;

    /// Sets the duration that transitions will take.
    extern fn gtk_revealer_set_transition_duration(p_revealer: *Revealer, p_duration: c_uint) void;
    pub const setTransitionDuration = gtk_revealer_set_transition_duration;

    /// Sets the type of animation that will be used for
    /// transitions in `revealer`.
    ///
    /// Available types include various kinds of fades and slides.
    extern fn gtk_revealer_set_transition_type(p_revealer: *Revealer, p_transition: gtk.RevealerTransitionType) void;
    pub const setTransitionType = gtk_revealer_set_transition_type;

    extern fn gtk_revealer_get_type() usize;
    pub const getGObjectType = gtk_revealer_get_type;

    extern fn g_object_ref(p_self: *gtk.Revealer) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Revealer) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Revealer, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows to select a numeric value with a slider control.
///
/// <picture>
///   <source srcset="scales-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkScale" src="scales.png">
/// </picture>
///
/// To use it, you’ll probably want to investigate the methods on its base
/// class, `gtk.Range`, in addition to the methods for `GtkScale` itself.
/// To set the value of a scale, you would normally use `gtk.Range.setValue`.
/// To detect changes to the value, you would normally use the
/// `gtk.Range.signals.value_changed` signal.
///
/// Note that using the same upper and lower bounds for the `GtkScale` (through
/// the `GtkRange` methods) will hide the slider itself. This is useful for
/// applications that want to show an undeterminate value on the scale, without
/// changing the layout of the application (such as movie or music players).
///
/// # GtkScale as GtkBuildable
///
/// `GtkScale` supports a custom `<marks>` element, which can contain multiple
/// `<mark\>` elements. The “value” and “position” attributes have the same
/// meaning as `gtk.Scale.addMark` parameters of the same name. If
/// the element is not empty, its content is taken as the markup to show at
/// the mark. It can be translated with the usual ”translatable” and
/// “context” attributes.
///
/// # Shortcuts and Gestures
///
/// `GtkPopoverMenu` supports the following keyboard shortcuts:
///
/// - Arrow keys, <kbd>+</kbd> and <kbd>-</kbd> will increment or decrement
///   by step, or by page when combined with <kbd>Ctrl</kbd>.
/// - <kbd>PgUp</kbd> and <kbd>PgDn</kbd> will increment or decrement by page.
/// - <kbd>Home</kbd> and <kbd>End</kbd> will set the minimum or maximum value.
///
/// # CSS nodes
///
/// ```
/// scale[.fine-tune][.marks-before][.marks-after]
/// ├── [value][.top][.right][.bottom][.left]
/// ├── marks.top
/// │   ├── mark
/// │   ┊    ├── [label]
/// │   ┊    ╰── indicator
/// ┊   ┊
/// │   ╰── mark
/// ├── marks.bottom
/// │   ├── mark
/// │   ┊    ├── indicator
/// │   ┊    ╰── [label]
/// ┊   ┊
/// │   ╰── mark
/// ╰── trough
///     ├── [fill]
///     ├── [highlight]
///     ╰── slider
/// ```
///
/// `GtkScale` has a main CSS node with name scale and a subnode for its contents,
/// with subnodes named trough and slider.
///
/// The main node gets the style class .fine-tune added when the scale is in
/// 'fine-tuning' mode.
///
/// If the scale has an origin (see `gtk.Scale.setHasOrigin`), there is
/// a subnode with name highlight below the trough node that is used for rendering
/// the highlighted part of the trough.
///
/// If the scale is showing a fill level (see `gtk.Range.setShowFillLevel`),
/// there is a subnode with name fill below the trough node that is used for
/// rendering the filled in part of the trough.
///
/// If marks are present, there is a marks subnode before or after the trough
/// node, below which each mark gets a node with name mark. The marks nodes get
/// either the .top or .bottom style class.
///
/// The mark node has a subnode named indicator. If the mark has text, it also
/// has a subnode named label. When the mark is either above or left of the
/// scale, the label subnode is the first when present. Otherwise, the indicator
/// subnode is the first.
///
/// The main CSS node gets the 'marks-before' and/or 'marks-after' style classes
/// added depending on what marks are present.
///
/// If the scale is displaying the value (see `gtk.Scale.properties.draw_value`),
/// there is subnode with name value. This node will get the .top or .bottom style
/// classes similar to the marks node.
///
/// # Accessibility
///
/// `GtkScale` uses the `gtk.@"AccessibleRole.slider"` role.
pub const Scale = extern struct {
    pub const Parent = gtk.Range;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.ScaleClass;
    f_parent_instance: gtk.Range,

    pub const virtual_methods = struct {
        /// Obtains the coordinates where the scale will draw the
        /// `PangoLayout` representing the text in the scale.
        ///
        /// Remember when using the `PangoLayout` function you need to
        /// convert to and from pixels using ``PANGO_PIXELS`` or `PANGO_SCALE`.
        ///
        /// If the `gtk.Scale.properties.draw_value` property is `FALSE`, the return
        /// values are undefined.
        pub const get_layout_offsets = struct {
            pub fn call(p_class: anytype, p_scale: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: ?*c_int, p_y: ?*c_int) void {
                return gobject.ext.as(Scale.Class, p_class).f_get_layout_offsets.?(gobject.ext.as(Scale, p_scale), p_x, p_y);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_scale: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: ?*c_int, p_y: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(Scale.Class, p_class).f_get_layout_offsets = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The number of decimal places that are displayed in the value.
        pub const digits = struct {
            pub const name = "digits";

            pub const Type = c_int;
        };

        /// Whether the current value is displayed as a string next to the slider.
        pub const draw_value = struct {
            pub const name = "draw-value";

            pub const Type = c_int;
        };

        /// Whether the scale has an origin.
        pub const has_origin = struct {
            pub const name = "has-origin";

            pub const Type = c_int;
        };

        /// The position in which the current value is displayed.
        pub const value_pos = struct {
            pub const name = "value-pos";

            pub const Type = gtk.PositionType;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkScale`.
    extern fn gtk_scale_new(p_orientation: gtk.Orientation, p_adjustment: ?*gtk.Adjustment) *gtk.Scale;
    pub const new = gtk_scale_new;

    /// Creates a new scale widget with a range from `min` to `max`.
    ///
    /// The returns scale will have the given orientation and will let the
    /// user input a number between `min` and `max` (including `min` and `max`)
    /// with the increment `step`. `step` must be nonzero; it’s the distance
    /// the slider moves when using the arrow keys to adjust the scale
    /// value.
    ///
    /// Note that the way in which the precision is derived works best if
    /// `step` is a power of ten. If the resulting precision is not suitable
    /// for your needs, use `gtk.Scale.setDigits` to correct it.
    extern fn gtk_scale_new_with_range(p_orientation: gtk.Orientation, p_min: f64, p_max: f64, p_step: f64) *gtk.Scale;
    pub const newWithRange = gtk_scale_new_with_range;

    /// Adds a mark at `value`.
    ///
    /// A mark is indicated visually by drawing a tick mark next to the scale,
    /// and GTK makes it easy for the user to position the scale exactly at the
    /// marks value.
    ///
    /// If `markup` is not `NULL`, text is shown next to the tick mark.
    ///
    /// To remove marks from a scale, use `gtk.Scale.clearMarks`.
    extern fn gtk_scale_add_mark(p_scale: *Scale, p_value: f64, p_position: gtk.PositionType, p_markup: ?[*:0]const u8) void;
    pub const addMark = gtk_scale_add_mark;

    /// Removes any marks that have been added.
    extern fn gtk_scale_clear_marks(p_scale: *Scale) void;
    pub const clearMarks = gtk_scale_clear_marks;

    /// Gets the number of decimal places that are displayed in the value.
    extern fn gtk_scale_get_digits(p_scale: *Scale) c_int;
    pub const getDigits = gtk_scale_get_digits;

    /// Returns whether the current value is displayed as a string
    /// next to the slider.
    extern fn gtk_scale_get_draw_value(p_scale: *Scale) c_int;
    pub const getDrawValue = gtk_scale_get_draw_value;

    /// Returns whether the scale has an origin.
    extern fn gtk_scale_get_has_origin(p_scale: *Scale) c_int;
    pub const getHasOrigin = gtk_scale_get_has_origin;

    /// Gets the `PangoLayout` used to display the scale.
    ///
    /// The returned object is owned by the scale so does not need
    /// to be freed by the caller.
    extern fn gtk_scale_get_layout(p_scale: *Scale) ?*pango.Layout;
    pub const getLayout = gtk_scale_get_layout;

    /// Obtains the coordinates where the scale will draw the
    /// `PangoLayout` representing the text in the scale.
    ///
    /// Remember when using the `PangoLayout` function you need to
    /// convert to and from pixels using ``PANGO_PIXELS`` or `PANGO_SCALE`.
    ///
    /// If the `gtk.Scale.properties.draw_value` property is `FALSE`, the return
    /// values are undefined.
    extern fn gtk_scale_get_layout_offsets(p_scale: *Scale, p_x: ?*c_int, p_y: ?*c_int) void;
    pub const getLayoutOffsets = gtk_scale_get_layout_offsets;

    /// Gets the position in which the current value is displayed.
    extern fn gtk_scale_get_value_pos(p_scale: *Scale) gtk.PositionType;
    pub const getValuePos = gtk_scale_get_value_pos;

    /// Sets the number of decimal places that are displayed in the value.
    ///
    /// Also causes the value of the adjustment to be rounded to this number
    /// of digits, so the retrieved value matches the displayed one, if
    /// `gtk.Scale.properties.draw_value` is `TRUE` when the value changes. If
    /// you want to enforce rounding the value when `gtk.Scale.properties.draw_value`
    /// is `FALSE`, you can set `gtk.Range.properties.round_digits` instead.
    ///
    /// Note that rounding to a small number of digits can interfere with
    /// the smooth autoscrolling that is built into `GtkScale`. As an alternative,
    /// you can use `gtk.Scale.setFormatValueFunc` to format the displayed
    /// value yourself.
    extern fn gtk_scale_set_digits(p_scale: *Scale, p_digits: c_int) void;
    pub const setDigits = gtk_scale_set_digits;

    /// Specifies whether the current value is displayed as a string next
    /// to the slider.
    extern fn gtk_scale_set_draw_value(p_scale: *Scale, p_draw_value: c_int) void;
    pub const setDrawValue = gtk_scale_set_draw_value;

    /// `func` allows you to change how the scale value is displayed.
    ///
    /// The given function will return an allocated string representing
    /// `value`. That string will then be used to display the scale's value.
    ///
    /// If `NULL` is passed as `func`, the value will be displayed on
    /// its own, rounded according to the value of the
    /// `gtk.Scale.properties.digits` property.
    extern fn gtk_scale_set_format_value_func(p_scale: *Scale, p_func: ?gtk.ScaleFormatValueFunc, p_user_data: ?*anyopaque, p_destroy_notify: ?glib.DestroyNotify) void;
    pub const setFormatValueFunc = gtk_scale_set_format_value_func;

    /// Sets whether the scale has an origin.
    ///
    /// If `gtk.Scale.properties.has_origin` is set to `TRUE` (the default),
    /// the scale will highlight the part of the trough between the origin
    /// (bottom or left side) and the current value.
    extern fn gtk_scale_set_has_origin(p_scale: *Scale, p_has_origin: c_int) void;
    pub const setHasOrigin = gtk_scale_set_has_origin;

    /// Sets the position in which the current value is displayed.
    extern fn gtk_scale_set_value_pos(p_scale: *Scale, p_pos: gtk.PositionType) void;
    pub const setValuePos = gtk_scale_set_value_pos;

    extern fn gtk_scale_get_type() usize;
    pub const getGObjectType = gtk_scale_get_type;

    extern fn g_object_ref(p_self: *gtk.Scale) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Scale) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Scale, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides a button which pops up a scale widget.
///
/// This kind of widget is commonly used for volume controls in multimedia
/// applications, and GTK provides a `gtk.VolumeButton` subclass that
/// is tailored for this use case.
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.ScaleButton.signals.popup`
///
/// # CSS nodes
///
/// ```
/// scalebutton.scale
/// ╰── button.toggle
///     ╰── <icon>
/// ```
///
/// `GtkScaleButton` has a single CSS node with name scalebutton and `.scale`
/// style class, and contains a `button` node with a `.toggle` style class.
pub const ScaleButton = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.ScaleButtonClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const value_changed = struct {
            pub fn call(p_class: anytype, p_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_value: f64) void {
                return gobject.ext.as(ScaleButton.Class, p_class).f_value_changed.?(gobject.ext.as(ScaleButton, p_button), p_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_value: f64) callconv(.c) void) void {
                gobject.ext.as(ScaleButton.Class, p_class).f_value_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// If the scale button should be pressed in.
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// The `GtkAdjustment` that is used as the model.
        pub const adjustment = struct {
            pub const name = "adjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// If the scale button has a frame.
        pub const has_frame = struct {
            pub const name = "has-frame";

            pub const Type = c_int;
        };

        /// The names of the icons to be used by the scale button.
        ///
        /// The first item in the array will be used in the button
        /// when the current value is the lowest value, the second
        /// item for the highest value. All the subsequent icons will
        /// be used for all the other values, spread evenly over the
        /// range of values.
        ///
        /// If there's only one icon name in the `icons` array, it will
        /// be used for all the values. If only two icon names are in
        /// the `icons` array, the first one will be used for the bottom
        /// 50% of the scale, and the second one for the top 50%.
        ///
        /// It is recommended to use at least 3 icons so that the
        /// `GtkScaleButton` reflects the current value of the scale
        /// better for the users.
        pub const icons = struct {
            pub const name = "icons";

            pub const Type = ?[*][*:0]u8;
        };

        /// The value of the scale.
        pub const value = struct {
            pub const name = "value";

            pub const Type = f64;
        };
    };

    pub const signals = struct {
        /// Emitted to dismiss the popup.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Escape</kbd>.
        pub const popdown = struct {
            pub const name = "popdown";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScaleButton, p_instance))),
                    gobject.signalLookup("popdown", ScaleButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to popup the scale widget.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are <kbd>Space</kbd>,
        /// <kbd>Enter</kbd> and <kbd>Return</kbd>.
        pub const popup = struct {
            pub const name = "popup";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScaleButton, p_instance))),
                    gobject.signalLookup("popup", ScaleButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the value field has changed.
        pub const value_changed = struct {
            pub const name = "value-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_value: f64, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScaleButton, p_instance))),
                    gobject.signalLookup("value-changed", ScaleButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a `GtkScaleButton`.
    ///
    /// The new scale button has a range between `min` and `max`,
    /// with a stepping of `step`.
    extern fn gtk_scale_button_new(p_min: f64, p_max: f64, p_step: f64, p_icons: ?[*][*:0]const u8) *gtk.ScaleButton;
    pub const new = gtk_scale_button_new;

    /// Queries a `GtkScaleButton` and returns its current state.
    ///
    /// Returns `TRUE` if the scale button is pressed in and `FALSE`
    /// if it is raised.
    extern fn gtk_scale_button_get_active(p_button: *ScaleButton) c_int;
    pub const getActive = gtk_scale_button_get_active;

    /// Gets the `GtkAdjustment` associated with the `GtkScaleButton`’s scale.
    ///
    /// See `gtk.Range.getAdjustment` for details.
    extern fn gtk_scale_button_get_adjustment(p_button: *ScaleButton) *gtk.Adjustment;
    pub const getAdjustment = gtk_scale_button_get_adjustment;

    /// Returns whether the button has a frame.
    extern fn gtk_scale_button_get_has_frame(p_button: *ScaleButton) c_int;
    pub const getHasFrame = gtk_scale_button_get_has_frame;

    /// Retrieves the minus button of the `GtkScaleButton`.
    extern fn gtk_scale_button_get_minus_button(p_button: *ScaleButton) *gtk.Button;
    pub const getMinusButton = gtk_scale_button_get_minus_button;

    /// Retrieves the plus button of the `GtkScaleButton.`
    extern fn gtk_scale_button_get_plus_button(p_button: *ScaleButton) *gtk.Button;
    pub const getPlusButton = gtk_scale_button_get_plus_button;

    /// Retrieves the popup of the `GtkScaleButton`.
    extern fn gtk_scale_button_get_popup(p_button: *ScaleButton) *gtk.Widget;
    pub const getPopup = gtk_scale_button_get_popup;

    /// Gets the current value of the scale button.
    extern fn gtk_scale_button_get_value(p_button: *ScaleButton) f64;
    pub const getValue = gtk_scale_button_get_value;

    /// Sets the `GtkAdjustment` to be used as a model
    /// for the `GtkScaleButton`’s scale.
    ///
    /// See `gtk.Range.setAdjustment` for details.
    extern fn gtk_scale_button_set_adjustment(p_button: *ScaleButton, p_adjustment: *gtk.Adjustment) void;
    pub const setAdjustment = gtk_scale_button_set_adjustment;

    /// Sets the style of the button.
    extern fn gtk_scale_button_set_has_frame(p_button: *ScaleButton, p_has_frame: c_int) void;
    pub const setHasFrame = gtk_scale_button_set_has_frame;

    /// Sets the icons to be used by the scale button.
    extern fn gtk_scale_button_set_icons(p_button: *ScaleButton, p_icons: [*][*:0]const u8) void;
    pub const setIcons = gtk_scale_button_set_icons;

    /// Sets the current value of the scale.
    ///
    /// If the value is outside the minimum or maximum range values,
    /// it will be clamped to fit inside them.
    ///
    /// The scale button emits the `gtk.ScaleButton.signals.value_changed`
    /// signal if the value changes.
    extern fn gtk_scale_button_set_value(p_button: *ScaleButton, p_value: f64) void;
    pub const setValue = gtk_scale_button_set_value;

    extern fn gtk_scale_button_get_type() usize;
    pub const getGObjectType = gtk_scale_button_get_type;

    extern fn g_object_ref(p_self: *gtk.ScaleButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ScaleButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ScaleButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a horizontal or vertical scrollbar.
///
/// <picture>
///   <source srcset="scrollbar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkScrollbar" src="scrollbar.png">
/// </picture>
///
/// Its position and movement are controlled by the adjustment that is passed to
/// or created by `gtk.Scrollbar.new`. See `gtk.Adjustment` for more
/// details. The `gtk.Adjustment.properties.value` field sets the position of the
/// thumb and must be between `gtk.Adjustment.properties.lower` and
/// `gtk.Adjustment.properties.upper` - `gtk.Adjustment.properties.page_size`.
/// The `gtk.Adjustment.properties.page_size` represents the size of the visible
/// scrollable area.
///
/// The fields `gtk.Adjustment.properties.step_increment` and
/// `gtk.Adjustment.properties.page_increment` fields are added to or subtracted
/// from the `gtk.Adjustment.properties.value` when the user asks to move by a step
/// (using e.g. the cursor arrow keys) or by a page (using e.g. the Page Down/Up
/// keys).
///
/// # CSS nodes
///
/// ```
/// scrollbar
/// ╰── range[.fine-tune]
///     ╰── trough
///         ╰── slider
/// ```
///
/// `GtkScrollbar` has a main CSS node with name scrollbar and a subnode for its
/// contents. The main node gets the .horizontal or .vertical style classes applied,
/// depending on the scrollbar's orientation.
///
/// The range node gets the style class .fine-tune added when the scrollbar is
/// in 'fine-tuning' mode.
///
/// Other style classes that may be added to scrollbars inside
/// `gtk.ScrolledWindow` include the positional classes (.left, .right,
/// .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator,
/// .dragging, .hovering).
///
/// # Accessibility
///
/// `GtkScrollbar` uses the `gtk.@"AccessibleRole.scrollbar"` role.
pub const Scrollbar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = Scrollbar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The `GtkAdjustment` controlled by this scrollbar.
        pub const adjustment = struct {
            pub const name = "adjustment";

            pub const Type = ?*gtk.Adjustment;
        };
    };

    pub const signals = struct {};

    /// Creates a new scrollbar with the given orientation.
    extern fn gtk_scrollbar_new(p_orientation: gtk.Orientation, p_adjustment: ?*gtk.Adjustment) *gtk.Scrollbar;
    pub const new = gtk_scrollbar_new;

    /// Returns the scrollbar's adjustment.
    extern fn gtk_scrollbar_get_adjustment(p_self: *Scrollbar) *gtk.Adjustment;
    pub const getAdjustment = gtk_scrollbar_get_adjustment;

    /// Makes the scrollbar use the given adjustment.
    extern fn gtk_scrollbar_set_adjustment(p_self: *Scrollbar, p_adjustment: ?*gtk.Adjustment) void;
    pub const setAdjustment = gtk_scrollbar_set_adjustment;

    extern fn gtk_scrollbar_get_type() usize;
    pub const getGObjectType = gtk_scrollbar_get_type;

    extern fn g_object_ref(p_self: *gtk.Scrollbar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Scrollbar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Scrollbar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Makes its child scrollable.
///
/// <picture>
///   <source srcset="scrolledwindow-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkScrolledWindow" src="scrolledwindow.png">
/// </picture>
///
/// It does so using either internally added scrollbars or externally
/// associated adjustments, and optionally draws a frame around the child.
///
/// Widgets with native scrolling support, i.e. those whose classes implement
/// the `gtk.Scrollable` interface, are added directly. For other types
/// of widget, the class `gtk.Viewport` acts as an adaptor, giving
/// scrollability to other widgets. `gtk.ScrolledWindow.setChild`
/// intelligently accounts for whether or not the added child is a `GtkScrollable`.
/// If it isn’t, then it wraps the child in a `GtkViewport`. Therefore, you can
/// just add any child widget and not worry about the details.
///
/// If `gtk.ScrolledWindow.setChild` has added a `GtkViewport` for you,
/// it will be automatically removed when you unset the child.
/// Unless `gtk.ScrolledWindow.properties.hscrollbar_policy` and
/// `gtk.ScrolledWindow.properties.vscrollbar_policy` are `GTK_POLICY_NEVER` or
/// `GTK_POLICY_EXTERNAL`, `GtkScrolledWindow` adds internal `GtkScrollbar` widgets
/// around its child. The scroll position of the child, and if applicable the
/// scrollbars, is controlled by the `gtk.ScrolledWindow.properties.hadjustment`
/// and `gtk.ScrolledWindow.properties.vadjustment` that are associated with the
/// `GtkScrolledWindow`. See the docs on `gtk.Scrollbar` for the details,
/// but note that the “step_increment” and “page_increment” fields are only
/// effective if the policy causes scrollbars to be present.
///
/// If a `GtkScrolledWindow` doesn’t behave quite as you would like, or
/// doesn’t have exactly the right layout, it’s very possible to set up
/// your own scrolling with `GtkScrollbar` and for example a `GtkGrid`.
///
/// # Touch support
///
/// `GtkScrolledWindow` has built-in support for touch devices. When a
/// touchscreen is used, swiping will move the scrolled window, and will
/// expose 'kinetic' behavior. This can be turned off with the
/// `gtk.ScrolledWindow.properties.kinetic_scrolling` property if it is undesired.
///
/// `GtkScrolledWindow` also displays visual 'overshoot' indication when
/// the content is pulled beyond the end, and this situation can be
/// captured with the `gtk.ScrolledWindow.signals.edge_overshot` signal.
///
/// If no mouse device is present, the scrollbars will overlaid as
/// narrow, auto-hiding indicators over the content. If traditional
/// scrollbars are desired although no mouse is present, this behaviour
/// can be turned off with the `gtk.ScrolledWindow.properties.overlay_scrolling`
/// property.
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.ScrolledWindow.signals.scroll_child`
///
/// # CSS nodes
///
/// `GtkScrolledWindow` has a main CSS node with name scrolledwindow.
/// It gets a .frame style class added when `gtk.ScrolledWindow.properties.has_frame`
/// is `TRUE`.
///
/// It uses subnodes with names overshoot and undershoot to draw the overflow
/// and underflow indications. These nodes get the .left, .right, .top or .bottom
/// style class added depending on where the indication is drawn.
///
/// `GtkScrolledWindow` also sets the positional style classes (.left, .right,
/// .top, .bottom) and style classes related to overlay scrolling
/// (.overlay-indicator, .dragging, .hovering) on its scrollbars.
///
/// If both scrollbars are visible, the area where they meet is drawn
/// with a subnode named junction.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkScrolledWindow` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkScrolledWindow` uses the `gtk.@"AccessibleRole.generic"`
/// role.
pub const ScrolledWindow = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = ScrolledWindow;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        ///
        /// When setting this property, if the child widget does not implement
        /// `gtk.Scrollable`, the scrolled window will add the child to
        /// a `gtk.Viewport` and then set the viewport as the child.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The `GtkAdjustment` for the horizontal position.
        pub const hadjustment = struct {
            pub const name = "hadjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// Whether to draw a frame around the contents.
        pub const has_frame = struct {
            pub const name = "has-frame";

            pub const Type = c_int;
        };

        /// When the horizontal scrollbar is displayed.
        ///
        /// Use `gtk.ScrolledWindow.setPolicy` to set
        /// this property.
        pub const hscrollbar_policy = struct {
            pub const name = "hscrollbar-policy";

            pub const Type = gtk.PolicyType;
        };

        /// Whether kinetic scrolling is enabled or not.
        ///
        /// Kinetic scrolling only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
        pub const kinetic_scrolling = struct {
            pub const name = "kinetic-scrolling";

            pub const Type = c_int;
        };

        /// The maximum content height of `scrolled_window`.
        pub const max_content_height = struct {
            pub const name = "max-content-height";

            pub const Type = c_int;
        };

        /// The maximum content width of `scrolled_window`.
        pub const max_content_width = struct {
            pub const name = "max-content-width";

            pub const Type = c_int;
        };

        /// The minimum content height of `scrolled_window`.
        pub const min_content_height = struct {
            pub const name = "min-content-height";

            pub const Type = c_int;
        };

        /// The minimum content width of `scrolled_window`.
        pub const min_content_width = struct {
            pub const name = "min-content-width";

            pub const Type = c_int;
        };

        /// Whether overlay scrolling is enabled or not.
        ///
        /// If it is, the scrollbars are only added as traditional widgets
        /// when a mouse is present. Otherwise, they are overlaid on top of
        /// the content, as narrow indicators.
        ///
        /// Note that overlay scrolling can also be globally disabled, with
        /// the `gtk.Settings.properties.gtk_overlay_scrolling` setting.
        pub const overlay_scrolling = struct {
            pub const name = "overlay-scrolling";

            pub const Type = c_int;
        };

        /// Whether the natural height of the child should be calculated and propagated
        /// through the scrolled window’s requested natural height.
        ///
        /// This is useful in cases where an attempt should be made to allocate exactly
        /// enough space for the natural size of the child.
        pub const propagate_natural_height = struct {
            pub const name = "propagate-natural-height";

            pub const Type = c_int;
        };

        /// Whether the natural width of the child should be calculated and propagated
        /// through the scrolled window’s requested natural width.
        ///
        /// This is useful in cases where an attempt should be made to allocate exactly
        /// enough space for the natural size of the child.
        pub const propagate_natural_width = struct {
            pub const name = "propagate-natural-width";

            pub const Type = c_int;
        };

        /// The `GtkAdjustment` for the vertical position.
        pub const vadjustment = struct {
            pub const name = "vadjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// When the vertical scrollbar is displayed.
        ///
        /// Use `gtk.ScrolledWindow.setPolicy` to set
        /// this property.
        pub const vscrollbar_policy = struct {
            pub const name = "vscrollbar-policy";

            pub const Type = gtk.PolicyType;
        };

        /// Where the contents are located with respect to the scrollbars.
        pub const window_placement = struct {
            pub const name = "window-placement";

            pub const Type = gtk.CornerType;
        };
    };

    pub const signals = struct {
        /// Emitted whenever user initiated scrolling makes the scrolled
        /// window firmly surpass the limits defined by the adjustment
        /// in that orientation.
        ///
        /// A similar behavior without edge resistance is provided by the
        /// `gtk.ScrolledWindow.signals.edge_reached` signal.
        ///
        /// Note: The `pos` argument is LTR/RTL aware, so callers should be
        /// aware too if intending to provide behavior on horizontal edges.
        pub const edge_overshot = struct {
            pub const name = "edge-overshot";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_pos: gtk.PositionType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScrolledWindow, p_instance))),
                    gobject.signalLookup("edge-overshot", ScrolledWindow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever user-initiated scrolling makes the scrolled
        /// window exactly reach the lower or upper limits defined by the
        /// adjustment in that orientation.
        ///
        /// A similar behavior with edge resistance is provided by the
        /// `gtk.ScrolledWindow.signals.edge_overshot` signal.
        ///
        /// Note: The `pos` argument is LTR/RTL aware, so callers should be
        /// aware too if intending to provide behavior on horizontal edges.
        pub const edge_reached = struct {
            pub const name = "edge-reached";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_pos: gtk.PositionType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScrolledWindow, p_instance))),
                    gobject.signalLookup("edge-reached", ScrolledWindow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when focus is moved away from the scrolled window by a
        /// keybinding.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd> to move forward and
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>` to move backward.
        pub const move_focus_out = struct {
            pub const name = "move-focus-out";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_direction_type: gtk.DirectionType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScrolledWindow, p_instance))),
                    gobject.signalLookup("move-focus-out", ScrolledWindow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a keybinding that scrolls is pressed.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The horizontal or vertical adjustment is updated which triggers a
        /// signal that the scrolled window’s child may listen to and scroll itself.
        pub const scroll_child = struct {
            pub const name = "scroll-child";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_scroll: gtk.ScrollType, p_horizontal: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ScrolledWindow, p_instance))),
                    gobject.signalLookup("scroll-child", ScrolledWindow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new scrolled window.
    extern fn gtk_scrolled_window_new() *gtk.ScrolledWindow;
    pub const new = gtk_scrolled_window_new;

    /// Gets the child widget of `scrolled_window`.
    ///
    /// If the scrolled window automatically added a `gtk.Viewport`, this
    /// function will return the viewport widget, and you can retrieve its child
    /// using `gtk.Viewport.getChild`.
    extern fn gtk_scrolled_window_get_child(p_scrolled_window: *ScrolledWindow) ?*gtk.Widget;
    pub const getChild = gtk_scrolled_window_get_child;

    /// Returns the horizontal scrollbar’s adjustment.
    ///
    /// This is the adjustment used to connect the horizontal scrollbar
    /// to the child widget’s horizontal scroll functionality.
    extern fn gtk_scrolled_window_get_hadjustment(p_scrolled_window: *ScrolledWindow) *gtk.Adjustment;
    pub const getHadjustment = gtk_scrolled_window_get_hadjustment;

    /// Gets whether the scrolled window draws a frame.
    extern fn gtk_scrolled_window_get_has_frame(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getHasFrame = gtk_scrolled_window_get_has_frame;

    /// Returns the horizontal scrollbar of `scrolled_window`.
    extern fn gtk_scrolled_window_get_hscrollbar(p_scrolled_window: *ScrolledWindow) *gtk.Widget;
    pub const getHscrollbar = gtk_scrolled_window_get_hscrollbar;

    /// Returns the specified kinetic scrolling behavior.
    extern fn gtk_scrolled_window_get_kinetic_scrolling(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getKineticScrolling = gtk_scrolled_window_get_kinetic_scrolling;

    /// Returns the maximum content height set.
    extern fn gtk_scrolled_window_get_max_content_height(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getMaxContentHeight = gtk_scrolled_window_get_max_content_height;

    /// Returns the maximum content width set.
    extern fn gtk_scrolled_window_get_max_content_width(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getMaxContentWidth = gtk_scrolled_window_get_max_content_width;

    /// Gets the minimal content height of `scrolled_window`.
    extern fn gtk_scrolled_window_get_min_content_height(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getMinContentHeight = gtk_scrolled_window_get_min_content_height;

    /// Gets the minimum content width of `scrolled_window`.
    extern fn gtk_scrolled_window_get_min_content_width(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getMinContentWidth = gtk_scrolled_window_get_min_content_width;

    /// Returns whether overlay scrolling is enabled for this scrolled window.
    extern fn gtk_scrolled_window_get_overlay_scrolling(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getOverlayScrolling = gtk_scrolled_window_get_overlay_scrolling;

    /// Gets the placement of the contents with respect to the scrollbars.
    extern fn gtk_scrolled_window_get_placement(p_scrolled_window: *ScrolledWindow) gtk.CornerType;
    pub const getPlacement = gtk_scrolled_window_get_placement;

    /// Retrieves the current policy values for the horizontal and vertical
    /// scrollbars.
    ///
    /// See `gtk.ScrolledWindow.setPolicy`.
    extern fn gtk_scrolled_window_get_policy(p_scrolled_window: *ScrolledWindow, p_hscrollbar_policy: ?*gtk.PolicyType, p_vscrollbar_policy: ?*gtk.PolicyType) void;
    pub const getPolicy = gtk_scrolled_window_get_policy;

    /// Reports whether the natural height of the child will be calculated
    /// and propagated through the scrolled window’s requested natural height.
    extern fn gtk_scrolled_window_get_propagate_natural_height(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getPropagateNaturalHeight = gtk_scrolled_window_get_propagate_natural_height;

    /// Reports whether the natural width of the child will be calculated
    /// and propagated through the scrolled window’s requested natural width.
    extern fn gtk_scrolled_window_get_propagate_natural_width(p_scrolled_window: *ScrolledWindow) c_int;
    pub const getPropagateNaturalWidth = gtk_scrolled_window_get_propagate_natural_width;

    /// Returns the vertical scrollbar’s adjustment.
    ///
    /// This is the adjustment used to connect the vertical
    /// scrollbar to the child widget’s vertical scroll functionality.
    extern fn gtk_scrolled_window_get_vadjustment(p_scrolled_window: *ScrolledWindow) *gtk.Adjustment;
    pub const getVadjustment = gtk_scrolled_window_get_vadjustment;

    /// Returns the vertical scrollbar of `scrolled_window`.
    extern fn gtk_scrolled_window_get_vscrollbar(p_scrolled_window: *ScrolledWindow) *gtk.Widget;
    pub const getVscrollbar = gtk_scrolled_window_get_vscrollbar;

    /// Sets the child widget of `scrolled_window`.
    ///
    /// If `child` does not implement the `gtk.Scrollable` interface,
    /// the scrolled window will add `child` to a `gtk.Viewport` instance
    /// and then add the viewport as its child widget.
    extern fn gtk_scrolled_window_set_child(p_scrolled_window: *ScrolledWindow, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_scrolled_window_set_child;

    /// Sets the `GtkAdjustment` for the horizontal scrollbar.
    extern fn gtk_scrolled_window_set_hadjustment(p_scrolled_window: *ScrolledWindow, p_hadjustment: ?*gtk.Adjustment) void;
    pub const setHadjustment = gtk_scrolled_window_set_hadjustment;

    /// Changes the frame drawn around the contents of `scrolled_window`.
    extern fn gtk_scrolled_window_set_has_frame(p_scrolled_window: *ScrolledWindow, p_has_frame: c_int) void;
    pub const setHasFrame = gtk_scrolled_window_set_has_frame;

    /// Turns kinetic scrolling on or off.
    ///
    /// Kinetic scrolling only applies to devices with source
    /// `GDK_SOURCE_TOUCHSCREEN`.
    extern fn gtk_scrolled_window_set_kinetic_scrolling(p_scrolled_window: *ScrolledWindow, p_kinetic_scrolling: c_int) void;
    pub const setKineticScrolling = gtk_scrolled_window_set_kinetic_scrolling;

    /// Sets the maximum height that `scrolled_window` should keep visible.
    ///
    /// The `scrolled_window` will grow up to this height before it starts
    /// scrolling the content.
    ///
    /// It is a programming error to set the maximum content height to a value
    /// smaller than `gtk.ScrolledWindow.properties.min_content_height`.
    extern fn gtk_scrolled_window_set_max_content_height(p_scrolled_window: *ScrolledWindow, p_height: c_int) void;
    pub const setMaxContentHeight = gtk_scrolled_window_set_max_content_height;

    /// Sets the maximum width that `scrolled_window` should keep visible.
    ///
    /// The `scrolled_window` will grow up to this width before it starts
    /// scrolling the content.
    ///
    /// It is a programming error to set the maximum content width to a
    /// value smaller than `gtk.ScrolledWindow.properties.min_content_width`.
    extern fn gtk_scrolled_window_set_max_content_width(p_scrolled_window: *ScrolledWindow, p_width: c_int) void;
    pub const setMaxContentWidth = gtk_scrolled_window_set_max_content_width;

    /// Sets the minimum height that `scrolled_window` should keep visible.
    ///
    /// Note that this can and (usually will) be smaller than the minimum
    /// size of the content.
    ///
    /// It is a programming error to set the minimum content height to a
    /// value greater than `gtk.ScrolledWindow.properties.max_content_height`.
    extern fn gtk_scrolled_window_set_min_content_height(p_scrolled_window: *ScrolledWindow, p_height: c_int) void;
    pub const setMinContentHeight = gtk_scrolled_window_set_min_content_height;

    /// Sets the minimum width that `scrolled_window` should keep visible.
    ///
    /// Note that this can and (usually will) be smaller than the minimum
    /// size of the content.
    ///
    /// It is a programming error to set the minimum content width to a
    /// value greater than `gtk.ScrolledWindow.properties.max_content_width`.
    extern fn gtk_scrolled_window_set_min_content_width(p_scrolled_window: *ScrolledWindow, p_width: c_int) void;
    pub const setMinContentWidth = gtk_scrolled_window_set_min_content_width;

    /// Enables or disables overlay scrolling for this scrolled window.
    extern fn gtk_scrolled_window_set_overlay_scrolling(p_scrolled_window: *ScrolledWindow, p_overlay_scrolling: c_int) void;
    pub const setOverlayScrolling = gtk_scrolled_window_set_overlay_scrolling;

    /// Sets the placement of the contents with respect to the scrollbars
    /// for the scrolled window.
    ///
    /// The default is `GTK_CORNER_TOP_LEFT`, meaning the child is
    /// in the top left, with the scrollbars underneath and to the right.
    /// Other values in `gtk.CornerType` are `GTK_CORNER_TOP_RIGHT`,
    /// `GTK_CORNER_BOTTOM_LEFT`, and `GTK_CORNER_BOTTOM_RIGHT`.
    ///
    /// See also `gtk.ScrolledWindow.getPlacement` and
    /// `gtk.ScrolledWindow.unsetPlacement`.
    extern fn gtk_scrolled_window_set_placement(p_scrolled_window: *ScrolledWindow, p_window_placement: gtk.CornerType) void;
    pub const setPlacement = gtk_scrolled_window_set_placement;

    /// Sets the scrollbar policy for the horizontal and vertical scrollbars.
    ///
    /// The policy determines when the scrollbar should appear; it is a value
    /// from the `gtk.PolicyType` enumeration. If `GTK_POLICY_ALWAYS`, the
    /// scrollbar is always present; if `GTK_POLICY_NEVER`, the scrollbar is
    /// never present; if `GTK_POLICY_AUTOMATIC`, the scrollbar is present only
    /// if needed (that is, if the slider part of the bar would be smaller
    /// than the trough — the display is larger than the page size).
    extern fn gtk_scrolled_window_set_policy(p_scrolled_window: *ScrolledWindow, p_hscrollbar_policy: gtk.PolicyType, p_vscrollbar_policy: gtk.PolicyType) void;
    pub const setPolicy = gtk_scrolled_window_set_policy;

    /// Sets whether the natural height of the child should be calculated
    /// and propagated through the scrolled window’s requested natural height.
    extern fn gtk_scrolled_window_set_propagate_natural_height(p_scrolled_window: *ScrolledWindow, p_propagate: c_int) void;
    pub const setPropagateNaturalHeight = gtk_scrolled_window_set_propagate_natural_height;

    /// Sets whether the natural width of the child should be calculated
    /// and propagated through the scrolled window’s requested natural width.
    extern fn gtk_scrolled_window_set_propagate_natural_width(p_scrolled_window: *ScrolledWindow, p_propagate: c_int) void;
    pub const setPropagateNaturalWidth = gtk_scrolled_window_set_propagate_natural_width;

    /// Sets the `GtkAdjustment` for the vertical scrollbar.
    extern fn gtk_scrolled_window_set_vadjustment(p_scrolled_window: *ScrolledWindow, p_vadjustment: ?*gtk.Adjustment) void;
    pub const setVadjustment = gtk_scrolled_window_set_vadjustment;

    /// Unsets the placement of the contents with respect to the scrollbars.
    ///
    /// If no window placement is set for a scrolled window,
    /// it defaults to `GTK_CORNER_TOP_LEFT`.
    extern fn gtk_scrolled_window_unset_placement(p_scrolled_window: *ScrolledWindow) void;
    pub const unsetPlacement = gtk_scrolled_window_unset_placement;

    extern fn gtk_scrolled_window_get_type() usize;
    pub const getGObjectType = gtk_scrolled_window_get_type;

    extern fn g_object_ref(p_self: *gtk.ScrolledWindow) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ScrolledWindow) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ScrolledWindow, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Reveals a search entry when search is started.
///
/// <picture>
///   <source srcset="search-bar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkSearchBar" src="search-bar.png">
/// </picture>
///
/// It can also contain additional widgets, such as drop-down menus,
/// or buttons.  The search bar would appear when a search is started
/// through typing on the keyboard, or the application’s search mode
/// is toggled on.
///
/// For keyboard presses to start a search, the search bar must be told
/// of a widget to capture key events from through
/// `gtk.SearchBar.setKeyCaptureWidget`. This widget will
/// typically be the top-level window, or a parent container of the
/// search bar. Common shortcuts such as Ctrl+F should be handled as an
/// application action, or through the menu items.
///
/// You will also need to tell the search bar about which entry you
/// are using as your search entry using `gtk.SearchBar.connectEntry`.
///
/// ## Creating a search bar
///
/// The following example shows you how to create a more complex search
/// entry.
///
/// [A simple example](https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/search-bar.c)
///
/// # Shortcuts and Gestures
///
/// `GtkSearchBar` supports the following keyboard shortcuts:
///
/// - <kbd>Escape</kbd> hides the search bar.
///
/// # CSS nodes
///
/// ```
/// searchbar
/// ╰── revealer
///     ╰── box
///          ├── [child]
///          ╰── [button.close]
/// ```
///
/// `GtkSearchBar` has a main CSS node with name searchbar. It has a child
/// node with name revealer that contains a node with name box. The box node
/// contains both the CSS node of the child widget as well as an optional button
/// node which gets the .close style class applied.
///
/// # Accessibility
///
/// `GtkSearchBar` uses the `gtk.@"AccessibleRole.search"` role.
pub const SearchBar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = SearchBar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The key capture widget.
        pub const key_capture_widget = struct {
            pub const name = "key-capture-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the search mode is on and the search bar shown.
        pub const search_mode_enabled = struct {
            pub const name = "search-mode-enabled";

            pub const Type = c_int;
        };

        /// Whether to show the close button in the search bar.
        pub const show_close_button = struct {
            pub const name = "show-close-button";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkSearchBar`.
    ///
    /// You will need to tell it about which widget is going to be your text
    /// entry using `gtk.SearchBar.connectEntry`.
    extern fn gtk_search_bar_new() *gtk.SearchBar;
    pub const new = gtk_search_bar_new;

    /// Connects the `GtkEditable` widget passed as the one to be used in
    /// this search bar.
    ///
    /// The entry should be a descendant of the search bar. Calling this
    /// function manually is only required if the entry isn’t the direct
    /// child of the search bar (as in our main example).
    extern fn gtk_search_bar_connect_entry(p_bar: *SearchBar, p_entry: *gtk.Editable) void;
    pub const connectEntry = gtk_search_bar_connect_entry;

    /// Gets the child widget of `bar`.
    extern fn gtk_search_bar_get_child(p_bar: *SearchBar) ?*gtk.Widget;
    pub const getChild = gtk_search_bar_get_child;

    /// Gets the widget that `bar` is capturing key events from.
    extern fn gtk_search_bar_get_key_capture_widget(p_bar: *SearchBar) ?*gtk.Widget;
    pub const getKeyCaptureWidget = gtk_search_bar_get_key_capture_widget;

    /// Returns whether the search mode is on or off.
    extern fn gtk_search_bar_get_search_mode(p_bar: *SearchBar) c_int;
    pub const getSearchMode = gtk_search_bar_get_search_mode;

    /// Returns whether the close button is shown.
    extern fn gtk_search_bar_get_show_close_button(p_bar: *SearchBar) c_int;
    pub const getShowCloseButton = gtk_search_bar_get_show_close_button;

    /// Sets the child widget of `bar`.
    extern fn gtk_search_bar_set_child(p_bar: *SearchBar, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_search_bar_set_child;

    /// Sets `widget` as the widget that `bar` will capture key events
    /// from.
    ///
    /// If key events are handled by the search bar, the bar will
    /// be shown, and the entry populated with the entered text.
    ///
    /// Note that despite the name of this function, the events
    /// are only 'captured' in the bubble phase, which means that
    /// editable child widgets of `widget` will receive text input
    /// before it gets captured. If that is not desired, you can
    /// capture and forward the events yourself with
    /// `gtk.EventControllerKey.forward`.
    extern fn gtk_search_bar_set_key_capture_widget(p_bar: *SearchBar, p_widget: ?*gtk.Widget) void;
    pub const setKeyCaptureWidget = gtk_search_bar_set_key_capture_widget;

    /// Switches the search mode on or off.
    extern fn gtk_search_bar_set_search_mode(p_bar: *SearchBar, p_search_mode: c_int) void;
    pub const setSearchMode = gtk_search_bar_set_search_mode;

    /// Shows or hides the close button.
    ///
    /// Applications that already have a “search” toggle button should not
    /// show a close button in their search bar, as it duplicates the role
    /// of the toggle button.
    extern fn gtk_search_bar_set_show_close_button(p_bar: *SearchBar, p_visible: c_int) void;
    pub const setShowCloseButton = gtk_search_bar_set_show_close_button;

    extern fn gtk_search_bar_get_type() usize;
    pub const getGObjectType = gtk_search_bar_get_type;

    extern fn g_object_ref(p_self: *gtk.SearchBar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SearchBar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SearchBar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A single-line text entry widget for use as a search entry.
///
/// The main API for interacting with a `GtkSearchEntry` as entry
/// is the `GtkEditable` interface.
///
/// <picture>
///   <source srcset="search-entry-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkSearchEntry" src="search-entry.png">
/// </picture>
///
/// It will show an inactive symbolic “find” icon when the search
/// entry is empty, and a symbolic “clear” icon when there is text.
/// Clicking on the “clear” icon will empty the search entry.
///
/// To make filtering appear more reactive, it is a good idea to
/// not react to every change in the entry text immediately, but
/// only after a short delay. To support this, `GtkSearchEntry`
/// emits the `gtk.SearchEntry.signals.search_changed` signal which
/// can be used instead of the `gtk.Editable.signals.changed` signal.
///
/// The `gtk.SearchEntry.signals.previous_match`,
/// `gtk.SearchEntry.signals.next_match` and
/// `gtk.SearchEntry.signals.stop_search` signals can be used to
/// implement moving between search results and ending the search.
///
/// Often, `GtkSearchEntry` will be fed events by means of being
/// placed inside a `gtk.SearchBar`. If that is not the case,
/// you can use `gtk.SearchEntry.setKeyCaptureWidget` to
/// let it capture key input from another widget.
///
/// `GtkSearchEntry` provides only minimal API and should be used with
/// the `gtk.Editable` API.
///
/// ## Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.SearchEntry.signals.activate`
/// - `gtk.SearchEntry.signals.next_match`
/// - `gtk.SearchEntry.signals.previous_match`
/// - `gtk.SearchEntry.signals.stop_search`
///
/// ## CSS Nodes
///
/// ```
/// entry.search
/// ╰── text
/// ```
///
/// `GtkSearchEntry` has a single CSS node with name entry that carries
/// a `.search` style class, and the text node is a child of that.
///
/// ## Accessibility
///
/// `GtkSearchEntry` uses the `gtk.@"AccessibleRole.search_box"` role.
pub const SearchEntry = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Editable };
    pub const Class = opaque {
        pub const Instance = SearchEntry;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to activate the default widget when Enter is pressed.
        pub const activates_default = struct {
            pub const name = "activates-default";

            pub const Type = c_int;
        };

        /// The hints about input for the `GtkSearchEntry` used to alter the
        /// behaviour of input methods.
        pub const input_hints = struct {
            pub const name = "input-hints";

            pub const Type = gtk.InputHints;
        };

        /// The purpose for the `GtkSearchEntry` input used to alter the
        /// behaviour of input methods.
        pub const input_purpose = struct {
            pub const name = "input-purpose";

            pub const Type = gtk.InputPurpose;
        };

        /// The widget that the entry will use to capture key events.
        ///
        /// Key events are consumed by the search entry to start or continue a search.
        pub const key_capture_widget = struct {
            pub const name = "key-capture-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// The text that will be displayed in the `GtkSearchEntry`
        /// when it is empty and unfocused.
        pub const placeholder_text = struct {
            pub const name = "placeholder-text";

            pub const Type = ?[*:0]u8;
        };

        /// The delay in milliseconds from last keypress to the search
        /// changed signal.
        pub const search_delay = struct {
            pub const name = "search-delay";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {
        /// Emitted when the entry is activated.
        ///
        /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SearchEntry, p_instance))),
                    gobject.signalLookup("activate", SearchEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a move to the next match
        /// for the current search string.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// Applications should connect to it, to implement moving
        /// between matches.
        ///
        /// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>g</kbd>.
        pub const next_match = struct {
            pub const name = "next-match";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SearchEntry, p_instance))),
                    gobject.signalLookup("next-match", SearchEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a move to the previous match
        /// for the current search string.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// Applications should connect to it, to implement moving
        /// between matches.
        ///
        /// The default bindings for this signal is
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>g</kbd>.
        pub const previous_match = struct {
            pub const name = "previous-match";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SearchEntry, p_instance))),
                    gobject.signalLookup("previous-match", SearchEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted with a delay. The length of the delay can be
        /// changed with the `gtk.SearchEntry.properties.search_delay`
        /// property.
        pub const search_changed = struct {
            pub const name = "search-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SearchEntry, p_instance))),
                    gobject.signalLookup("search-changed", SearchEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiated a search on the entry.
        pub const search_started = struct {
            pub const name = "search-started";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SearchEntry, p_instance))),
                    gobject.signalLookup("search-started", SearchEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user stops a search via keyboard input.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// Applications should connect to it, to implement hiding
        /// the search entry in this case.
        ///
        /// The default bindings for this signal is <kbd>Escape</kbd>.
        pub const stop_search = struct {
            pub const name = "stop-search";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SearchEntry, p_instance))),
                    gobject.signalLookup("stop-search", SearchEntry.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a `GtkSearchEntry`.
    extern fn gtk_search_entry_new() *gtk.SearchEntry;
    pub const new = gtk_search_entry_new;

    /// Gets the input purpose for `entry`.
    extern fn gtk_search_entry_get_input_hints(p_entry: *SearchEntry) gtk.InputHints;
    pub const getInputHints = gtk_search_entry_get_input_hints;

    /// Gets the input purpose of `entry`.
    extern fn gtk_search_entry_get_input_purpose(p_entry: *SearchEntry) gtk.InputPurpose;
    pub const getInputPurpose = gtk_search_entry_get_input_purpose;

    /// Gets the widget that `entry` is capturing key events from.
    extern fn gtk_search_entry_get_key_capture_widget(p_entry: *SearchEntry) ?*gtk.Widget;
    pub const getKeyCaptureWidget = gtk_search_entry_get_key_capture_widget;

    /// Gets the placeholder text associated with `entry`.
    extern fn gtk_search_entry_get_placeholder_text(p_entry: *SearchEntry) ?[*:0]const u8;
    pub const getPlaceholderText = gtk_search_entry_get_placeholder_text;

    /// Get the delay to be used between the last keypress and the
    /// `gtk.SearchEntry.signals.search_changed` signal being emitted.
    extern fn gtk_search_entry_get_search_delay(p_entry: *SearchEntry) c_uint;
    pub const getSearchDelay = gtk_search_entry_get_search_delay;

    /// Sets the input hints for `entry`.
    extern fn gtk_search_entry_set_input_hints(p_entry: *SearchEntry, p_hints: gtk.InputHints) void;
    pub const setInputHints = gtk_search_entry_set_input_hints;

    /// Sets the input purpose of `entry`.
    extern fn gtk_search_entry_set_input_purpose(p_entry: *SearchEntry, p_purpose: gtk.InputPurpose) void;
    pub const setInputPurpose = gtk_search_entry_set_input_purpose;

    /// Sets `widget` as the widget that `entry` will capture key
    /// events from.
    ///
    /// Key events are consumed by the search entry to start or
    /// continue a search.
    ///
    /// If the entry is part of a `GtkSearchBar`, it is preferable
    /// to call `gtk.SearchBar.setKeyCaptureWidget` instead,
    /// which will reveal the entry in addition to triggering the
    /// search entry.
    ///
    /// Note that despite the name of this function, the events
    /// are only 'captured' in the bubble phase, which means that
    /// editable child widgets of `widget` will receive text input
    /// before it gets captured. If that is not desired, you can
    /// capture and forward the events yourself with
    /// `gtk.EventControllerKey.forward`.
    extern fn gtk_search_entry_set_key_capture_widget(p_entry: *SearchEntry, p_widget: ?*gtk.Widget) void;
    pub const setKeyCaptureWidget = gtk_search_entry_set_key_capture_widget;

    /// Sets the placeholder text associated with `entry`.
    extern fn gtk_search_entry_set_placeholder_text(p_entry: *SearchEntry, p_text: ?[*:0]const u8) void;
    pub const setPlaceholderText = gtk_search_entry_set_placeholder_text;

    /// Set the delay to be used between the last keypress and the
    /// `gtk.SearchEntry.signals.search_changed` signal being emitted.
    extern fn gtk_search_entry_set_search_delay(p_entry: *SearchEntry, p_delay: c_uint) void;
    pub const setSearchDelay = gtk_search_entry_set_search_delay;

    extern fn gtk_search_entry_get_type() usize;
    pub const getGObjectType = gtk_search_entry_get_type;

    extern fn g_object_ref(p_self: *gtk.SearchEntry) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SearchEntry) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SearchEntry, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that presents the selection from a `GtkSelectionModel`.
pub const SelectionFilterModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gio.ListModel};
    pub const Class = gtk.SelectionFilterModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being filtered.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.SelectionModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkSelectionFilterModel` that will include the
    /// selected items from the underlying selection model.
    extern fn gtk_selection_filter_model_new(p_model: ?*gtk.SelectionModel) *gtk.SelectionFilterModel;
    pub const new = gtk_selection_filter_model_new;

    /// Gets the model currently filtered or `NULL` if none.
    extern fn gtk_selection_filter_model_get_model(p_self: *SelectionFilterModel) ?*gtk.SelectionModel;
    pub const getModel = gtk_selection_filter_model_get_model;

    /// Sets the model to be filtered.
    ///
    /// Note that GTK makes no effort to ensure that `model` conforms to
    /// the item type of `self`. It assumes that the caller knows what they
    /// are doing and have set up an appropriate filter to ensure that item
    /// types match.
    extern fn gtk_selection_filter_model_set_model(p_self: *SelectionFilterModel, p_model: ?*gtk.SelectionModel) void;
    pub const setModel = gtk_selection_filter_model_set_model;

    extern fn gtk_selection_filter_model_get_type() usize;
    pub const getGObjectType = gtk_selection_filter_model_get_type;

    extern fn g_object_ref(p_self: *gtk.SelectionFilterModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SelectionFilterModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SelectionFilterModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Draws a horizontal or vertical line to separate other widgets.
///
/// <picture>
///   <source srcset="separator-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkSeparator" src="separator.png">
/// </picture>
///
/// A `GtkSeparator` can be used to group the widgets within a window.
/// It displays a line with a shadow to make it appear sunken into the
/// interface.
///
/// # CSS nodes
///
/// `GtkSeparator` has a single CSS node with name separator. The node
/// gets one of the .horizontal or .vertical style classes.
///
/// # Accessibility
///
/// `GtkSeparator` uses the `gtk.@"AccessibleRole.separator"` role.
pub const Separator = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = Separator;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkSeparator` with the given orientation.
    extern fn gtk_separator_new(p_orientation: gtk.Orientation) *gtk.Separator;
    pub const new = gtk_separator_new;

    extern fn gtk_separator_get_type() usize;
    pub const getGObjectType = gtk_separator_get_type;

    extern fn g_object_ref(p_self: *gtk.Separator) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Separator) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Separator, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides a mechanism to share global settings between applications.
///
/// GTK relies on the platform-specific API for getting desktop-wide
/// settings.
///
/// On Wayland, the settings are obtained via a settings portal that
/// is part of the Linux desktop APIs for application.
///
/// On the X window system, this sharing is realized by an
/// [XSettings](http://www.freedesktop.org/wiki/Specifications/xsettings-spec)
/// manager.
///
/// On macOS, the settings are obtained from `NSUserDefaults`.
///
/// In the absence of these sharing mechanisms, GTK reads default values for
/// settings from `settings.ini` files in `/etc/gtk-4.0`, `$XDG_CONFIG_DIRS/gtk-4.0`
/// and `$XDG_CONFIG_HOME/gtk-4.0`. These files must be valid key files (see
/// `GKeyFile`), and have a section called Settings. Themes can also provide
/// default values for settings by installing a `settings.ini` file
/// next to their `gtk.css` file.
///
/// Applications can override system-wide settings by setting the property
/// of the `GtkSettings` object with `gobject.Object.set`. This should be restricted
/// to special cases though; `GtkSettings` are not meant as an application
/// configuration facility.
///
/// There is one `GtkSettings` instance per display. It can be obtained with
/// `gtk.Settings.getForDisplay`, but in many cases, it is more
/// convenient to use `gtk.Widget.getSettings`.
pub const Settings = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.StyleProvider};
    pub const Class = opaque {
        pub const Instance = Settings;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether buttons in dialogs should use the alternative button order.
        pub const gtk_alternative_button_order = struct {
            pub const name = "gtk-alternative-button-order";

            pub const Type = c_int;
        };

        /// Controls the direction of the sort indicators in sorted list and tree
        /// views.
        ///
        /// By default an arrow pointing down means the column is sorted
        /// in ascending order. When set to `TRUE`, this order will be inverted.
        pub const gtk_alternative_sort_arrows = struct {
            pub const name = "gtk-alternative-sort-arrows";

            pub const Type = c_int;
        };

        /// Whether the application prefers to use a dark theme.
        ///
        /// If a GTK theme includes a dark variant, it will be used
        /// instead of the configured theme.
        ///
        /// Some applications benefit from minimizing the amount of light
        /// pollution that interferes with the content. Good candidates for
        /// dark themes are photo and video editors that make the actual
        /// content get all the attention and minimize the distraction of
        /// the chrome.
        ///
        /// Dark themes should not be used for documents, where large spaces
        /// are white/light and the dark chrome creates too much contrast
        /// (web browser, text editor...).
        pub const gtk_application_prefer_dark_theme = struct {
            pub const name = "gtk-application-prefer-dark-theme";

            pub const Type = c_int;
        };

        /// The aspect ratio of the text caret.
        pub const gtk_cursor_aspect_ratio = struct {
            pub const name = "gtk-cursor-aspect-ratio";

            pub const Type = f64;
        };

        /// Whether the cursor should blink.
        ///
        /// Also see the `gtk.Settings.properties.gtk_cursor_blink_timeout` setting,
        /// which allows more flexible control over cursor blinking.
        pub const gtk_cursor_blink = struct {
            pub const name = "gtk-cursor-blink";

            pub const Type = c_int;
        };

        /// Length of the cursor blink cycle, in milliseconds.
        pub const gtk_cursor_blink_time = struct {
            pub const name = "gtk-cursor-blink-time";

            pub const Type = c_int;
        };

        /// Time after which the cursor stops blinking, in seconds.
        ///
        /// The timer is reset after each user interaction.
        ///
        /// Setting this to zero has the same effect as setting
        /// `gtk.Settings.properties.gtk_cursor_blink` to `FALSE`.
        pub const gtk_cursor_blink_timeout = struct {
            pub const name = "gtk-cursor-blink-timeout";

            pub const Type = c_int;
        };

        /// Name of the cursor theme to use.
        ///
        /// Use `NULL` to use the default theme.
        pub const gtk_cursor_theme_name = struct {
            pub const name = "gtk-cursor-theme-name";

            pub const Type = ?[*:0]u8;
        };

        /// The size to use for cursors.
        ///
        /// 0 means to use the default size.
        pub const gtk_cursor_theme_size = struct {
            pub const name = "gtk-cursor-theme-size";

            pub const Type = c_int;
        };

        /// Determines which buttons should be put in the
        /// titlebar of client-side decorated windows, and whether they
        /// should be placed on the left or right.
        ///
        /// The format of the string is button names, separated by commas.
        /// A colon separates the buttons that should appear on the left
        /// from those on the right. Recognized button names are minimize,
        /// maximize, close, icon (the window icon) and menu (a menu button
        /// for the fallback app menu).
        ///
        /// For example, "menu:minimize,maximize,close" specifies a menu
        /// on the left, and minimize, maximize and close buttons on the right.
        ///
        /// Note that buttons will only be shown when they are meaningful.
        /// E.g. a menu button only appears when the desktop shell does not
        /// show the app menu, and a close button only appears on a window
        /// that can be closed.
        ///
        /// Also note that the setting can be overridden with the
        /// `gtk.HeaderBar.properties.decoration_layout` property.
        pub const gtk_decoration_layout = struct {
            pub const name = "gtk-decoration-layout";

            pub const Type = ?[*:0]u8;
        };

        /// Whether builtin GTK dialogs such as the file chooser, the
        /// color chooser or the font chooser will use a header bar at
        /// the top to show action widgets, or an action area at the bottom.
        ///
        /// This setting does not affect custom dialogs using `GtkDialog`
        /// directly, or message dialogs.
        pub const gtk_dialogs_use_header = struct {
            pub const name = "gtk-dialogs-use-header";

            pub const Type = c_int;
        };

        /// The number of pixels the cursor can move before dragging.
        pub const gtk_dnd_drag_threshold = struct {
            pub const name = "gtk-dnd-drag-threshold";

            pub const Type = c_int;
        };

        /// The maximum distance allowed between two clicks for them to be considered
        /// a double click, in pixels.
        pub const gtk_double_click_distance = struct {
            pub const name = "gtk-double-click-distance";

            pub const Type = c_int;
        };

        /// The maximum time to allow between two clicks for them to be considered
        /// a double click, in milliseconds.
        pub const gtk_double_click_time = struct {
            pub const name = "gtk-double-click-time";

            pub const Type = c_int;
        };

        /// Whether menu items should have visible accelerators which can be
        /// activated.
        pub const gtk_enable_accels = struct {
            pub const name = "gtk-enable-accels";

            pub const Type = c_int;
        };

        /// Whether to enable toolkit-wide animations.
        pub const gtk_enable_animations = struct {
            pub const name = "gtk-enable-animations";

            pub const Type = c_int;
        };

        /// Whether to play any event sounds at all.
        ///
        /// See the [Sound Theme Specifications](http://www.freedesktop.org/wiki/Specifications/sound-theme-spec)
        /// for more information on event sounds and sound themes.
        ///
        /// GTK itself does not support event sounds, you have to use a loadable
        /// module like the one that comes with libcanberra.
        pub const gtk_enable_event_sounds = struct {
            pub const name = "gtk-enable-event-sounds";

            pub const Type = c_int;
        };

        /// Whether to play event sounds as feedback to user input.
        ///
        /// See the [Sound Theme Specifications](http://www.freedesktop.org/wiki/Specifications/sound-theme-spec)
        /// for more information on event sounds and sound themes.
        ///
        /// GTK itself does not support event sounds, you have to use a loadable
        /// module like the one that comes with libcanberra.
        pub const gtk_enable_input_feedback_sounds = struct {
            pub const name = "gtk-enable-input-feedback-sounds";

            pub const Type = c_int;
        };

        /// Whether a middle click on a mouse should paste the
        /// 'PRIMARY' clipboard content at the cursor location.
        pub const gtk_enable_primary_paste = struct {
            pub const name = "gtk-enable-primary-paste";

            pub const Type = c_int;
        };

        /// How long to show the last input character in hidden
        /// entries.
        ///
        /// This value is in milliseconds. 0 disables showing the
        /// last char. 600 is a good value for enabling it.
        pub const gtk_entry_password_hint_timeout = struct {
            pub const name = "gtk-entry-password-hint-timeout";

            pub const Type = c_uint;
        };

        /// Whether to select the contents of an entry when it is focused.
        pub const gtk_entry_select_on_focus = struct {
            pub const name = "gtk-entry-select-on-focus";

            pub const Type = c_int;
        };

        /// When `TRUE`, keyboard navigation and other input-related errors
        /// will cause a beep.
        ///
        /// Since the error bell is implemented using `gdk.Surface.beep`, the
        /// windowing system may offer ways to configure the error bell in many
        /// ways, such as flashing the window or similar visual effects.
        pub const gtk_error_bell = struct {
            pub const name = "gtk-error-bell";

            pub const Type = c_int;
        };

        /// The default font to use.
        ///
        /// GTK uses the family name and size from this string.
        pub const gtk_font_name = struct {
            pub const name = "gtk-font-name";

            pub const Type = ?[*:0]u8;
        };

        /// How GTK font rendering is set up.
        ///
        /// When set to `gtk.@"FontRendering.MANUAL"`, GTK respects the low-level
        /// font-related settings (`gtk.Settings.properties.gtk_hint_font_metrics`,
        /// `gtk.Settings.properties.gtk_xft_antialias`, `gtk.Settings.properties.gtk_xft_hinting`,
        /// `gtk.Settings.properties.gtk_xft_hintstyle` and `gtk.Settings.properties.gtk_xft_rgba`)
        /// as much as practical.
        ///
        /// When set to `gtk.@"FontRendering.AUTOMATIC"`, GTK will consider factors such
        /// as screen resolution and scale in deciding how to render fonts.
        pub const gtk_font_rendering = struct {
            pub const name = "gtk-font-rendering";

            pub const Type = gtk.FontRendering;
        };

        /// Timestamp of the current fontconfig configuration.
        pub const gtk_fontconfig_timestamp = struct {
            pub const name = "gtk-fontconfig-timestamp";

            pub const Type = c_uint;
        };

        /// Whether hinting should be applied to font metrics.
        ///
        /// Note that this also turns off subpixel positioning of glyphs,
        /// since it conflicts with metrics hinting.
        pub const gtk_hint_font_metrics = struct {
            pub const name = "gtk-hint-font-metrics";

            pub const Type = c_int;
        };

        /// Name of the icon theme to use.
        ///
        /// See `gtk.IconTheme` for details about how
        /// GTK handles icon themes.
        pub const gtk_icon_theme_name = struct {
            pub const name = "gtk-icon-theme-name";

            pub const Type = ?[*:0]u8;
        };

        /// Which IM (input method) module should be used by default.
        ///
        /// This is the input method that will be used if the user has not
        /// explicitly chosen another input method from the IM context menu.
        /// This also can be a colon-separated list of input methods, which GTK
        /// will try in turn until it finds one available on the system.
        ///
        /// See `gtk.IMContext`.
        pub const gtk_im_module = struct {
            pub const name = "gtk-im-module";

            pub const Type = ?[*:0]u8;
        };

        /// The color scheme used for rendering the user interface.
        ///
        /// This setting communicates the system-wide preference.
        /// The color scheme that is actually used when applying CSS
        /// styles can be set with the `gtk.CssProvider.properties.prefers_color_scheme`
        /// property.
        pub const gtk_interface_color_scheme = struct {
            pub const name = "gtk-interface-color-scheme";

            pub const Type = gtk.InterfaceColorScheme;
        };

        /// The level of contrast to use for the user interface.
        ///
        /// This setting communicates the system-wide preference.
        /// The contrast level that is actually used when applying CSS
        /// styles can be set with the `gtk.CssProvider.properties.prefers_contrast`
        /// property.
        pub const gtk_interface_contrast = struct {
            pub const name = "gtk-interface-contrast";

            pub const Type = gtk.InterfaceContrast;
        };

        /// Whether animations should be reduced to essential motions.
        ///
        /// This setting communicates the system-wide preference.
        /// The motion level that is actually used when applying CSS
        /// styles can be set with the `gtk.CssProvider.properties.prefers_reduced_motion`
        /// property.
        pub const gtk_interface_reduced_motion = struct {
            pub const name = "gtk-interface-reduced-motion";

            pub const Type = gtk.ReducedMotion;
        };

        /// Whether GTK should make sure that text can be navigated with
        /// a caret, even if it is not editable.
        ///
        /// This is useful when using a screen reader.
        pub const gtk_keynav_use_caret = struct {
            pub const name = "gtk-keynav-use-caret";

            pub const Type = c_int;
        };

        /// Whether to select the contents of a selectable
        /// label when it is focused.
        pub const gtk_label_select_on_focus = struct {
            pub const name = "gtk-label-select-on-focus";

            pub const Type = c_int;
        };

        /// The time for a button or touch press to be considered a “long press”.
        ///
        /// See `gtk.GestureLongPress`.
        pub const gtk_long_press_time = struct {
            pub const name = "gtk-long-press-time";

            pub const Type = c_uint;
        };

        /// Whether scrolled windows may use overlaid scrolling indicators.
        ///
        /// If this is set to `FALSE`, scrolled windows will have permanent
        /// scrollbars.
        pub const gtk_overlay_scrolling = struct {
            pub const name = "gtk-overlay-scrolling";

            pub const Type = c_int;
        };

        /// If the value of this setting is `TRUE`, clicking the primary button in a
        /// `GtkRange` trough will move the slider, and hence set the range’s value, to
        /// the point that you clicked.
        ///
        /// If it is `FALSE`, a primary click will cause the slider/value to move
        /// by the range’s page-size towards the point clicked.
        ///
        /// Whichever action you choose for the primary button, the other action will
        /// be available by holding Shift and primary-clicking, or clicking the middle
        /// mouse button.
        pub const gtk_primary_button_warps_slider = struct {
            pub const name = "gtk-primary-button-warps-slider";

            pub const Type = c_int;
        };

        /// A comma-separated list of print backends to use in the print
        /// dialog.
        ///
        /// Available print backends depend on the GTK installation,
        /// and may include "file", "cups", "lpr" or "papi".
        pub const gtk_print_backends = struct {
            pub const name = "gtk-print-backends";

            pub const Type = ?[*:0]u8;
        };

        /// A command to run for displaying the print preview.
        ///
        /// The command should contain a ``f`` placeholder, which will get
        /// replaced by the path to the pdf file. The command may also
        /// contain a ``s`` placeholder, which will get replaced by the
        /// path to a file containing the print settings in the format
        /// produced by `gtk.PrintSettings.toFile`.
        ///
        /// The preview application is responsible for removing the pdf
        /// file and the print settings file when it is done.
        pub const gtk_print_preview_command = struct {
            pub const name = "gtk-print-preview-command";

            pub const Type = ?[*:0]u8;
        };

        /// Whether GTK should keep track of items inside the recently used
        /// resources list.
        ///
        /// If set to `FALSE`, the list will always be empty.
        pub const gtk_recent_files_enabled = struct {
            pub const name = "gtk-recent-files-enabled";

            pub const Type = c_int;
        };

        /// The maximum age, in days, of the items inside the recently used
        /// resources list.
        ///
        /// Items older than this setting will be excised from the list.
        /// If set to 0, the list will always be empty; if set to -1, no
        /// item will be removed.
        pub const gtk_recent_files_max_age = struct {
            pub const name = "gtk-recent-files-max-age";

            pub const Type = c_int;
        };

        /// Set to `TRUE` if the desktop environment is displaying
        /// the app menu, `FALSE` if the app should display it itself.
        pub const gtk_shell_shows_app_menu = struct {
            pub const name = "gtk-shell-shows-app-menu";

            pub const Type = c_int;
        };

        /// Set to `TRUE` if the desktop environment is displaying
        /// the desktop folder, `FALSE` if not.
        pub const gtk_shell_shows_desktop = struct {
            pub const name = "gtk-shell-shows-desktop";

            pub const Type = c_int;
        };

        /// Set to `TRUE` if the desktop environment is displaying
        /// the menubar, `FALSE` if the app should display it itself.
        pub const gtk_shell_shows_menubar = struct {
            pub const name = "gtk-shell-shows-menubar";

            pub const Type = c_int;
        };

        /// When `TRUE`, widgets like switches include shapes to indicate their on/off state.
        pub const gtk_show_status_shapes = struct {
            pub const name = "gtk-show-status-shapes";

            pub const Type = c_int;
        };

        /// The XDG sound theme to use for event sounds.
        ///
        /// See the [Sound Theme Specifications](http://www.freedesktop.org/wiki/Specifications/sound-theme-spec)
        /// for more information on event sounds and sound themes.
        ///
        /// GTK itself does not support event sounds, you have to use
        /// a loadable module like the one that comes with libcanberra.
        pub const gtk_sound_theme_name = struct {
            pub const name = "gtk-sound-theme-name";

            pub const Type = ?[*:0]u8;
        };

        /// Whether two cursors should be displayed for mixed left-to-right and
        /// right-to-left text.
        pub const gtk_split_cursor = struct {
            pub const name = "gtk-split-cursor";

            pub const Type = c_int;
        };

        /// Name of the theme to load.
        ///
        /// See `gtk.CssProvider` for details about how
        /// GTK finds the CSS stylesheet for a theme.
        pub const gtk_theme_name = struct {
            pub const name = "gtk-theme-name";

            pub const Type = ?[*:0]u8;
        };

        /// Determines the action to take when a double-click
        /// occurs on the titlebar of client-side decorated windows.
        ///
        /// Recognized actions are minimize, toggle-maximize, menu, lower
        /// or none.
        pub const gtk_titlebar_double_click = struct {
            pub const name = "gtk-titlebar-double-click";

            pub const Type = ?[*:0]u8;
        };

        /// Determines the action to take when a middle-click
        /// occurs on the titlebar of client-side decorated windows.
        ///
        /// Recognized actions are minimize, toggle-maximize, menu, lower
        /// or none.
        pub const gtk_titlebar_middle_click = struct {
            pub const name = "gtk-titlebar-middle-click";

            pub const Type = ?[*:0]u8;
        };

        /// Determines the action to take when a right-click
        /// occurs on the titlebar of client-side decorated windows.
        ///
        /// Recognized actions are minimize, toggle-maximize, menu, lower
        /// or none.
        pub const gtk_titlebar_right_click = struct {
            pub const name = "gtk-titlebar-right-click";

            pub const Type = ?[*:0]u8;
        };

        /// Whether to antialias fonts.
        ///
        /// The values are 0 for no, 1 for yes, or -1 for the system default.
        pub const gtk_xft_antialias = struct {
            pub const name = "gtk-xft-antialias";

            pub const Type = c_int;
        };

        /// The font resolution, in 1024 * dots/inch.
        ///
        /// -1 to use the default value.
        pub const gtk_xft_dpi = struct {
            pub const name = "gtk-xft-dpi";

            pub const Type = c_int;
        };

        /// Whether to enable font hinting.
        ///
        /// The values are 0 for no, 1 for yes, or -1 for the system default.
        pub const gtk_xft_hinting = struct {
            pub const name = "gtk-xft-hinting";

            pub const Type = c_int;
        };

        /// What degree of font hinting to use.
        ///
        /// The possible vaues are hintnone, hintslight,
        /// hintmedium, hintfull.
        pub const gtk_xft_hintstyle = struct {
            pub const name = "gtk-xft-hintstyle";

            pub const Type = ?[*:0]u8;
        };

        /// The type of subpixel antialiasing to use.
        ///
        /// The possible values are none, rgb, bgr, vrgb, vbgr.
        ///
        /// Note that GSK does not support subpixel antialiasing, and this
        /// setting has no effect on font rendering in GTK.
        pub const gtk_xft_rgba = struct {
            pub const name = "gtk-xft-rgba";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Gets the `GtkSettings` object for the default display, creating
    /// it if necessary.
    ///
    /// See `gtk.Settings.getForDisplay`.
    extern fn gtk_settings_get_default() ?*gtk.Settings;
    pub const getDefault = gtk_settings_get_default;

    /// Gets the `GtkSettings` object for `display`, creating it if necessary.
    extern fn gtk_settings_get_for_display(p_display: *gdk.Display) *gtk.Settings;
    pub const getForDisplay = gtk_settings_get_for_display;

    /// Undoes the effect of calling `gobject.Object.set` to install an
    /// application-specific value for a setting.
    ///
    /// After this call, the setting will again follow the session-wide
    /// value for this setting.
    extern fn gtk_settings_reset_property(p_settings: *Settings, p_name: [*:0]const u8) void;
    pub const resetProperty = gtk_settings_reset_property;

    extern fn gtk_settings_get_type() usize;
    pub const getGObjectType = gtk_settings_get_type;

    extern fn g_object_ref(p_self: *gtk.Settings) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Settings) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Settings, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes a keyboard shortcut.
///
/// It contains a description of how to trigger the shortcut via a
/// `gtk.ShortcutTrigger` and a way to activate the shortcut
/// on a widget via a `gtk.ShortcutAction`.
///
/// The actual work is usually done via `gtk.ShortcutController`,
/// which decides if and when to activate a shortcut. Using that controller
/// directly however is rarely necessary as various higher level
/// convenience APIs exist on `GtkWidget`s that make it easier to use
/// shortcuts in GTK.
///
/// `GtkShortcut` does provide functionality to make it easy for users
/// to work with shortcuts, either by providing informational strings
/// for display purposes or by allowing shortcuts to be configured.
pub const Shortcut = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ShortcutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The action that gets activated by this shortcut.
        pub const action = struct {
            pub const name = "action";

            pub const Type = ?*gtk.ShortcutAction;
        };

        /// Arguments passed to activation.
        pub const arguments = struct {
            pub const name = "arguments";

            pub const Type = ?*glib.Variant;
        };

        /// The trigger that triggers this shortcut.
        pub const trigger = struct {
            pub const name = "trigger";

            pub const Type = ?*gtk.ShortcutTrigger;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkShortcut` that is triggered by
    /// `trigger` and then activates `action`.
    extern fn gtk_shortcut_new(p_trigger: ?*gtk.ShortcutTrigger, p_action: ?*gtk.ShortcutAction) *gtk.Shortcut;
    pub const new = gtk_shortcut_new;

    /// Creates a new `GtkShortcut` that is triggered by `trigger` and then activates
    /// `action` with arguments given by `format_string`.
    extern fn gtk_shortcut_new_with_arguments(p_trigger: ?*gtk.ShortcutTrigger, p_action: ?*gtk.ShortcutAction, p_format_string: ?[*:0]const u8, ...) *gtk.Shortcut;
    pub const newWithArguments = gtk_shortcut_new_with_arguments;

    /// Gets the action that is activated by this shortcut.
    extern fn gtk_shortcut_get_action(p_self: *Shortcut) ?*gtk.ShortcutAction;
    pub const getAction = gtk_shortcut_get_action;

    /// Gets the arguments that are passed when activating the shortcut.
    extern fn gtk_shortcut_get_arguments(p_self: *Shortcut) ?*glib.Variant;
    pub const getArguments = gtk_shortcut_get_arguments;

    /// Gets the trigger used to trigger `self`.
    extern fn gtk_shortcut_get_trigger(p_self: *Shortcut) ?*gtk.ShortcutTrigger;
    pub const getTrigger = gtk_shortcut_get_trigger;

    /// Sets the new action for `self` to be `action`.
    extern fn gtk_shortcut_set_action(p_self: *Shortcut, p_action: ?*gtk.ShortcutAction) void;
    pub const setAction = gtk_shortcut_set_action;

    /// Sets the arguments to pass when activating the shortcut.
    extern fn gtk_shortcut_set_arguments(p_self: *Shortcut, p_args: ?*glib.Variant) void;
    pub const setArguments = gtk_shortcut_set_arguments;

    /// Sets the new trigger for `self` to be `trigger`.
    extern fn gtk_shortcut_set_trigger(p_self: *Shortcut, p_trigger: ?*gtk.ShortcutTrigger) void;
    pub const setTrigger = gtk_shortcut_set_trigger;

    extern fn gtk_shortcut_get_type() usize;
    pub const getGObjectType = gtk_shortcut_get_type;

    extern fn g_object_ref(p_self: *gtk.Shortcut) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Shortcut) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Shortcut, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Encodes an action that can be triggered by a keyboard shortcut.
///
/// `GtkShortcutActions` contain functions that allow easy presentation
/// to end users as well as being printed for debugging.
///
/// All `GtkShortcutActions` are immutable, you can only specify their
/// properties during construction. If you want to change a action, you
/// have to replace it with a new one. If you need to pass arguments to
/// an action, these are specified by the higher-level `GtkShortcut` object.
///
/// To activate a `GtkShortcutAction` manually, `gtk.ShortcutAction.activate`
/// can be called.
///
/// GTK provides various actions:
///
///  - `gtk.MnemonicAction`: a shortcut action that calls
///    `gtk.Widget.mnemonicActivate`
///  - `gtk.CallbackAction`: a shortcut action that invokes
///    a given callback
///  - `gtk.SignalAction`: a shortcut action that emits a
///    given signal
///  - `gtk.ActivateAction`: a shortcut action that calls
///    `gtk.Widget.activate`
///  - `gtk.NamedAction`: a shortcut action that calls
///    `gtk.Widget.activateAction`
///  - `gtk.NothingAction`: a shortcut action that does nothing
pub const ShortcutAction = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ShortcutActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Tries to parse the given string into an action.
    ///
    /// On success, the parsed action is returned. When parsing
    /// failed, `NULL` is returned.
    ///
    /// The accepted strings are:
    ///
    /// - `nothing`, for `GtkNothingAction`
    /// - `activate`, for `GtkActivateAction`
    /// - `mnemonic-activate`, for `GtkMnemonicAction`
    /// - `action(NAME)`, for a `GtkNamedAction` for the action named `NAME`
    /// - `signal(NAME)`, for a `GtkSignalAction` for the signal `NAME`
    extern fn gtk_shortcut_action_parse_string(p_string: [*:0]const u8) ?*gtk.ShortcutAction;
    pub const parseString = gtk_shortcut_action_parse_string;

    /// Activates the action on the `widget` with the given `args`.
    ///
    /// Note that some actions ignore the passed in `flags`, `widget` or `args`.
    ///
    /// Activation of an action can fail for various reasons. If the action
    /// is not supported by the `widget`, if the `args` don't match the action
    /// or if the activation otherwise had no effect, `FALSE` will be returned.
    extern fn gtk_shortcut_action_activate(p_self: *ShortcutAction, p_flags: gtk.ShortcutActionFlags, p_widget: *gtk.Widget, p_args: ?*glib.Variant) c_int;
    pub const activate = gtk_shortcut_action_activate;

    /// Prints the given action into a string for the developer.
    ///
    /// This is meant for debugging and logging.
    ///
    /// The form of the representation may change at any time and is
    /// not guaranteed to stay identical.
    extern fn gtk_shortcut_action_print(p_self: *ShortcutAction, p_string: *glib.String) void;
    pub const print = gtk_shortcut_action_print;

    /// Prints the given action into a human-readable string.
    ///
    /// This is a small wrapper around `gtk.ShortcutAction.print`
    /// to help when debugging.
    extern fn gtk_shortcut_action_to_string(p_self: *ShortcutAction) [*:0]u8;
    pub const toString = gtk_shortcut_action_to_string;

    extern fn gtk_shortcut_action_get_type() usize;
    pub const getGObjectType = gtk_shortcut_action_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Manages keyboard shortcuts and their activation.
///
/// Most common shortcuts are using this controller implicitly, e.g. by
/// adding a mnemonic underline to a `gtk.Label`, or by installing a key
/// binding using `gtk.WidgetClass.addBinding`, or by adding accelerators
/// to global actions using `gtk.Application.setAccelsForAction`.
///
/// But it is possible to create your own shortcut controller, and add
/// shortcuts to it.
///
/// `GtkShortcutController` implements `gio.ListModel` for querying the
/// shortcuts that have been added to it.
///
/// # GtkShortcutController as GtkBuildable
///
/// `GtkShortcutController`s can be created in `gtk.Builder` ui files, to set up
/// shortcuts in the same place as the widgets.
///
/// An example of a UI definition fragment with `GtkShortcutController`:
/// ```xml
///   <object class='GtkButton'>
///     <child>
///       <object class='GtkShortcutController'>
///         <property name='scope'>managed</property>
///         <child>
///           <object class='GtkShortcut'>
///             <property name='trigger'>&lt;Control&gt;k</property>
///             <property name='action'>activate</property>
///           </object>
///         </child>
///       </object>
///     </child>
///   </object>
/// ```
///
/// This example creates a `gtk.ActivateAction` for triggering the
/// `activate` signal of the `gtk.Button`. See `gtk.ShortcutAction.parseString`
/// for the syntax for other kinds of `gtk.ShortcutAction`. See
/// `gtk.ShortcutTrigger.parseString` to learn more about the syntax
/// for triggers.
pub const ShortcutController = opaque {
    pub const Parent = gtk.EventController;
    pub const Implements = [_]type{ gio.ListModel, gtk.Buildable };
    pub const Class = gtk.ShortcutControllerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The modifiers that need to be pressed to allow mnemonics activation.
        pub const mnemonic_modifiers = struct {
            pub const name = "mnemonic-modifiers";

            pub const Type = gdk.ModifierType;
        };

        /// A list model to take shortcuts from.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// What scope the shortcuts will be handled in.
        pub const scope = struct {
            pub const name = "scope";

            pub const Type = gtk.ShortcutScope;
        };
    };

    pub const signals = struct {};

    /// Creates a new shortcut controller.
    extern fn gtk_shortcut_controller_new() *gtk.ShortcutController;
    pub const new = gtk_shortcut_controller_new;

    /// Creates a new shortcut controller that takes its shortcuts from
    /// the given list model.
    ///
    /// A controller created by this function does not let you add or
    /// remove individual shortcuts using the shortcut controller api,
    /// but you can change the contents of the model.
    extern fn gtk_shortcut_controller_new_for_model(p_model: *gio.ListModel) *gtk.ShortcutController;
    pub const newForModel = gtk_shortcut_controller_new_for_model;

    /// Adds `shortcut` to the list of shortcuts handled by `self`.
    ///
    /// If this controller uses an external shortcut list, this
    /// function does nothing.
    extern fn gtk_shortcut_controller_add_shortcut(p_self: *ShortcutController, p_shortcut: *gtk.Shortcut) void;
    pub const addShortcut = gtk_shortcut_controller_add_shortcut;

    /// Gets the mnemonics modifiers for when this controller activates its shortcuts.
    extern fn gtk_shortcut_controller_get_mnemonics_modifiers(p_self: *ShortcutController) gdk.ModifierType;
    pub const getMnemonicsModifiers = gtk_shortcut_controller_get_mnemonics_modifiers;

    /// Gets the scope for when this controller activates its shortcuts.
    ///
    /// See `gtk.ShortcutController.setScope` for details.
    extern fn gtk_shortcut_controller_get_scope(p_self: *ShortcutController) gtk.ShortcutScope;
    pub const getScope = gtk_shortcut_controller_get_scope;

    /// Removes `shortcut` from the list of shortcuts handled by `self`.
    ///
    /// If `shortcut` had not been added to `controller` or this controller
    /// uses an external shortcut list, this function does nothing.
    extern fn gtk_shortcut_controller_remove_shortcut(p_self: *ShortcutController, p_shortcut: *gtk.Shortcut) void;
    pub const removeShortcut = gtk_shortcut_controller_remove_shortcut;

    /// Sets the controller to use the given modifier for mnemonics.
    ///
    /// The mnemonics modifiers determines which modifiers need to be pressed to allow
    /// activation of shortcuts with mnemonics triggers.
    ///
    /// GTK normally uses the Alt modifier for mnemonics, except in `GtkPopoverMenu`s,
    /// where mnemonics can be triggered without any modifiers. It should be very
    /// rarely necessary to change this, and doing so is likely to interfere with
    /// other shortcuts.
    ///
    /// This value is only relevant for local shortcut controllers. Global and managed
    /// shortcut controllers will have their shortcuts activated from other places which
    /// have their own modifiers for activating mnemonics.
    extern fn gtk_shortcut_controller_set_mnemonics_modifiers(p_self: *ShortcutController, p_modifiers: gdk.ModifierType) void;
    pub const setMnemonicsModifiers = gtk_shortcut_controller_set_mnemonics_modifiers;

    /// Sets the controller to have the given `scope`.
    ///
    /// The scope allows shortcuts to be activated outside of the normal
    /// event propagation. In particular, it allows installing global
    /// keyboard shortcuts that can be activated even when a widget does
    /// not have focus.
    ///
    /// With `GTK_SHORTCUT_SCOPE_LOCAL`, shortcuts will only be activated
    /// when the widget has focus.
    extern fn gtk_shortcut_controller_set_scope(p_self: *ShortcutController, p_scope: gtk.ShortcutScope) void;
    pub const setScope = gtk_shortcut_controller_set_scope;

    extern fn gtk_shortcut_controller_get_type() usize;
    pub const getGObjectType = gtk_shortcut_controller_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutController) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutController) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutController, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkShortcutLabel` displays a single keyboard shortcut or gesture.
///
/// The main use case for `GtkShortcutLabel` is inside a `gtk.ShortcutsWindow`.
pub const ShortcutLabel = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.ShortcutLabelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The accelerator that `self` displays.
        ///
        /// See `gtk.ShortcutsShortcut.properties.accelerator`
        /// for the accepted syntax.
        pub const accelerator = struct {
            pub const name = "accelerator";

            pub const Type = ?[*:0]u8;
        };

        /// The text that is displayed when no accelerator is set.
        pub const disabled_text = struct {
            pub const name = "disabled-text";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkShortcutLabel` with `accelerator` set.
    extern fn gtk_shortcut_label_new(p_accelerator: [*:0]const u8) *gtk.ShortcutLabel;
    pub const new = gtk_shortcut_label_new;

    /// Retrieves the current accelerator of `self`.
    extern fn gtk_shortcut_label_get_accelerator(p_self: *ShortcutLabel) ?[*:0]const u8;
    pub const getAccelerator = gtk_shortcut_label_get_accelerator;

    /// Retrieves the text that is displayed when no accelerator is set.
    extern fn gtk_shortcut_label_get_disabled_text(p_self: *ShortcutLabel) ?[*:0]const u8;
    pub const getDisabledText = gtk_shortcut_label_get_disabled_text;

    /// Sets the accelerator to be displayed by `self`.
    extern fn gtk_shortcut_label_set_accelerator(p_self: *ShortcutLabel, p_accelerator: [*:0]const u8) void;
    pub const setAccelerator = gtk_shortcut_label_set_accelerator;

    /// Sets the text to be displayed by `self` when no accelerator is set.
    extern fn gtk_shortcut_label_set_disabled_text(p_self: *ShortcutLabel, p_disabled_text: [*:0]const u8) void;
    pub const setDisabledText = gtk_shortcut_label_set_disabled_text;

    extern fn gtk_shortcut_label_get_type() usize;
    pub const getGObjectType = gtk_shortcut_label_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutLabel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutLabel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutLabel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Tracks how a `GtkShortcut` can be activated.
///
/// To find out if a `GtkShortcutTrigger` triggers, you can call
/// `gtk.ShortcutTrigger.trigger` on a `GdkEvent`.
///
/// `GtkShortcutTriggers` contain functions that allow easy presentation
/// to end users as well as being printed for debugging.
///
/// All `GtkShortcutTriggers` are immutable, you can only specify their
/// properties during construction. If you want to change a trigger, you
/// have to replace it with a new one.
pub const ShortcutTrigger = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.ShortcutTriggerClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Tries to parse the given string into a trigger.
    ///
    /// On success, the parsed trigger is returned.
    /// When parsing failed, `NULL` is returned.
    ///
    /// The accepted strings are:
    ///
    ///   - `never`, for `GtkNeverTrigger`
    ///   - a string parsed by `gtk.acceleratorParse`, for a `GtkKeyvalTrigger`, e.g. `<Control>C`
    ///   - underscore, followed by a single character, for `GtkMnemonicTrigger`, e.g. `_l`
    ///   - two valid trigger strings, separated by a `|` character, for a
    ///     `GtkAlternativeTrigger`: `<Control>q|<Control>w`
    ///
    /// Note that you will have to escape the `<` and `>` characters when specifying
    /// triggers in XML files, such as GtkBuilder ui files. Use `&lt;` instead of
    /// `<` and `&gt;` instead of `>`.
    extern fn gtk_shortcut_trigger_parse_string(p_string: [*:0]const u8) ?*gtk.ShortcutTrigger;
    pub const parseString = gtk_shortcut_trigger_parse_string;

    /// The types of `trigger1` and `trigger2` are `gconstpointer` only to allow
    /// use of this function as a `GCompareFunc`.
    ///
    /// They must each be a `GtkShortcutTrigger`.
    extern fn gtk_shortcut_trigger_compare(p_trigger1: *const ShortcutTrigger, p_trigger2: *const gtk.ShortcutTrigger) c_int;
    pub const compare = gtk_shortcut_trigger_compare;

    /// Checks if `trigger1` and `trigger2` trigger under the same conditions.
    ///
    /// The types of `one` and `two` are `gconstpointer` only to allow use of this
    /// function with `GHashTable`. They must each be a `GtkShortcutTrigger`.
    extern fn gtk_shortcut_trigger_equal(p_trigger1: *const ShortcutTrigger, p_trigger2: *const gtk.ShortcutTrigger) c_int;
    pub const equal = gtk_shortcut_trigger_equal;

    /// Generates a hash value for a `GtkShortcutTrigger`.
    ///
    /// The output of this function is guaranteed to be the same for a given
    /// value only per-process. It may change between different processor
    /// architectures or even different versions of GTK. Do not use this
    /// function as a basis for building protocols or file formats.
    ///
    /// The types of `trigger` is `gconstpointer` only to allow use of this
    /// function with `GHashTable`. They must each be a `GtkShortcutTrigger`.
    extern fn gtk_shortcut_trigger_hash(p_trigger: *const ShortcutTrigger) c_uint;
    pub const hash = gtk_shortcut_trigger_hash;

    /// Prints the given trigger into a string for the developer.
    /// This is meant for debugging and logging.
    ///
    /// The form of the representation may change at any time
    /// and is not guaranteed to stay identical.
    extern fn gtk_shortcut_trigger_print(p_self: *ShortcutTrigger, p_string: *glib.String) void;
    pub const print = gtk_shortcut_trigger_print;

    /// Prints the given trigger into a string.
    ///
    /// This function is returning a translated string for presentation
    /// to end users for example in menu items or in help texts.
    ///
    /// The `display` in use may influence the resulting string in
    /// various forms, such as resolving hardware keycodes or by
    /// causing display-specific modifier names.
    ///
    /// The form of the representation may change at any time and is
    /// not guaranteed to stay identical.
    extern fn gtk_shortcut_trigger_print_label(p_self: *ShortcutTrigger, p_display: *gdk.Display, p_string: *glib.String) c_int;
    pub const printLabel = gtk_shortcut_trigger_print_label;

    /// Gets textual representation for the given trigger.
    ///
    /// This function is returning a translated string for
    /// presentation to end users for example in menu items
    /// or in help texts.
    ///
    /// The `display` in use may influence the resulting string in
    /// various forms, such as resolving hardware keycodes or by
    /// causing display-specific modifier names.
    ///
    /// The form of the representation may change at any time and is
    /// not guaranteed to stay identical.
    extern fn gtk_shortcut_trigger_to_label(p_self: *ShortcutTrigger, p_display: *gdk.Display) [*:0]u8;
    pub const toLabel = gtk_shortcut_trigger_to_label;

    /// Prints the given trigger into a human-readable string.
    ///
    /// This is a small wrapper around `gtk.ShortcutTrigger.print`
    /// to help when debugging.
    extern fn gtk_shortcut_trigger_to_string(p_self: *ShortcutTrigger) [*:0]u8;
    pub const toString = gtk_shortcut_trigger_to_string;

    /// Checks if the given `event` triggers `self`.
    extern fn gtk_shortcut_trigger_trigger(p_self: *ShortcutTrigger, p_event: *gdk.Event, p_enable_mnemonics: c_int) gdk.KeyMatch;
    pub const trigger = gtk_shortcut_trigger_trigger;

    extern fn gtk_shortcut_trigger_get_type() usize;
    pub const getGObjectType = gtk_shortcut_trigger_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutTrigger) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutTrigger) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutTrigger, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkShortcutsGroup` represents a group of related keyboard shortcuts
/// or gestures.
///
/// The group has a title. It may optionally be associated with a view
/// of the application, which can be used to show only relevant shortcuts
/// depending on the application context.
///
/// This widget is only meant to be used with `gtk.ShortcutsWindow`.
///
/// The recommended way to construct a `GtkShortcutsGroup` is with
/// `gtk.Builder`, by using the `<child>` tag to populate a
/// `GtkShortcutsGroup` with one or more `gtk.ShortcutsShortcut`
/// instances.
///
/// If you need to add a shortcut programmatically, use
/// `gtk.ShortcutsGroup.addShortcut`.
pub const ShortcutsGroup = opaque {
    pub const Parent = gtk.Box;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.ShortcutsGroupClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The size group for the accelerator portion of shortcuts in this group.
        ///
        /// This is used internally by GTK, and must not be modified by applications.
        pub const accel_size_group = struct {
            pub const name = "accel-size-group";

            pub const Type = ?*gtk.SizeGroup;
        };

        /// A rough measure for the number of lines in this group.
        ///
        /// This is used internally by GTK, and is not useful for applications.
        pub const height = struct {
            pub const name = "height";

            pub const Type = c_uint;
        };

        /// The title for this group of shortcuts.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// The size group for the textual portion of shortcuts in this group.
        ///
        /// This is used internally by GTK, and must not be modified by applications.
        pub const title_size_group = struct {
            pub const name = "title-size-group";

            pub const Type = ?*gtk.SizeGroup;
        };

        /// An optional view that the shortcuts in this group are relevant for.
        ///
        /// The group will be hidden if the `gtk.ShortcutsWindow.properties.view_name`
        /// property does not match the view of this group.
        ///
        /// Set this to `NULL` to make the group always visible.
        pub const view = struct {
            pub const name = "view";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Adds a shortcut to the shortcuts group.
    ///
    /// This is the programmatic equivalent to using `gtk.Builder` and a
    /// `<child>` tag to add the child. Adding children with other API is not
    /// appropriate as `GtkShortcutsGroup` manages its children internally.
    extern fn gtk_shortcuts_group_add_shortcut(p_self: *ShortcutsGroup, p_shortcut: *gtk.ShortcutsShortcut) void;
    pub const addShortcut = gtk_shortcuts_group_add_shortcut;

    extern fn gtk_shortcuts_group_get_type() usize;
    pub const getGObjectType = gtk_shortcuts_group_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutsGroup) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutsGroup) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutsGroup, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkShortcutsSection` collects all the keyboard shortcuts and gestures
/// for a major application mode.
///
/// If your application needs multiple sections, you should give each
/// section a unique `gtk.ShortcutsSection.properties.section_name` and
/// a `gtk.ShortcutsSection.properties.title` that can be shown in the
/// section selector of the `gtk.ShortcutsWindow`.
///
/// The `gtk.ShortcutsSection.properties.max_height` property can be used
/// to influence how the groups in the section are distributed over pages
/// and columns.
///
/// This widget is only meant to be used with `gtk.ShortcutsWindow`.
///
/// The recommended way to construct a `GtkShortcutsSection` is with
/// `gtk.Builder`, by using the `<child>` tag to populate a
/// `GtkShortcutsSection` with one or more `gtk.ShortcutsGroup`
/// instances, which in turn contain one or more `gtk.ShortcutsShortcut`
/// objects.
///
/// If you need to add a group programmatically, use
/// `gtk.ShortcutsSection.addGroup`.
///
/// # Shortcuts and Gestures
///
/// Pan gestures allow to navigate between sections.
///
/// The following signals have default keybindings:
///
/// - `gtk.ShortcutsSection.signals.change_current_page`
pub const ShortcutsSection = opaque {
    pub const Parent = gtk.Box;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = gtk.ShortcutsSectionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The maximum number of lines to allow per column.
        ///
        /// This property can be used to influence how the groups in this
        /// section are distributed across pages and columns. The default
        /// value of 15 should work in most cases.
        pub const max_height = struct {
            pub const name = "max-height";

            pub const Type = c_uint;
        };

        /// A unique name to identify this section among the sections
        /// added to the `GtkShortcutsWindow`.
        ///
        /// Setting the `gtk.ShortcutsWindow.properties.section_name` property
        /// to this string will make this section shown in the `GtkShortcutsWindow`.
        pub const section_name = struct {
            pub const name = "section-name";

            pub const Type = ?[*:0]u8;
        };

        /// The string to show in the section selector of the `GtkShortcutsWindow`
        /// for this section.
        ///
        /// If there is only one section, you don't need to set a title,
        /// since the section selector will not be shown in this case.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// A view name to filter the groups in this section by.
        ///
        /// See `gtk.ShortcutsGroup.properties.view`.
        ///
        /// Applications are expected to use the
        /// `gtk.ShortcutsWindow.properties.view_name` property
        /// for this purpose.
        pub const view_name = struct {
            pub const name = "view-name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted when we change the current page.
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>PgUp</kbd>, <kbd>PgUp</kbd>,
        /// <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>, <kbd>PgDn</kbd>.
        pub const change_current_page = struct {
            pub const name = "change-current-page";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_offset: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ShortcutsSection, p_instance))),
                    gobject.signalLookup("change-current-page", ShortcutsSection.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Adds a group to the shortcuts section.
    ///
    /// This is the programmatic equivalent to using `gtk.Builder` and a
    /// `<child>` tag to add the child.
    ///
    /// Adding children with the `GtkBox` API is not appropriate, as
    /// `GtkShortcutsSection` manages its children internally.
    extern fn gtk_shortcuts_section_add_group(p_self: *ShortcutsSection, p_group: *gtk.ShortcutsGroup) void;
    pub const addGroup = gtk_shortcuts_section_add_group;

    extern fn gtk_shortcuts_section_get_type() usize;
    pub const getGObjectType = gtk_shortcuts_section_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutsSection) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutsSection) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutsSection, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkShortcutsShortcut` represents a single keyboard shortcut or gesture
/// with a short text.
///
/// This widget is only meant to be used with `GtkShortcutsWindow`.
pub const ShortcutsShortcut = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.ShortcutsShortcutClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The size group for the accelerator portion of this shortcut.
        ///
        /// This is used internally by GTK, and must not be modified by applications.
        pub const accel_size_group = struct {
            pub const name = "accel-size-group";

            pub const Type = ?*gtk.SizeGroup;
        };

        /// The accelerator(s) represented by this object.
        ///
        /// This property is used if `gtk.ShortcutsShortcut.properties.shortcut_type`
        /// is set to `GTK_SHORTCUT_ACCELERATOR`.
        ///
        /// The syntax of this property is (an extension of) the syntax understood
        /// by `gtk.acceleratorParse`. Multiple accelerators can be specified
        /// by separating them with a space, but keep in mind that the available width
        /// is limited.
        ///
        /// It is also possible to specify ranges of shortcuts, using `...` between
        /// the keys. Sequences of keys can be specified using a `+` or `&` between
        /// the keys.
        ///
        /// Examples:
        ///
        /// - A single shortcut: `<ctl><alt>delete`
        /// - Two alternative shortcuts: `<shift>a Home`
        /// - A range of shortcuts: `<alt>1...<alt>9`
        /// - Several keys pressed together: `Control_L&Control_R`
        /// - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
        ///
        /// Use "+" instead of "&" when the keys may (or have to be) pressed
        /// sequentially (e.g use "t+t" for 'press the t key twice').
        ///
        /// Note that `<`, `>` and `&` need to be escaped as `&lt;`, `&gt`; and `&amp`; when used
        /// in .ui files.
        pub const accelerator = struct {
            pub const name = "accelerator";

            pub const Type = ?[*:0]u8;
        };

        /// A detailed action name.
        ///
        /// If this is set for a shortcut of type `GTK_SHORTCUT_ACCELERATOR`,
        /// then GTK will use the accelerators that are associated with the
        /// action via `gtk.Application.setAccelsForAction`, and
        /// setting `gtk.ShortcutsShortcut.properties.accelerator` is not necessary.
        pub const action_name = struct {
            pub const name = "action-name";

            pub const Type = ?[*:0]u8;
        };

        /// The text direction for which this shortcut is active.
        ///
        /// If the shortcut is used regardless of the text direction,
        /// set this property to `GTK_TEXT_DIR_NONE`.
        pub const direction = struct {
            pub const name = "direction";

            pub const Type = gtk.TextDirection;
        };

        /// An icon to represent the shortcut or gesture.
        ///
        /// This property is used if `gtk.ShortcutsShortcut.properties.shortcut_type`
        /// is set to `GTK_SHORTCUT_GESTURE`.
        ///
        /// For the other predefined gesture types, GTK provides an icon on its own.
        pub const icon = struct {
            pub const name = "icon";

            pub const Type = ?*gio.Icon;
        };

        /// `TRUE` if an icon has been set.
        pub const icon_set = struct {
            pub const name = "icon-set";

            pub const Type = c_int;
        };

        /// The type of shortcut that is represented.
        pub const shortcut_type = struct {
            pub const name = "shortcut-type";

            pub const Type = gtk.ShortcutType;
        };

        /// The subtitle for the shortcut or gesture.
        ///
        /// This is typically used for gestures and should be a short, one-line
        /// text that describes the gesture itself. For the predefined gesture
        /// types, GTK provides a subtitle on its own.
        pub const subtitle = struct {
            pub const name = "subtitle";

            pub const Type = ?[*:0]u8;
        };

        /// `TRUE` if a subtitle has been set.
        pub const subtitle_set = struct {
            pub const name = "subtitle-set";

            pub const Type = c_int;
        };

        /// The textual description for the shortcut or gesture represented by
        /// this object.
        ///
        /// This should be a short string that can fit in a single line.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// The size group for the textual portion of this shortcut.
        ///
        /// This is used internally by GTK, and must not be modified by applications.
        pub const title_size_group = struct {
            pub const name = "title-size-group";

            pub const Type = ?*gtk.SizeGroup;
        };
    };

    pub const signals = struct {};

    extern fn gtk_shortcuts_shortcut_get_type() usize;
    pub const getGObjectType = gtk_shortcuts_shortcut_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutsShortcut) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutsShortcut) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutsShortcut, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkShortcutsWindow` shows information about the keyboard shortcuts
/// and gestures of an application.
///
/// The shortcuts can be grouped, and you can have multiple sections in this
/// window, corresponding to the major modes of your application.
///
/// Additionally, the shortcuts can be filtered by the current view, to avoid
/// showing information that is not relevant in the current application context.
///
/// The recommended way to construct a `GtkShortcutsWindow` is with
/// `gtk.Builder`, by using the `<child>` tag to populate a
/// `GtkShortcutsWindow` with one or more `gtk.ShortcutsSection` objects,
/// which contain one or more `gtk.ShortcutsGroup` instances, which, in turn,
/// contain `gtk.ShortcutsShortcut` instances.
///
/// If you need to add a section programmatically, use `gtk.ShortcutsWindow.addSection`
/// instead of `gtk.Window.setChild`, as the shortcuts window manages
/// its children directly.
///
/// # A simple example:
///
/// <picture>
///   <source srcset="gedit-shortcuts-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="A simple example" src="gedit-shortcuts.png">
/// </picture>
///
/// This example has as single section. As you can see, the shortcut groups
/// are arranged in columns, and spread across several pages if there are too
/// many to find on a single page.
///
/// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-gedit.ui).
///
/// # An example with multiple views:
///
/// <picture>
///   <source srcset="clocks-shortcuts-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example with multiple views" src="clocks-shortcuts.png">
/// </picture>
///
/// This example shows a `GtkShortcutsWindow` that has been configured to show only
/// the shortcuts relevant to the “Stopwatch” view.
///
/// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-clocks.ui).
///
/// # An example with multiple sections:
///
/// <picture>
///   <source srcset="builder-shortcuts-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example with multiple sections" src="builder-shortcuts.png">
/// </picture>
///
/// This example shows a `GtkShortcutsWindow` with two sections, “Editor Shortcuts”
/// and “Terminal Shortcuts”.
///
/// The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-builder.ui).
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.ShortcutsWindow.signals.close`
/// - `gtk.ShortcutsWindow.signals.search`
///
/// # CSS nodes
///
/// `GtkShortcutsWindow` has a single CSS node with the name `window` and style
/// class `.shortcuts`.
pub const ShortcutsWindow = opaque {
    pub const Parent = gtk.Window;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = opaque {
        pub const Instance = ShortcutsWindow;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The name of the section to show.
        ///
        /// This should be the section-name of one of the `GtkShortcutsSection`
        /// objects that are in this shortcuts window.
        pub const section_name = struct {
            pub const name = "section-name";

            pub const Type = ?[*:0]u8;
        };

        /// The view name by which to filter the contents.
        ///
        /// This should correspond to the `gtk.ShortcutsGroup.properties.view`
        /// property of some of the `gtk.ShortcutsGroup` objects that
        /// are inside this shortcuts window.
        ///
        /// Set this to `NULL` to show all groups.
        pub const view_name = struct {
            pub const name = "view-name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted when the user uses a keybinding to close the window.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is the <kbd>Escape</kbd> key.
        pub const close = struct {
            pub const name = "close";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ShortcutsWindow, p_instance))),
                    gobject.signalLookup("close", ShortcutsWindow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user uses a keybinding to start a search.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Control</kbd>+<kbd>F</kbd>.
        pub const search = struct {
            pub const name = "search";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ShortcutsWindow, p_instance))),
                    gobject.signalLookup("search", ShortcutsWindow.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Adds a section to the shortcuts window.
    ///
    /// This is the programmatic equivalent to using `gtk.Builder` and a
    /// `<child>` tag to add the child.
    ///
    /// Using `gtk.Window.setChild` is not appropriate as the shortcuts
    /// window manages its children internally.
    extern fn gtk_shortcuts_window_add_section(p_self: *ShortcutsWindow, p_section: *gtk.ShortcutsSection) void;
    pub const addSection = gtk_shortcuts_window_add_section;

    extern fn gtk_shortcuts_window_get_type() usize;
    pub const getGObjectType = gtk_shortcuts_window_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutsWindow) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutsWindow) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutsWindow, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Emits a signal on a widget.
///
/// Signals that are used in this way are referred to as keybinding signals,
/// and they are expected to be defined with the `G_SIGNAL_ACTION` flag.
pub const SignalAction = opaque {
    pub const Parent = gtk.ShortcutAction;
    pub const Implements = [_]type{};
    pub const Class = gtk.SignalActionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The name of the signal to emit.
        pub const signal_name = struct {
            pub const name = "signal-name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates an action that when activated, emits the given action signal
    /// on the provided widget.
    ///
    /// It will also unpack the args into arguments passed to the signal.
    extern fn gtk_signal_action_new(p_signal_name: [*:0]const u8) *gtk.SignalAction;
    pub const new = gtk_signal_action_new;

    /// Returns the name of the signal that will be emitted.
    extern fn gtk_signal_action_get_signal_name(p_self: *SignalAction) [*:0]const u8;
    pub const getSignalName = gtk_signal_action_get_signal_name;

    extern fn gtk_signal_action_get_type() usize;
    pub const getGObjectType = gtk_signal_action_get_type;

    extern fn g_object_ref(p_self: *gtk.SignalAction) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SignalAction) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SignalAction, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Emits signals to manage listitems.
///
/// Signals are emitted for every listitem in the same order:
///
///  1. `gtk.SignalListItemFactory.signals.setup` is emitted to set up permanent
///  things on the listitem. This usually means constructing the widgets used in
///  the row and adding them to the listitem.
///
///  2. `gtk.SignalListItemFactory.signals.bind` is emitted to bind the item passed
///  via `gtk.ListItem.properties.item` to the widgets that have been created in
///  step 1 or to add item-specific widgets. Signals are connected to listen to
///  changes - both to changes in the item to update the widgets or to changes
///  in the widgets to update the item. After this signal has been called, the
///  listitem may be shown in a list widget.
///
///  3. `gtk.SignalListItemFactory.signals.unbind` is emitted to undo everything
///  done in step 2. Usually this means disconnecting signal handlers. Once this
///  signal has been called, the listitem will no longer be used in a list
///  widget.
///
///  4. `gtk.SignalListItemFactory.signals.bind` and
///  `gtk.SignalListItemFactory.signals.unbind` may be emitted multiple times
///  again to bind the listitem for use with new items. By reusing listitems,
///  potentially costly setup can be avoided. However, it means code needs to
///  make sure to properly clean up the listitem in step 3 so that no information
///  from the previous use leaks into the next one.
///
///  5. `gtk.SignalListItemFactory.signals.teardown` is emitted to allow undoing
///  the effects of `gtk.SignalListItemFactory.signals.setup`. After this signal
///  was emitted on a listitem, the listitem will be destroyed and not be used again.
///
/// Note that during the signal emissions, changing properties on the listitems
/// passed will not trigger notify signals as the listitem's notifications are
/// frozen. See `gobject.Object.freezeNotify` for details.
///
/// For tracking changes in other properties in the listitem, the
/// ::notify signal is recommended. The signal can be connected in the
/// `gtk.SignalListItemFactory.signals.setup` signal and removed again during
/// `gtk.SignalListItemFactory.signals.teardown`.
pub const SignalListItemFactory = opaque {
    pub const Parent = gtk.ListItemFactory;
    pub const Implements = [_]type{};
    pub const Class = gtk.SignalListItemFactoryClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted when an object has been bound to an item.
        ///
        /// The handler for this signal must set
        /// to populate the listitem with widgets.
        ///
        /// After this signal was emitted, the object might be shown in
        /// a `gtk.ListView` or other widget.
        ///
        /// The `gtk.SignalListItemFactory.signals.unbind` signal is the
        /// opposite of this signal and can be used to undo everything done
        /// in this signal.
        pub const bind = struct {
            pub const name = "bind";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_object: *gobject.Object, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SignalListItemFactory, p_instance))),
                    gobject.signalLookup("bind", SignalListItemFactory.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a newly created listitem needs to be prepared for use.
        ///
        /// It is the first signal emitted for every listitem.
        ///
        /// The handler for this signal must call `gtk.ListItem.setChild`
        /// to populate the listitem with widgets.
        ///
        /// The `gtk.SignalListItemFactory.signals.teardown` signal is the opposite
        /// of this signal and can be used to undo everything done in this signal.
        pub const setup = struct {
            pub const name = "setup";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_object: *gobject.Object, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SignalListItemFactory, p_instance))),
                    gobject.signalLookup("setup", SignalListItemFactory.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when an object is about to be destroyed.
        ///
        /// It is the last signal ever emitted for this `object`.
        ///
        /// This signal is the opposite of the `gtk.SignalListItemFactory.signals.setup`
        /// signal and should be used to undo everything done in that signal.
        pub const teardown = struct {
            pub const name = "teardown";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_object: *gobject.Object, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SignalListItemFactory, p_instance))),
                    gobject.signalLookup("teardown", SignalListItemFactory.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when an object has been unbound from its item.
        ///
        /// This happens for example when a listitem was removed from use
        /// in a list widget and its `gtk.ListItem.properties.item` is about
        /// to be unset.
        ///
        /// This signal is the opposite of the `gtk.SignalListItemFactory.signals.bind`
        /// signal and should be used to undo everything done in that signal.
        pub const unbind = struct {
            pub const name = "unbind";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_object: *gobject.Object, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SignalListItemFactory, p_instance))),
                    gobject.signalLookup("unbind", SignalListItemFactory.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkSignalListItemFactory`.
    ///
    /// You need to connect signal handlers before you use it.
    extern fn gtk_signal_list_item_factory_new() *gtk.SignalListItemFactory;
    pub const new = gtk_signal_list_item_factory_new;

    extern fn gtk_signal_list_item_factory_get_type() usize;
    pub const getGObjectType = gtk_signal_list_item_factory_get_type;

    extern fn g_object_ref(p_self: *gtk.SignalListItemFactory) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SignalListItemFactory) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SignalListItemFactory, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A selection model that allows selecting a single item.
///
/// Note that the selection is *persistent* -- if the selected item is removed
/// and re-added in the same `gio.ListModel.signals.items_changed` emission, it
/// stays selected. In particular, this means that changing the sort order of an
/// underlying sort model will preserve the selection.
pub const SingleSelection = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel, gtk.SelectionModel };
    pub const Class = gtk.SingleSelectionClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If the selection will always select an item.
        pub const autoselect = struct {
            pub const name = "autoselect";

            pub const Type = c_int;
        };

        /// If unselecting the selected item is allowed.
        pub const can_unselect = struct {
            pub const name = "can-unselect";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being managed.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// Position of the selected item.
        pub const selected = struct {
            pub const name = "selected";

            pub const Type = c_uint;
        };

        /// The selected item.
        pub const selected_item = struct {
            pub const name = "selected-item";

            pub const Type = ?*gobject.Object;
        };
    };

    pub const signals = struct {};

    /// Creates a new selection to handle `model`.
    extern fn gtk_single_selection_new(p_model: ?*gio.ListModel) *gtk.SingleSelection;
    pub const new = gtk_single_selection_new;

    /// Checks if autoselect has been enabled or disabled via
    /// `gtk.SingleSelection.setAutoselect`.
    extern fn gtk_single_selection_get_autoselect(p_self: *SingleSelection) c_int;
    pub const getAutoselect = gtk_single_selection_get_autoselect;

    /// If `TRUE`, `gtk.SelectionModel.unselectItem` is supported and allows
    /// unselecting the selected item.
    extern fn gtk_single_selection_get_can_unselect(p_self: *SingleSelection) c_int;
    pub const getCanUnselect = gtk_single_selection_get_can_unselect;

    /// Gets the model that `self` is wrapping.
    extern fn gtk_single_selection_get_model(p_self: *SingleSelection) ?*gio.ListModel;
    pub const getModel = gtk_single_selection_get_model;

    /// Gets the position of the selected item.
    ///
    /// If no item is selected, `GTK_INVALID_LIST_POSITION` is returned.
    extern fn gtk_single_selection_get_selected(p_self: *SingleSelection) c_uint;
    pub const getSelected = gtk_single_selection_get_selected;

    /// Gets the selected item.
    ///
    /// If no item is selected, `NULL` is returned.
    extern fn gtk_single_selection_get_selected_item(p_self: *SingleSelection) ?*gobject.Object;
    pub const getSelectedItem = gtk_single_selection_get_selected_item;

    /// Enables or disables autoselect.
    ///
    /// If `autoselect` is `TRUE`, `self` will enforce that an item is always
    /// selected. It will select a new item when the currently selected
    /// item is deleted and it will disallow unselecting the current item.
    extern fn gtk_single_selection_set_autoselect(p_self: *SingleSelection, p_autoselect: c_int) void;
    pub const setAutoselect = gtk_single_selection_set_autoselect;

    /// If `TRUE`, unselecting the current item via
    /// `gtk.SelectionModel.unselectItem` is supported.
    ///
    /// Note that setting `gtk.SingleSelection.properties.autoselect` will
    /// cause unselecting to not work, so it practically makes no sense
    /// to set both at the same time.
    extern fn gtk_single_selection_set_can_unselect(p_self: *SingleSelection, p_can_unselect: c_int) void;
    pub const setCanUnselect = gtk_single_selection_set_can_unselect;

    /// Sets the model that `self` should wrap.
    ///
    /// If `model` is `NULL`, `self` will be empty.
    extern fn gtk_single_selection_set_model(p_self: *SingleSelection, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_single_selection_set_model;

    /// Selects the item at the given position.
    ///
    /// If the list does not have an item at `position` or
    /// `GTK_INVALID_LIST_POSITION` is given, the behavior depends on the
    /// value of the `gtk.SingleSelection.properties.autoselect` property:
    /// If it is set, no change will occur and the old item will stay
    /// selected. If it is unset, the selection will be unset and no item
    /// will be selected. This also applies if `gtk.SingleSelection.properties.can_unselect`
    /// is set to `FALSE`.
    extern fn gtk_single_selection_set_selected(p_self: *SingleSelection, p_position: c_uint) void;
    pub const setSelected = gtk_single_selection_set_selected;

    extern fn gtk_single_selection_get_type() usize;
    pub const getGObjectType = gtk_single_selection_get_type;

    extern fn g_object_ref(p_self: *gtk.SingleSelection) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SingleSelection) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SingleSelection, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Groups widgets together so they all request the same size.
///
/// This is typically useful when you want a column of widgets to have
/// the same size, but you can’t use a `gtk.Grid` or `gtk.Box`.
///
/// In detail, the size requested for each widget in a `GtkSizeGroup` is
/// the maximum of the sizes that would have been requested for each
/// widget in the size group if they were not in the size group. The
/// [mode]`gtk.SizeGroup.setMode` of the size group determines
/// whether this applies to the horizontal size, the vertical size, or
/// both sizes.
///
/// Note that size groups only affect the amount of space requested, not
/// the size that the widgets finally receive. If you want the widgets in
/// a `GtkSizeGroup` to actually be the same size, you need to pack them in
/// such a way that they get the size they request and not more. In
/// particular it doesn't make a lot of sense to set
/// [the expand flags]`gtk.Widget.setHexpand` on the widgets that
/// are members of a size group.
///
/// `GtkSizeGroup` objects are referenced by each widget in the size group,
/// so once you have added all widgets to a `GtkSizeGroup`, you can drop
/// the initial reference to the size group with
/// `gobject.Object.unref`. If the widgets in the size group are
/// subsequently destroyed, then they will be removed from the size group
/// and drop their references on the size group; when all widgets have been
/// removed, the size group will be freed.
///
/// Widgets can be part of multiple size groups; GTK will compute the
/// horizontal size of a widget from the horizontal requisition of all widgets
/// that can be reached from the widget by a chain of size groups with mode
/// `gtk.@"SizeGroupMode.HORIZONTAL"` or `gtk.@"SizeGroupMode.BOTH"`, and
/// the vertical size from the vertical requisition of all widgets that can be
/// reached from the widget by a chain of size groups with mode
/// `gtk.@"SizeGroupMode.VERTICAL"` or `gtk.@"SizeGroupMode.BOTH"`.
///
/// # Size groups and trading height-for-width
///
/// ::: warning
///     Generally, size groups don't interact well with widgets that
///     trade height for width (or width for height), such as wrappable
///     labels. Avoid using size groups with such widgets.
///
/// A size group with mode `gtk.@"SizeGroupMode.HORIZONTAL"` or
/// `gtk.@"SizeGroupMode.VERTICAL"` only consults non-contextual sizes
/// of widgets other than the one being measured, since it has no
/// knowledge of what size a widget will get allocated in the other
/// orientation. This can lead to widgets in a group actually requesting
/// different contextual sizes, contrary to the purpose of
/// `GtkSizeGroup`.
///
/// In contrast, a size group with mode `gtk.@"SizeGroupMode.BOTH"` can
/// properly propagate the available size in the opposite orientation
/// when measuring widgets in the group, which results in consistent and
/// accurate measurements.
///
/// In case some mechanism other than a size group is already used to
/// ensure that widgets in a group all get the same size in one
/// orientation (for example, some common ancestor is known to allocate
/// the same width to all its children), and the size group is only
/// really needed to also make the widgets request the same size in the
/// other orientation, it is beneficial to still set the group's mode to
/// `gtk.@"SizeGroupMode.BOTH"`. This lets the group assume and count
/// on sizes of the widgets in the former orientation being the same,
/// which enables it to propagate the available size as described above.
///
/// # Alternatives to size groups
///
/// Size groups have many limitations, such as only influencing size
/// requests but not allocations, and poor height-for-width support. When
/// possible, prefer using dedicated mechanisms that can properly ensure
/// that the widgets get the same size.
///
/// Various container widgets and layout managers support a homogeneous
/// layout mode, where they will explicitly give the same size to their
/// children (see `gtk.Box.properties.homogeneous`). Using homogeneous mode
/// can also have large performance benefits compared to either the same
/// container in non-homogeneous mode, or to size groups.
///
/// `gtk.Grid` can be used to position widgets into rows and
/// columns. Members of each column will have the same width among them;
/// likewise, members of each row will have the same height. On top of
/// that, the heights can be made equal between all rows with
/// `gtk.Grid.properties.row_homogeneous`, and the widths can be made equal
/// between all columns with `gtk.Grid.properties.column_homogeneous`.
///
/// # GtkSizeGroup as GtkBuildable
///
/// Size groups can be specified in a UI definition by placing an `<object>`
/// element with `class="GtkSizeGroup"` somewhere in the UI definition. The
/// widgets that belong to the size group are specified by a `<widgets>` element
/// that may contain multiple `<widget>` elements, one for each member of the
/// size group. The ”name” attribute gives the id of the widget.
///
/// An example of a UI definition fragment with `GtkSizeGroup`:
/// ```xml
/// <object class="GtkSizeGroup">
///   <property name="mode">horizontal</property>
///   <widgets>
///     <widget name="radio1"/>
///     <widget name="radio2"/>
///   </widgets>
/// </object>
/// ```
pub const SizeGroup = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.Buildable};
    pub const Class = opaque {
        pub const Instance = SizeGroup;
    };
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The direction in which the size group affects requested sizes.
        pub const mode = struct {
            pub const name = "mode";

            pub const Type = gtk.SizeGroupMode;
        };
    };

    pub const signals = struct {};

    /// Create a new `GtkSizeGroup`.
    extern fn gtk_size_group_new(p_mode: gtk.SizeGroupMode) *gtk.SizeGroup;
    pub const new = gtk_size_group_new;

    /// Adds a widget to a `GtkSizeGroup`.
    ///
    /// In the future, the requisition
    /// of the widget will be determined as the maximum of its requisition
    /// and the requisition of the other widgets in the size group.
    /// Whether this applies horizontally, vertically, or in both directions
    /// depends on the mode of the size group.
    /// See `gtk.SizeGroup.setMode`.
    ///
    /// When the widget is destroyed or no longer referenced elsewhere, it
    /// will be removed from the size group.
    extern fn gtk_size_group_add_widget(p_size_group: *SizeGroup, p_widget: *gtk.Widget) void;
    pub const addWidget = gtk_size_group_add_widget;

    /// Gets the current mode of the size group.
    extern fn gtk_size_group_get_mode(p_size_group: *SizeGroup) gtk.SizeGroupMode;
    pub const getMode = gtk_size_group_get_mode;

    /// Returns the list of widgets associated with `size_group`.
    extern fn gtk_size_group_get_widgets(p_size_group: *SizeGroup) *glib.SList;
    pub const getWidgets = gtk_size_group_get_widgets;

    /// Removes a widget from a `GtkSizeGroup`.
    extern fn gtk_size_group_remove_widget(p_size_group: *SizeGroup, p_widget: *gtk.Widget) void;
    pub const removeWidget = gtk_size_group_remove_widget;

    /// Sets the `GtkSizeGroupMode` of the size group.
    ///
    /// The mode of the size group determines whether the widgets in the
    /// size group should all have the same horizontal requisition
    /// (`GTK_SIZE_GROUP_HORIZONTAL`) all have the same vertical requisition
    /// (`GTK_SIZE_GROUP_VERTICAL`), or should all have the same requisition
    /// in both directions (`GTK_SIZE_GROUP_BOTH`).
    extern fn gtk_size_group_set_mode(p_size_group: *SizeGroup, p_mode: gtk.SizeGroupMode) void;
    pub const setMode = gtk_size_group_set_mode;

    extern fn gtk_size_group_get_type() usize;
    pub const getGObjectType = gtk_size_group_get_type;

    extern fn g_object_ref(p_self: *gtk.SizeGroup) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SizeGroup) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SizeGroup, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that presents a slice of another model.
///
/// This is useful when implementing paging by setting the size to the number
/// of elements per page and updating the offset whenever a different page is
/// opened.
///
/// `GtkSliceListModel` passes through sections from the underlying model.
pub const SliceListModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel };
    pub const Class = gtk.SliceListModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// Child model to take slice from.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// Offset of slice.
        pub const offset = struct {
            pub const name = "offset";

            pub const Type = c_uint;
        };

        /// Maximum size of slice.
        pub const size = struct {
            pub const name = "size";

            pub const Type = c_uint;
        };
    };

    pub const signals = struct {};

    /// Creates a new slice model.
    ///
    /// It presents the slice from `offset` to offset + `size`
    /// of the given `model`.
    extern fn gtk_slice_list_model_new(p_model: ?*gio.ListModel, p_offset: c_uint, p_size: c_uint) *gtk.SliceListModel;
    pub const new = gtk_slice_list_model_new;

    /// Gets the model that is currently being used or `NULL` if none.
    extern fn gtk_slice_list_model_get_model(p_self: *SliceListModel) ?*gio.ListModel;
    pub const getModel = gtk_slice_list_model_get_model;

    /// Gets the offset set via `gtk.SliceListModel.setOffset`.
    extern fn gtk_slice_list_model_get_offset(p_self: *SliceListModel) c_uint;
    pub const getOffset = gtk_slice_list_model_get_offset;

    /// Gets the size set via `gtk.SliceListModel.setSize`.
    extern fn gtk_slice_list_model_get_size(p_self: *SliceListModel) c_uint;
    pub const getSize = gtk_slice_list_model_get_size;

    /// Sets the model to show a slice of.
    ///
    /// The model's item type must conform to `self`'s item type.
    extern fn gtk_slice_list_model_set_model(p_self: *SliceListModel, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_slice_list_model_set_model;

    /// Sets the offset into the original model for this slice.
    ///
    /// If the offset is too large for the sliced model,
    /// `self` will end up empty.
    extern fn gtk_slice_list_model_set_offset(p_self: *SliceListModel, p_offset: c_uint) void;
    pub const setOffset = gtk_slice_list_model_set_offset;

    /// Sets the maximum size. `self` will never have more items
    /// than `size`.
    ///
    /// It can however have fewer items if the offset is too large
    /// or the model sliced from doesn't have enough items.
    extern fn gtk_slice_list_model_set_size(p_self: *SliceListModel, p_size: c_uint) void;
    pub const setSize = gtk_slice_list_model_set_size;

    extern fn gtk_slice_list_model_get_type() usize;
    pub const getGObjectType = gtk_slice_list_model_get_type;

    extern fn g_object_ref(p_self: *gtk.SliceListModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SliceListModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SliceListModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Assists in creating `gsk.RenderNode`s for widgets.
///
/// It functions in a similar way to a cairo context, and maintains a stack
/// of render nodes and their associated transformations.
///
/// The node at the top of the stack is the one that `gtk_snapshot_append_…()`
/// functions operate on. Use the `gtk_snapshot_push_…()` functions and
/// `Snapshot.pop` to change the current node.
///
/// The typical way to obtain a `GtkSnapshot` object is as an argument to
/// the `gtk.Widget.virtual_methods.snapshot` vfunc. If you need to create your own
/// `GtkSnapshot`, use `gtk.Snapshot.new`.
///
/// Note that `GtkSnapshot` applies some optimizations, so the node
/// it produces may not match the API calls 1:1. For example, it will
/// omit clip nodes if the child node is entirely contained within the
/// clip rectangle.
pub const Snapshot = opaque {
    pub const Parent = gdk.Snapshot;
    pub const Implements = [_]type{};
    pub const Class = gtk.SnapshotClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkSnapshot`.
    extern fn gtk_snapshot_new() *gtk.Snapshot;
    pub const new = gtk_snapshot_new;

    /// Appends a stroked border rectangle inside the given `outline`.
    ///
    /// The four sides of the border can have different widths and colors.
    extern fn gtk_snapshot_append_border(p_snapshot: *Snapshot, p_outline: *const gsk.RoundedRect, p_border_width: *const [4]f32, p_border_color: *const [4]gdk.RGBA) void;
    pub const appendBorder = gtk_snapshot_append_border;

    /// Creates a new `gsk.CairoNode` and appends it to the current
    /// render node of `snapshot`, without changing the current node.
    extern fn gtk_snapshot_append_cairo(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect) *cairo.Context;
    pub const appendCairo = gtk_snapshot_append_cairo;

    /// Creates a new render node drawing the `color` into the
    /// given `bounds` and appends it to the current render node
    /// of `snapshot`.
    ///
    /// You should try to avoid calling this function if
    /// `color` is transparent.
    extern fn gtk_snapshot_append_color(p_snapshot: *Snapshot, p_color: *const gdk.RGBA, p_bounds: *const graphene.Rect) void;
    pub const appendColor = gtk_snapshot_append_color;

    /// Appends a conic gradient node with the given stops to `snapshot`.
    extern fn gtk_snapshot_append_conic_gradient(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_center: *const graphene.Point, p_rotation: f32, p_stops: [*]const gsk.ColorStop, p_n_stops: usize) void;
    pub const appendConicGradient = gtk_snapshot_append_conic_gradient;

    /// A convenience method to fill a path with a color.
    ///
    /// See `gtk.Snapshot.pushFill` if you need
    /// to fill a path with more complex content than
    /// a color.
    extern fn gtk_snapshot_append_fill(p_snapshot: *Snapshot, p_path: *gsk.Path, p_fill_rule: gsk.FillRule, p_color: *const gdk.RGBA) void;
    pub const appendFill = gtk_snapshot_append_fill;

    /// Appends an inset shadow into the box given by `outline`.
    extern fn gtk_snapshot_append_inset_shadow(p_snapshot: *Snapshot, p_outline: *const gsk.RoundedRect, p_color: *const gdk.RGBA, p_dx: f32, p_dy: f32, p_spread: f32, p_blur_radius: f32) void;
    pub const appendInsetShadow = gtk_snapshot_append_inset_shadow;

    /// Creates render nodes for rendering `layout` in the given foregound `color`
    /// and appends them to the current node of `snapshot` without changing the
    /// current node. The current theme's foreground color for a widget can be
    /// obtained with `gtk.Widget.getColor`.
    ///
    /// Note that if the layout does not produce any visible output, then nodes
    /// may not be added to the `snapshot`.
    extern fn gtk_snapshot_append_layout(p_snapshot: *Snapshot, p_layout: *pango.Layout, p_color: *const gdk.RGBA) void;
    pub const appendLayout = gtk_snapshot_append_layout;

    /// Appends a linear gradient node with the given stops to `snapshot`.
    extern fn gtk_snapshot_append_linear_gradient(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_start_point: *const graphene.Point, p_end_point: *const graphene.Point, p_stops: [*]const gsk.ColorStop, p_n_stops: usize) void;
    pub const appendLinearGradient = gtk_snapshot_append_linear_gradient;

    /// Appends `node` to the current render node of `snapshot`,
    /// without changing the current node.
    ///
    /// If `snapshot` does not have a current node yet, `node`
    /// will become the initial node.
    extern fn gtk_snapshot_append_node(p_snapshot: *Snapshot, p_node: *gsk.RenderNode) void;
    pub const appendNode = gtk_snapshot_append_node;

    /// Appends an outset shadow node around the box given by `outline`.
    extern fn gtk_snapshot_append_outset_shadow(p_snapshot: *Snapshot, p_outline: *const gsk.RoundedRect, p_color: *const gdk.RGBA, p_dx: f32, p_dy: f32, p_spread: f32, p_blur_radius: f32) void;
    pub const appendOutsetShadow = gtk_snapshot_append_outset_shadow;

    /// Creates a new render node that pastes the contents
    /// copied by a previous call to `gtk.Snapshot.pushCopy`
    extern fn gtk_snapshot_append_paste(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_nth: usize) void;
    pub const appendPaste = gtk_snapshot_append_paste;

    /// Appends a radial gradient node with the given stops to `snapshot`.
    extern fn gtk_snapshot_append_radial_gradient(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_center: *const graphene.Point, p_hradius: f32, p_vradius: f32, p_start: f32, p_end: f32, p_stops: [*]const gsk.ColorStop, p_n_stops: usize) void;
    pub const appendRadialGradient = gtk_snapshot_append_radial_gradient;

    /// Appends a repeating linear gradient node with the given stops to `snapshot`.
    extern fn gtk_snapshot_append_repeating_linear_gradient(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_start_point: *const graphene.Point, p_end_point: *const graphene.Point, p_stops: [*]const gsk.ColorStop, p_n_stops: usize) void;
    pub const appendRepeatingLinearGradient = gtk_snapshot_append_repeating_linear_gradient;

    /// Appends a repeating radial gradient node with the given stops to `snapshot`.
    extern fn gtk_snapshot_append_repeating_radial_gradient(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_center: *const graphene.Point, p_hradius: f32, p_vradius: f32, p_start: f32, p_end: f32, p_stops: [*]const gsk.ColorStop, p_n_stops: usize) void;
    pub const appendRepeatingRadialGradient = gtk_snapshot_append_repeating_radial_gradient;

    /// Creates a new render node drawing the `texture`
    /// into the given `bounds` and appends it to the
    /// current render node of `snapshot`.
    ///
    /// In contrast to `gtk.Snapshot.appendTexture`,
    /// this function provides control about how the filter
    /// that is used when scaling.
    extern fn gtk_snapshot_append_scaled_texture(p_snapshot: *Snapshot, p_texture: *gdk.Texture, p_filter: gsk.ScalingFilter, p_bounds: *const graphene.Rect) void;
    pub const appendScaledTexture = gtk_snapshot_append_scaled_texture;

    /// A convenience method to stroke a path with a color.
    ///
    /// See `gtk.Snapshot.pushStroke` if you need
    /// to stroke a path with more complex content than
    /// a color.
    extern fn gtk_snapshot_append_stroke(p_snapshot: *Snapshot, p_path: *gsk.Path, p_stroke: *const gsk.Stroke, p_color: *const gdk.RGBA) void;
    pub const appendStroke = gtk_snapshot_append_stroke;

    /// Creates a new render node drawing the `texture`
    /// into the given `bounds` and appends it to the
    /// current render node of `snapshot`.
    ///
    /// If the texture needs to be scaled to fill `bounds`,
    /// linear filtering is used. See `gtk.Snapshot.appendScaledTexture`
    /// if you need other filtering, such as nearest-neighbour.
    extern fn gtk_snapshot_append_texture(p_snapshot: *Snapshot, p_texture: *gdk.Texture, p_bounds: *const graphene.Rect) void;
    pub const appendTexture = gtk_snapshot_append_texture;

    /// Returns the node that was constructed by `snapshot`
    /// and frees `snapshot`.
    ///
    /// See also `gtk.Snapshot.toNode`.
    extern fn gtk_snapshot_free_to_node(p_snapshot: *Snapshot) ?*gsk.RenderNode;
    pub const freeToNode = gtk_snapshot_free_to_node;

    /// Returns a paintable for the node that was
    /// constructed by `snapshot` and frees `snapshot`.
    extern fn gtk_snapshot_free_to_paintable(p_snapshot: *Snapshot, p_size: ?*const graphene.Size) ?*gdk.Paintable;
    pub const freeToPaintable = gtk_snapshot_free_to_paintable;

    /// Removes the top element from the stack of render nodes and
    /// adds it to the nearest `gsk.GLShaderNode` below it.
    ///
    /// This must be called the same number of times as the number
    /// of textures is needed for the shader in
    /// `gtk.Snapshot.pushGlShader`.
    extern fn gtk_snapshot_gl_shader_pop_texture(p_snapshot: *Snapshot) void;
    pub const glShaderPopTexture = gtk_snapshot_gl_shader_pop_texture;

    /// Applies a perspective projection transform.
    ///
    /// See `gsk.Transform.perspective` for a discussion on the details.
    extern fn gtk_snapshot_perspective(p_snapshot: *Snapshot, p_depth: f32) void;
    pub const perspective = gtk_snapshot_perspective;

    /// Removes the top element from the stack of render nodes,
    /// and appends it to the node underneath it.
    extern fn gtk_snapshot_pop(p_snapshot: *Snapshot) void;
    pub const pop = gtk_snapshot_pop;

    /// Blends together two images with the given blend mode.
    ///
    /// Until the first call to `gtk.Snapshot.pop`, the
    /// bottom image for the blend operation will be recorded.
    /// After that call, the top image to be blended will be
    /// recorded until the second call to `gtk.Snapshot.pop`.
    ///
    /// Calling this function requires two subsequent calls
    /// to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_blend(p_snapshot: *Snapshot, p_blend_mode: gsk.BlendMode) void;
    pub const pushBlend = gtk_snapshot_push_blend;

    /// Blurs an image.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_blur(p_snapshot: *Snapshot, p_radius: f64) void;
    pub const pushBlur = gtk_snapshot_push_blur;

    /// Clips an image to a rectangle.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_clip(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect) void;
    pub const pushClip = gtk_snapshot_push_clip;

    /// Modifies the colors of an image by applying an affine transformation
    /// in RGB space.
    ///
    /// In particular, the colors will be transformed by applying
    ///
    ///     pixel = transpose(color_matrix) * pixel + color_offset
    ///
    /// for every pixel. The transformation operates on unpremultiplied
    /// colors, with color components ordered R, G, B, A.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_color_matrix(p_snapshot: *Snapshot, p_color_matrix: *const graphene.Matrix, p_color_offset: *const graphene.Vec4) void;
    pub const pushColorMatrix = gtk_snapshot_push_color_matrix;

    /// Modifies the colors of an image by applying a transfer
    /// function for each component.
    ///
    /// The transfer functions operate on unpremultiplied colors.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_component_transfer(p_snapshot: *Snapshot, p_red: *const gsk.ComponentTransfer, p_green: *const gsk.ComponentTransfer, p_blue: *const gsk.ComponentTransfer, p_alpha: *const gsk.ComponentTransfer) void;
    pub const pushComponentTransfer = gtk_snapshot_push_component_transfer;

    /// Until the first call to `gtk.Snapshot.pop`, the
    /// mask image for the mask operation will be recorded.
    ///
    /// After that call, the child image will be recorded until
    /// the second call to `gtk.Snapshot.pop`.
    ///
    /// Calling this function requires 2 subsequent calls to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_composite(p_snapshot: *Snapshot, p_op: gsk.PorterDuff) void;
    pub const pushComposite = gtk_snapshot_push_composite;

    /// Stores the current rendering state for later pasting via
    /// `gtk.Snapshot.appendPaste`.
    ///
    /// Pasting is possible until the matching call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_copy(p_snapshot: *Snapshot) void;
    pub const pushCopy = gtk_snapshot_push_copy;

    /// Snapshots a cross-fade operation between two images with the
    /// given `progress`.
    ///
    /// Until the first call to `gtk.Snapshot.pop`, the start image
    /// will be snapshot. After that call, the end image will be recorded
    /// until the second call to `gtk.Snapshot.pop`.
    ///
    /// Calling this function requires two subsequent calls
    /// to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_cross_fade(p_snapshot: *Snapshot, p_progress: f64) void;
    pub const pushCrossFade = gtk_snapshot_push_cross_fade;

    /// Inserts a debug node with a message.
    ///
    /// Debug nodes don't affect the rendering at all, but can be
    /// helpful in identifying parts of a render node tree dump,
    /// for example in the GTK inspector.
    extern fn gtk_snapshot_push_debug(p_snapshot: *Snapshot, p_message: [*:0]const u8, ...) void;
    pub const pushDebug = gtk_snapshot_push_debug;

    /// Fills the area given by `path` and `fill_rule` with an image and discards everything
    /// outside of it.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    ///
    /// If you want to fill the path with a color, `gtk.Snapshot.appendFill`
    /// than rendering new ones, use `gtk.Snapshot.appendFill`
    /// may be more convenient.
    extern fn gtk_snapshot_push_fill(p_snapshot: *Snapshot, p_path: *gsk.Path, p_fill_rule: gsk.FillRule) void;
    pub const pushFill = gtk_snapshot_push_fill;

    /// Push a `gsk.GLShaderNode`.
    ///
    /// The node uses the given `gsk.GLShader` and uniform values
    /// Additionally this takes a list of `n_children` other nodes
    /// which will be passed to the `gsk.GLShaderNode`.
    ///
    /// The `take_args` argument is a block of data to use for uniform
    /// arguments, as per types and offsets defined by the `shader`.
    /// Normally this is generated by `gsk.GLShader.formatArgs`
    /// or `gsk.ShaderArgsBuilder`.
    ///
    /// The snapshotter takes ownership of `take_args`, so the caller should
    /// not free it after this.
    ///
    /// If the renderer doesn't support GL shaders, or if there is any
    /// problem when compiling the shader, then the node will draw pink.
    /// You should use `gsk.GLShader.compile` to ensure the `shader`
    /// will work for the renderer before using it.
    ///
    /// If the shader requires textures (see `gsk.GLShader.getNTextures`),
    /// then it is expected that you call `gtk.Snapshot.glShaderPopTexture`
    /// the number of times that are required. Each of these calls will generate
    /// a node that is added as a child to the `GskGLShaderNode`, which in turn
    /// will render these offscreen and pass as a texture to the shader.
    ///
    /// Once all textures (if any) are pop:ed, you must call the regular
    /// `gtk.Snapshot.pop`.
    ///
    /// If you want to use pre-existing textures as input to the shader rather
    /// than rendering new ones, use `gtk.Snapshot.appendTexture` to
    /// push a texture node. These will be used directly rather than being
    /// re-rendered.
    ///
    /// For details on how to write shaders, see `gsk.GLShader`.
    extern fn gtk_snapshot_push_gl_shader(p_snapshot: *Snapshot, p_shader: *gsk.GLShader, p_bounds: *const graphene.Rect, p_take_args: *glib.Bytes) void;
    pub const pushGlShader = gtk_snapshot_push_gl_shader;

    /// Isolates the following drawing operations from previous ones.
    ///
    /// You can express "everything but these flags" in a forward compatible
    /// way by using bit math:
    /// `GSK_ISOLATION_ALL & ~(GSK_ISOLATION_BACKGROUND | GSK_ISOLATION_COPY_PASTE)`
    /// will isolate everything but background and copy/paste.
    ///
    /// For what isolation features exist, see `gsk.Isolation`.
    ///
    /// Content is isolated until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_isolation(p_snapshot: *Snapshot, p_features: gsk.Isolation) void;
    pub const pushIsolation = gtk_snapshot_push_isolation;

    /// Until the first call to `gtk.Snapshot.pop`, the
    /// mask image for the mask operation will be recorded.
    ///
    /// After that call, the source image will be recorded until
    /// the second call to `gtk.Snapshot.pop`.
    ///
    /// Calling this function requires 2 subsequent calls to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_mask(p_snapshot: *Snapshot, p_mask_mode: gsk.MaskMode) void;
    pub const pushMask = gtk_snapshot_push_mask;

    /// Modifies the opacity of an image.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_opacity(p_snapshot: *Snapshot, p_opacity: f64) void;
    pub const pushOpacity = gtk_snapshot_push_opacity;

    /// Creates a node that repeats the child node.
    ///
    /// The child is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_repeat(p_snapshot: *Snapshot, p_bounds: *const graphene.Rect, p_child_bounds: ?*const graphene.Rect) void;
    pub const pushRepeat = gtk_snapshot_push_repeat;

    /// Clips an image to a rounded rectangle.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_rounded_clip(p_snapshot: *Snapshot, p_bounds: *const gsk.RoundedRect) void;
    pub const pushRoundedClip = gtk_snapshot_push_rounded_clip;

    /// Applies a shadow to an image.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    extern fn gtk_snapshot_push_shadow(p_snapshot: *Snapshot, p_shadow: [*]const gsk.Shadow, p_n_shadows: usize) void;
    pub const pushShadow = gtk_snapshot_push_shadow;

    /// Strokes the given `path` with the attributes given by `stroke` and
    /// an image.
    ///
    /// The image is recorded until the next call to `gtk.Snapshot.pop`.
    ///
    /// Note that the strokes are subject to the same transformation as
    /// everything else, so uneven scaling will cause horizontal and vertical
    /// strokes to have different widths.
    ///
    /// If you want to stroke the path with a color, `gtk.Snapshot.appendStroke`
    /// may be more convenient.
    extern fn gtk_snapshot_push_stroke(p_snapshot: *Snapshot, p_path: *gsk.Path, p_stroke: *const gsk.Stroke) void;
    pub const pushStroke = gtk_snapshot_push_stroke;

    /// Creates a render node for the CSS background according to `context`,
    /// and appends it to the current node of `snapshot`, without changing
    /// the current node.
    extern fn gtk_snapshot_render_background(p_snapshot: *Snapshot, p_context: *gtk.StyleContext, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
    pub const renderBackground = gtk_snapshot_render_background;

    /// Creates a render node for the focus outline according to `context`,
    /// and appends it to the current node of `snapshot`, without changing
    /// the current node.
    extern fn gtk_snapshot_render_focus(p_snapshot: *Snapshot, p_context: *gtk.StyleContext, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
    pub const renderFocus = gtk_snapshot_render_focus;

    /// Creates a render node for the CSS border according to `context`,
    /// and appends it to the current node of `snapshot`, without changing
    /// the current node.
    extern fn gtk_snapshot_render_frame(p_snapshot: *Snapshot, p_context: *gtk.StyleContext, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
    pub const renderFrame = gtk_snapshot_render_frame;

    /// Draws a text caret using `snapshot` at the specified index of `layout`.
    extern fn gtk_snapshot_render_insertion_cursor(p_snapshot: *Snapshot, p_context: *gtk.StyleContext, p_x: f64, p_y: f64, p_layout: *pango.Layout, p_index: c_int, p_direction: pango.Direction) void;
    pub const renderInsertionCursor = gtk_snapshot_render_insertion_cursor;

    /// Creates a render node for rendering `layout` according to the style
    /// information in `context`, and appends it to the current node of `snapshot`,
    /// without changing the current node.
    extern fn gtk_snapshot_render_layout(p_snapshot: *Snapshot, p_context: *gtk.StyleContext, p_x: f64, p_y: f64, p_layout: *pango.Layout) void;
    pub const renderLayout = gtk_snapshot_render_layout;

    /// Restores `snapshot` to the state saved by a preceding call to
    /// `Snapshot.save` and removes that state from the stack of
    /// saved states.
    extern fn gtk_snapshot_restore(p_snapshot: *Snapshot) void;
    pub const restore = gtk_snapshot_restore;

    /// Rotates @`snapshot`'s coordinate system by `angle` degrees in 2D space -
    /// or in 3D speak, rotates around the Z axis. The rotation happens around
    /// the origin point of (0, 0) in the `snapshot`'s current coordinate system.
    ///
    /// To rotate around axes other than the Z axis, use `gsk.Transform.rotate3d`.
    extern fn gtk_snapshot_rotate(p_snapshot: *Snapshot, p_angle: f32) void;
    pub const rotate = gtk_snapshot_rotate;

    /// Rotates `snapshot`'s coordinate system by `angle` degrees around `axis`.
    ///
    /// For a rotation in 2D space, use `gsk.Transform.rotate`.
    extern fn gtk_snapshot_rotate_3d(p_snapshot: *Snapshot, p_angle: f32, p_axis: *const graphene.Vec3) void;
    pub const rotate3d = gtk_snapshot_rotate_3d;

    /// Makes a copy of the current state of `snapshot` and saves it
    /// on an internal stack.
    ///
    /// When `gtk.Snapshot.restore` is called, `snapshot` will
    /// be restored to the saved state.
    ///
    /// Multiple calls to `gtk.Snapshot.save` and `gtk.Snapshot.restore`
    /// can be nested; each call to ``gtk.Snapshot.restore`` restores the state from
    /// the matching paired ``gtk.Snapshot.save``.
    ///
    /// It is necessary to clear all saved states with corresponding
    /// calls to ``gtk.Snapshot.restore``.
    extern fn gtk_snapshot_save(p_snapshot: *Snapshot) void;
    pub const save = gtk_snapshot_save;

    /// Scales `snapshot`'s coordinate system in 2-dimensional space by
    /// the given factors.
    ///
    /// Use `gtk.Snapshot.scale3d` to scale in all 3 dimensions.
    extern fn gtk_snapshot_scale(p_snapshot: *Snapshot, p_factor_x: f32, p_factor_y: f32) void;
    pub const scale = gtk_snapshot_scale;

    /// Scales `snapshot`'s coordinate system by the given factors.
    extern fn gtk_snapshot_scale_3d(p_snapshot: *Snapshot, p_factor_x: f32, p_factor_y: f32, p_factor_z: f32) void;
    pub const scale3d = gtk_snapshot_scale_3d;

    /// Returns the render node that was constructed
    /// by `snapshot`.
    ///
    /// Note that this function may return `NULL` if nothing has been
    /// added to the snapshot or if its content does not produce pixels
    /// to be rendered.
    ///
    /// After calling this function, it is no longer possible to
    /// add more nodes to `snapshot`. The only function that should
    /// be called after this is `gobject.Object.unref`.
    extern fn gtk_snapshot_to_node(p_snapshot: *Snapshot) ?*gsk.RenderNode;
    pub const toNode = gtk_snapshot_to_node;

    /// Returns a paintable encapsulating the render node
    /// that was constructed by `snapshot`.
    ///
    /// After calling this function, it is no longer possible to
    /// add more nodes to `snapshot`. The only function that should
    /// be called after this is `gobject.Object.unref`.
    extern fn gtk_snapshot_to_paintable(p_snapshot: *Snapshot, p_size: ?*const graphene.Size) ?*gdk.Paintable;
    pub const toPaintable = gtk_snapshot_to_paintable;

    /// Transforms `snapshot`'s coordinate system with the given `transform`.
    extern fn gtk_snapshot_transform(p_snapshot: *Snapshot, p_transform: ?*gsk.Transform) void;
    pub const transform = gtk_snapshot_transform;

    /// Transforms `snapshot`'s coordinate system with the given `matrix`.
    extern fn gtk_snapshot_transform_matrix(p_snapshot: *Snapshot, p_matrix: *const graphene.Matrix) void;
    pub const transformMatrix = gtk_snapshot_transform_matrix;

    /// Translates `snapshot`'s coordinate system by `point` in 2-dimensional space.
    extern fn gtk_snapshot_translate(p_snapshot: *Snapshot, p_point: *const graphene.Point) void;
    pub const translate = gtk_snapshot_translate;

    /// Translates `snapshot`'s coordinate system by `point`.
    extern fn gtk_snapshot_translate_3d(p_snapshot: *Snapshot, p_point: *const graphene.Point3D) void;
    pub const translate3d = gtk_snapshot_translate_3d;

    extern fn gtk_snapshot_get_type() usize;
    pub const getGObjectType = gtk_snapshot_get_type;

    extern fn g_object_ref(p_self: *gtk.Snapshot) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Snapshot) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Snapshot, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that sorts the elements of another model.
///
/// The elements are sorted according to a `GtkSorter`.
///
/// The model is a stable sort. If two items compare equal according
/// to the sorter, the one that appears first in the original model will
/// also appear first after sorting.
///
/// Note that if you change the sorter, the previous order will have no
/// influence on the new order. If you want that, consider using a
/// `GtkMultiSorter` and appending the previous sorter to it.
///
/// The model can be set up to do incremental sorting, so that
/// sorting long lists doesn't block the UI. See
/// `gtk.SortListModel.setIncremental` for details.
///
/// `GtkSortListModel` is a generic model and because of that it
/// cannot take advantage of any external knowledge when sorting.
/// If you run into performance issues with `GtkSortListModel`,
/// it is strongly recommended that you write your own sorting list
/// model.
///
/// `GtkSortListModel` allows sorting the items into sections. It
/// implements `GtkSectionModel` and when `gtk.SortListModel.properties.section_sorter`
/// is set, it will sort all items with that sorter and items comparing
/// equal with it will be put into the same section.
/// The `gtk.SortListModel.properties.sorter` will then be used to sort items
/// inside their sections.
pub const SortListModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.SectionModel };
    pub const Class = gtk.SortListModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If the model should sort items incrementally.
        pub const incremental = struct {
            pub const name = "incremental";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The model being sorted.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// Estimate of unsorted items remaining.
        pub const pending = struct {
            pub const name = "pending";

            pub const Type = c_uint;
        };

        /// The section sorter for this model, if one is set.
        pub const section_sorter = struct {
            pub const name = "section-sorter";

            pub const Type = ?*gtk.Sorter;
        };

        /// The sorter for this model.
        pub const sorter = struct {
            pub const name = "sorter";

            pub const Type = ?*gtk.Sorter;
        };
    };

    pub const signals = struct {};

    /// Creates a new sort list model that uses the `sorter` to sort `model`.
    extern fn gtk_sort_list_model_new(p_model: ?*gio.ListModel, p_sorter: ?*gtk.Sorter) *gtk.SortListModel;
    pub const new = gtk_sort_list_model_new;

    /// Returns whether incremental sorting is enabled.
    ///
    /// See `gtk.SortListModel.setIncremental`.
    extern fn gtk_sort_list_model_get_incremental(p_self: *SortListModel) c_int;
    pub const getIncremental = gtk_sort_list_model_get_incremental;

    /// Gets the model currently sorted or `NULL` if none.
    extern fn gtk_sort_list_model_get_model(p_self: *SortListModel) ?*gio.ListModel;
    pub const getModel = gtk_sort_list_model_get_model;

    /// Estimates progress of an ongoing sorting operation.
    ///
    /// The estimate is the number of items that would still need to be
    /// sorted to finish the sorting operation if this was a linear
    /// algorithm. So this number is not related to how many items are
    /// already correctly sorted.
    ///
    /// If you want to estimate the progress, you can use code like this:
    /// ```c
    /// pending = gtk_sort_list_model_get_pending (self);
    /// model = gtk_sort_list_model_get_model (self);
    /// progress = 1.0 - pending / (double) MAX (1, g_list_model_get_n_items (model));
    /// ```
    ///
    /// If no sort operation is ongoing - in particular when
    /// `gtk.SortListModel.properties.incremental` is `FALSE` - this
    /// function returns 0.
    extern fn gtk_sort_list_model_get_pending(p_self: *SortListModel) c_uint;
    pub const getPending = gtk_sort_list_model_get_pending;

    /// Gets the section sorter that is used to sort items of `self` into
    /// sections.
    extern fn gtk_sort_list_model_get_section_sorter(p_self: *SortListModel) ?*gtk.Sorter;
    pub const getSectionSorter = gtk_sort_list_model_get_section_sorter;

    /// Gets the sorter that is used to sort `self`.
    extern fn gtk_sort_list_model_get_sorter(p_self: *SortListModel) ?*gtk.Sorter;
    pub const getSorter = gtk_sort_list_model_get_sorter;

    /// Sets the sort model to do an incremental sort.
    ///
    /// When incremental sorting is enabled, the `GtkSortListModel` will not do
    /// a complete sort immediately, but will instead queue an idle handler that
    /// incrementally sorts the items towards their correct position. This of
    /// course means that items do not instantly appear in the right place. It
    /// also means that the total sorting time is a lot slower.
    ///
    /// When your filter blocks the UI while sorting, you might consider
    /// turning this on. Depending on your model and sorters, this may become
    /// interesting around 10,000 to 100,000 items.
    ///
    /// By default, incremental sorting is disabled.
    ///
    /// See `gtk.SortListModel.getPending` for progress information
    /// about an ongoing incremental sorting operation.
    extern fn gtk_sort_list_model_set_incremental(p_self: *SortListModel, p_incremental: c_int) void;
    pub const setIncremental = gtk_sort_list_model_set_incremental;

    /// Sets the model to be sorted.
    ///
    /// The `model`'s item type must conform to the item type of `self`.
    extern fn gtk_sort_list_model_set_model(p_self: *SortListModel, p_model: ?*gio.ListModel) void;
    pub const setModel = gtk_sort_list_model_set_model;

    /// Sets a new section sorter on `self`.
    extern fn gtk_sort_list_model_set_section_sorter(p_self: *SortListModel, p_sorter: ?*gtk.Sorter) void;
    pub const setSectionSorter = gtk_sort_list_model_set_section_sorter;

    /// Sets a new sorter on `self`.
    extern fn gtk_sort_list_model_set_sorter(p_self: *SortListModel, p_sorter: ?*gtk.Sorter) void;
    pub const setSorter = gtk_sort_list_model_set_sorter;

    extern fn gtk_sort_list_model_get_type() usize;
    pub const getGObjectType = gtk_sort_list_model_get_type;

    extern fn g_object_ref(p_self: *gtk.SortListModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SortListModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SortListModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes sorting criteria for a `gtk.SortListModel`.
///
/// Its primary user is `gtk.SortListModel`
///
/// The model will use a sorter to determine the order in which
/// its items should appear by calling `gtk.Sorter.compare`
/// for pairs of items.
///
/// Sorters may change their sorting behavior through their lifetime.
/// In that case, they will emit the `gtk.Sorter.signals.changed` signal
/// to notify that the sort order is no longer valid and should be updated
/// by calling `gtk.Sorter.compare` again.
///
/// GTK provides various pre-made sorter implementations for common sorting
/// operations. `gtk.ColumnView` has built-in support for sorting lists
/// via the `gtk.ColumnViewColumn.properties.sorter` property, where the user can
/// change the sorting by clicking on list headers.
///
/// Of course, in particular for large lists, it is also possible to subclass
/// `GtkSorter` and provide one's own sorter.
pub const Sorter = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.SorterClass;
    f_parent_instance: gobject.Object,

    pub const virtual_methods = struct {
        /// Compares two given items according to the sort order implemented
        /// by the sorter.
        ///
        /// Sorters implement a partial order:
        ///
        /// * It is reflexive, ie a = a
        /// * It is antisymmetric, ie if a < b and b < a, then a = b
        /// * It is transitive, ie given any 3 items with a ≤ b and b ≤ c,
        ///   then a ≤ c
        ///
        /// The sorter may signal it conforms to additional constraints
        /// via the return value of `gtk.Sorter.getOrder`.
        pub const compare = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_item1: ?*gobject.Object, p_item2: ?*gobject.Object) gtk.Ordering {
                return gobject.ext.as(Sorter.Class, p_class).f_compare.?(gobject.ext.as(Sorter, p_self), p_item1, p_item2);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_item1: ?*gobject.Object, p_item2: ?*gobject.Object) callconv(.c) gtk.Ordering) void {
                gobject.ext.as(Sorter.Class, p_class).f_compare = @ptrCast(p_implementation);
            }
        };

        /// Gets the order that `self` conforms to.
        ///
        /// See `gtk.SorterOrder` for details
        /// of the possible return values.
        ///
        /// This function is intended to allow optimizations.
        pub const get_order = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) gtk.SorterOrder {
                return gobject.ext.as(Sorter.Class, p_class).f_get_order.?(gobject.ext.as(Sorter, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) gtk.SorterOrder) void {
                gobject.ext.as(Sorter.Class, p_class).f_get_order = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever the sorter changed.
        ///
        /// Users of the sorter should then update the sort order
        /// again via `gtk.Sorter.compare`.
        ///
        /// `gtk.SortListModel` handles this signal automatically.
        ///
        /// Depending on the `change` parameter, it may be possible to update
        /// the sort order without a full resorting. Refer to the
        /// `gtk.SorterChange` documentation for details.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_change: gtk.SorterChange, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Sorter, p_instance))),
                    gobject.signalLookup("changed", Sorter.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Notifies all users of the sorter that it has changed.
    ///
    /// This emits the `gtk.Sorter.signals.changed` signal. Users
    /// of the sorter should then update the sort order via
    /// `gtk.Sorter.compare`.
    ///
    /// Depending on the `change` parameter, it may be possible to
    /// update the sort order without a full resorting. Refer to
    /// the `gtk.SorterChange` documentation for details.
    ///
    /// This function is intended for implementers of `GtkSorter`
    /// subclasses and should not be called from other functions.
    extern fn gtk_sorter_changed(p_self: *Sorter, p_change: gtk.SorterChange) void;
    pub const changed = gtk_sorter_changed;

    /// Compares two given items according to the sort order implemented
    /// by the sorter.
    ///
    /// Sorters implement a partial order:
    ///
    /// * It is reflexive, ie a = a
    /// * It is antisymmetric, ie if a < b and b < a, then a = b
    /// * It is transitive, ie given any 3 items with a ≤ b and b ≤ c,
    ///   then a ≤ c
    ///
    /// The sorter may signal it conforms to additional constraints
    /// via the return value of `gtk.Sorter.getOrder`.
    extern fn gtk_sorter_compare(p_self: *Sorter, p_item1: *gobject.Object, p_item2: *gobject.Object) gtk.Ordering;
    pub const compare = gtk_sorter_compare;

    /// Gets the order that `self` conforms to.
    ///
    /// See `gtk.SorterOrder` for details
    /// of the possible return values.
    ///
    /// This function is intended to allow optimizations.
    extern fn gtk_sorter_get_order(p_self: *Sorter) gtk.SorterOrder;
    pub const getOrder = gtk_sorter_get_order;

    extern fn gtk_sorter_get_type() usize;
    pub const getGObjectType = gtk_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.Sorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Sorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Sorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows to enter or change numeric values.
///
/// <picture>
///   <source srcset="spinbutton-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkSpinButton" src="spinbutton.png">
/// </picture>
///
/// Rather than having to directly type a number into a `GtkEntry`,
/// `GtkSpinButton` allows the user to click on one of two arrows
/// to increment or decrement the displayed value. A value can still be
/// typed in, with the bonus that it can be checked to ensure it is in a
/// given range.
///
/// The main properties of a `GtkSpinButton` are through an adjustment.
/// See the `gtk.Adjustment` documentation for more details about
/// an adjustment's properties.
///
/// Note that `GtkSpinButton` will by default make its entry large enough
/// to accommodate the lower and upper bounds of the adjustment. If this
/// is not desired, the automatic sizing can be turned off by explicitly
/// setting `gtk.Editable.properties.width_chars` to a value != -1.
///
/// ## Using a GtkSpinButton to get an integer
///
/// ```c
/// // Provides a function to retrieve an integer value from a GtkSpinButton
/// // and creates a spin button to model percentage values.
///
/// int
/// grab_int_value (GtkSpinButton *button,
///                 gpointer       user_data)
/// {
///   return gtk_spin_button_get_value_as_int (button);
/// }
///
/// void
/// create_integer_spin_button (void)
/// {
///
///   GtkWidget *window, *button;
///   GtkAdjustment *adjustment;
///
///   adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0);
///
///   window = gtk_window_new ();
///
///   // creates the spinbutton, with no decimal places
///   button = gtk_spin_button_new (adjustment, 1.0, 0);
///   gtk_window_set_child (GTK_WINDOW (window), button);
///
///   gtk_window_present (GTK_WINDOW (window));
/// }
/// ```
///
/// ## Using a GtkSpinButton to get a floating point value
///
/// ```c
/// // Provides a function to retrieve a floating point value from a
/// // GtkSpinButton, and creates a high precision spin button.
///
/// float
/// grab_float_value (GtkSpinButton *button,
///                   gpointer       user_data)
/// {
///   return gtk_spin_button_get_value (button);
/// }
///
/// void
/// create_floating_spin_button (void)
/// {
///   GtkWidget *window, *button;
///   GtkAdjustment *adjustment;
///
///   adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0);
///
///   window = gtk_window_new ();
///
///   // creates the spinbutton, with three decimal places
///   button = gtk_spin_button_new (adjustment, 0.001, 3);
///   gtk_window_set_child (GTK_WINDOW (window), button);
///
///   gtk_window_present (GTK_WINDOW (window));
/// }
/// ```
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - `gtk.SpinButton.signals.change_value`
///
/// # CSS nodes
///
/// ```
/// spinbutton.horizontal
/// ├── text
/// │    ├── undershoot.left
/// │    ╰── undershoot.right
/// ├── button.down
/// ╰── button.up
/// ```
///
/// ```
/// spinbutton.vertical
/// ├── button.up
/// ├── text
/// │    ├── undershoot.left
/// │    ╰── undershoot.right
/// ╰── button.down
/// ```
///
/// `GtkSpinButton`s main CSS node has the name spinbutton. It creates subnodes
/// for the entry and the two buttons, with these names. The button nodes have
/// the style classes .up and .down. The `GtkText` subnodes (if present) are put
/// below the text node. The orientation of the spin button is reflected in
/// the .vertical or .horizontal style class on the main node.
///
/// # Accessibility
///
/// `GtkSpinButton` uses the `gtk.@"AccessibleRole.spin_button"` role.
pub const SpinButton = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.CellEditable, gtk.ConstraintTarget, gtk.Editable, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = SpinButton;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to activate the default widget when the spin button is activated.
        ///
        /// See `gtk.SpinButton.signals.activate` for what counts as activation.
        pub const activates_default = struct {
            pub const name = "activates-default";

            pub const Type = c_int;
        };

        /// The adjustment that holds the value of the spin button.
        pub const adjustment = struct {
            pub const name = "adjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// The acceleration rate when you hold down a button or key.
        pub const climb_rate = struct {
            pub const name = "climb-rate";

            pub const Type = f64;
        };

        /// The number of decimal places to display.
        pub const digits = struct {
            pub const name = "digits";

            pub const Type = c_uint;
        };

        /// Whether non-numeric characters should be ignored.
        pub const numeric = struct {
            pub const name = "numeric";

            pub const Type = c_int;
        };

        /// Whether erroneous values are automatically changed to the spin buttons
        /// nearest step increment.
        pub const snap_to_ticks = struct {
            pub const name = "snap-to-ticks";

            pub const Type = c_int;
        };

        /// Whether the spin button should update always, or only when the value
        /// is acceptable.
        pub const update_policy = struct {
            pub const name = "update-policy";

            pub const Type = gtk.SpinButtonUpdatePolicy;
        };

        /// The current value.
        pub const value = struct {
            pub const name = "value";

            pub const Type = f64;
        };

        /// Whether a spin button should wrap upon reaching its limits.
        pub const wrap = struct {
            pub const name = "wrap";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the spin button is activated.
        ///
        /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
        ///
        /// If the <kbd>Enter</kbd> key results in the value being committed to the
        /// spin button, then activation does not occur until <kbd>Enter</kbd> is
        /// pressed again.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SpinButton, p_instance))),
                    gobject.signalLookup("activate", SpinButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a value change.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control the cursor
        /// programmatically.
        ///
        /// The default bindings for this signal are Up/Down and PageUp/PageDown.
        pub const change_value = struct {
            pub const name = "change-value";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_scroll: gtk.ScrollType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SpinButton, p_instance))),
                    gobject.signalLookup("change-value", SpinButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to convert the users input into a double value.
        ///
        /// The signal handler is expected to use `gtk.Editable.getText`
        /// to retrieve the text of the spinbutton and set `new_value` to the
        /// new value.
        ///
        /// The default conversion uses `glib.strtod`.
        pub const input = struct {
            pub const name = "input";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_new_value: *f64, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SpinButton, p_instance))),
                    gobject.signalLookup("input", SpinButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to tweak the formatting of the value for display.
        ///
        /// ```c
        /// // show leading zeros
        /// static gboolean
        /// on_output (GtkSpinButton *spin,
        ///            gpointer       data)
        /// {
        ///    char *text;
        ///    int value;
        ///
        ///    value = gtk_spin_button_get_value_as_int (spin);
        ///    text = g_strdup_printf ("`@"02d"`", value);
        ///    gtk_editable_set_text (GTK_EDITABLE (spin), text):
        ///    g_free (text);
        ///
        ///    return TRUE;
        /// }
        /// ```
        pub const output = struct {
            pub const name = "output";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SpinButton, p_instance))),
                    gobject.signalLookup("output", SpinButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the value is changed.
        ///
        /// Also see the `gtk.SpinButton.signals.output` signal.
        pub const value_changed = struct {
            pub const name = "value-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SpinButton, p_instance))),
                    gobject.signalLookup("value-changed", SpinButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted right after the spinbutton wraps from its maximum
        /// to its minimum value or vice-versa.
        pub const wrapped = struct {
            pub const name = "wrapped";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SpinButton, p_instance))),
                    gobject.signalLookup("wrapped", SpinButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkSpinButton`.
    extern fn gtk_spin_button_new(p_adjustment: ?*gtk.Adjustment, p_climb_rate: f64, p_digits: c_uint) *gtk.SpinButton;
    pub const new = gtk_spin_button_new;

    /// Creates a new `GtkSpinButton` with the given properties.
    ///
    /// This is a convenience constructor that allows creation
    /// of a numeric `GtkSpinButton` without manually creating
    /// an adjustment. The value is initially set to the minimum
    /// value and a page increment of 10 * `step` is the default.
    /// The precision of the spin button is equivalent to the
    /// precision of `step`.
    ///
    /// Note that the way in which the precision is derived works
    /// best if `step` is a power of ten. If the resulting precision
    /// is not suitable for your needs, use
    /// `gtk.SpinButton.setDigits` to correct it.
    extern fn gtk_spin_button_new_with_range(p_min: f64, p_max: f64, p_step: f64) *gtk.SpinButton;
    pub const newWithRange = gtk_spin_button_new_with_range;

    /// Changes the properties of an existing spin button.
    ///
    /// The adjustment, climb rate, and number of decimal places
    /// are updated accordingly.
    extern fn gtk_spin_button_configure(p_spin_button: *SpinButton, p_adjustment: ?*gtk.Adjustment, p_climb_rate: f64, p_digits: c_uint) void;
    pub const configure = gtk_spin_button_configure;

    /// Retrieves the value set by `gtk.SpinButton.setActivatesDefault`.
    extern fn gtk_spin_button_get_activates_default(p_spin_button: *SpinButton) c_int;
    pub const getActivatesDefault = gtk_spin_button_get_activates_default;

    /// Get the adjustment associated with a `GtkSpinButton`.
    extern fn gtk_spin_button_get_adjustment(p_spin_button: *SpinButton) *gtk.Adjustment;
    pub const getAdjustment = gtk_spin_button_get_adjustment;

    /// Returns the acceleration rate for repeated changes.
    extern fn gtk_spin_button_get_climb_rate(p_spin_button: *SpinButton) f64;
    pub const getClimbRate = gtk_spin_button_get_climb_rate;

    /// Fetches the precision of `spin_button`.
    extern fn gtk_spin_button_get_digits(p_spin_button: *SpinButton) c_uint;
    pub const getDigits = gtk_spin_button_get_digits;

    /// Gets the current step and page the increments
    /// used by `spin_button`.
    ///
    /// See `gtk.SpinButton.setIncrements`.
    extern fn gtk_spin_button_get_increments(p_spin_button: *SpinButton, p_step: ?*f64, p_page: ?*f64) void;
    pub const getIncrements = gtk_spin_button_get_increments;

    /// Returns whether non-numeric text can be typed into the spin button.
    extern fn gtk_spin_button_get_numeric(p_spin_button: *SpinButton) c_int;
    pub const getNumeric = gtk_spin_button_get_numeric;

    /// Gets the range allowed for `spin_button`.
    ///
    /// See `gtk.SpinButton.setRange`.
    extern fn gtk_spin_button_get_range(p_spin_button: *SpinButton, p_min: ?*f64, p_max: ?*f64) void;
    pub const getRange = gtk_spin_button_get_range;

    /// Returns whether the values are corrected to the nearest step.
    extern fn gtk_spin_button_get_snap_to_ticks(p_spin_button: *SpinButton) c_int;
    pub const getSnapToTicks = gtk_spin_button_get_snap_to_ticks;

    /// Gets the update behavior of a spin button.
    ///
    /// See `gtk.SpinButton.setUpdatePolicy`.
    extern fn gtk_spin_button_get_update_policy(p_spin_button: *SpinButton) gtk.SpinButtonUpdatePolicy;
    pub const getUpdatePolicy = gtk_spin_button_get_update_policy;

    /// Get the value in the `spin_button`.
    extern fn gtk_spin_button_get_value(p_spin_button: *SpinButton) f64;
    pub const getValue = gtk_spin_button_get_value;

    /// Get the value `spin_button` represented as an integer.
    extern fn gtk_spin_button_get_value_as_int(p_spin_button: *SpinButton) c_int;
    pub const getValueAsInt = gtk_spin_button_get_value_as_int;

    /// Returns whether the spin button’s value wraps around to the
    /// opposite limit when the upper or lower limit of the range is
    /// exceeded.
    extern fn gtk_spin_button_get_wrap(p_spin_button: *SpinButton) c_int;
    pub const getWrap = gtk_spin_button_get_wrap;

    /// Sets whether activating the spin button will activate the default
    /// widget for the window containing the spin button.
    ///
    /// See `gtk.SpinButton.signals.activate` for what counts as activation.
    extern fn gtk_spin_button_set_activates_default(p_spin_button: *SpinButton, p_activates_default: c_int) void;
    pub const setActivatesDefault = gtk_spin_button_set_activates_default;

    /// Replaces the `GtkAdjustment` associated with `spin_button`.
    extern fn gtk_spin_button_set_adjustment(p_spin_button: *SpinButton, p_adjustment: *gtk.Adjustment) void;
    pub const setAdjustment = gtk_spin_button_set_adjustment;

    /// Sets the acceleration rate for repeated changes when you
    /// hold down a button or key.
    extern fn gtk_spin_button_set_climb_rate(p_spin_button: *SpinButton, p_climb_rate: f64) void;
    pub const setClimbRate = gtk_spin_button_set_climb_rate;

    /// Set the precision to be displayed by `spin_button`.
    ///
    /// Up to 20 digit precision is allowed.
    extern fn gtk_spin_button_set_digits(p_spin_button: *SpinButton, p_digits: c_uint) void;
    pub const setDigits = gtk_spin_button_set_digits;

    /// Sets the step and page increments for spin_button.
    ///
    /// This affects how quickly the value changes when
    /// the spin button’s arrows are activated.
    extern fn gtk_spin_button_set_increments(p_spin_button: *SpinButton, p_step: f64, p_page: f64) void;
    pub const setIncrements = gtk_spin_button_set_increments;

    /// Sets the flag that determines if non-numeric text can be typed
    /// into the spin button.
    extern fn gtk_spin_button_set_numeric(p_spin_button: *SpinButton, p_numeric: c_int) void;
    pub const setNumeric = gtk_spin_button_set_numeric;

    /// Sets the minimum and maximum allowable values for `spin_button`.
    ///
    /// If the current value is outside this range, it will be adjusted
    /// to fit within the range, otherwise it will remain unchanged.
    extern fn gtk_spin_button_set_range(p_spin_button: *SpinButton, p_min: f64, p_max: f64) void;
    pub const setRange = gtk_spin_button_set_range;

    /// Sets the policy as to whether values are corrected to the
    /// nearest step increment when a spin button is activated after
    /// providing an invalid value.
    extern fn gtk_spin_button_set_snap_to_ticks(p_spin_button: *SpinButton, p_snap_to_ticks: c_int) void;
    pub const setSnapToTicks = gtk_spin_button_set_snap_to_ticks;

    /// Sets the update behavior of a spin button.
    ///
    /// This determines whether the spin button is always
    /// updated or only when a valid value is set.
    extern fn gtk_spin_button_set_update_policy(p_spin_button: *SpinButton, p_policy: gtk.SpinButtonUpdatePolicy) void;
    pub const setUpdatePolicy = gtk_spin_button_set_update_policy;

    /// Sets the value of `spin_button`.
    extern fn gtk_spin_button_set_value(p_spin_button: *SpinButton, p_value: f64) void;
    pub const setValue = gtk_spin_button_set_value;

    /// Sets the flag that determines if a spin button value wraps
    /// around to the opposite limit when the upper or lower limit
    /// of the range is exceeded.
    extern fn gtk_spin_button_set_wrap(p_spin_button: *SpinButton, p_wrap: c_int) void;
    pub const setWrap = gtk_spin_button_set_wrap;

    /// Increment or decrement a spin button’s value in a specified
    /// direction by a specified amount.
    extern fn gtk_spin_button_spin(p_spin_button: *SpinButton, p_direction: gtk.SpinType, p_increment: f64) void;
    pub const spin = gtk_spin_button_spin;

    /// Manually force an update of the spin button.
    extern fn gtk_spin_button_update(p_spin_button: *SpinButton) void;
    pub const update = gtk_spin_button_update;

    extern fn gtk_spin_button_get_type() usize;
    pub const getGObjectType = gtk_spin_button_get_type;

    extern fn g_object_ref(p_self: *gtk.SpinButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SpinButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SpinButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays an icon-size spinning animation.
///
/// It is often used as an alternative to a `gtk.ProgressBar`
/// for displaying indefinite activity, instead of actual progress.
///
/// <picture>
///   <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkSpinner" src="spinner.png">
/// </picture>
///
/// To start the animation, use `gtk.Spinner.start`, to stop it
/// use `gtk.Spinner.stop`.
///
/// # CSS nodes
///
/// `GtkSpinner` has a single CSS node with the name spinner.
/// When the animation is active, the :checked pseudoclass is
/// added to this node.
///
/// # Accessibility
///
/// `GtkSpinner` uses the `gtk.@"AccessibleRole.progress_bar"` role.
pub const Spinner = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Spinner;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the spinner is spinning
        pub const spinning = struct {
            pub const name = "spinning";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Returns a new spinner widget. Not yet started.
    extern fn gtk_spinner_new() *gtk.Spinner;
    pub const new = gtk_spinner_new;

    /// Returns whether the spinner is spinning.
    extern fn gtk_spinner_get_spinning(p_spinner: *Spinner) c_int;
    pub const getSpinning = gtk_spinner_get_spinning;

    /// Sets the activity of the spinner.
    extern fn gtk_spinner_set_spinning(p_spinner: *Spinner, p_spinning: c_int) void;
    pub const setSpinning = gtk_spinner_set_spinning;

    /// Starts the animation of the spinner.
    extern fn gtk_spinner_start(p_spinner: *Spinner) void;
    pub const start = gtk_spinner_start;

    /// Stops the animation of the spinner.
    extern fn gtk_spinner_stop(p_spinner: *Spinner) void;
    pub const stop = gtk_spinner_stop;

    extern fn gtk_spinner_get_type() usize;
    pub const getGObjectType = gtk_spinner_get_type;

    extern fn g_object_ref(p_self: *gtk.Spinner) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Spinner) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Spinner, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows one of its children at a time.
///
/// <picture>
///   <source srcset="stack-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkStack" src="stack.png">
/// </picture>
///
/// In contrast to `GtkNotebook`, `GtkStack` does not provide a means
/// for users to change the visible child. Instead, a separate widget
/// such as `gtk.StackSwitcher` or `gtk.StackSidebar` can
/// be used with `GtkStack` to provide this functionality.
///
/// Transitions between pages can be animated as slides or fades. This
/// can be controlled with `gtk.Stack.setTransitionType`.
/// These animations respect the `gtk.Settings.properties.gtk_enable_animations`
/// setting.
///
/// `GtkStack` maintains a `gtk.StackPage` object for each added
/// child, which holds additional per-child properties. You
/// obtain the `GtkStackPage` for a child with `gtk.Stack.getPage`
/// and you can obtain a `GtkSelectionModel` containing all the pages
/// with `gtk.Stack.getPages`.
///
/// # GtkStack as GtkBuildable
///
/// To set child-specific properties in a .ui file, create `GtkStackPage`
/// objects explicitly, and set the child widget as a property on it:
///
/// ```xml
///   <object class="GtkStack" id="stack">
///     <child>
///       <object class="GtkStackPage">
///         <property name="name">page1</property>
///         <property name="title">In the beginning…</property>
///         <property name="child">
///           <object class="GtkLabel">
///             <property name="label">It was dark</property>
///           </object>
///         </property>
///       </object>
///     </child>
/// ```
///
/// # CSS nodes
///
/// `GtkStack` has a single CSS node named stack.
///
/// # Accessibility
///
/// `GtkStack` uses the `gtk.@"AccessibleRole.tab_panel"` role for the stack
/// pages, which are the accessible parent objects of the child widgets.
pub const Stack = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Stack;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// `TRUE` if the stack allocates the same width for all children.
        pub const hhomogeneous = struct {
            pub const name = "hhomogeneous";

            pub const Type = c_int;
        };

        /// Whether or not the size should smoothly change during the transition.
        pub const interpolate_size = struct {
            pub const name = "interpolate-size";

            pub const Type = c_int;
        };

        /// A selection model with the stack pages.
        pub const pages = struct {
            pub const name = "pages";

            pub const Type = ?*gtk.SelectionModel;
        };

        /// The animation duration, in milliseconds.
        pub const transition_duration = struct {
            pub const name = "transition-duration";

            pub const Type = c_uint;
        };

        /// Whether or not the transition is currently running.
        pub const transition_running = struct {
            pub const name = "transition-running";

            pub const Type = c_int;
        };

        /// The type of animation used to transition.
        pub const transition_type = struct {
            pub const name = "transition-type";

            pub const Type = gtk.StackTransitionType;
        };

        /// `TRUE` if the stack allocates the same height for all children.
        pub const vhomogeneous = struct {
            pub const name = "vhomogeneous";

            pub const Type = c_int;
        };

        /// The widget currently visible in the stack.
        pub const visible_child = struct {
            pub const name = "visible-child";

            pub const Type = ?*gtk.Widget;
        };

        /// The name of the widget currently visible in the stack.
        pub const visible_child_name = struct {
            pub const name = "visible-child-name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkStack`.
    extern fn gtk_stack_new() *gtk.Stack;
    pub const new = gtk_stack_new;

    /// Adds a child to `stack`.
    extern fn gtk_stack_add_child(p_stack: *Stack, p_child: *gtk.Widget) *gtk.StackPage;
    pub const addChild = gtk_stack_add_child;

    /// Adds a child to `stack`.
    ///
    /// The child is identified by the `name`.
    extern fn gtk_stack_add_named(p_stack: *Stack, p_child: *gtk.Widget, p_name: ?[*:0]const u8) *gtk.StackPage;
    pub const addNamed = gtk_stack_add_named;

    /// Adds a child to `stack`.
    ///
    /// The child is identified by the `name`. The `title`
    /// will be used by `GtkStackSwitcher` to represent
    /// `child` in a tab bar, so it should be short.
    extern fn gtk_stack_add_titled(p_stack: *Stack, p_child: *gtk.Widget, p_name: ?[*:0]const u8, p_title: [*:0]const u8) *gtk.StackPage;
    pub const addTitled = gtk_stack_add_titled;

    /// Finds the child with the name given as the argument.
    ///
    /// Returns `NULL` if there is no child with this name.
    extern fn gtk_stack_get_child_by_name(p_stack: *Stack, p_name: [*:0]const u8) ?*gtk.Widget;
    pub const getChildByName = gtk_stack_get_child_by_name;

    /// Gets whether `stack` is horizontally homogeneous.
    extern fn gtk_stack_get_hhomogeneous(p_stack: *Stack) c_int;
    pub const getHhomogeneous = gtk_stack_get_hhomogeneous;

    /// Returns whether the `GtkStack` is set up to interpolate between
    /// the sizes of children on page switch.
    extern fn gtk_stack_get_interpolate_size(p_stack: *Stack) c_int;
    pub const getInterpolateSize = gtk_stack_get_interpolate_size;

    /// Returns the `GtkStackPage` object for `child`.
    extern fn gtk_stack_get_page(p_stack: *Stack, p_child: *gtk.Widget) *gtk.StackPage;
    pub const getPage = gtk_stack_get_page;

    /// Returns a `GListModel` that contains the pages of the stack.
    ///
    /// This can be used to keep an up-to-date view. The model also
    /// implements `gtk.SelectionModel` and can be used to track
    /// and modify the visible page.
    extern fn gtk_stack_get_pages(p_stack: *Stack) *gtk.SelectionModel;
    pub const getPages = gtk_stack_get_pages;

    /// Returns the amount of time (in milliseconds) that
    /// transitions between pages in `stack` will take.
    extern fn gtk_stack_get_transition_duration(p_stack: *Stack) c_uint;
    pub const getTransitionDuration = gtk_stack_get_transition_duration;

    /// Returns whether the `stack` is currently in a transition from one page to
    /// another.
    extern fn gtk_stack_get_transition_running(p_stack: *Stack) c_int;
    pub const getTransitionRunning = gtk_stack_get_transition_running;

    /// Gets the type of animation that will be used
    /// for transitions between pages in `stack`.
    extern fn gtk_stack_get_transition_type(p_stack: *Stack) gtk.StackTransitionType;
    pub const getTransitionType = gtk_stack_get_transition_type;

    /// Gets whether `stack` is vertically homogeneous.
    extern fn gtk_stack_get_vhomogeneous(p_stack: *Stack) c_int;
    pub const getVhomogeneous = gtk_stack_get_vhomogeneous;

    /// Gets the currently visible child of `stack`.
    ///
    /// Returns `NULL` if there are no visible children.
    extern fn gtk_stack_get_visible_child(p_stack: *Stack) ?*gtk.Widget;
    pub const getVisibleChild = gtk_stack_get_visible_child;

    /// Returns the name of the currently visible child of `stack`.
    ///
    /// Returns `NULL` if there is no visible child.
    extern fn gtk_stack_get_visible_child_name(p_stack: *Stack) ?[*:0]const u8;
    pub const getVisibleChildName = gtk_stack_get_visible_child_name;

    /// Removes a child widget from `stack`.
    extern fn gtk_stack_remove(p_stack: *Stack, p_child: *gtk.Widget) void;
    pub const remove = gtk_stack_remove;

    /// Sets the `GtkStack` to be horizontally homogeneous or not.
    ///
    /// If it is homogeneous, the `GtkStack` will request the same
    /// width for all its children. If it isn't, the stack
    /// may change width when a different child becomes visible.
    extern fn gtk_stack_set_hhomogeneous(p_stack: *Stack, p_hhomogeneous: c_int) void;
    pub const setHhomogeneous = gtk_stack_set_hhomogeneous;

    /// Sets whether or not `stack` will interpolate its size when
    /// changing the visible child.
    ///
    /// If the `gtk.Stack.properties.interpolate_size` property is set
    /// to `TRUE`, `stack` will interpolate its size between the current
    /// one and the one it'll take after changing the visible child,
    /// according to the set transition duration.
    extern fn gtk_stack_set_interpolate_size(p_stack: *Stack, p_interpolate_size: c_int) void;
    pub const setInterpolateSize = gtk_stack_set_interpolate_size;

    /// Sets the duration that transitions between pages in `stack`
    /// will take.
    extern fn gtk_stack_set_transition_duration(p_stack: *Stack, p_duration: c_uint) void;
    pub const setTransitionDuration = gtk_stack_set_transition_duration;

    /// Sets the type of animation that will be used for
    /// transitions between pages in `stack`.
    ///
    /// Available types include various kinds of fades and slides.
    ///
    /// The transition type can be changed without problems
    /// at runtime, so it is possible to change the animation
    /// based on the page that is about to become current.
    extern fn gtk_stack_set_transition_type(p_stack: *Stack, p_transition: gtk.StackTransitionType) void;
    pub const setTransitionType = gtk_stack_set_transition_type;

    /// Sets the `GtkStack` to be vertically homogeneous or not.
    ///
    /// If it is homogeneous, the `GtkStack` will request the same
    /// height for all its children. If it isn't, the stack
    /// may change height when a different child becomes visible.
    extern fn gtk_stack_set_vhomogeneous(p_stack: *Stack, p_vhomogeneous: c_int) void;
    pub const setVhomogeneous = gtk_stack_set_vhomogeneous;

    /// Makes `child` the visible child of `stack`.
    ///
    /// If `child` is different from the currently visible child,
    /// the transition between the two will be animated with the
    /// current transition type of `stack`.
    ///
    /// Note that the `child` widget has to be visible itself
    /// (see `gtk.Widget.show`) in order to become the visible
    /// child of `stack`.
    extern fn gtk_stack_set_visible_child(p_stack: *Stack, p_child: *gtk.Widget) void;
    pub const setVisibleChild = gtk_stack_set_visible_child;

    /// Makes the child with the given name visible.
    ///
    /// Note that the child widget has to be visible itself
    /// (see `gtk.Widget.show`) in order to become the visible
    /// child of `stack`.
    extern fn gtk_stack_set_visible_child_full(p_stack: *Stack, p_name: [*:0]const u8, p_transition: gtk.StackTransitionType) void;
    pub const setVisibleChildFull = gtk_stack_set_visible_child_full;

    /// Makes the child with the given name visible.
    ///
    /// If `child` is different from the currently visible child,
    /// the transition between the two will be animated with the
    /// current transition type of `stack`.
    ///
    /// Note that the child widget has to be visible itself
    /// (see `gtk.Widget.show`) in order to become the visible
    /// child of `stack`.
    extern fn gtk_stack_set_visible_child_name(p_stack: *Stack, p_name: [*:0]const u8) void;
    pub const setVisibleChildName = gtk_stack_set_visible_child_name;

    extern fn gtk_stack_get_type() usize;
    pub const getGObjectType = gtk_stack_get_type;

    extern fn g_object_ref(p_self: *gtk.Stack) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Stack) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Stack, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An auxiliary class used by `GtkStack`.
pub const StackPage = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.Accessible};
    pub const Class = opaque {
        pub const Instance = StackPage;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child that this page is for.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// The icon name of the child page.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// The name of the child page.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the page requires the user attention.
        ///
        /// This is used by the `gtk.StackSwitcher` to change the
        /// appearance of the corresponding button when a page needs
        /// attention and it is not the current one.
        pub const needs_attention = struct {
            pub const name = "needs-attention";

            pub const Type = c_int;
        };

        /// The title of the child page.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// If set, an underline in the title indicates a mnemonic.
        pub const use_underline = struct {
            pub const name = "use-underline";

            pub const Type = c_int;
        };

        /// Whether this page is visible.
        pub const visible = struct {
            pub const name = "visible";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Returns the stack child to which `self` belongs.
    extern fn gtk_stack_page_get_child(p_self: *StackPage) *gtk.Widget;
    pub const getChild = gtk_stack_page_get_child;

    /// Returns the icon name of the page.
    extern fn gtk_stack_page_get_icon_name(p_self: *StackPage) ?[*:0]const u8;
    pub const getIconName = gtk_stack_page_get_icon_name;

    /// Returns the name of the page.
    extern fn gtk_stack_page_get_name(p_self: *StackPage) ?[*:0]const u8;
    pub const getName = gtk_stack_page_get_name;

    /// Returns whether the page is marked as “needs attention”.
    extern fn gtk_stack_page_get_needs_attention(p_self: *StackPage) c_int;
    pub const getNeedsAttention = gtk_stack_page_get_needs_attention;

    /// Gets the page title.
    extern fn gtk_stack_page_get_title(p_self: *StackPage) ?[*:0]const u8;
    pub const getTitle = gtk_stack_page_get_title;

    /// Gets whether underlines in the page title indicate mnemonics.
    extern fn gtk_stack_page_get_use_underline(p_self: *StackPage) c_int;
    pub const getUseUnderline = gtk_stack_page_get_use_underline;

    /// Returns whether `page` is visible in its `GtkStack`.
    ///
    /// This is independent from the `gtk.Widget.properties.visible`
    /// property of its widget.
    extern fn gtk_stack_page_get_visible(p_self: *StackPage) c_int;
    pub const getVisible = gtk_stack_page_get_visible;

    /// Sets the icon name of the page.
    extern fn gtk_stack_page_set_icon_name(p_self: *StackPage, p_setting: [*:0]const u8) void;
    pub const setIconName = gtk_stack_page_set_icon_name;

    /// Sets the name of the page.
    extern fn gtk_stack_page_set_name(p_self: *StackPage, p_setting: [*:0]const u8) void;
    pub const setName = gtk_stack_page_set_name;

    /// Sets whether the page is marked as “needs attention”.
    extern fn gtk_stack_page_set_needs_attention(p_self: *StackPage, p_setting: c_int) void;
    pub const setNeedsAttention = gtk_stack_page_set_needs_attention;

    /// Sets the page title.
    extern fn gtk_stack_page_set_title(p_self: *StackPage, p_setting: [*:0]const u8) void;
    pub const setTitle = gtk_stack_page_set_title;

    /// Sets whether underlines in the page title indicate mnemonics.
    extern fn gtk_stack_page_set_use_underline(p_self: *StackPage, p_setting: c_int) void;
    pub const setUseUnderline = gtk_stack_page_set_use_underline;

    /// Sets whether `page` is visible in its `GtkStack`.
    extern fn gtk_stack_page_set_visible(p_self: *StackPage, p_visible: c_int) void;
    pub const setVisible = gtk_stack_page_set_visible;

    extern fn gtk_stack_page_get_type() usize;
    pub const getGObjectType = gtk_stack_page_get_type;

    extern fn g_object_ref(p_self: *gtk.StackPage) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StackPage) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StackPage, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Uses a sidebar to switch between `GtkStack` pages.
///
/// <picture>
///   <source srcset="sidebar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkStackSidebar" src="sidebar.png">
/// </picture>
///
/// In order to use a `GtkStackSidebar`, you simply use a `GtkStack` to
/// organize your UI flow, and add the sidebar to your sidebar area. You
/// can use `gtk.StackSidebar.setStack` to connect the `GtkStackSidebar`
/// to the `GtkStack`.
///
/// # CSS nodes
///
/// `GtkStackSidebar` has a single CSS node with name stacksidebar and
/// style class .sidebar.
///
/// When circumstances require it, `GtkStackSidebar` adds the
/// .needs-attention style class to the widgets representing the stack
/// pages.
pub const StackSidebar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = StackSidebar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The stack.
        pub const stack = struct {
            pub const name = "stack";

            pub const Type = ?*gtk.Stack;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkStackSidebar`.
    extern fn gtk_stack_sidebar_new() *gtk.StackSidebar;
    pub const new = gtk_stack_sidebar_new;

    /// Retrieves the stack.
    extern fn gtk_stack_sidebar_get_stack(p_self: *StackSidebar) ?*gtk.Stack;
    pub const getStack = gtk_stack_sidebar_get_stack;

    /// Set the `GtkStack` associated with this `GtkStackSidebar`.
    ///
    /// The sidebar widget will automatically update according to
    /// the order and items within the given `GtkStack`.
    extern fn gtk_stack_sidebar_set_stack(p_self: *StackSidebar, p_stack: *gtk.Stack) void;
    pub const setStack = gtk_stack_sidebar_set_stack;

    extern fn gtk_stack_sidebar_get_type() usize;
    pub const getGObjectType = gtk_stack_sidebar_get_type;

    extern fn g_object_ref(p_self: *gtk.StackSidebar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StackSidebar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StackSidebar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a row of buttons to switch between `GtkStack` pages.
///
/// <picture>
///   <source srcset="stackswitcher-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkStackSwitcher" src="stackswitcher.png">
/// </picture>
///
/// It acts as a controller for the associated `GtkStack`.
///
/// All the content for the buttons comes from the properties of the stacks
/// `gtk.StackPage` objects; the button visibility in a `GtkStackSwitcher`
/// widget is controlled by the visibility of the child in the `GtkStack`.
///
/// It is possible to associate multiple `GtkStackSwitcher` widgets
/// with the same `GtkStack` widget.
///
/// # CSS nodes
///
/// `GtkStackSwitcher` has a single CSS node named stackswitcher and
/// style class .stack-switcher.
///
/// When circumstances require it, `GtkStackSwitcher` adds the
/// .needs-attention style class to the widgets representing the
/// stack pages.
///
/// # Accessibility
///
/// `GtkStackSwitcher` uses the `gtk.@"AccessibleRole.tab_list"` role
/// and uses the `gtk.@"AccessibleRole.tab"` role for its buttons.
///
/// # Orientable
///
/// Since GTK 4.4, `GtkStackSwitcher` implements `GtkOrientable` allowing
/// the stack switcher to be made vertical with
/// ``gtk.Orientable.setOrientation``.
pub const StackSwitcher = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = StackSwitcher;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The stack.
        pub const stack = struct {
            pub const name = "stack";

            pub const Type = ?*gtk.Stack;
        };
    };

    pub const signals = struct {};

    /// Create a new `GtkStackSwitcher`.
    extern fn gtk_stack_switcher_new() *gtk.StackSwitcher;
    pub const new = gtk_stack_switcher_new;

    /// Retrieves the stack.
    extern fn gtk_stack_switcher_get_stack(p_switcher: *StackSwitcher) ?*gtk.Stack;
    pub const getStack = gtk_stack_switcher_get_stack;

    /// Sets the stack to control.
    extern fn gtk_stack_switcher_set_stack(p_switcher: *StackSwitcher, p_stack: ?*gtk.Stack) void;
    pub const setStack = gtk_stack_switcher_set_stack;

    extern fn gtk_stack_switcher_get_type() usize;
    pub const getGObjectType = gtk_stack_switcher_get_type;

    extern fn g_object_ref(p_self: *gtk.StackSwitcher) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StackSwitcher) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StackSwitcher, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkStatusbar` widget is usually placed along the bottom of an application's
/// main `gtk.Window`.
///
/// <picture>
///   <source srcset="statusbar-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkStatusbar" src="statusbar.png">
/// </picture>
///
/// A `GtkStatusBar` may provide a regular commentary of the application's
/// status (as is usually the case in a web browser, for example), or may be
/// used to simply output a message when the status changes, (when an upload
/// is complete in an FTP client, for example).
///
/// Status bars in GTK maintain a stack of messages. The message at
/// the top of the each bar’s stack is the one that will currently be displayed.
///
/// Any messages added to a statusbar’s stack must specify a context id that
/// is used to uniquely identify the source of a message. This context id can
/// be generated by `gtk.Statusbar.getContextId`, given a message and
/// the statusbar that it will be added to. Note that messages are stored in a
/// stack, and when choosing which message to display, the stack structure is
/// adhered to, regardless of the context identifier of a message.
///
/// One could say that a statusbar maintains one stack of messages for
/// display purposes, but allows multiple message producers to maintain
/// sub-stacks of the messages they produced (via context ids).
///
/// Status bars are created using `gtk.Statusbar.new`.
///
/// Messages are added to the bar’s stack with `gtk.Statusbar.push`.
///
/// The message at the top of the stack can be removed using
/// `gtk.Statusbar.pop`. A message can be removed from anywhere in the
/// stack if its message id was recorded at the time it was added. This is done
/// using `gtk.Statusbar.remove`.
///
/// ## CSS node
///
/// `GtkStatusbar` has a single CSS node with name `statusbar`.
pub const Statusbar = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Statusbar;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted whenever a new message is popped off a statusbar's stack.
        pub const text_popped = struct {
            pub const name = "text-popped";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context_id: c_uint, p_text: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Statusbar, p_instance))),
                    gobject.signalLookup("text-popped", Statusbar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted whenever a new message gets pushed onto a statusbar's stack.
        pub const text_pushed = struct {
            pub const name = "text-pushed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context_id: c_uint, p_text: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Statusbar, p_instance))),
                    gobject.signalLookup("text-pushed", Statusbar.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkStatusbar` ready for messages.
    extern fn gtk_statusbar_new() *gtk.Statusbar;
    pub const new = gtk_statusbar_new;

    /// Returns a new context identifier, given a description
    /// of the actual context.
    ///
    /// Note that the description is not shown in the UI.
    extern fn gtk_statusbar_get_context_id(p_statusbar: *Statusbar, p_context_description: [*:0]const u8) c_uint;
    pub const getContextId = gtk_statusbar_get_context_id;

    /// Removes the first message in the `GtkStatusbar`’s stack
    /// with the given context id.
    ///
    /// Note that this may not change the displayed message,
    /// if the message at the top of the stack has a different
    /// context id.
    extern fn gtk_statusbar_pop(p_statusbar: *Statusbar, p_context_id: c_uint) void;
    pub const pop = gtk_statusbar_pop;

    /// Pushes a new message onto a statusbar’s stack.
    extern fn gtk_statusbar_push(p_statusbar: *Statusbar, p_context_id: c_uint, p_text: [*:0]const u8) c_uint;
    pub const push = gtk_statusbar_push;

    /// Forces the removal of a message from a statusbar’s stack.
    /// The exact `context_id` and `message_id` must be specified.
    extern fn gtk_statusbar_remove(p_statusbar: *Statusbar, p_context_id: c_uint, p_message_id: c_uint) void;
    pub const remove = gtk_statusbar_remove;

    /// Forces the removal of all messages from a statusbar's
    /// stack with the exact `context_id`.
    extern fn gtk_statusbar_remove_all(p_statusbar: *Statusbar, p_context_id: c_uint) void;
    pub const removeAll = gtk_statusbar_remove_all;

    extern fn gtk_statusbar_get_type() usize;
    pub const getGObjectType = gtk_statusbar_get_type;

    extern fn g_object_ref(p_self: *gtk.Statusbar) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Statusbar) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Statusbar, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines whether to include items by comparing strings to a fixed search term.
///
/// The strings are obtained from the items by evaluating an expression
/// set with `gtk.StringFilter.setExpression`, and they are
/// compared against a search term set with `gtk.StringFilter.setSearch`.
///
/// `GtkStringFilter` has several different modes of comparison - it
/// can match the whole string, just a prefix, or any substring. Use
/// `gtk.StringFilter.setMatchMode` choose a mode.
///
/// It is also possible to make case-insensitive comparisons, with
/// `gtk.StringFilter.setIgnoreCase`.
pub const StringFilter = opaque {
    pub const Parent = gtk.Filter;
    pub const Implements = [_]type{};
    pub const Class = gtk.StringFilterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The expression to evaluate on each item to get a
        /// string to compare with.
        pub const expression = struct {
            pub const name = "expression";

            pub const Type = ?*gtk.Expression;
        };

        /// If matching is case sensitive.
        pub const ignore_case = struct {
            pub const name = "ignore-case";

            pub const Type = c_int;
        };

        /// If exact matches are necessary or if substrings are allowed.
        pub const match_mode = struct {
            pub const name = "match-mode";

            pub const Type = gtk.StringFilterMatchMode;
        };

        /// The search term.
        pub const search = struct {
            pub const name = "search";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new string filter.
    ///
    /// You will want to set up the filter by providing a string to search for
    /// and by providing a property to look up on the item.
    extern fn gtk_string_filter_new(p_expression: ?*gtk.Expression) *gtk.StringFilter;
    pub const new = gtk_string_filter_new;

    /// Gets the expression that the string filter uses to
    /// obtain strings from items.
    extern fn gtk_string_filter_get_expression(p_self: *StringFilter) ?*gtk.Expression;
    pub const getExpression = gtk_string_filter_get_expression;

    /// Returns whether the filter ignores case differences.
    extern fn gtk_string_filter_get_ignore_case(p_self: *StringFilter) c_int;
    pub const getIgnoreCase = gtk_string_filter_get_ignore_case;

    /// Returns the match mode that the filter is using.
    extern fn gtk_string_filter_get_match_mode(p_self: *StringFilter) gtk.StringFilterMatchMode;
    pub const getMatchMode = gtk_string_filter_get_match_mode;

    /// Gets the search term.
    extern fn gtk_string_filter_get_search(p_self: *StringFilter) ?[*:0]const u8;
    pub const getSearch = gtk_string_filter_get_search;

    /// Sets the expression that the string filter uses to
    /// obtain strings from items.
    ///
    /// The expression must have a value type of `G_TYPE_STRING`.
    extern fn gtk_string_filter_set_expression(p_self: *StringFilter, p_expression: ?*gtk.Expression) void;
    pub const setExpression = gtk_string_filter_set_expression;

    /// Sets whether the filter ignores case differences.
    extern fn gtk_string_filter_set_ignore_case(p_self: *StringFilter, p_ignore_case: c_int) void;
    pub const setIgnoreCase = gtk_string_filter_set_ignore_case;

    /// Sets the match mode for the filter.
    extern fn gtk_string_filter_set_match_mode(p_self: *StringFilter, p_mode: gtk.StringFilterMatchMode) void;
    pub const setMatchMode = gtk_string_filter_set_match_mode;

    /// Sets the string to search for.
    extern fn gtk_string_filter_set_search(p_self: *StringFilter, p_search: ?[*:0]const u8) void;
    pub const setSearch = gtk_string_filter_set_search;

    extern fn gtk_string_filter_get_type() usize;
    pub const getGObjectType = gtk_string_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.StringFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StringFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StringFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that wraps an array of strings.
///
/// The objects in the model are of type `gtk.StringObject` and have
/// a "string" property that can be used inside expressions.
///
/// `GtkStringList` is well-suited for any place where you would
/// typically use a `char*[]`, but need a list model.
///
/// ## GtkStringList as GtkBuildable
///
/// The `GtkStringList` implementation of the `GtkBuildable` interface
/// supports adding items directly using the `<items>` element and
/// specifying `<item>` elements for each item. Each `<item>` element
/// supports the regular translation attributes “translatable”,
/// “context” and “comments”.
///
/// Here is a UI definition fragment specifying a `GtkStringList`
///
/// ```xml
/// <object class="GtkStringList">
///   <items>
///     <item translatable="yes">Factory</item>
///     <item translatable="yes">Home</item>
///     <item translatable="yes">Subway</item>
///   </items>
/// </object>
/// ```
pub const StringList = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gio.ListModel, gtk.Buildable };
    pub const Class = gtk.StringListClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// The strings in the model.
        pub const strings = struct {
            pub const name = "strings";

            pub const Type = ?[*][*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkStringList` with the given `strings`.
    extern fn gtk_string_list_new(p_strings: ?[*]const [*:0]const u8) *gtk.StringList;
    pub const new = gtk_string_list_new;

    /// Appends `string` to `self`.
    ///
    /// The `string` will be copied. See
    /// `gtk.StringList.take` for a way to avoid that.
    extern fn gtk_string_list_append(p_self: *StringList, p_string: [*:0]const u8) void;
    pub const append = gtk_string_list_append;

    /// Gets the position of the `string` in `self`.
    ///
    /// If `self` does not contain `string` item, `G_MAXUINT` is returned.
    extern fn gtk_string_list_find(p_self: *StringList, p_string: [*:0]const u8) c_uint;
    pub const find = gtk_string_list_find;

    /// Gets the string that is at `position` in `self`.
    ///
    /// If `self` does not contain `position` items, `NULL` is returned.
    ///
    /// This function returns the const char *. To get the
    /// object wrapping it, use `gio.ListModel.getItem`.
    extern fn gtk_string_list_get_string(p_self: *StringList, p_position: c_uint) ?[*:0]const u8;
    pub const getString = gtk_string_list_get_string;

    /// Removes the string at `position` from `self`.
    ///
    /// `position` must be smaller than the current
    /// length of the list.
    extern fn gtk_string_list_remove(p_self: *StringList, p_position: c_uint) void;
    pub const remove = gtk_string_list_remove;

    /// Changes `self` by removing `n_removals` strings and adding `additions`
    /// to it.
    ///
    /// This function is more efficient than `gtk.StringList.append`
    /// and `gtk.StringList.remove`, because it only emits the
    /// ::items-changed signal once for the change.
    ///
    /// This function copies the strings in `additions`.
    ///
    /// The parameters `position` and `n_removals` must be correct (ie:
    /// `position` + `n_removals` must be less than or equal to the length
    /// of the list at the time this function is called).
    extern fn gtk_string_list_splice(p_self: *StringList, p_position: c_uint, p_n_removals: c_uint, p_additions: ?[*]const [*:0]const u8) void;
    pub const splice = gtk_string_list_splice;

    /// Adds `string` to self at the end, and takes
    /// ownership of it.
    ///
    /// This variant of `gtk.StringList.append`
    /// is convenient for formatting strings:
    ///
    /// ```c
    /// gtk_string_list_take (self, g_strdup_print ("`d` dollars", lots));
    /// ```
    extern fn gtk_string_list_take(p_self: *StringList, p_string: [*:0]u8) void;
    pub const take = gtk_string_list_take;

    extern fn gtk_string_list_get_type() usize;
    pub const getGObjectType = gtk_string_list_get_type;

    extern fn g_object_ref(p_self: *gtk.StringList) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StringList) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StringList, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The type of items in a `GtkStringList`.
///
/// A `GtkStringObject` is a wrapper around a `const char*`; it has
/// a `gtk.StringObject.properties.string` property that can be used
/// for property bindings and expressions.
pub const StringObject = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.StringObjectClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The string.
        pub const string = struct {
            pub const name = "string";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Wraps a string in an object for use with `GListModel`.
    extern fn gtk_string_object_new(p_string: [*:0]const u8) *gtk.StringObject;
    pub const new = gtk_string_object_new;

    /// Returns the string contained in a `GtkStringObject`.
    extern fn gtk_string_object_get_string(p_self: *StringObject) [*:0]const u8;
    pub const getString = gtk_string_object_get_string;

    extern fn gtk_string_object_get_type() usize;
    pub const getGObjectType = gtk_string_object_get_type;

    extern fn g_object_ref(p_self: *gtk.StringObject) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StringObject) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StringObject, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Sorts items by comparing strings.
///
/// To obtain the strings to compare, this sorter evaluates a
/// `gtk.Expression`.
///
/// It does the comparison in a linguistically correct way using the
/// current locale by normalizing Unicode strings and possibly case-folding
/// them before performing the comparison.
pub const StringSorter = opaque {
    pub const Parent = gtk.Sorter;
    pub const Implements = [_]type{};
    pub const Class = gtk.StringSorterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The collation method to use for sorting.
        ///
        /// The `GTK_COLLATION_NONE` value is useful when the expression already
        /// returns collation keys, or strings that need to be compared byte-by-byte.
        ///
        /// The default value, `GTK_COLLATION_UNICODE`, compares strings according
        /// to the [Unicode collation algorithm](https://www.unicode.org/reports/tr10/).
        pub const collation = struct {
            pub const name = "collation";

            pub const Type = gtk.Collation;
        };

        /// The expression to evaluate on item to get a string to compare with.
        pub const expression = struct {
            pub const name = "expression";

            pub const Type = ?*gtk.Expression;
        };

        /// If sorting is case sensitive.
        pub const ignore_case = struct {
            pub const name = "ignore-case";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new string sorter that compares items using the given
    /// `expression`.
    ///
    /// Unless an expression is set on it, this sorter will always
    /// compare items as invalid.
    extern fn gtk_string_sorter_new(p_expression: ?*gtk.Expression) *gtk.StringSorter;
    pub const new = gtk_string_sorter_new;

    /// Gets which collation method the sorter uses.
    extern fn gtk_string_sorter_get_collation(p_self: *StringSorter) gtk.Collation;
    pub const getCollation = gtk_string_sorter_get_collation;

    /// Gets the expression that is evaluated to obtain strings from items.
    extern fn gtk_string_sorter_get_expression(p_self: *StringSorter) ?*gtk.Expression;
    pub const getExpression = gtk_string_sorter_get_expression;

    /// Gets whether the sorter ignores case differences.
    extern fn gtk_string_sorter_get_ignore_case(p_self: *StringSorter) c_int;
    pub const getIgnoreCase = gtk_string_sorter_get_ignore_case;

    /// Sets the collation method to use for sorting.
    extern fn gtk_string_sorter_set_collation(p_self: *StringSorter, p_collation: gtk.Collation) void;
    pub const setCollation = gtk_string_sorter_set_collation;

    /// Sets the expression that is evaluated to obtain strings from items.
    ///
    /// The expression must have the type `G_TYPE_STRING`.
    extern fn gtk_string_sorter_set_expression(p_self: *StringSorter, p_expression: ?*gtk.Expression) void;
    pub const setExpression = gtk_string_sorter_set_expression;

    /// Sets whether the sorter will ignore case differences.
    extern fn gtk_string_sorter_set_ignore_case(p_self: *StringSorter, p_ignore_case: c_int) void;
    pub const setIgnoreCase = gtk_string_sorter_set_ignore_case;

    extern fn gtk_string_sorter_get_type() usize;
    pub const getGObjectType = gtk_string_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.StringSorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StringSorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StringSorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkStyleContext` stores styling information affecting a widget.
///
/// In order to construct the final style information, `GtkStyleContext`
/// queries information from all attached `GtkStyleProviders`. Style
/// providers can be either attached explicitly to the context through
/// `gtk.StyleContext.addProvider`, or to the display through
/// `gtk.StyleContext.addProviderForDisplay`. The resulting
/// style is a combination of all providers’ information in priority order.
///
/// For GTK widgets, any `GtkStyleContext` returned by
/// `gtk.Widget.getStyleContext` will already have a `GdkDisplay`
/// and RTL/LTR information set. The style context will also be updated
/// automatically if any of these settings change on the widget.
///
/// ## Style Classes
///
/// Widgets can add style classes to their context, which can be used to associate
/// different styles by class. The documentation for individual widgets lists
/// which style classes it uses itself, and which style classes may be added by
/// applications to affect their appearance.
///
/// # Custom styling in UI libraries and applications
///
/// If you are developing a library with custom widgets that render differently
/// than standard components, you may need to add a `GtkStyleProvider` yourself
/// with the `GTK_STYLE_PROVIDER_PRIORITY_FALLBACK` priority, either a
/// `GtkCssProvider` or a custom object implementing the `GtkStyleProvider`
/// interface. This way themes may still attempt to style your UI elements in
/// a different way if needed so.
///
/// If you are using custom styling on an applications, you probably want then
/// to make your style information prevail to the theme’s, so you must use
/// a `GtkStyleProvider` with the `GTK_STYLE_PROVIDER_PRIORITY_APPLICATION`
/// priority, keep in mind that the user settings in
/// `XDG_CONFIG_HOME/gtk-4.0/gtk.css` will
/// still take precedence over your changes, as it uses the
/// `GTK_STYLE_PROVIDER_PRIORITY_USER` priority.
pub const StyleContext = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.StyleContextClass;
    f_parent_object: gobject.Object,

    pub const virtual_methods = struct {
        pub const changed = struct {
            pub fn call(p_class: anytype, p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(StyleContext.Class, p_class).f_changed.?(gobject.ext.as(StyleContext, p_context));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_context: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(StyleContext.Class, p_class).f_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The display of the style context.
        pub const display = struct {
            pub const name = "display";

            pub const Type = ?*gdk.Display;
        };
    };

    pub const signals = struct {};

    /// Adds a global style provider to `display`, which will be used
    /// in style construction for all `GtkStyleContexts` under `display`.
    ///
    /// GTK uses this to make styling information from `GtkSettings`
    /// available.
    ///
    /// Note: If both priorities are the same, A `GtkStyleProvider`
    /// added through `gtk.StyleContext.addProvider` takes
    /// precedence over another added through this function.
    extern fn gtk_style_context_add_provider_for_display(p_display: *gdk.Display, p_provider: *gtk.StyleProvider, p_priority: c_uint) void;
    pub const addProviderForDisplay = gtk_style_context_add_provider_for_display;

    /// Removes `provider` from the global style providers list in `display`.
    extern fn gtk_style_context_remove_provider_for_display(p_display: *gdk.Display, p_provider: *gtk.StyleProvider) void;
    pub const removeProviderForDisplay = gtk_style_context_remove_provider_for_display;

    /// Adds a style class to `context`, so later uses of the
    /// style context will make use of this new class for styling.
    ///
    /// In the CSS file format, a `GtkEntry` defining a “search”
    /// class, would be matched by:
    ///
    /// ```css
    /// entry.search { ... }
    /// ```
    ///
    /// While any widget defining a “search” class would be
    /// matched by:
    /// ```css
    /// .search { ... }
    /// ```
    extern fn gtk_style_context_add_class(p_context: *StyleContext, p_class_name: [*:0]const u8) void;
    pub const addClass = gtk_style_context_add_class;

    /// Adds a style provider to `context`, to be used in style construction.
    ///
    /// Note that a style provider added by this function only affects
    /// the style of the widget to which `context` belongs. If you want
    /// to affect the style of all widgets, use
    /// `gtk.StyleContext.addProviderForDisplay`.
    ///
    /// Note: If both priorities are the same, a `GtkStyleProvider`
    /// added through this function takes precedence over another added
    /// through `gtk.StyleContext.addProviderForDisplay`.
    extern fn gtk_style_context_add_provider(p_context: *StyleContext, p_provider: *gtk.StyleProvider, p_priority: c_uint) void;
    pub const addProvider = gtk_style_context_add_provider;

    /// Gets the border for a given state as a `GtkBorder`.
    extern fn gtk_style_context_get_border(p_context: *StyleContext, p_border: *gtk.Border) void;
    pub const getBorder = gtk_style_context_get_border;

    /// Gets the foreground color for a given state.
    extern fn gtk_style_context_get_color(p_context: *StyleContext, p_color: *gdk.RGBA) void;
    pub const getColor = gtk_style_context_get_color;

    /// Returns the `GdkDisplay` to which `context` is attached.
    extern fn gtk_style_context_get_display(p_context: *StyleContext) *gdk.Display;
    pub const getDisplay = gtk_style_context_get_display;

    /// Gets the margin for a given state as a `GtkBorder`.
    extern fn gtk_style_context_get_margin(p_context: *StyleContext, p_margin: *gtk.Border) void;
    pub const getMargin = gtk_style_context_get_margin;

    /// Gets the padding for a given state as a `GtkBorder`.
    extern fn gtk_style_context_get_padding(p_context: *StyleContext, p_padding: *gtk.Border) void;
    pub const getPadding = gtk_style_context_get_padding;

    /// Returns the scale used for assets.
    extern fn gtk_style_context_get_scale(p_context: *StyleContext) c_int;
    pub const getScale = gtk_style_context_get_scale;

    /// Returns the state used for style matching.
    ///
    /// This method should only be used to retrieve the `GtkStateFlags`
    /// to pass to `GtkStyleContext` methods, like
    /// `gtk.StyleContext.getPadding`.
    /// If you need to retrieve the current state of a `GtkWidget`, use
    /// `gtk.Widget.getStateFlags`.
    extern fn gtk_style_context_get_state(p_context: *StyleContext) gtk.StateFlags;
    pub const getState = gtk_style_context_get_state;

    /// Returns `TRUE` if `context` currently has defined the
    /// given class name.
    extern fn gtk_style_context_has_class(p_context: *StyleContext, p_class_name: [*:0]const u8) c_int;
    pub const hasClass = gtk_style_context_has_class;

    /// Looks up and resolves a color name in the `context` color map.
    extern fn gtk_style_context_lookup_color(p_context: *StyleContext, p_color_name: [*:0]const u8, p_color: *gdk.RGBA) c_int;
    pub const lookupColor = gtk_style_context_lookup_color;

    /// Removes `class_name` from `context`.
    extern fn gtk_style_context_remove_class(p_context: *StyleContext, p_class_name: [*:0]const u8) void;
    pub const removeClass = gtk_style_context_remove_class;

    /// Removes `provider` from the style providers list in `context`.
    extern fn gtk_style_context_remove_provider(p_context: *StyleContext, p_provider: *gtk.StyleProvider) void;
    pub const removeProvider = gtk_style_context_remove_provider;

    /// Restores `context` state to a previous stage.
    ///
    /// See `gtk.StyleContext.save`.
    extern fn gtk_style_context_restore(p_context: *StyleContext) void;
    pub const restore = gtk_style_context_restore;

    /// Saves the `context` state.
    ///
    /// This allows temporary modifications done through
    /// `gtk.StyleContext.addClass`,
    /// `gtk.StyleContext.removeClass`,
    /// `gtk.StyleContext.setState` to be quickly
    /// reverted in one go through `gtk.StyleContext.restore`.
    ///
    /// The matching call to `gtk.StyleContext.restore`
    /// must be done before GTK returns to the main loop.
    extern fn gtk_style_context_save(p_context: *StyleContext) void;
    pub const save = gtk_style_context_save;

    /// Attaches `context` to the given display.
    ///
    /// The display is used to add style information from “global”
    /// style providers, such as the display's `GtkSettings` instance.
    ///
    /// If you are using a `GtkStyleContext` returned from
    /// `gtk.Widget.getStyleContext`, you do not need to
    /// call this yourself.
    extern fn gtk_style_context_set_display(p_context: *StyleContext, p_display: *gdk.Display) void;
    pub const setDisplay = gtk_style_context_set_display;

    /// Sets the scale to use when getting image assets for the style.
    extern fn gtk_style_context_set_scale(p_context: *StyleContext, p_scale: c_int) void;
    pub const setScale = gtk_style_context_set_scale;

    /// Sets the state to be used for style matching.
    extern fn gtk_style_context_set_state(p_context: *StyleContext, p_flags: gtk.StateFlags) void;
    pub const setState = gtk_style_context_set_state;

    /// Converts the style context into a string representation.
    ///
    /// The string representation always includes information about
    /// the name, state, id, visibility and style classes of the CSS
    /// node that is backing `context`. Depending on the flags, more
    /// information may be included.
    ///
    /// This function is intended for testing and debugging of the
    /// CSS implementation in GTK. There are no guarantees about
    /// the format of the returned string, it may change.
    extern fn gtk_style_context_to_string(p_context: *StyleContext, p_flags: gtk.StyleContextPrintFlags) [*:0]u8;
    pub const toString = gtk_style_context_to_string;

    extern fn gtk_style_context_get_type() usize;
    pub const getGObjectType = gtk_style_context_get_type;

    extern fn g_object_ref(p_self: *gtk.StyleContext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StyleContext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StyleContext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A paintable implementation that renders SVG, with animations.
///
/// `GtkSvg` objects are created by parsing a subset of SVG,
/// including SVG animations.
///
/// `GtkSvg` fills or strokes paths with symbolic or fixed colors.
/// It can have multiple states, and paths can be included in a subset
/// of the states. States can have animations, and the transition
/// between different states can also be animated.
///
/// To show a static SVG image, it is enough to load the
/// the SVG and use it like any other paintable.
///
/// To play an SVG animation, use `gtk.Svg.setFrameClock`
/// to connect the paintable to a frame clock, and call
/// `gtk.Svg.play` after loading the SVG. The animation can
/// be paused using `gtk.Svg.pause`.
///
/// To set the current state, use `gtk.Svg.setState`.
///
///
/// ## Error handling
///
/// Loading an SVG into `GtkSvg` will always produce a (possibly empty)
/// paintable. GTK will drop things that it can't handle and try to make
/// sense of the rest.
///
/// To track errors during parsing or rendering, connect to the
/// `gtk.Svg.signals.@"error"` signal.
///
/// For parsing errors in the `GTK_SVG_ERROR` domain, the functions
/// `gtk.SvgError.getStart`, `gtk.SvgError.getEnd`,
/// `gtk.SvgError.getElement` and `gtk.SvgError.getAttribute`
/// can be used to obtain information about where the error occurred.
///
///
/// ## The supported subset of SVG
///
/// The paintable supports much of SVG 2, with some exceptions.
///
/// Among the graphical elements, `<textPath>` and `<foreignObject>`
/// are not supported.
///
/// Among the structural elements, `<a>` and `<view>` are not supported.
///
/// In the `<filter>` element, the following primitives are not
/// supported: feConvolveMatrix, feDiffuseLighting,
/// feMorphology, feSpecularLighting and feTurbulence.
///
/// Support for the `mask` attribute is limited to just a url
/// referring to the `<mask>` element by ID.
///
/// In animation elements, the parsing of `begin` and `end` attributes
/// is limited, and the `min` and `max` attributes are not supported.
///
/// Lastly, there is only minimal CSS support (the style attribute,
/// but not `<style>`), and no interactivity.
///
///
/// ## SVG Extensions
///
/// The paintable supports a number of [custom attributes](icon-format.html)
/// that offer a convenient way to define states, transitions and animations.
/// For example,
///
///     <circle cx='5' cy='5' r='5'
///             gpa:states='0 1'
///             gpa:animation-type='automatic'
///             gpa:animation-direction='segment'
///             gpa:animation-duration='600ms'/>
///
/// defines the circle to be shown in states 0 and 1, and animates a segment
/// of the circle.
///
/// <image src="svg-renderer1.svg">
///
/// Note that the generated animations are implemented using standard
/// SVG attributes (`visibility`, `stroke-dasharray, `stroke-dashoffset`,
/// `pathLength` and `filter`). Setting these attributes in your SVG
/// is therefore going to interfere with generated animations.
///
/// To connect general SVG animations to the states of the paintable,
/// use the custom `gpa:states(...)` condition in the `begin` and `end`
/// attributes of SVG animation elements. For example,
///
///     <animate href='path1'
///              attributeName='fill'
///              begin='gpa:states(0).begin'
///              dur='300ms'
///              fill='freeze'
///              from='black'
///              to='magenta'/>
///
/// will make the fill color of path1 transition from black to
/// magenta when the renderer enters state 0.
///
/// <image src="svg-renderer2.svg">
///
/// The `gpa:states(...)` condition triggers for upcoming state changes
/// as well, to support fade-out transitions. For example,
///
///     <animate href='path1'
///              attributeName='opacity'
///              begin='gpa:states(0).end -300ms'
///              dur='300ms'
///              fill='freeze'
///              from='1'
///              to='0'/>
///
/// will start a fade-out of path1 300ms before state 0 ends.
///
/// A variant of the `gpa:states(...)` condition allows specifying
/// both before and after states:
///
///     <animate href='path1'
///              attributeName='opacity'
///              begin='gpa:states(0, 1 2)'
///              dur='300ms'
///              fill='freeze'
///              from='1'
///              to='0'/>
///
/// will start the animation when the state changes from 0 to 1 or
/// from 0 to 2, but not when it changes from 0 to 3.
///
/// In addition to the `gpa:fill` and `gpa:stroke` attributes, symbolic
/// colors can also be specified as a custom paint server reference,
/// like this: `url(`gpa.properties.warning`)`. This works in `fill` and `stroke`
/// attributes, but also when specifying colors in SVG animation
/// attributes like `to` or `values`.
///
/// Note that the SVG syntax allows for a fallback RGB color to be
/// specified after the url, for compatibility with other SVG consumers:
///
///     fill='url(`gpa.properties.warning`) orange'
///
/// In contrast to SVG 1.1 and 2.0, we allow the `transform` attribute
/// to be animated with `<animate>`.
pub const Svg = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gdk.Paintable, gtk.SymbolicPaintable };
    pub const Class = gtk.SvgClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Enabled features for this paintable.
        ///
        /// Note that features have to be set before
        /// loading SVG data to take effect.
        pub const features = struct {
            pub const name = "features";

            pub const Type = gtk.SvgFeatures;
        };

        /// Whether the paintable is currently animating its content.
        ///
        /// To set this property, use the `gtk.Svg.play` and
        /// `gtk.Svg.pause` functions.
        pub const playing = struct {
            pub const name = "playing";

            pub const Type = c_int;
        };

        /// Resource to load SVG data from.
        ///
        /// This property is meant to create a paintable
        /// from a resource in ui files.
        pub const resource = struct {
            pub const name = "resource";

            pub const Type = ?[*:0]u8;
        };

        /// The current state of the renderer.
        ///
        /// This can be a number between 0 and 63.
        pub const state = struct {
            pub const name = "state";

            pub const Type = c_uint;
        };

        /// If not set to -1, this value overrides the weight used
        /// when rendering the paintable.
        pub const weight = struct {
            pub const name = "weight";

            pub const Type = f64;
        };
    };

    pub const signals = struct {
        /// Signals that an error occurred.
        ///
        /// Errors can occur both during parsing and during rendering.
        ///
        /// The expected error values are in the `gtk.SvgError` enumeration,
        /// context information about the location of parsing errors can
        /// be obtained with the various `gtk_svg_error` functions.
        ///
        /// Parsing errors are never fatal, so the parsing will resume after
        /// the error. Errors may however cause parts of the given data or
        /// even all of it to not be parsed at all. So it is a useful idea
        /// to check that the parsing succeeds by connecting to this signal.
        ///
        /// ::: note
        ///     This signal is emitted in the middle of parsing or rendering,
        ///     and if you handle it, you must be careful. Logging the errors
        ///     you receive is fine, but modifying the widget hierarchy or
        ///     changing the paintable state definitively isn't.
        ///
        ///     If in doubt, defer to an idle.
        pub const @"error" = struct {
            pub const name = "error";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_error: *glib.Error, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Svg, p_instance))),
                    gobject.signalLookup("error", Svg.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new, empty SVG paintable.
    extern fn gtk_svg_new() *gtk.Svg;
    pub const new = gtk_svg_new;

    /// Parses the SVG data in `bytes` and creates a paintable.
    extern fn gtk_svg_new_from_bytes(p_bytes: *glib.Bytes) *gtk.Svg;
    pub const newFromBytes = gtk_svg_new_from_bytes;

    /// Parses the SVG data in the resource and creates a paintable.
    extern fn gtk_svg_new_from_resource(p_path: [*:0]const u8) *gtk.Svg;
    pub const newFromResource = gtk_svg_new_from_resource;

    /// Returns the currently enabled features.
    extern fn gtk_svg_get_features(p_self: *Svg) gtk.SvgFeatures;
    pub const getFeatures = gtk_svg_get_features;

    /// Gets the current state of the paintable.
    extern fn gtk_svg_get_state(p_self: *Svg) c_uint;
    pub const getState = gtk_svg_get_state;

    /// Returns a `NULL`-terminated array of
    /// state names, if available.
    ///
    /// Note that the returned array and the strings
    /// contained in it will only be valid until the
    /// `GtkSvg` is cleared or reloaded, so if you
    /// want to keep it around, you should make a copy.
    extern fn gtk_svg_get_state_names(p_self: *Svg, p_length: *c_uint) ?[*][*:0]const u8;
    pub const getStateNames = gtk_svg_get_state_names;

    /// Gets the value of the weight property.
    extern fn gtk_svg_get_weight(p_self: *Svg) f64;
    pub const getWeight = gtk_svg_get_weight;

    /// Loads SVG content into an existing SVG paintable.
    ///
    /// To track errors while loading SVG content,
    /// connect to the `gtk.Svg.signals.@"error"` signal.
    ///
    /// This clears any previously loaded content.
    extern fn gtk_svg_load_from_bytes(p_self: *Svg, p_bytes: *glib.Bytes) void;
    pub const loadFromBytes = gtk_svg_load_from_bytes;

    /// Loads SVG content into an existing SVG paintable.
    ///
    /// To track errors while loading SVG content,
    /// connect to the `gtk.Svg.signals.@"error"` signal.
    ///
    /// This clears any previously loaded content.
    extern fn gtk_svg_load_from_resource(p_self: *Svg, p_path: [*:0]const u8) void;
    pub const loadFromResource = gtk_svg_load_from_resource;

    /// Stop any playing animations and state transitions.
    ///
    /// Animations can be paused and started repeatedly.
    extern fn gtk_svg_pause(p_self: *Svg) void;
    pub const pause = gtk_svg_pause;

    /// Start playing animations and state transitions.
    ///
    /// Animations can be paused and started repeatedly.
    extern fn gtk_svg_play(p_self: *Svg) void;
    pub const play = gtk_svg_play;

    /// Serializes the content of the renderer as SVG.
    ///
    /// The SVG will be similar to the orignally loaded one,
    /// but is not guaranteed to be 100% identical.
    ///
    /// This function serializes the DOM, i.e. the results
    /// of parsing the SVG. It does not reflect the effect
    /// of applying animations.
    extern fn gtk_svg_serialize(p_self: *Svg) *glib.Bytes;
    pub const serialize = gtk_svg_serialize;

    /// Enables or disables features of the SVG paintable.
    ///
    /// By default, all features are enabled.
    ///
    /// Note that this call only has an effect before the
    /// SVG is loaded.
    extern fn gtk_svg_set_features(p_self: *Svg, p_features: gtk.SvgFeatures) void;
    pub const setFeatures = gtk_svg_set_features;

    /// Sets a frame clock.
    ///
    /// Without a frame clock, GtkSvg will not advance animations.
    extern fn gtk_svg_set_frame_clock(p_self: *Svg, p_clock: *gdk.FrameClock) void;
    pub const setFrameClock = gtk_svg_set_frame_clock;

    /// Sets the state of the paintable.
    ///
    /// If the paintable is currently playing, the state change
    /// will apply transitions that are defined in the SVG. If
    /// the paintable is not playing, the state change will take
    /// effect instantaneously.
    extern fn gtk_svg_set_state(p_self: *Svg, p_state: c_uint) void;
    pub const setState = gtk_svg_set_state;

    /// Sets the weight that is used when rendering.
    ///
    /// The weight affects the effective linewidth when stroking
    /// paths.
    ///
    /// The default value of -1 means to use the font weight
    /// from CSS.
    extern fn gtk_svg_set_weight(p_self: *Svg, p_weight: f64) void;
    pub const setWeight = gtk_svg_set_weight;

    /// Serializes the paintable, and saves the result to a file.
    extern fn gtk_svg_write_to_file(p_self: *Svg, p_filename: [*:0]const u8, p_error: ?*?*glib.Error) c_int;
    pub const writeToFile = gtk_svg_write_to_file;

    extern fn gtk_svg_get_type() usize;
    pub const getGObjectType = gtk_svg_get_type;

    extern fn g_object_ref(p_self: *gtk.Svg) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Svg) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Svg, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a "light switch" that has two states: on or off.
///
/// <picture>
///   <source srcset="switch-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkSwitch" src="switch.png">
/// </picture>
///
/// The user can control which state should be active by clicking the
/// empty area, or by dragging the slider.
///
/// `GtkSwitch` can also express situations where the underlying state changes
/// with a delay. In this case, the slider position indicates the user's recent
/// change (represented by the `gtk.Switch.properties.active` property), while the
/// trough color indicates the present underlying state (represented by the
/// `gtk.Switch.properties.state` property).
///
/// <picture>
///   <source srcset="switch-state-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="GtkSwitch with delayed state change" src="switch-state.png">
/// </picture>
///
/// See `gtk.Switch.signals.state_set` for details.
///
/// # Shortcuts and Gestures
///
/// `GtkSwitch` supports pan and drag gestures to move the slider.
///
/// # CSS nodes
///
/// ```
/// switch
/// ├── image
/// ├── image
/// ╰── slider
/// ```
///
/// `GtkSwitch` has four css nodes, the main node with the name switch and
/// subnodes for the slider and the on and off images. Neither of them is
/// using any style classes.
///
/// # Accessibility
///
/// `GtkSwitch` uses the `gtk.@"AccessibleRole.switch"` role.
pub const Switch = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = opaque {
        pub const Instance = Switch;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the `GtkSwitch` widget is in its on or off state.
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// The backend state that is controlled by the switch.
        ///
        /// Applications should usually set the `gtk.Switch.properties.active` property,
        /// except when indicating a change to the backend state which occurs
        /// separately from the user's interaction.
        ///
        /// See `gtk.Switch.signals.state_set` for details.
        pub const state = struct {
            pub const name = "state";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted to animate the switch.
        ///
        /// Applications should never connect to this signal,
        /// but use the `gtk.Switch.properties.active` property.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Switch, p_instance))),
                    gobject.signalLookup("activate", Switch.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to change the underlying state.
        ///
        /// The ::state-set signal is emitted when the user changes the switch
        /// position. The default handler calls `gtk.Switch.setState` with the
        /// value of `state`.
        ///
        /// To implement delayed state change, applications can connect to this
        /// signal, initiate the change of the underlying state, and call
        /// `gtk.Switch.setState` when the underlying state change is
        /// complete. The signal handler should return `TRUE` to prevent the
        /// default handler from running.
        pub const state_set = struct {
            pub const name = "state-set";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_state: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Switch, p_instance))),
                    gobject.signalLookup("state-set", Switch.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkSwitch` widget.
    extern fn gtk_switch_new() *gtk.Switch;
    pub const new = gtk_switch_new;

    /// Gets whether the `GtkSwitch` is in its “on” or “off” state.
    extern fn gtk_switch_get_active(p_self: *Switch) c_int;
    pub const getActive = gtk_switch_get_active;

    /// Gets the underlying state of the `GtkSwitch`.
    extern fn gtk_switch_get_state(p_self: *Switch) c_int;
    pub const getState = gtk_switch_get_state;

    /// Changes the state of `self` to the desired one.
    extern fn gtk_switch_set_active(p_self: *Switch, p_is_active: c_int) void;
    pub const setActive = gtk_switch_set_active;

    /// Sets the underlying state of the `GtkSwitch`.
    ///
    /// This function is typically called from a `gtk.Switch.signals.state_set`
    /// signal handler in order to set up delayed state changes.
    ///
    /// See `gtk.Switch.signals.state_set` for details.
    extern fn gtk_switch_set_state(p_self: *Switch, p_state: c_int) void;
    pub const setState = gtk_switch_set_state;

    extern fn gtk_switch_get_type() usize;
    pub const getGObjectType = gtk_switch_get_type;

    extern fn g_object_ref(p_self: *gtk.Switch) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Switch) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Switch, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A single-line text entry.
///
/// `GtkText` is the common implementation of single-line text editing
/// that is shared between `gtk.Entry`, `gtk.PasswordEntry`,
/// `gtk.SpinButton`, and other widgets. In all of these, a `GtkText`
/// instance is used as the delegate for the `gtk.Editable` implementation.
///
/// A large number of key bindings s supported by default. If the entered
/// text is longer than the allocation of the widget, the widget will scroll
/// so that the cursor position is visible.
///
/// When using an entry for passwords and other sensitive information,
/// it can be put into “password mode” using `gtk.Text.setVisibility`.
/// In this mode, entered text is displayed using an “invisible” character.
/// By default, GTK picks the best invisible character that is available
/// in the current font, but it can be changed with
/// `gtk.Text.setInvisibleChar`.
///
/// If you want to add icons or progress display in an entry, look at
/// `gtk.Entry`. There are other alternatives for more specialized
/// use cases, such as `gtk.SearchEntry`.
///
/// If you need multi-line editable text, use `gtk.TextView`.
///
/// # Shortcuts and Gestures
///
/// `GtkText` supports the following keyboard shortcuts:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
/// - <kbd>Ctrl</kbd>+<kbd>A</kbd> or <kbd>Ctrl</kbd>+<kbd>&sol;</kbd>
///   selects all the text.
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> or
///   <kbd>Ctrl</kbd>+<kbd>&bsol;</kbd> unselects all.
/// - <kbd>Ctrl</kbd>+<kbd>Z</kbd> undoes the last modification.
/// - <kbd>Ctrl</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd>
///   redoes the last undone modification.
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> toggles the text direction.
/// - <kbd>Clear</kbd> clears the content.
///
/// Additionally, the following signals have default keybindings:
///
/// - `gtk.Text.signals.activate`
/// - `gtk.Text.signals.backspace`
/// - `gtk.Text.signals.copy_clipboard`
/// - `gtk.Text.signals.cut_clipboard`
/// - `gtk.Text.signals.delete_from_cursor`
/// - `gtk.Text.signals.insert_emoji`
/// - `gtk.Text.signals.move_cursor`
/// - `gtk.Text.signals.paste_clipboard`
/// - `gtk.Text.signals.toggle_overwrite`
///
/// # Actions
///
/// `GtkText` defines a set of built-in actions:
///
/// - `clipboard.copy` copies the contents to the clipboard.
/// - `clipboard.cut` copies the contents to the clipboard and deletes it from
///   the widget.
/// - `clipboard.paste` inserts the contents of the clipboard into the widget.
/// - `menu.popup` opens the context menu.
/// - `misc.insert-emoji` opens the Emoji chooser.
/// - `misc.toggle-visibility` toggles the `GtkText`:visibility property.
/// - `misc.toggle-direction` toggles the text direction.
/// - `selection.delete` deletes the current selection.
/// - `selection.select-all` selects all of the widgets content.
/// - `text.redo` redoes the last change to the contents.
/// - `text.undo` undoes the last change to the contents.
/// - `text.clear` removes all content.
///
/// # CSS nodes
///
/// ```
/// text[.read-only]
/// ├── placeholder
/// ├── undershoot.left
/// ├── undershoot.right
/// ├── [selection]
/// ├── [cursor-handle[.top]
/// ├── [cursor-handle.bottom]
/// ├── [block-cursor]
/// ├── [cursor-handle[.top/.bottom][.insertion-cursor]]
/// ╰── [window.popup]
/// ```
///
/// `GtkText` has a main node with the name `text`. Depending on the properties
/// of the widget, the `.read-only` style class may appear.
///
/// When the entry has a selection, it adds a subnode with the name `selection`.
///
/// When the entry is in overwrite mode, it adds a subnode with the name
/// `block-cursor` that determines how the block cursor is drawn.
///
/// The CSS node for a context menu is added as a subnode with the name `popup`.
///
/// The `undershoot` nodes are used to draw the underflow indication when content
/// is scrolled out of view. These nodes get the `.left` or `.right` style class
/// added depending on where the indication is drawn.
///
/// When touch is used and touch selection handles are shown, they are using
/// CSS nodes with name `cursor-handle`. They get the `.top` or `.bottom` style
/// class depending on where they are shown in relation to the selection. If
/// there is just a single handle for the text cursor, it gets the style class
/// `.insertion-cursor`.
///
/// # Accessibility
///
/// `GtkText` uses the `gtk.@"AccessibleRole.none"` role, which causes it to be
/// skipped for accessibility. This is because `GtkText` is expected to be used
/// as a delegate for a `GtkEditable` implementation that will be represented
/// to accessibility.
pub const Text = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleText, gtk.Buildable, gtk.ConstraintTarget, gtk.Editable };
    pub const Class = opaque {
        pub const Instance = Text;
    };
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
        pub const activates_default = struct {
            pub const name = "activates-default";

            pub const Type = c_int;
        };

        /// A list of Pango attributes to apply to the text.
        ///
        /// This is mainly useful to change the size or weight of the text.
        ///
        /// The `PangoAttribute`'s `start_index` and `end_index` must refer to the
        /// `GtkEntryBuffer` text, i.e. without the preedit string.
        pub const attributes = struct {
            pub const name = "attributes";

            pub const Type = ?*pango.AttrList;
        };

        /// The `GtkEntryBuffer` object which stores the text.
        pub const buffer = struct {
            pub const name = "buffer";

            pub const Type = ?*gtk.EntryBuffer;
        };

        /// Whether to suggest Emoji replacements.
        pub const enable_emoji_completion = struct {
            pub const name = "enable-emoji-completion";

            pub const Type = c_int;
        };

        /// A menu model whose contents will be appended to the context menu.
        pub const extra_menu = struct {
            pub const name = "extra-menu";

            pub const Type = ?*gio.MenuModel;
        };

        /// Which input method module should be used.
        ///
        /// See `gtk.IMMulticontext`.
        ///
        /// Setting this to a non-`NULL` value overrides the system-wide
        /// input method. See the `gtk.Settings.properties.gtk_im_module`
        /// setting.
        pub const im_module = struct {
            pub const name = "im-module";

            pub const Type = ?[*:0]u8;
        };

        /// Additional hints that allow input methods to fine-tune
        /// their behaviour.
        pub const input_hints = struct {
            pub const name = "input-hints";

            pub const Type = gtk.InputHints;
        };

        /// The purpose of this text field.
        ///
        /// This information can be used by on-screen keyboards and other input
        /// methods to adjust their behaviour.
        ///
        /// Note that setting the purpose to `gtk.@"InputPurpose.password"`
        /// or `gtk.@"InputPurpose.pin"` is independent from setting
        /// `gtk.Text.properties.visibility`.
        pub const input_purpose = struct {
            pub const name = "input-purpose";

            pub const Type = gtk.InputPurpose;
        };

        /// The character to used when masking contents (in “password mode”).
        pub const invisible_char = struct {
            pub const name = "invisible-char";

            pub const Type = c_uint;
        };

        /// Whether the invisible char has been set.
        pub const invisible_char_set = struct {
            pub const name = "invisible-char-set";

            pub const Type = c_int;
        };

        /// Maximum number of characters that are allowed.
        ///
        /// Zero indicates no limit.
        pub const max_length = struct {
            pub const name = "max-length";

            pub const Type = c_int;
        };

        /// If text is overwritten when typing.
        pub const overwrite_mode = struct {
            pub const name = "overwrite-mode";

            pub const Type = c_int;
        };

        /// The text that will be displayed in the `GtkText` when it is empty
        /// and unfocused.
        pub const placeholder_text = struct {
            pub const name = "placeholder-text";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the widget should grow and shrink with the content.
        pub const propagate_text_width = struct {
            pub const name = "propagate-text-width";

            pub const Type = c_int;
        };

        /// Number of pixels scrolled of the screen to the left.
        pub const scroll_offset = struct {
            pub const name = "scroll-offset";

            pub const Type = c_int;
        };

        /// Custom tabs for this text widget.
        pub const tabs = struct {
            pub const name = "tabs";

            pub const Type = ?*pango.TabArray;
        };

        /// When true, pasted multi-line text is truncated to the first line.
        pub const truncate_multiline = struct {
            pub const name = "truncate-multiline";

            pub const Type = c_int;
        };

        /// If false, the text is masked with the “invisible char”.
        pub const visibility = struct {
            pub const name = "visibility";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the user hits the <kbd>Enter</kbd> key.
        ///
        /// The default bindings for this signal are all forms
        /// of the <kbd>Enter</kbd> key.
        pub const activate = struct {
            pub const name = "activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("activate", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user asks for it.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Backspace</kbd> and <kbd>Shift</kbd>+<kbd>Backspace</kbd>.
        pub const backspace = struct {
            pub const name = "backspace";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("backspace", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to copy the selection to the clipboard.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>c</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>Insert</kbd>.
        pub const copy_clipboard = struct {
            pub const name = "copy-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("copy-clipboard", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to cut the selection to the clipboard.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>x</kbd> and
        /// <kbd>Shift</kbd>+<kbd>Delete</kbd>.
        pub const cut_clipboard = struct {
            pub const name = "cut-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("cut-clipboard", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a text deletion.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// If the `type` is `gtk.@"DeleteType.chars"`, GTK deletes the
        /// selection if there is one, otherwise it deletes the requested
        /// number of characters.
        ///
        /// The default bindings for this signal are <kbd>Delete</kbd>
        /// for deleting a character and <kbd>Ctrl</kbd>+<kbd>Delete</kbd>
        /// for deleting a word.
        pub const delete_from_cursor = struct {
            pub const name = "delete-from-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_type: gtk.DeleteType, p_count: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("delete-from-cursor", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates the insertion of a
        /// fixed string at the cursor.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// This signal has no default bindings.
        pub const insert_at_cursor = struct {
            pub const name = "insert-at-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_string: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("insert-at-cursor", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to present the Emoji chooser.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>.</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>;</kbd>
        pub const insert_emoji = struct {
            pub const name = "insert-emoji";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("insert-emoji", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user initiates a cursor movement.
        ///
        /// If the cursor is not visible in `self`, this signal causes
        /// the viewport to be moved instead.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control
        /// the cursor programmatically.
        ///
        /// The default bindings for this signal come in two variants,
        /// the variant with the <kbd>Shift</kbd> modifier extends the
        /// selection, the variant without it does not.
        /// There are too many key combinations to list them all here.
        ///
        /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
        ///   move by individual characters/lines
        /// - <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs
        /// - <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("move-cursor", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to paste the contents of the clipboard.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>Shift</kbd>+<kbd>Insert</kbd>.
        pub const paste_clipboard = struct {
            pub const name = "paste-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("paste-clipboard", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the preedit text changes.
        ///
        /// If an input method is used, the typed text will not immediately
        /// be committed to the buffer. So if you are interested in the text,
        /// connect to this signal.
        pub const preedit_changed = struct {
            pub const name = "preedit-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_preedit: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("preedit-changed", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to toggle the overwrite mode.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal is <kbd>Insert</kbd>.
        pub const toggle_overwrite = struct {
            pub const name = "toggle-overwrite";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Text, p_instance))),
                    gobject.signalLookup("toggle-overwrite", Text.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkText`.
    extern fn gtk_text_new() *gtk.Text;
    pub const new = gtk_text_new;

    /// Creates a new `GtkText` with the specified buffer.
    extern fn gtk_text_new_with_buffer(p_buffer: *gtk.EntryBuffer) *gtk.Text;
    pub const newWithBuffer = gtk_text_new_with_buffer;

    /// Determines the positions of the strong and weak cursors for a
    /// given character position.
    ///
    /// The position of each cursor is stored as a zero-width rectangle.
    /// The strong cursor location is the location where characters of
    /// the directionality equal to the base direction are inserted.
    /// The weak cursor location is the location where characters of
    /// the directionality opposite to the base direction are inserted.
    ///
    /// The rectangle positions are in widget coordinates.
    extern fn gtk_text_compute_cursor_extents(p_self: *Text, p_position: usize, p_strong: ?*graphene.Rect, p_weak: ?*graphene.Rect) void;
    pub const computeCursorExtents = gtk_text_compute_cursor_extents;

    /// Returns whether pressing <kbd>Enter</kbd> will activate
    /// the default widget for the window containing the widget.
    ///
    /// See `gtk.Text.setActivatesDefault`.
    extern fn gtk_text_get_activates_default(p_self: *Text) c_int;
    pub const getActivatesDefault = gtk_text_get_activates_default;

    /// Gets the attribute list that was set on the text widget.
    ///
    /// See `gtk.Text.setAttributes`.
    extern fn gtk_text_get_attributes(p_self: *Text) ?*pango.AttrList;
    pub const getAttributes = gtk_text_get_attributes;

    /// Get the entry buffer object which holds the text for
    /// this widget.
    extern fn gtk_text_get_buffer(p_self: *Text) *gtk.EntryBuffer;
    pub const getBuffer = gtk_text_get_buffer;

    /// Returns whether Emoji completion is enabled.
    extern fn gtk_text_get_enable_emoji_completion(p_self: *Text) c_int;
    pub const getEnableEmojiCompletion = gtk_text_get_enable_emoji_completion;

    /// Gets the extra menu model of the text widget.
    ///
    /// See `gtk.Text.setExtraMenu`.
    extern fn gtk_text_get_extra_menu(p_self: *Text) ?*gio.MenuModel;
    pub const getExtraMenu = gtk_text_get_extra_menu;

    /// Gets the input hints of the text widget.
    extern fn gtk_text_get_input_hints(p_self: *Text) gtk.InputHints;
    pub const getInputHints = gtk_text_get_input_hints;

    /// Gets the input purpose of the text widget.
    extern fn gtk_text_get_input_purpose(p_self: *Text) gtk.InputPurpose;
    pub const getInputPurpose = gtk_text_get_input_purpose;

    /// Retrieves the character displayed when visibility is set to false.
    ///
    /// Note that GTK does not compute this value unless it needs it,
    /// so the value returned by this function is not very useful unless
    /// it has been explicitly set with `gtk.Text.setInvisibleChar`.
    extern fn gtk_text_get_invisible_char(p_self: *Text) u32;
    pub const getInvisibleChar = gtk_text_get_invisible_char;

    /// Retrieves the maximum allowed length of the contents.
    ///
    /// See `gtk.Text.setMaxLength`.
    ///
    /// This is equivalent to getting `self`'s `GtkEntryBuffer` and
    /// calling `gtk.EntryBuffer.getMaxLength` on it.
    extern fn gtk_text_get_max_length(p_self: *Text) c_int;
    pub const getMaxLength = gtk_text_get_max_length;

    /// Gets whether text is overwritten when typing.
    ///
    /// See `gtk.Text.setOverwriteMode`.
    extern fn gtk_text_get_overwrite_mode(p_self: *Text) c_int;
    pub const getOverwriteMode = gtk_text_get_overwrite_mode;

    /// Retrieves the text that will be displayed when the text widget
    /// is empty and unfocused
    ///
    /// See `gtk.Text.setPlaceholderText`.
    extern fn gtk_text_get_placeholder_text(p_self: *Text) ?[*:0]const u8;
    pub const getPlaceholderText = gtk_text_get_placeholder_text;

    /// Returns whether the text widget will grow and shrink
    /// with the content.
    extern fn gtk_text_get_propagate_text_width(p_self: *Text) c_int;
    pub const getPropagateTextWidth = gtk_text_get_propagate_text_width;

    /// Gets the tab stops for the text widget.
    ///
    /// See `gtk.Text.setTabs`.
    extern fn gtk_text_get_tabs(p_self: *Text) ?*pango.TabArray;
    pub const getTabs = gtk_text_get_tabs;

    /// Retrieves the length of the contents.
    ///
    /// This is equivalent to getting `self`'s `GtkEntryBuffer`
    /// and calling `gtk.EntryBuffer.getLength` on it.
    extern fn gtk_text_get_text_length(p_self: *Text) u16;
    pub const getTextLength = gtk_text_get_text_length;

    /// Returns whether pasted text will be truncated to the first line.
    extern fn gtk_text_get_truncate_multiline(p_self: *Text) c_int;
    pub const getTruncateMultiline = gtk_text_get_truncate_multiline;

    /// Retrieves whether the text is visible.
    extern fn gtk_text_get_visibility(p_self: *Text) c_int;
    pub const getVisibility = gtk_text_get_visibility;

    /// Causes the text widget to have the keyboard focus.
    ///
    /// It behaves like `gtk.Widget.grabFocus`,
    /// except that it does not select the contents of `self`.
    ///
    /// You only want to call this on some special entries
    /// which the user usually doesn't want to replace all
    /// text in, such as search-as-you-type entries.
    extern fn gtk_text_grab_focus_without_selecting(p_self: *Text) c_int;
    pub const grabFocusWithoutSelecting = gtk_text_grab_focus_without_selecting;

    /// Sets whether pressing <kbd>Enter</kbd> will activate
    /// the default widget.
    ///
    /// This usually means that the dialog containing `self` will
    /// be closed, since the default widget is usually one of
    /// the dialog buttons.
    extern fn gtk_text_set_activates_default(p_self: *Text, p_activates: c_int) void;
    pub const setActivatesDefault = gtk_text_set_activates_default;

    /// Apply attributes to the contents of the text widget.
    extern fn gtk_text_set_attributes(p_self: *Text, p_attrs: ?*pango.AttrList) void;
    pub const setAttributes = gtk_text_set_attributes;

    /// Set the entry buffer object which holds the text for
    /// this widget.
    extern fn gtk_text_set_buffer(p_self: *Text, p_buffer: *gtk.EntryBuffer) void;
    pub const setBuffer = gtk_text_set_buffer;

    /// Sets whether Emoji completion is enabled.
    ///
    /// If it is, typing ':', followed by a recognized keyword,
    /// will pop up a window with suggested Emojis matching the
    /// keyword.
    extern fn gtk_text_set_enable_emoji_completion(p_self: *Text, p_enable_emoji_completion: c_int) void;
    pub const setEnableEmojiCompletion = gtk_text_set_enable_emoji_completion;

    /// Sets a menu model to add to the context menu of the text widget.
    extern fn gtk_text_set_extra_menu(p_self: *Text, p_model: ?*gio.MenuModel) void;
    pub const setExtraMenu = gtk_text_set_extra_menu;

    /// Sets hints that allow input methods to fine-tune their behaviour.
    extern fn gtk_text_set_input_hints(p_self: *Text, p_hints: gtk.InputHints) void;
    pub const setInputHints = gtk_text_set_input_hints;

    /// Sets the input purpose of the text widget.
    ///
    /// The input purpose can be used by on-screen keyboards
    /// and other input methods to adjust their behaviour.
    extern fn gtk_text_set_input_purpose(p_self: *Text, p_purpose: gtk.InputPurpose) void;
    pub const setInputPurpose = gtk_text_set_input_purpose;

    /// Sets the character to use when in “password mode”.
    ///
    /// By default, GTK picks the best invisible char available in the
    /// current font. If you set the invisible char to 0, then the user
    /// will get no feedback at all; there will be no text on the screen
    /// as they type.
    extern fn gtk_text_set_invisible_char(p_self: *Text, p_ch: u32) void;
    pub const setInvisibleChar = gtk_text_set_invisible_char;

    /// Sets the maximum allowed length of the contents.
    ///
    /// If the current contents are longer than the given length,
    /// they will be truncated to fit.
    ///
    /// This is equivalent to getting `self`'s `GtkEntryBuffer` and
    /// calling `gtk.EntryBuffer.setMaxLength` on it.
    extern fn gtk_text_set_max_length(p_self: *Text, p_length: c_int) void;
    pub const setMaxLength = gtk_text_set_max_length;

    /// Sets whether the text is overwritten when typing.
    extern fn gtk_text_set_overwrite_mode(p_self: *Text, p_overwrite: c_int) void;
    pub const setOverwriteMode = gtk_text_set_overwrite_mode;

    /// Sets the text to be displayed when the text widget is
    /// empty and unfocused.
    ///
    /// This can be used to give a visual hint of the expected
    /// contents of the text widget.
    extern fn gtk_text_set_placeholder_text(p_self: *Text, p_text: ?[*:0]const u8) void;
    pub const setPlaceholderText = gtk_text_set_placeholder_text;

    /// Sets whether the text widget should grow and shrink with the content.
    extern fn gtk_text_set_propagate_text_width(p_self: *Text, p_propagate_text_width: c_int) void;
    pub const setPropagateTextWidth = gtk_text_set_propagate_text_width;

    /// Sets tab stops for the text widget.
    extern fn gtk_text_set_tabs(p_self: *Text, p_tabs: ?*pango.TabArray) void;
    pub const setTabs = gtk_text_set_tabs;

    /// Sets whether pasted text should be truncated to the first line.
    extern fn gtk_text_set_truncate_multiline(p_self: *Text, p_truncate_multiline: c_int) void;
    pub const setTruncateMultiline = gtk_text_set_truncate_multiline;

    /// Sets whether the contents of the text widget are visible or not.
    ///
    /// When visibility is set to false, characters are displayed
    /// as the invisible char, and it will also appear that way when
    /// the text in the widget is copied to the clipboard.
    ///
    /// By default, GTK picks the best invisible character available
    /// in the current font, but it can be changed with
    /// `gtk.Text.setInvisibleChar`.
    ///
    /// Note that you probably want to set `gtk.Text.properties.input_purpose`
    /// to `gtk.@"InputPurpose.password"` or `gtk.@"InputPurpose.pin"`
    /// to inform input methods about the purpose of this widget, in addition
    /// to setting visibility to false.
    extern fn gtk_text_set_visibility(p_self: *Text, p_visible: c_int) void;
    pub const setVisibility = gtk_text_set_visibility;

    /// Unsets the invisible char.
    ///
    /// After calling this, the default invisible char is used again.
    extern fn gtk_text_unset_invisible_char(p_self: *Text) void;
    pub const unsetInvisibleChar = gtk_text_unset_invisible_char;

    extern fn gtk_text_get_type() usize;
    pub const getGObjectType = gtk_text_get_type;

    extern fn g_object_ref(p_self: *gtk.Text) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Text) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Text, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Stores text and attributes for display in a `GtkTextView`.
///
/// You may wish to begin by reading the
/// [text widget conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types
/// related to the text widget and how they work together.
///
/// GtkTextBuffer can support undoing changes to the buffer
/// content, see `gtk.TextBuffer.setEnableUndo`.
pub const TextBuffer = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.TextBufferClass;
    f_parent_instance: gobject.Object,
    f_priv: ?*gtk.TextBufferPrivate,

    pub const virtual_methods = struct {
        /// Emits the “apply-tag” signal on `buffer`.
        ///
        /// The default handler for the signal applies
        /// `tag` to the given range. `start` and `end` do
        /// not have to be in order.
        pub const apply_tag = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_apply_tag.?(gobject.ext.as(TextBuffer, p_buffer), p_tag, p_start, p_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_apply_tag = @ptrCast(p_implementation);
            }
        };

        /// Called to indicate that the buffer operations between here and a
        /// call to `gtk.TextBuffer.endUserAction` are part of a single
        /// user-visible operation.
        ///
        /// The operations between `gtk.TextBuffer.beginUserAction` and
        /// `gtk.TextBuffer.endUserAction` can then be grouped when creating
        /// an undo stack. `GtkTextBuffer` maintains a count of calls to
        /// `gtk.TextBuffer.beginUserAction` that have not been closed with
        /// a call to `gtk.TextBuffer.endUserAction`, and emits the
        /// “begin-user-action” and “end-user-action” signals only for the
        /// outermost pair of calls. This allows you to build user actions
        /// from other user actions.
        ///
        /// The “interactive” buffer mutation functions, such as
        /// `gtk.TextBuffer.insertInteractive`, automatically call
        /// begin/end user action around the buffer operations they perform,
        /// so there's no need to add extra calls if you user action consists
        /// solely of a single call to one of those functions.
        pub const begin_user_action = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_begin_user_action.?(gobject.ext.as(TextBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_begin_user_action = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::changed` signal.
        pub const changed = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_changed.?(gobject.ext.as(TextBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_changed = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::delete-range` signal.
        pub const delete_range = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start: *gtk.TextIter, p_end: *gtk.TextIter) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_delete_range.?(gobject.ext.as(TextBuffer, p_buffer), p_start, p_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start: *gtk.TextIter, p_end: *gtk.TextIter) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_delete_range = @ptrCast(p_implementation);
            }
        };

        /// Ends a user-visible operation.
        ///
        /// Should be paired with a call to
        /// `gtk.TextBuffer.beginUserAction`.
        /// See that function for a full explanation.
        pub const end_user_action = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_end_user_action.?(gobject.ext.as(TextBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_end_user_action = @ptrCast(p_implementation);
            }
        };

        /// Inserts a child widget anchor into the text buffer at `iter`.
        ///
        /// The anchor will be counted as one character in character counts, and
        /// when obtaining the buffer contents as a string, will be represented
        /// by the Unicode “object replacement character” 0xFFFC. Note that the
        /// “slice” variants for obtaining portions of the buffer as a string
        /// include this character for child anchors, but the “text” variants do
        /// not. E.g. see `gtk.TextBuffer.getSlice` and
        /// `gtk.TextBuffer.getText`.
        ///
        /// Consider `gtk.TextBuffer.createChildAnchor` as a more
        /// convenient alternative to this function. The buffer will add a
        /// reference to the anchor, so you can unref it after insertion.
        pub const insert_child_anchor = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TextIter, p_anchor: *gtk.TextChildAnchor) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_insert_child_anchor.?(gobject.ext.as(TextBuffer, p_buffer), p_iter, p_anchor);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TextIter, p_anchor: *gtk.TextChildAnchor) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_insert_child_anchor = @ptrCast(p_implementation);
            }
        };

        /// Inserts an image into the text buffer at `iter`.
        ///
        /// The image will be counted as one character in character counts,
        /// and when obtaining the buffer contents as a string, will be
        /// represented by the Unicode “object replacement character” 0xFFFC.
        /// Note that the “slice” variants for obtaining portions of the buffer
        /// as a string include this character for paintable, but the “text”
        /// variants do not. e.g. see `gtk.TextBuffer.getSlice` and
        /// `gtk.TextBuffer.getText`.
        pub const insert_paintable = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TextIter, p_paintable: *gdk.Paintable) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_insert_paintable.?(gobject.ext.as(TextBuffer, p_buffer), p_iter, p_paintable);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TextIter, p_paintable: *gdk.Paintable) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_insert_paintable = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::insert-text` signal.
        pub const insert_text = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_pos: *gtk.TextIter, p_new_text: [*:0]const u8, p_new_text_length: c_int) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_insert_text.?(gobject.ext.as(TextBuffer, p_buffer), p_pos, p_new_text, p_new_text_length);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_pos: *gtk.TextIter, p_new_text: [*:0]const u8, p_new_text_length: c_int) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_insert_text = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::mark-deleted` signal.
        pub const mark_deleted = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_mark: *gtk.TextMark) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_mark_deleted.?(gobject.ext.as(TextBuffer, p_buffer), p_mark);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_mark: *gtk.TextMark) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_mark_deleted = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::mark-set` signal.
        pub const mark_set = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_location: *const gtk.TextIter, p_mark: *gtk.TextMark) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_mark_set.?(gobject.ext.as(TextBuffer, p_buffer), p_location, p_mark);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_location: *const gtk.TextIter, p_mark: *gtk.TextMark) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_mark_set = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::modified-changed` signal.
        pub const modified_changed = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_modified_changed.?(gobject.ext.as(TextBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_modified_changed = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextBuffer::paste-done` signal.
        pub const paste_done = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_clipboard: *gdk.Clipboard) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_paste_done.?(gobject.ext.as(TextBuffer, p_buffer), p_clipboard);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_clipboard: *gdk.Clipboard) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_paste_done = @ptrCast(p_implementation);
            }
        };

        /// Redoes the next redoable action on the buffer, if there is one.
        pub const redo = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_redo.?(gobject.ext.as(TextBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_redo = @ptrCast(p_implementation);
            }
        };

        /// Emits the “remove-tag” signal.
        ///
        /// The default handler for the signal removes all occurrences
        /// of `tag` from the given range. `start` and `end` don’t have
        /// to be in order.
        pub const remove_tag = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_remove_tag.?(gobject.ext.as(TextBuffer, p_buffer), p_tag, p_start, p_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_remove_tag = @ptrCast(p_implementation);
            }
        };

        /// Undoes the last undoable action on the buffer, if there is one.
        pub const undo = struct {
            pub fn call(p_class: anytype, p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextBuffer.Class, p_class).f_undo.?(gobject.ext.as(TextBuffer, p_buffer));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buffer: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextBuffer.Class, p_class).f_undo = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Denotes that the buffer can reapply the last undone action.
        pub const can_redo = struct {
            pub const name = "can-redo";

            pub const Type = c_int;
        };

        /// Denotes that the buffer can undo the last applied action.
        pub const can_undo = struct {
            pub const name = "can-undo";

            pub const Type = c_int;
        };

        /// The position of the insert mark.
        ///
        /// This is an offset from the beginning of the buffer.
        /// It is useful for getting notified when the cursor moves.
        pub const cursor_position = struct {
            pub const name = "cursor-position";

            pub const Type = c_int;
        };

        /// Denotes if support for undoing and redoing changes to the buffer is allowed.
        pub const enable_undo = struct {
            pub const name = "enable-undo";

            pub const Type = c_int;
        };

        /// Whether the buffer has some text currently selected.
        pub const has_selection = struct {
            pub const name = "has-selection";

            pub const Type = c_int;
        };

        /// The GtkTextTagTable for the buffer.
        pub const tag_table = struct {
            pub const name = "tag-table";

            pub const Type = ?*gtk.TextTagTable;
        };

        /// The text content of the buffer.
        ///
        /// Without child widgets and images,
        /// see `gtk.TextBuffer.getText` for more information.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {
        /// Emitted to apply a tag to a range of text in a `GtkTextBuffer`.
        ///
        /// Applying actually occurs in the default handler.
        ///
        /// Note that if your handler runs before the default handler
        /// it must not invalidate the `start` and `end` iters (or has to
        /// revalidate them).
        ///
        /// See also:
        /// `gtk.TextBuffer.applyTag`,
        /// `gtk.TextBuffer.insertWithTags`,
        /// `gtk.TextBuffer.insertRange`.
        pub const apply_tag = struct {
            pub const name = "apply-tag";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_tag: *gtk.TextTag, p_start: *gtk.TextIter, p_end: *gtk.TextIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("apply-tag", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted at the beginning of a single user-visible
        /// operation on a `GtkTextBuffer`.
        ///
        /// See also:
        /// `gtk.TextBuffer.beginUserAction`,
        /// `gtk.TextBuffer.insertInteractive`,
        /// `gtk.TextBuffer.insertRangeInteractive`,
        /// `gtk.TextBuffer.deleteInteractive`,
        /// `gtk.TextBuffer.backspace`,
        /// `gtk.TextBuffer.deleteSelection`.
        pub const begin_user_action = struct {
            pub const name = "begin-user-action";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("begin-user-action", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the content of a `GtkTextBuffer` has changed.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("changed", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to delete a range from a `GtkTextBuffer`.
        ///
        /// Note that if your handler runs before the default handler
        /// it must not invalidate the `start` and `end` iters (or has
        /// to revalidate them). The default signal handler revalidates
        /// the `start` and `end` iters to both point to the location
        /// where text was deleted. Handlers which run after the default
        /// handler (see `g_signal_connect_after`) do not have access to
        /// the deleted text.
        ///
        /// See also: `gtk.TextBuffer.delete`.
        pub const delete_range = struct {
            pub const name = "delete-range";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_start: *gtk.TextIter, p_end: *gtk.TextIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("delete-range", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted at the end of a single user-visible
        /// operation on the `GtkTextBuffer`.
        ///
        /// See also:
        /// `gtk.TextBuffer.endUserAction`,
        /// `gtk.TextBuffer.insertInteractive`,
        /// `gtk.TextBuffer.insertRangeInteractive`,
        /// `gtk.TextBuffer.deleteInteractive`,
        /// `gtk.TextBuffer.backspace`,
        /// `gtk.TextBuffer.deleteSelection`,
        /// `gtk.TextBuffer.backspace`.
        pub const end_user_action = struct {
            pub const name = "end-user-action";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("end-user-action", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to insert a `GtkTextChildAnchor` in a `GtkTextBuffer`.
        ///
        /// Insertion actually occurs in the default handler.
        ///
        /// Note that if your handler runs before the default handler
        /// it must not invalidate the `location` iter (or has to
        /// revalidate it). The default signal handler revalidates
        /// it to be placed after the inserted `anchor`.
        ///
        /// See also: `gtk.TextBuffer.insertChildAnchor`.
        pub const insert_child_anchor = struct {
            pub const name = "insert-child-anchor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_location: *gtk.TextIter, p_anchor: *gtk.TextChildAnchor, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("insert-child-anchor", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to insert a `GdkPaintable` in a `GtkTextBuffer`.
        ///
        /// Insertion actually occurs in the default handler.
        ///
        /// Note that if your handler runs before the default handler
        /// it must not invalidate the `location` iter (or has to
        /// revalidate it). The default signal handler revalidates
        /// it to be placed after the inserted `paintable`.
        ///
        /// See also: `gtk.TextBuffer.insertPaintable`.
        pub const insert_paintable = struct {
            pub const name = "insert-paintable";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_location: *gtk.TextIter, p_paintable: *gdk.Paintable, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("insert-paintable", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to insert text in a `GtkTextBuffer`.
        ///
        /// Insertion actually occurs in the default handler.
        ///
        /// Note that if your handler runs before the default handler
        /// it must not invalidate the `location` iter (or has to
        /// revalidate it). The default signal handler revalidates
        /// it to point to the end of the inserted text.
        ///
        /// See also: `gtk.TextBuffer.insert`,
        /// `gtk.TextBuffer.insertRange`.
        pub const insert_text = struct {
            pub const name = "insert-text";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_location: *gtk.TextIter, p_text: [*:0]u8, p_len: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("insert-text", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted as notification after a `GtkTextMark` is deleted.
        ///
        /// See also: `gtk.TextBuffer.deleteMark`.
        pub const mark_deleted = struct {
            pub const name = "mark-deleted";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_mark: *gtk.TextMark, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("mark-deleted", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted as notification after a `GtkTextMark` is set.
        ///
        /// See also:
        /// `gtk.TextBuffer.createMark`,
        /// `gtk.TextBuffer.moveMark`.
        pub const mark_set = struct {
            pub const name = "mark-set";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_location: *gtk.TextIter, p_mark: *gtk.TextMark, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("mark-set", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the modified bit of a `GtkTextBuffer` flips.
        ///
        /// See also: `gtk.TextBuffer.setModified`.
        pub const modified_changed = struct {
            pub const name = "modified-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("modified-changed", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted after paste operation has been completed.
        ///
        /// This is useful to properly scroll the view to the end
        /// of the pasted text. See `gtk.TextBuffer.pasteClipboard`
        /// for more details.
        pub const paste_done = struct {
            pub const name = "paste-done";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_clipboard: *gdk.Clipboard, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("paste-done", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a request has been made to redo the
        /// previously undone operation.
        pub const redo = struct {
            pub const name = "redo";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("redo", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted to remove all occurrences of `tag` from a range
        /// of text in a `GtkTextBuffer`.
        ///
        /// Removal actually occurs in the default handler.
        ///
        /// Note that if your handler runs before the default handler
        /// it must not invalidate the `start` and `end` iters (or has
        /// to revalidate them).
        ///
        /// See also: `gtk.TextBuffer.removeTag`.
        pub const remove_tag = struct {
            pub const name = "remove-tag";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_tag: *gtk.TextTag, p_start: *gtk.TextIter, p_end: *gtk.TextIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("remove-tag", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a request has been made to undo the
        /// previous operation or set of operations that have
        /// been grouped together.
        pub const undo = struct {
            pub const name = "undo";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextBuffer, p_instance))),
                    gobject.signalLookup("undo", TextBuffer.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new text buffer.
    extern fn gtk_text_buffer_new(p_table: ?*gtk.TextTagTable) *gtk.TextBuffer;
    pub const new = gtk_text_buffer_new;

    /// Adds a `gtk.TextBufferCommitNotify` to be called when a change
    /// is to be made to the `gtk.TextBuffer`.
    ///
    /// Functions are explicitly forbidden from making changes to the
    /// `gtk.TextBuffer` from this callback. It is intended for tracking
    /// changes to the buffer only.
    ///
    /// It may be advantageous to use `gtk.TextBufferCommitNotify` over
    /// connecting to the `gtk.TextBuffer.signals.insert_text` or
    /// `gtk.TextBuffer.signals.delete_range` signals to avoid ordering issues with
    /// other signal handlers which may further modify the `gtk.TextBuffer`.
    extern fn gtk_text_buffer_add_commit_notify(p_buffer: *TextBuffer, p_flags: gtk.TextBufferNotifyFlags, p_commit_notify: gtk.TextBufferCommitNotify, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) c_uint;
    pub const addCommitNotify = gtk_text_buffer_add_commit_notify;

    /// Adds the mark at position `where`.
    ///
    /// The mark must not be added to another buffer, and if its name
    /// is not `NULL` then there must not be another mark in the buffer
    /// with the same name.
    ///
    /// Emits the `gtk.TextBuffer.signals.mark_set` signal as notification
    /// of the mark's initial placement.
    extern fn gtk_text_buffer_add_mark(p_buffer: *TextBuffer, p_mark: *gtk.TextMark, p_where: *const gtk.TextIter) void;
    pub const addMark = gtk_text_buffer_add_mark;

    /// Adds `clipboard` to the list of clipboards in which the selection
    /// contents of `buffer` are available.
    ///
    /// In most cases, `clipboard` will be the `GdkClipboard` returned by
    /// `gtk.Widget.getPrimaryClipboard` for a view of `buffer`.
    extern fn gtk_text_buffer_add_selection_clipboard(p_buffer: *TextBuffer, p_clipboard: *gdk.Clipboard) void;
    pub const addSelectionClipboard = gtk_text_buffer_add_selection_clipboard;

    /// Emits the “apply-tag” signal on `buffer`.
    ///
    /// The default handler for the signal applies
    /// `tag` to the given range. `start` and `end` do
    /// not have to be in order.
    extern fn gtk_text_buffer_apply_tag(p_buffer: *TextBuffer, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void;
    pub const applyTag = gtk_text_buffer_apply_tag;

    /// Emits the “apply-tag” signal on `buffer`.
    ///
    /// Calls `gtk.TextTagTable.lookup` on the buffer’s
    /// tag table to get a `GtkTextTag`, then calls
    /// `gtk.TextBuffer.applyTag`.
    extern fn gtk_text_buffer_apply_tag_by_name(p_buffer: *TextBuffer, p_name: [*:0]const u8, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void;
    pub const applyTagByName = gtk_text_buffer_apply_tag_by_name;

    /// Performs the appropriate action as if the user hit the delete
    /// key with the cursor at the position specified by `iter`.
    ///
    /// In the normal case a single character will be deleted, but when
    /// combining accents are involved, more than one character can
    /// be deleted, and when precomposed character and accent combinations
    /// are involved, less than one character will be deleted.
    ///
    /// Because the buffer is modified, all outstanding iterators become
    /// invalid after calling this function; however, the `iter` will be
    /// re-initialized to point to the location where text was deleted.
    extern fn gtk_text_buffer_backspace(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_interactive: c_int, p_default_editable: c_int) c_int;
    pub const backspace = gtk_text_buffer_backspace;

    /// Denotes the beginning of an action that may not be undone.
    ///
    /// This will cause any previous operations in the undo/redo queue
    /// to be cleared.
    ///
    /// This should be paired with a call to
    /// `gtk.TextBuffer.endIrreversibleAction` after the irreversible
    /// action has completed.
    ///
    /// You may nest calls to `gtk.TextBuffer.beginIrreversibleAction`
    /// and `gtk.TextBuffer.endIrreversibleAction` pairs.
    extern fn gtk_text_buffer_begin_irreversible_action(p_buffer: *TextBuffer) void;
    pub const beginIrreversibleAction = gtk_text_buffer_begin_irreversible_action;

    /// Called to indicate that the buffer operations between here and a
    /// call to `gtk.TextBuffer.endUserAction` are part of a single
    /// user-visible operation.
    ///
    /// The operations between `gtk.TextBuffer.beginUserAction` and
    /// `gtk.TextBuffer.endUserAction` can then be grouped when creating
    /// an undo stack. `GtkTextBuffer` maintains a count of calls to
    /// `gtk.TextBuffer.beginUserAction` that have not been closed with
    /// a call to `gtk.TextBuffer.endUserAction`, and emits the
    /// “begin-user-action” and “end-user-action” signals only for the
    /// outermost pair of calls. This allows you to build user actions
    /// from other user actions.
    ///
    /// The “interactive” buffer mutation functions, such as
    /// `gtk.TextBuffer.insertInteractive`, automatically call
    /// begin/end user action around the buffer operations they perform,
    /// so there's no need to add extra calls if you user action consists
    /// solely of a single call to one of those functions.
    extern fn gtk_text_buffer_begin_user_action(p_buffer: *TextBuffer) void;
    pub const beginUserAction = gtk_text_buffer_begin_user_action;

    /// Copies the currently-selected text to a clipboard.
    extern fn gtk_text_buffer_copy_clipboard(p_buffer: *TextBuffer, p_clipboard: *gdk.Clipboard) void;
    pub const copyClipboard = gtk_text_buffer_copy_clipboard;

    /// Creates and inserts a child anchor.
    ///
    /// This is a convenience function which simply creates a child anchor
    /// with `gtk.TextChildAnchor.new` and inserts it into the buffer
    /// with `gtk.TextBuffer.insertChildAnchor`.
    ///
    /// The new anchor is owned by the buffer; no reference count is
    /// returned to the caller of this function.
    extern fn gtk_text_buffer_create_child_anchor(p_buffer: *TextBuffer, p_iter: *gtk.TextIter) *gtk.TextChildAnchor;
    pub const createChildAnchor = gtk_text_buffer_create_child_anchor;

    /// Creates a mark at position `where`.
    ///
    /// If `mark_name` is `NULL`, the mark is anonymous; otherwise, the mark
    /// can be retrieved by name using `gtk.TextBuffer.getMark`.
    /// If a mark has left gravity, and text is inserted at the mark’s
    /// current location, the mark will be moved to the left of the
    /// newly-inserted text. If the mark has right gravity
    /// (`left_gravity` = `FALSE`), the mark will end up on the right of
    /// newly-inserted text. The standard left-to-right cursor is a mark
    /// with right gravity (when you type, the cursor stays on the right
    /// side of the text you’re typing).
    ///
    /// The caller of this function does not own a
    /// reference to the returned `GtkTextMark`, so you can ignore the
    /// return value if you like. Marks are owned by the buffer and go
    /// away when the buffer does.
    ///
    /// Emits the `gtk.TextBuffer.signals.mark_set` signal as notification
    /// of the mark's initial placement.
    extern fn gtk_text_buffer_create_mark(p_buffer: *TextBuffer, p_mark_name: ?[*:0]const u8, p_where: *const gtk.TextIter, p_left_gravity: c_int) *gtk.TextMark;
    pub const createMark = gtk_text_buffer_create_mark;

    /// Creates a tag and adds it to the tag table for `buffer`.
    ///
    /// Equivalent to calling `gtk.TextTag.new` and then adding the
    /// tag to the buffer’s tag table. The returned tag is owned by
    /// the buffer’s tag table, so the ref count will be equal to one.
    ///
    /// If `tag_name` is `NULL`, the tag is anonymous.
    ///
    /// If `tag_name` is non-`NULL`, a tag called `tag_name` must not already
    /// exist in the tag table for this buffer.
    ///
    /// The `first_property_name` argument and subsequent arguments are a list
    /// of properties to set on the tag, as with `gobject.Object.set`.
    extern fn gtk_text_buffer_create_tag(p_buffer: *TextBuffer, p_tag_name: ?[*:0]const u8, p_first_property_name: ?[*:0]const u8, ...) *gtk.TextTag;
    pub const createTag = gtk_text_buffer_create_tag;

    /// Copies the currently-selected text to a clipboard,
    /// then deletes said text if it’s editable.
    extern fn gtk_text_buffer_cut_clipboard(p_buffer: *TextBuffer, p_clipboard: *gdk.Clipboard, p_default_editable: c_int) void;
    pub const cutClipboard = gtk_text_buffer_cut_clipboard;

    /// Deletes text between `start` and `end`.
    ///
    /// The order of `start` and `end` is not actually relevant;
    /// `gtk.TextBuffer.delete` will reorder them.
    ///
    /// This function actually emits the “delete-range” signal, and
    /// the default handler of that signal deletes the text. Because the
    /// buffer is modified, all outstanding iterators become invalid after
    /// calling this function; however, the `start` and `end` will be
    /// re-initialized to point to the location where text was deleted.
    extern fn gtk_text_buffer_delete(p_buffer: *TextBuffer, p_start: *gtk.TextIter, p_end: *gtk.TextIter) void;
    pub const delete = gtk_text_buffer_delete;

    /// Deletes all editable text in the given range.
    ///
    /// Calls `gtk.TextBuffer.delete` for each editable
    /// sub-range of [`start`,`end`). `start` and `end` are revalidated
    /// to point to the location of the last deleted range, or left
    /// untouched if no text was deleted.
    extern fn gtk_text_buffer_delete_interactive(p_buffer: *TextBuffer, p_start_iter: *gtk.TextIter, p_end_iter: *gtk.TextIter, p_default_editable: c_int) c_int;
    pub const deleteInteractive = gtk_text_buffer_delete_interactive;

    /// Deletes `mark`, so that it’s no longer located anywhere in the
    /// buffer.
    ///
    /// Removes the reference the buffer holds to the mark, so if
    /// you haven’t called `gobject.Object.ref` on the mark, it will be freed.
    /// Even if the mark isn’t freed, most operations on `mark` become
    /// invalid, until it gets added to a buffer again with
    /// `gtk.TextBuffer.addMark`. Use `gtk.TextMark.getDeleted`
    /// to find out if a mark has been removed from its buffer.
    ///
    /// The `gtk.TextBuffer.signals.mark_deleted` signal will be emitted as
    /// notification after the mark is deleted.
    extern fn gtk_text_buffer_delete_mark(p_buffer: *TextBuffer, p_mark: *gtk.TextMark) void;
    pub const deleteMark = gtk_text_buffer_delete_mark;

    /// Deletes the mark named `name`; the mark must exist.
    ///
    /// See `gtk.TextBuffer.deleteMark` for details.
    extern fn gtk_text_buffer_delete_mark_by_name(p_buffer: *TextBuffer, p_name: [*:0]const u8) void;
    pub const deleteMarkByName = gtk_text_buffer_delete_mark_by_name;

    /// Deletes the range between the “insert” and “selection_bound” marks,
    /// that is, the currently-selected text.
    ///
    /// If `interactive` is `TRUE`, the editability of the selection will be
    /// considered (users can’t delete uneditable text).
    extern fn gtk_text_buffer_delete_selection(p_buffer: *TextBuffer, p_interactive: c_int, p_default_editable: c_int) c_int;
    pub const deleteSelection = gtk_text_buffer_delete_selection;

    /// Denotes the end of an action that may not be undone.
    ///
    /// This will cause any previous operations in the undo/redo
    /// queue to be cleared.
    ///
    /// This should be called after completing modifications to the
    /// text buffer after `gtk.TextBuffer.beginIrreversibleAction`
    /// was called.
    ///
    /// You may nest calls to `gtk.TextBuffer.beginIrreversibleAction`
    /// and `gtk.TextBuffer.endIrreversibleAction` pairs.
    extern fn gtk_text_buffer_end_irreversible_action(p_buffer: *TextBuffer) void;
    pub const endIrreversibleAction = gtk_text_buffer_end_irreversible_action;

    /// Ends a user-visible operation.
    ///
    /// Should be paired with a call to
    /// `gtk.TextBuffer.beginUserAction`.
    /// See that function for a full explanation.
    extern fn gtk_text_buffer_end_user_action(p_buffer: *TextBuffer) void;
    pub const endUserAction = gtk_text_buffer_end_user_action;

    /// Retrieves the first and last iterators in the buffer, i.e. the
    /// entire buffer lies within the range [`start`,`end`).
    extern fn gtk_text_buffer_get_bounds(p_buffer: *TextBuffer, p_start: *gtk.TextIter, p_end: *gtk.TextIter) void;
    pub const getBounds = gtk_text_buffer_get_bounds;

    /// Gets whether there is a redoable action in the history.
    extern fn gtk_text_buffer_get_can_redo(p_buffer: *TextBuffer) c_int;
    pub const getCanRedo = gtk_text_buffer_get_can_redo;

    /// Gets whether there is an undoable action in the history.
    extern fn gtk_text_buffer_get_can_undo(p_buffer: *TextBuffer) c_int;
    pub const getCanUndo = gtk_text_buffer_get_can_undo;

    /// Gets the number of characters in the buffer.
    ///
    /// Note that characters and bytes are not the same, you can’t e.g.
    /// expect the contents of the buffer in string form to be this
    /// many bytes long.
    ///
    /// The character count is cached, so this function is very fast.
    extern fn gtk_text_buffer_get_char_count(p_buffer: *TextBuffer) c_int;
    pub const getCharCount = gtk_text_buffer_get_char_count;

    /// Gets whether the buffer is saving modifications to the buffer
    /// to allow for undo and redo actions.
    ///
    /// See `gtk.TextBuffer.beginIrreversibleAction` and
    /// `gtk.TextBuffer.endIrreversibleAction` to create
    /// changes to the buffer that cannot be undone.
    extern fn gtk_text_buffer_get_enable_undo(p_buffer: *TextBuffer) c_int;
    pub const getEnableUndo = gtk_text_buffer_get_enable_undo;

    /// Initializes `iter` with the “end iterator,” one past the last valid
    /// character in the text buffer.
    ///
    /// If dereferenced with `gtk.TextIter.getChar`, the end
    /// iterator has a character value of 0.
    /// The entire buffer lies in the range from the first position in
    /// the buffer (call `gtk.TextBuffer.getStartIter` to get
    /// character position 0) to the end iterator.
    extern fn gtk_text_buffer_get_end_iter(p_buffer: *TextBuffer, p_iter: *gtk.TextIter) void;
    pub const getEndIter = gtk_text_buffer_get_end_iter;

    /// Indicates whether the buffer has some text currently selected.
    extern fn gtk_text_buffer_get_has_selection(p_buffer: *TextBuffer) c_int;
    pub const getHasSelection = gtk_text_buffer_get_has_selection;

    /// Returns the mark that represents the cursor (insertion point).
    ///
    /// Equivalent to calling `gtk.TextBuffer.getMark`
    /// to get the mark named “insert”, but very slightly more
    /// efficient, and involves less typing.
    extern fn gtk_text_buffer_get_insert(p_buffer: *TextBuffer) *gtk.TextMark;
    pub const getInsert = gtk_text_buffer_get_insert;

    /// Obtains the location of `anchor` within `buffer`.
    extern fn gtk_text_buffer_get_iter_at_child_anchor(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_anchor: *gtk.TextChildAnchor) void;
    pub const getIterAtChildAnchor = gtk_text_buffer_get_iter_at_child_anchor;

    /// Initializes `iter` to the start of the given line.
    ///
    /// If `line_number` is greater than or equal to the number of lines
    /// in the `buffer`, the end iterator is returned.
    extern fn gtk_text_buffer_get_iter_at_line(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_line_number: c_int) c_int;
    pub const getIterAtLine = gtk_text_buffer_get_iter_at_line;

    /// Obtains an iterator pointing to `byte_index` within the given line.
    ///
    /// `byte_index` must be the start of a UTF-8 character. Note bytes, not
    /// characters; UTF-8 may encode one character as multiple bytes.
    ///
    /// If `line_number` is greater than or equal to the number of lines in the `buffer`,
    /// the end iterator is returned. And if `byte_index` is off the
    /// end of the line, the iterator at the end of the line is returned.
    extern fn gtk_text_buffer_get_iter_at_line_index(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_line_number: c_int, p_byte_index: c_int) c_int;
    pub const getIterAtLineIndex = gtk_text_buffer_get_iter_at_line_index;

    /// Obtains an iterator pointing to `char_offset` within the given line.
    ///
    /// Note characters, not bytes; UTF-8 may encode one character as multiple
    /// bytes.
    ///
    /// If `line_number` is greater than or equal to the number of lines in the `buffer`,
    /// the end iterator is returned. And if `char_offset` is off the
    /// end of the line, the iterator at the end of the line is returned.
    extern fn gtk_text_buffer_get_iter_at_line_offset(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_line_number: c_int, p_char_offset: c_int) c_int;
    pub const getIterAtLineOffset = gtk_text_buffer_get_iter_at_line_offset;

    /// Initializes `iter` with the current position of `mark`.
    extern fn gtk_text_buffer_get_iter_at_mark(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_mark: *gtk.TextMark) void;
    pub const getIterAtMark = gtk_text_buffer_get_iter_at_mark;

    /// Initializes `iter` to a position `char_offset` chars from the start
    /// of the entire buffer.
    ///
    /// If `char_offset` is -1 or greater than the number
    /// of characters in the buffer, `iter` is initialized to the end iterator,
    /// the iterator one past the last valid character in the buffer.
    extern fn gtk_text_buffer_get_iter_at_offset(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_char_offset: c_int) void;
    pub const getIterAtOffset = gtk_text_buffer_get_iter_at_offset;

    /// Obtains the number of lines in the buffer.
    ///
    /// This value is cached, so the function is very fast.
    extern fn gtk_text_buffer_get_line_count(p_buffer: *TextBuffer) c_int;
    pub const getLineCount = gtk_text_buffer_get_line_count;

    /// Returns the mark named `name` in buffer `buffer`, or `NULL` if no such
    /// mark exists in the buffer.
    extern fn gtk_text_buffer_get_mark(p_buffer: *TextBuffer, p_name: [*:0]const u8) ?*gtk.TextMark;
    pub const getMark = gtk_text_buffer_get_mark;

    /// Gets the maximum number of undo levels to perform.
    ///
    /// If 0, unlimited undo actions may be performed. Note that this may
    /// have a memory usage impact as it requires storing an additional
    /// copy of the inserted or removed text within the text buffer.
    extern fn gtk_text_buffer_get_max_undo_levels(p_buffer: *TextBuffer) c_uint;
    pub const getMaxUndoLevels = gtk_text_buffer_get_max_undo_levels;

    /// Indicates whether the buffer has been modified since the last call
    /// to `gtk.TextBuffer.setModified` set the modification flag to
    /// `FALSE`.
    ///
    /// Used for example to enable a “save” function in a text editor.
    extern fn gtk_text_buffer_get_modified(p_buffer: *TextBuffer) c_int;
    pub const getModified = gtk_text_buffer_get_modified;

    /// Returns the mark that represents the selection bound.
    ///
    /// Equivalent to calling `gtk.TextBuffer.getMark`
    /// to get the mark named “selection_bound”, but very slightly
    /// more efficient, and involves less typing.
    ///
    /// The currently-selected text in `buffer` is the region between the
    /// “selection_bound” and “insert” marks. If “selection_bound” and
    /// “insert” are in the same place, then there is no current selection.
    /// `gtk.TextBuffer.getSelectionBounds` is another convenient
    /// function for handling the selection, if you just want to know whether
    /// there’s a selection and what its bounds are.
    extern fn gtk_text_buffer_get_selection_bound(p_buffer: *TextBuffer) *gtk.TextMark;
    pub const getSelectionBound = gtk_text_buffer_get_selection_bound;

    /// Returns `TRUE` if some text is selected; places the bounds
    /// of the selection in `start` and `end`.
    ///
    /// If the selection has length 0, then `start` and `end` are filled
    /// in with the same value. `start` and `end` will be in ascending order.
    /// If `start` and `end` are `NULL`, then they are not filled in, but the
    /// return value still indicates whether text is selected.
    extern fn gtk_text_buffer_get_selection_bounds(p_buffer: *TextBuffer, p_start: *gtk.TextIter, p_end: *gtk.TextIter) c_int;
    pub const getSelectionBounds = gtk_text_buffer_get_selection_bounds;

    /// Get a content provider for this buffer.
    ///
    /// It can be used to make the content of `buffer` available
    /// in a `GdkClipboard`, see `gdk.Clipboard.setContent`.
    extern fn gtk_text_buffer_get_selection_content(p_buffer: *TextBuffer) *gdk.ContentProvider;
    pub const getSelectionContent = gtk_text_buffer_get_selection_content;

    /// Returns the text in the range [`start`,`end`).
    ///
    /// Excludes undisplayed text (text marked with tags that set the
    /// invisibility attribute) if `include_hidden_chars` is `FALSE`.
    /// The returned string includes a 0xFFFC character whenever the
    /// buffer contains embedded images, so byte and character indexes
    /// into the returned string do correspond to byte and character
    /// indexes into the buffer. Contrast with `gtk.TextBuffer.getText`.
    /// Note that 0xFFFC can occur in normal text as well, so it is not a
    /// reliable indicator that a paintable or widget is in the buffer.
    extern fn gtk_text_buffer_get_slice(p_buffer: *TextBuffer, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter, p_include_hidden_chars: c_int) [*:0]u8;
    pub const getSlice = gtk_text_buffer_get_slice;

    /// Initialized `iter` with the first position in the text buffer.
    ///
    /// This is the same as using `gtk.TextBuffer.getIterAtOffset`
    /// to get the iter at character offset 0.
    extern fn gtk_text_buffer_get_start_iter(p_buffer: *TextBuffer, p_iter: *gtk.TextIter) void;
    pub const getStartIter = gtk_text_buffer_get_start_iter;

    /// Get the `GtkTextTagTable` associated with this buffer.
    extern fn gtk_text_buffer_get_tag_table(p_buffer: *TextBuffer) *gtk.TextTagTable;
    pub const getTagTable = gtk_text_buffer_get_tag_table;

    /// Returns the text in the range [`start`,`end`).
    ///
    /// Excludes undisplayed text (text marked with tags that set the
    /// invisibility attribute) if `include_hidden_chars` is `FALSE`.
    /// Does not include characters representing embedded images, so
    /// byte and character indexes into the returned string do not
    /// correspond to byte and character indexes into the buffer.
    /// Contrast with `gtk.TextBuffer.getSlice`.
    extern fn gtk_text_buffer_get_text(p_buffer: *TextBuffer, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter, p_include_hidden_chars: c_int) [*:0]u8;
    pub const getText = gtk_text_buffer_get_text;

    /// Inserts `len` bytes of `text` at position `iter`.
    ///
    /// If `len` is -1, `text` must be nul-terminated and will be inserted in its
    /// entirety. Emits the “insert-text” signal; insertion actually occurs
    /// in the default handler for the signal. `iter` is invalidated when
    /// insertion occurs (because the buffer contents change), but the
    /// default signal handler revalidates it to point to the end of the
    /// inserted text.
    extern fn gtk_text_buffer_insert(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_text: [*:0]const u8, p_len: c_int) void;
    pub const insert = gtk_text_buffer_insert;

    /// Inserts `text` in `buffer`.
    ///
    /// Simply calls `gtk.TextBuffer.insert`,
    /// using the current cursor position as the insertion point.
    extern fn gtk_text_buffer_insert_at_cursor(p_buffer: *TextBuffer, p_text: [*:0]const u8, p_len: c_int) void;
    pub const insertAtCursor = gtk_text_buffer_insert_at_cursor;

    /// Inserts a child widget anchor into the text buffer at `iter`.
    ///
    /// The anchor will be counted as one character in character counts, and
    /// when obtaining the buffer contents as a string, will be represented
    /// by the Unicode “object replacement character” 0xFFFC. Note that the
    /// “slice” variants for obtaining portions of the buffer as a string
    /// include this character for child anchors, but the “text” variants do
    /// not. E.g. see `gtk.TextBuffer.getSlice` and
    /// `gtk.TextBuffer.getText`.
    ///
    /// Consider `gtk.TextBuffer.createChildAnchor` as a more
    /// convenient alternative to this function. The buffer will add a
    /// reference to the anchor, so you can unref it after insertion.
    extern fn gtk_text_buffer_insert_child_anchor(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_anchor: *gtk.TextChildAnchor) void;
    pub const insertChildAnchor = gtk_text_buffer_insert_child_anchor;

    /// Inserts `text` in `buffer`.
    ///
    /// Like `gtk.TextBuffer.insert`, but the insertion will not occur
    /// if `iter` is at a non-editable location in the buffer. Usually you
    /// want to prevent insertions at ineditable locations if the insertion
    /// results from a user action (is interactive).
    ///
    /// `default_editable` indicates the editability of text that doesn't
    /// have a tag affecting editability applied to it. Typically the
    /// result of `gtk.TextView.getEditable` is appropriate here.
    extern fn gtk_text_buffer_insert_interactive(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_text: [*:0]const u8, p_len: c_int, p_default_editable: c_int) c_int;
    pub const insertInteractive = gtk_text_buffer_insert_interactive;

    /// Inserts `text` in `buffer`.
    ///
    /// Calls `gtk.TextBuffer.insertInteractive`
    /// at the cursor position.
    ///
    /// `default_editable` indicates the editability of text that doesn't
    /// have a tag affecting editability applied to it. Typically the
    /// result of `gtk.TextView.getEditable` is appropriate here.
    extern fn gtk_text_buffer_insert_interactive_at_cursor(p_buffer: *TextBuffer, p_text: [*:0]const u8, p_len: c_int, p_default_editable: c_int) c_int;
    pub const insertInteractiveAtCursor = gtk_text_buffer_insert_interactive_at_cursor;

    /// Inserts the text in `markup` at position `iter`.
    ///
    /// `markup` will be inserted in its entirety and must be nul-terminated
    /// and valid UTF-8. Emits the `gtk.TextBuffer.signals.insert_text` signal,
    /// possibly multiple times; insertion actually occurs in the default handler
    /// for the signal. `iter` will point to the end of the inserted text on return.
    extern fn gtk_text_buffer_insert_markup(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_markup: [*:0]const u8, p_len: c_int) void;
    pub const insertMarkup = gtk_text_buffer_insert_markup;

    /// Inserts an image into the text buffer at `iter`.
    ///
    /// The image will be counted as one character in character counts,
    /// and when obtaining the buffer contents as a string, will be
    /// represented by the Unicode “object replacement character” 0xFFFC.
    /// Note that the “slice” variants for obtaining portions of the buffer
    /// as a string include this character for paintable, but the “text”
    /// variants do not. e.g. see `gtk.TextBuffer.getSlice` and
    /// `gtk.TextBuffer.getText`.
    extern fn gtk_text_buffer_insert_paintable(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_paintable: *gdk.Paintable) void;
    pub const insertPaintable = gtk_text_buffer_insert_paintable;

    /// Copies text, tags, and paintables between `start` and `end`
    /// and inserts the copy at `iter`.
    ///
    /// The order of `start` and `end` doesn’t matter.
    ///
    /// Used instead of simply getting/inserting text because it preserves
    /// images and tags. If `start` and `end` are in a different buffer from
    /// `buffer`, the two buffers must share the same tag table.
    ///
    /// Implemented via emissions of the ::insert-text and ::apply-tag signals,
    /// so expect those.
    extern fn gtk_text_buffer_insert_range(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void;
    pub const insertRange = gtk_text_buffer_insert_range;

    /// Copies text, tags, and paintables between `start` and `end`
    /// and inserts the copy at `iter`.
    ///
    /// Same as `gtk.TextBuffer.insertRange`, but does nothing
    /// if the insertion point isn’t editable. The `default_editable`
    /// parameter indicates whether the text is editable at `iter` if
    /// no tags enclosing `iter` affect editability. Typically the result
    /// of `gtk.TextView.getEditable` is appropriate here.
    extern fn gtk_text_buffer_insert_range_interactive(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter, p_default_editable: c_int) c_int;
    pub const insertRangeInteractive = gtk_text_buffer_insert_range_interactive;

    /// Inserts `text` into `buffer` at `iter`, applying the list of tags to
    /// the newly-inserted text.
    ///
    /// The last tag specified must be `NULL` to terminate the list.
    /// Equivalent to calling `gtk.TextBuffer.insert`,
    /// then `gtk.TextBuffer.applyTag` on the inserted text;
    /// this is just a convenience function.
    extern fn gtk_text_buffer_insert_with_tags(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_text: [*:0]const u8, p_len: c_int, p_first_tag: *gtk.TextTag, ...) void;
    pub const insertWithTags = gtk_text_buffer_insert_with_tags;

    /// Inserts `text` into `buffer` at `iter`, applying the list of tags to
    /// the newly-inserted text.
    ///
    /// Same as `gtk.TextBuffer.insertWithTags`, but allows you
    /// to pass in tag names instead of tag objects.
    extern fn gtk_text_buffer_insert_with_tags_by_name(p_buffer: *TextBuffer, p_iter: *gtk.TextIter, p_text: [*:0]const u8, p_len: c_int, p_first_tag_name: [*:0]const u8, ...) void;
    pub const insertWithTagsByName = gtk_text_buffer_insert_with_tags_by_name;

    /// Moves `mark` to the new location `where`.
    ///
    /// Emits the `gtk.TextBuffer.signals.mark_set` signal
    /// as notification of the move.
    extern fn gtk_text_buffer_move_mark(p_buffer: *TextBuffer, p_mark: *gtk.TextMark, p_where: *const gtk.TextIter) void;
    pub const moveMark = gtk_text_buffer_move_mark;

    /// Moves the mark named `name` (which must exist) to location `where`.
    ///
    /// See `gtk.TextBuffer.moveMark` for details.
    extern fn gtk_text_buffer_move_mark_by_name(p_buffer: *TextBuffer, p_name: [*:0]const u8, p_where: *const gtk.TextIter) void;
    pub const moveMarkByName = gtk_text_buffer_move_mark_by_name;

    /// Pastes the contents of a clipboard.
    ///
    /// If `override_location` is `NULL`, the pasted text will be inserted
    /// at the cursor position, or the buffer selection will be replaced
    /// if the selection is non-empty.
    ///
    /// Note: pasting is asynchronous, that is, we’ll ask for the paste data
    /// and return, and at some point later after the main loop runs, the paste
    /// data will be inserted.
    extern fn gtk_text_buffer_paste_clipboard(p_buffer: *TextBuffer, p_clipboard: *gdk.Clipboard, p_override_location: ?*gtk.TextIter, p_default_editable: c_int) void;
    pub const pasteClipboard = gtk_text_buffer_paste_clipboard;

    /// This function moves the “insert” and “selection_bound” marks
    /// simultaneously.
    ///
    /// If you move them to the same place in two steps with
    /// `gtk.TextBuffer.moveMark`, you will temporarily select a
    /// region in between their old and new locations, which can be pretty
    /// inefficient since the temporarily-selected region will force stuff
    /// to be recalculated. This function moves them as a unit, which can
    /// be optimized.
    extern fn gtk_text_buffer_place_cursor(p_buffer: *TextBuffer, p_where: *const gtk.TextIter) void;
    pub const placeCursor = gtk_text_buffer_place_cursor;

    /// Redoes the next redoable action on the buffer, if there is one.
    extern fn gtk_text_buffer_redo(p_buffer: *TextBuffer) void;
    pub const redo = gtk_text_buffer_redo;

    /// Removes all tags in the range between `start` and `end`.
    ///
    /// Be careful with this function; it could remove tags added in code
    /// unrelated to the code you’re currently writing. That is, using this
    /// function is probably a bad idea if you have two or more unrelated
    /// code sections that add tags.
    extern fn gtk_text_buffer_remove_all_tags(p_buffer: *TextBuffer, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void;
    pub const removeAllTags = gtk_text_buffer_remove_all_tags;

    /// Removes the `GtkTextBufferCommitNotify` handler previously registered
    /// with `gtk.TextBuffer.addCommitNotify`.
    ///
    /// This may result in the `user_data_destroy` being called that was passed when registering
    /// the commit notify functions.
    extern fn gtk_text_buffer_remove_commit_notify(p_buffer: *TextBuffer, p_commit_notify_handler: c_uint) void;
    pub const removeCommitNotify = gtk_text_buffer_remove_commit_notify;

    /// Removes a `GdkClipboard` added with
    /// `gtk.TextBuffer.addSelectionClipboard`
    extern fn gtk_text_buffer_remove_selection_clipboard(p_buffer: *TextBuffer, p_clipboard: *gdk.Clipboard) void;
    pub const removeSelectionClipboard = gtk_text_buffer_remove_selection_clipboard;

    /// Emits the “remove-tag” signal.
    ///
    /// The default handler for the signal removes all occurrences
    /// of `tag` from the given range. `start` and `end` don’t have
    /// to be in order.
    extern fn gtk_text_buffer_remove_tag(p_buffer: *TextBuffer, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void;
    pub const removeTag = gtk_text_buffer_remove_tag;

    /// Emits the “remove-tag” signal.
    ///
    /// Calls `gtk.TextTagTable.lookup` on the buffer’s
    /// tag table to get a `GtkTextTag`, then calls
    /// `gtk.TextBuffer.removeTag`.
    extern fn gtk_text_buffer_remove_tag_by_name(p_buffer: *TextBuffer, p_name: [*:0]const u8, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) void;
    pub const removeTagByName = gtk_text_buffer_remove_tag_by_name;

    /// This function moves the “insert” and “selection_bound” marks
    /// simultaneously.
    ///
    /// If you move them in two steps with
    /// `gtk.TextBuffer.moveMark`, you will temporarily select a
    /// region in between their old and new locations, which can be pretty
    /// inefficient since the temporarily-selected region will force stuff
    /// to be recalculated. This function moves them as a unit, which can
    /// be optimized.
    extern fn gtk_text_buffer_select_range(p_buffer: *TextBuffer, p_ins: *const gtk.TextIter, p_bound: *const gtk.TextIter) void;
    pub const selectRange = gtk_text_buffer_select_range;

    /// Sets whether or not to enable undoable actions in the text buffer.
    ///
    /// Undoable actions in this context are changes to the text content of
    /// the buffer. Changes to tags and marks are not tracked.
    ///
    /// If enabled, the user will be able to undo the last number of actions
    /// up to `gtk.TextBuffer.getMaxUndoLevels`.
    ///
    /// See `gtk.TextBuffer.beginIrreversibleAction` and
    /// `gtk.TextBuffer.endIrreversibleAction` to create
    /// changes to the buffer that cannot be undone.
    extern fn gtk_text_buffer_set_enable_undo(p_buffer: *TextBuffer, p_enable_undo: c_int) void;
    pub const setEnableUndo = gtk_text_buffer_set_enable_undo;

    /// Sets the maximum number of undo levels to perform.
    ///
    /// If 0, unlimited undo actions may be performed. Note that this may
    /// have a memory usage impact as it requires storing an additional
    /// copy of the inserted or removed text within the text buffer.
    extern fn gtk_text_buffer_set_max_undo_levels(p_buffer: *TextBuffer, p_max_undo_levels: c_uint) void;
    pub const setMaxUndoLevels = gtk_text_buffer_set_max_undo_levels;

    /// Used to keep track of whether the buffer has been
    /// modified since the last time it was saved.
    ///
    /// Whenever the buffer is saved to disk, call
    /// `gtk_text_buffer_set_modified (`buffer`, FALSE)`.
    /// When the buffer is modified, it will automatically
    /// toggle on the modified bit again. When the modified
    /// bit flips, the buffer emits the
    /// `gtk.TextBuffer.signals.modified_changed` signal.
    extern fn gtk_text_buffer_set_modified(p_buffer: *TextBuffer, p_setting: c_int) void;
    pub const setModified = gtk_text_buffer_set_modified;

    /// Deletes current contents of `buffer`, and inserts `text` instead. This is
    /// automatically marked as an irreversible action in the undo stack. If you
    /// wish to mark this action as part of a larger undo operation, call
    /// `TextBuffer.delete` and `TextBuffer.insert` directly instead.
    ///
    /// If `len` is -1, `text` must be nul-terminated.
    /// `text` must be valid UTF-8.
    extern fn gtk_text_buffer_set_text(p_buffer: *TextBuffer, p_text: [*:0]const u8, p_len: c_int) void;
    pub const setText = gtk_text_buffer_set_text;

    /// Undoes the last undoable action on the buffer, if there is one.
    extern fn gtk_text_buffer_undo(p_buffer: *TextBuffer) void;
    pub const undo = gtk_text_buffer_undo;

    extern fn gtk_text_buffer_get_type() usize;
    pub const getGObjectType = gtk_text_buffer_get_type;

    extern fn g_object_ref(p_self: *gtk.TextBuffer) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TextBuffer) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TextBuffer, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Marks a spot in a `GtkTextBuffer` where child widgets can be “anchored”.
///
/// The anchor can have multiple widgets anchored, to allow for multiple views.
pub const TextChildAnchor = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.TextChildAnchorClass;
    f_parent_instance: gobject.Object,
    f_segment: ?*anyopaque,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkTextChildAnchor`.
    ///
    /// Usually you would then insert it into a `GtkTextBuffer` with
    /// `gtk.TextBuffer.insertChildAnchor`. To perform the
    /// creation and insertion in one step, use the convenience
    /// function `gtk.TextBuffer.createChildAnchor`.
    extern fn gtk_text_child_anchor_new() *gtk.TextChildAnchor;
    pub const new = gtk_text_child_anchor_new;

    /// Creates a new `GtkTextChildAnchor` with the given replacement character.
    ///
    /// Usually you would then insert it into a `GtkTextBuffer` with
    /// `gtk.TextBuffer.insertChildAnchor`.
    extern fn gtk_text_child_anchor_new_with_replacement(p_character: [*:0]const u8) *gtk.TextChildAnchor;
    pub const newWithReplacement = gtk_text_child_anchor_new_with_replacement;

    /// Determines whether a child anchor has been deleted from
    /// the buffer.
    ///
    /// Keep in mind that the child anchor will be unreferenced
    /// when removed from the buffer, so you need to hold your own
    /// reference (with `gobject.Object.ref`) if you plan to use this
    /// function — otherwise all deleted child anchors will also
    /// be finalized.
    extern fn gtk_text_child_anchor_get_deleted(p_anchor: *TextChildAnchor) c_int;
    pub const getDeleted = gtk_text_child_anchor_get_deleted;

    /// Gets a list of all widgets anchored at this child anchor.
    ///
    /// The order in which the widgets are returned is not defined.
    extern fn gtk_text_child_anchor_get_widgets(p_anchor: *TextChildAnchor, p_out_len: *c_uint) [*]*gtk.Widget;
    pub const getWidgets = gtk_text_child_anchor_get_widgets;

    extern fn gtk_text_child_anchor_get_type() usize;
    pub const getGObjectType = gtk_text_child_anchor_get_type;

    extern fn g_object_ref(p_self: *gtk.TextChildAnchor) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TextChildAnchor) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TextChildAnchor, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Marks a position in a `GtkTextbuffer` that is preserved
/// across modifications.
///
/// You may wish to begin by reading the
/// [text widget conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types
/// related to the text widget and how they work together.
///
/// A `GtkTextMark` is like a bookmark in a text buffer; it preserves
/// a position in the text. You can convert the mark to an iterator using
/// `gtk.TextBuffer.getIterAtMark`. Unlike iterators, marks remain
/// valid across buffer mutations, because their behavior is defined when
/// text is inserted or deleted. When text containing a mark is deleted,
/// the mark remains in the position originally occupied by the deleted
/// text. When text is inserted at a mark, a mark with “left gravity” will
/// be moved to the beginning of the newly-inserted text, and a mark with
/// “right gravity” will be moved to the end.
///
/// Note that “left” and “right” here refer to logical direction (left
/// is the toward the start of the buffer); in some languages such as
/// Hebrew the logically-leftmost text is not actually on the left when
/// displayed.
///
/// Marks are reference counted, but the reference count only controls
/// the validity of the memory; marks can be deleted from the buffer at
/// any time with `gtk.TextBuffer.deleteMark`. Once deleted from
/// the buffer, a mark is essentially useless.
///
/// Marks optionally have names; these can be convenient to avoid passing
/// the `GtkTextMark` object around.
///
/// Marks are typically created using the `gtk.TextBuffer.createMark`
/// function.
pub const TextMark = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.TextMarkClass;
    f_parent_instance: gobject.Object,
    f_segment: ?*anyopaque,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the mark has left gravity.
        ///
        /// When text is inserted at the mark’s current location, if the mark
        /// has left gravity it will be moved to the left of the newly-inserted
        /// text, otherwise to the right.
        pub const left_gravity = struct {
            pub const name = "left-gravity";

            pub const Type = c_int;
        };

        /// The name of the mark or `NULL` if the mark is anonymous.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a text mark.
    ///
    /// Add it to a buffer using `gtk.TextBuffer.addMark`.
    /// If `name` is `NULL`, the mark is anonymous; otherwise, the mark can be
    /// retrieved by name using `gtk.TextBuffer.getMark`. If a mark
    /// has left gravity, and text is inserted at the mark’s current location,
    /// the mark will be moved to the left of the newly-inserted text. If the
    /// mark has right gravity (`left_gravity` = `FALSE`), the mark will end up
    /// on the right of newly-inserted text. The standard left-to-right cursor
    /// is a mark with right gravity (when you type, the cursor stays on the
    /// right side of the text you’re typing).
    extern fn gtk_text_mark_new(p_name: ?[*:0]const u8, p_left_gravity: c_int) *gtk.TextMark;
    pub const new = gtk_text_mark_new;

    /// Gets the buffer this mark is located inside.
    ///
    /// Returns `NULL` if the mark is deleted.
    extern fn gtk_text_mark_get_buffer(p_mark: *TextMark) ?*gtk.TextBuffer;
    pub const getBuffer = gtk_text_mark_get_buffer;

    /// Returns `TRUE` if the mark has been removed from its buffer.
    ///
    /// See `gtk.TextBuffer.addMark` for a way to add it
    /// to a buffer again.
    extern fn gtk_text_mark_get_deleted(p_mark: *TextMark) c_int;
    pub const getDeleted = gtk_text_mark_get_deleted;

    /// Determines whether the mark has left gravity.
    extern fn gtk_text_mark_get_left_gravity(p_mark: *TextMark) c_int;
    pub const getLeftGravity = gtk_text_mark_get_left_gravity;

    /// Returns the mark name.
    ///
    /// Returns `NULL` for anonymous marks.
    extern fn gtk_text_mark_get_name(p_mark: *TextMark) ?[*:0]const u8;
    pub const getName = gtk_text_mark_get_name;

    /// Returns `TRUE` if the mark is visible.
    ///
    /// A cursor is displayed for visible marks.
    extern fn gtk_text_mark_get_visible(p_mark: *TextMark) c_int;
    pub const getVisible = gtk_text_mark_get_visible;

    /// Sets the visibility of `mark`.
    ///
    /// The insertion point is normally visible, i.e. you can see it as
    /// a vertical bar. Also, the text widget uses a visible mark to
    /// indicate where a drop will occur when dragging-and-dropping text.
    /// Most other marks are not visible.
    ///
    /// Marks are not visible by default.
    extern fn gtk_text_mark_set_visible(p_mark: *TextMark, p_setting: c_int) void;
    pub const setVisible = gtk_text_mark_set_visible;

    extern fn gtk_text_mark_get_type() usize;
    pub const getGObjectType = gtk_text_mark_get_type;

    extern fn g_object_ref(p_self: *gtk.TextMark) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TextMark) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TextMark, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Can be applied to text contained in a `GtkTextBuffer`.
///
/// You may wish to begin by reading the
/// [text widget conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types
/// related to the text widget and how they work together.
///
/// Tags should be in the `gtk.TextTagTable` for a given
/// `GtkTextBuffer` before using them with that buffer.
///
/// `gtk.TextBuffer.createTag` is the best way to create tags.
/// See “gtk4-demo” for numerous examples.
///
/// For each property of `GtkTextTag`, there is a “set” property, e.g.
/// “font-set” corresponds to “font”. These “set” properties reflect
/// whether a property has been set or not.
///
/// They are maintained by GTK and you should not set them independently.
pub const TextTag = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.TextTagClass;
    f_parent_instance: gobject.Object,
    f_priv: ?*gtk.TextTagPrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether the margins accumulate or override each other.
        ///
        /// When set to `TRUE` the margins of this tag are added to the margins
        /// of any other non-accumulative margins present. When set to `FALSE`
        /// the margins override one another (the default).
        pub const accumulative_margin = struct {
            pub const name = "accumulative-margin";

            pub const Type = c_int;
        };

        /// Whether breaks are allowed.
        pub const allow_breaks = struct {
            pub const name = "allow-breaks";

            pub const Type = c_int;
        };

        /// Whether the `allow-breaks` property is set.
        pub const allow_breaks_set = struct {
            pub const name = "allow-breaks-set";

            pub const Type = c_int;
        };

        /// Background color as a string.
        pub const background = struct {
            pub const name = "background";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the background color fills the entire line height
        /// or only the height of the tagged characters.
        pub const background_full_height = struct {
            pub const name = "background-full-height";

            pub const Type = c_int;
        };

        /// Whether the `background-full-height` property is set.
        pub const background_full_height_set = struct {
            pub const name = "background-full-height-set";

            pub const Type = c_int;
        };

        /// Background color as a `GdkRGBA`.
        pub const background_rgba = struct {
            pub const name = "background-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// Whether the `background` property is set.
        pub const background_set = struct {
            pub const name = "background-set";

            pub const Type = c_int;
        };

        /// Text direction, e.g. right-to-left or left-to-right.
        pub const direction = struct {
            pub const name = "direction";

            pub const Type = gtk.TextDirection;
        };

        /// Whether the text can be modified by the user.
        pub const editable = struct {
            pub const name = "editable";

            pub const Type = c_int;
        };

        /// Whether the `editable` property is set.
        pub const editable_set = struct {
            pub const name = "editable-set";

            pub const Type = c_int;
        };

        /// Whether font fallback is enabled.
        ///
        /// When set to `TRUE`, other fonts will be substituted
        /// where the current font is missing glyphs.
        pub const fallback = struct {
            pub const name = "fallback";

            pub const Type = c_int;
        };

        /// Whether the `fallback` property is set.
        pub const fallback_set = struct {
            pub const name = "fallback-set";

            pub const Type = c_int;
        };

        /// Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
        pub const family = struct {
            pub const name = "family";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the `family` property is set.
        pub const family_set = struct {
            pub const name = "family-set";

            pub const Type = c_int;
        };

        /// Font description as string, e.g. \"Sans Italic 12\".
        ///
        /// Note that the initial value of this property depends on
        /// the internals of `PangoFontDescription`.
        pub const font = struct {
            pub const name = "font";

            pub const Type = ?[*:0]u8;
        };

        /// Font description as a `PangoFontDescription`.
        pub const font_desc = struct {
            pub const name = "font-desc";

            pub const Type = ?*pango.FontDescription;
        };

        /// OpenType font features, as a string.
        pub const font_features = struct {
            pub const name = "font-features";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the `font-features` property is set.
        pub const font_features_set = struct {
            pub const name = "font-features-set";

            pub const Type = c_int;
        };

        /// Foreground color as a string.
        pub const foreground = struct {
            pub const name = "foreground";

            pub const Type = ?[*:0]u8;
        };

        /// Foreground color as a `GdkRGBA`.
        pub const foreground_rgba = struct {
            pub const name = "foreground-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// Whether the `foreground` property is set.
        pub const foreground_set = struct {
            pub const name = "foreground-set";

            pub const Type = c_int;
        };

        /// Amount to indent the paragraph, in pixels.
        ///
        /// A negative value of indent will produce a hanging indentation.
        /// That is, the first line will have the full width, and subsequent
        /// lines will be indented by the absolute value of indent.
        pub const indent = struct {
            pub const name = "indent";

            pub const Type = c_int;
        };

        /// Whether the `indent` property is set.
        pub const indent_set = struct {
            pub const name = "indent-set";

            pub const Type = c_int;
        };

        /// Whether to insert hyphens at breaks.
        pub const insert_hyphens = struct {
            pub const name = "insert-hyphens";

            pub const Type = c_int;
        };

        /// Whether the `insert-hyphens` property is set.
        pub const insert_hyphens_set = struct {
            pub const name = "insert-hyphens-set";

            pub const Type = c_int;
        };

        /// Whether this text is hidden.
        ///
        /// Note that there may still be problems with the support for invisible
        /// text, in particular when navigating programmatically inside a buffer
        /// containing invisible segments.
        pub const invisible = struct {
            pub const name = "invisible";

            pub const Type = c_int;
        };

        /// Whether the `invisible` property is set.
        pub const invisible_set = struct {
            pub const name = "invisible-set";

            pub const Type = c_int;
        };

        /// Left, right, or center justification.
        pub const justification = struct {
            pub const name = "justification";

            pub const Type = gtk.Justification;
        };

        /// Whether the `justification` property is set.
        pub const justification_set = struct {
            pub const name = "justification-set";

            pub const Type = c_int;
        };

        /// The language this text is in, as an ISO code.
        ///
        /// Pango can use this as a hint when rendering the text.
        /// If not set, an appropriate default will be used.
        ///
        /// Note that the initial value of this property depends
        /// on the current locale, see also `gtk.getDefaultLanguage`.
        pub const language = struct {
            pub const name = "language";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the `language` property is set.
        pub const language_set = struct {
            pub const name = "language-set";

            pub const Type = c_int;
        };

        /// Width of the left margin in pixels.
        pub const left_margin = struct {
            pub const name = "left-margin";

            pub const Type = c_int;
        };

        /// Whether the `left-margin` property is set.
        pub const left_margin_set = struct {
            pub const name = "left-margin-set";

            pub const Type = c_int;
        };

        /// Extra spacing between graphemes, in Pango units.
        pub const letter_spacing = struct {
            pub const name = "letter-spacing";

            pub const Type = c_int;
        };

        /// Whether the `letter-spacing` property is set.
        pub const letter_spacing_set = struct {
            pub const name = "letter-spacing-set";

            pub const Type = c_int;
        };

        /// Factor to scale line height by.
        pub const line_height = struct {
            pub const name = "line-height";

            pub const Type = f32;
        };

        /// Whether the `line-height` property is set.
        pub const line_height_set = struct {
            pub const name = "line-height-set";

            pub const Type = c_int;
        };

        /// The name used to refer to the tag.
        ///
        /// `NULL` for anonymous tags.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// Style of overline for this text.
        pub const overline = struct {
            pub const name = "overline";

            pub const Type = pango.Overline;
        };

        /// This property modifies the color of overlines.
        ///
        /// If not set, overlines will use the foreground color.
        pub const overline_rgba = struct {
            pub const name = "overline-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// Whether the `overline-rgba` property is set.
        pub const overline_rgba_set = struct {
            pub const name = "overline-rgba-set";

            pub const Type = c_int;
        };

        /// Whether the `overline` property is set.
        pub const overline_set = struct {
            pub const name = "overline-set";

            pub const Type = c_int;
        };

        /// The paragraph background color as a string.
        pub const paragraph_background = struct {
            pub const name = "paragraph-background";

            pub const Type = ?[*:0]u8;
        };

        /// The paragraph background color as a `GdkRGBA`.
        pub const paragraph_background_rgba = struct {
            pub const name = "paragraph-background-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// Whether the `paragraph-background` property is set.
        pub const paragraph_background_set = struct {
            pub const name = "paragraph-background-set";

            pub const Type = c_int;
        };

        /// Pixels of blank space above paragraphs.
        pub const pixels_above_lines = struct {
            pub const name = "pixels-above-lines";

            pub const Type = c_int;
        };

        /// Whether the `pixels-above-lines` property is set.
        pub const pixels_above_lines_set = struct {
            pub const name = "pixels-above-lines-set";

            pub const Type = c_int;
        };

        /// Pixels of blank space below paragraphs.
        pub const pixels_below_lines = struct {
            pub const name = "pixels-below-lines";

            pub const Type = c_int;
        };

        /// Whether the `pixels-below-lines` property is set.
        pub const pixels_below_lines_set = struct {
            pub const name = "pixels-below-lines-set";

            pub const Type = c_int;
        };

        /// Pixels of blank space between wrapped lines in a paragraph.
        pub const pixels_inside_wrap = struct {
            pub const name = "pixels-inside-wrap";

            pub const Type = c_int;
        };

        /// Whether the `pixels-inside-wrap` property is set.
        pub const pixels_inside_wrap_set = struct {
            pub const name = "pixels-inside-wrap-set";

            pub const Type = c_int;
        };

        /// Width of the right margin, in pixels.
        pub const right_margin = struct {
            pub const name = "right-margin";

            pub const Type = c_int;
        };

        /// Whether the `right-margin` property is set.
        pub const right_margin_set = struct {
            pub const name = "right-margin-set";

            pub const Type = c_int;
        };

        /// Offset of text above the baseline, in Pango units.
        ///
        /// Negative values go below the baseline.
        pub const rise = struct {
            pub const name = "rise";

            pub const Type = c_int;
        };

        /// Whether the `rise` property is set.
        pub const rise_set = struct {
            pub const name = "rise-set";

            pub const Type = c_int;
        };

        /// Font size as a scale factor relative to the default font size.
        ///
        /// This properly adapts to theme changes, etc. so is recommended.
        /// Pango predefines some scales such as `PANGO_SCALE_X_LARGE`.
        pub const scale = struct {
            pub const name = "scale";

            pub const Type = f64;
        };

        /// Whether the `scale` property is set.
        pub const scale_set = struct {
            pub const name = "scale-set";

            pub const Type = c_int;
        };

        /// Whether this tag represents a single sentence.
        ///
        /// This affects cursor movement.
        pub const sentence = struct {
            pub const name = "sentence";

            pub const Type = c_int;
        };

        /// Whether the `sentence` property is set.
        pub const sentence_set = struct {
            pub const name = "sentence-set";

            pub const Type = c_int;
        };

        /// How to render invisible characters.
        pub const show_spaces = struct {
            pub const name = "show-spaces";

            pub const Type = pango.ShowFlags;
        };

        /// Whether the `show-spaces` property is set.
        pub const show_spaces_set = struct {
            pub const name = "show-spaces-set";

            pub const Type = c_int;
        };

        /// Font size in Pango units.
        pub const size = struct {
            pub const name = "size";

            pub const Type = c_int;
        };

        /// Font size in points.
        pub const size_points = struct {
            pub const name = "size-points";

            pub const Type = f64;
        };

        /// Whether the `size` property is set.
        pub const size_set = struct {
            pub const name = "size-set";

            pub const Type = c_int;
        };

        /// Font stretch as a `PangoStretch`, e.g. `PANGO_STRETCH_CONDENSED`.
        pub const stretch = struct {
            pub const name = "stretch";

            pub const Type = pango.Stretch;
        };

        /// Whether the `stretch` property is set.
        pub const stretch_set = struct {
            pub const name = "stretch-set";

            pub const Type = c_int;
        };

        /// Whether to strike through the text.
        pub const strikethrough = struct {
            pub const name = "strikethrough";

            pub const Type = c_int;
        };

        /// This property modifies the color of strikeouts.
        ///
        /// If not set, strikeouts will use the foreground color.
        pub const strikethrough_rgba = struct {
            pub const name = "strikethrough-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// If the `strikethrough-rgba` property has been set.
        pub const strikethrough_rgba_set = struct {
            pub const name = "strikethrough-rgba-set";

            pub const Type = c_int;
        };

        /// Whether the `strikethrough` property is set.
        pub const strikethrough_set = struct {
            pub const name = "strikethrough-set";

            pub const Type = c_int;
        };

        /// Font style as a `PangoStyle`, e.g. `PANGO_STYLE_ITALIC`.
        pub const style = struct {
            pub const name = "style";

            pub const Type = pango.Style;
        };

        /// Whether the `style` property is set.
        pub const style_set = struct {
            pub const name = "style-set";

            pub const Type = c_int;
        };

        /// Custom tabs for this text.
        pub const tabs = struct {
            pub const name = "tabs";

            pub const Type = ?*pango.TabArray;
        };

        /// Whether the `tabs` property is set.
        pub const tabs_set = struct {
            pub const name = "tabs-set";

            pub const Type = c_int;
        };

        /// How to transform the text for display.
        pub const text_transform = struct {
            pub const name = "text-transform";

            pub const Type = pango.TextTransform;
        };

        /// Whether the `text-transform` property is set.
        pub const text_transform_set = struct {
            pub const name = "text-transform-set";

            pub const Type = c_int;
        };

        /// Style of underline for this text.
        pub const underline = struct {
            pub const name = "underline";

            pub const Type = pango.Underline;
        };

        /// This property modifies the color of underlines.
        ///
        /// If not set, underlines will use the foreground color.
        ///
        /// If `gtk.TextTag.properties.underline` is set to `PANGO_UNDERLINE_ERROR`,
        /// an alternate color may be applied instead of the foreground. Setting
        /// this property will always override those defaults.
        pub const underline_rgba = struct {
            pub const name = "underline-rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// If the `underline-rgba` property has been set.
        pub const underline_rgba_set = struct {
            pub const name = "underline-rgba-set";

            pub const Type = c_int;
        };

        /// Whether the `underline` property is set.
        pub const underline_set = struct {
            pub const name = "underline-set";

            pub const Type = c_int;
        };

        /// Font variant as a `PangoVariant`, e.g. `PANGO_VARIANT_SMALL_CAPS`.
        pub const variant = struct {
            pub const name = "variant";

            pub const Type = pango.Variant;
        };

        /// Whether the `variant` property is set.
        pub const variant_set = struct {
            pub const name = "variant-set";

            pub const Type = c_int;
        };

        /// Font weight as an integer.
        pub const weight = struct {
            pub const name = "weight";

            pub const Type = c_int;
        };

        /// Whether the `weight` property is set.
        pub const weight_set = struct {
            pub const name = "weight-set";

            pub const Type = c_int;
        };

        /// Whether this tag represents a single word.
        ///
        /// This affects line breaks and cursor movement.
        pub const word = struct {
            pub const name = "word";

            pub const Type = c_int;
        };

        /// Whether the `word` property is set.
        pub const word_set = struct {
            pub const name = "word-set";

            pub const Type = c_int;
        };

        /// Whether to wrap lines never, at word boundaries, or
        /// at character boundaries.
        pub const wrap_mode = struct {
            pub const name = "wrap-mode";

            pub const Type = gtk.WrapMode;
        };

        /// Whether the `wrap-mode` property is set.
        pub const wrap_mode_set = struct {
            pub const name = "wrap-mode-set";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkTextTag`.
    extern fn gtk_text_tag_new(p_name: ?[*:0]const u8) *gtk.TextTag;
    pub const new = gtk_text_tag_new;

    /// Emits the `gtk.TextTagTable.signals.tag_changed` signal on the
    /// `GtkTextTagTable` where the tag is included.
    ///
    /// The signal is already emitted when setting a `GtkTextTag` property.
    /// This function is useful for a `GtkTextTag` subclass.
    extern fn gtk_text_tag_changed(p_tag: *TextTag, p_size_changed: c_int) void;
    pub const changed = gtk_text_tag_changed;

    /// Get the tag priority.
    extern fn gtk_text_tag_get_priority(p_tag: *TextTag) c_int;
    pub const getPriority = gtk_text_tag_get_priority;

    /// Sets the priority of a `GtkTextTag`.
    ///
    /// Valid priorities start at 0 and go to one less than
    /// `gtk.TextTagTable.getSize`. Each tag in a table
    /// has a unique priority; setting the priority of one tag shifts
    /// the priorities of all the other tags in the table to maintain
    /// a unique priority for each tag.
    ///
    /// Higher priority tags “win” if two tags both set the same text
    /// attribute. When adding a tag to a tag table, it will be assigned
    /// the highest priority in the table by default; so normally the
    /// precedence of a set of tags is the order in which they were added
    /// to the table, or created with `gtk.TextBuffer.createTag`,
    /// which adds the tag to the buffer’s table automatically.
    extern fn gtk_text_tag_set_priority(p_tag: *TextTag, p_priority: c_int) void;
    pub const setPriority = gtk_text_tag_set_priority;

    extern fn gtk_text_tag_get_type() usize;
    pub const getGObjectType = gtk_text_tag_get_type;

    extern fn g_object_ref(p_self: *gtk.TextTag) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TextTag) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TextTag, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Collects the tags in a `GtkTextBuffer`.
///
/// You may wish to begin by reading the
/// [text widget conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types
/// related to the text widget and how they work together.
///
/// # GtkTextTagTables as GtkBuildable
///
/// The `GtkTextTagTable` implementation of the `GtkBuildable` interface
/// supports adding tags by specifying “tag” as the “type” attribute
/// of a `<child>` element.
///
/// An example of a UI definition fragment specifying tags:
/// ```xml
/// <object class="GtkTextTagTable">
///  <child type="tag">
///    <object class="GtkTextTag"/>
///  </child>
/// </object>
/// ```
pub const TextTagTable = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gtk.Buildable};
    pub const Class = opaque {
        pub const Instance = TextTagTable;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted every time a new tag is added in the `GtkTextTagTable`.
        pub const tag_added = struct {
            pub const name = "tag-added";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_tag: *gtk.TextTag, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextTagTable, p_instance))),
                    gobject.signalLookup("tag-added", TextTagTable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted every time a tag in the `GtkTextTagTable` changes.
        pub const tag_changed = struct {
            pub const name = "tag-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_tag: *gtk.TextTag, p_size_changed: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextTagTable, p_instance))),
                    gobject.signalLookup("tag-changed", TextTagTable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted every time a tag is removed from the `GtkTextTagTable`.
        ///
        /// The `tag` is still valid by the time the signal is emitted, but
        /// it is not associated with a tag table any more.
        pub const tag_removed = struct {
            pub const name = "tag-removed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_tag: *gtk.TextTag, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextTagTable, p_instance))),
                    gobject.signalLookup("tag-removed", TextTagTable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkTextTagTable`.
    ///
    /// The table contains no tags by default.
    extern fn gtk_text_tag_table_new() *gtk.TextTagTable;
    pub const new = gtk_text_tag_table_new;

    /// Add a tag to the table.
    ///
    /// The tag is assigned the highest priority in the table.
    ///
    /// `tag` must not be in a tag table already, and may not have
    /// the same name as an already-added tag.
    extern fn gtk_text_tag_table_add(p_table: *TextTagTable, p_tag: *gtk.TextTag) c_int;
    pub const add = gtk_text_tag_table_add;

    /// Calls `func` on each tag in `table`, with user data `data`.
    ///
    /// Note that the table may not be modified while iterating
    /// over it (you can’t add/remove tags).
    extern fn gtk_text_tag_table_foreach(p_table: *TextTagTable, p_func: gtk.TextTagTableForeach, p_data: ?*anyopaque) void;
    pub const foreach = gtk_text_tag_table_foreach;

    /// Returns the size of the table (number of tags)
    extern fn gtk_text_tag_table_get_size(p_table: *TextTagTable) c_int;
    pub const getSize = gtk_text_tag_table_get_size;

    /// Look up a named tag.
    extern fn gtk_text_tag_table_lookup(p_table: *TextTagTable, p_name: [*:0]const u8) ?*gtk.TextTag;
    pub const lookup = gtk_text_tag_table_lookup;

    /// Remove a tag from the table.
    ///
    /// If a `GtkTextBuffer` has `table` as its tag table, the tag is
    /// removed from the buffer. The table’s reference to the tag is
    /// removed, so the tag will end up destroyed if you don’t have
    /// a reference to it.
    extern fn gtk_text_tag_table_remove(p_table: *TextTagTable, p_tag: *gtk.TextTag) void;
    pub const remove = gtk_text_tag_table_remove;

    extern fn gtk_text_tag_table_get_type() usize;
    pub const getGObjectType = gtk_text_tag_table_get_type;

    extern fn g_object_ref(p_self: *gtk.TextTagTable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TextTagTable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TextTagTable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Displays the contents of a `gtk.TextBuffer`.
///
/// <picture>
///   <source srcset="multiline-text-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkTextView" src="multiline-text.png">
/// </picture>
///
/// You may wish to begin by reading the [conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types related to the
/// text widget and how they work together.
///
/// ## Shortcuts and Gestures
///
/// `GtkTextView` supports the following keyboard shortcuts:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
/// - <kbd>Ctrl</kbd>+<kbd>Z</kbd> undoes the last modification.
/// - <kbd>Ctrl</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd>
///    redoes the last undone modification.
/// - <kbd>Clear</kbd> clears the content.
///
/// Additionally, the following signals have default keybindings:
///
/// - `gtk.TextView.signals.backspace`
/// - `gtk.TextView.signals.copy_clipboard`
/// - `gtk.TextView.signals.cut_clipboard`
/// - `gtk.TextView.signals.delete_from_cursor`
/// - `gtk.TextView.signals.insert_emoji`
/// - `gtk.TextView.signals.move_cursor`
/// - `gtk.TextView.signals.paste_clipboard`
/// - `gtk.TextView.signals.select_all`
/// - `gtk.TextView.signals.toggle_cursor_visible`
/// - `gtk.TextView.signals.toggle_overwrite`
///
/// ## Actions
///
/// `GtkTextView` defines a set of built-in actions:
///
/// - `clipboard.copy` copies the contents to the clipboard.
/// - `clipboard.cut` copies the contents to the clipboard and deletes it from
///   the widget.
/// - `clipboard.paste` inserts the contents of the clipboard into the widget.
/// - `menu.popup` opens the context menu.
/// - `misc.insert-emoji` opens the Emoji chooser.
/// - `selection.delete` deletes the current selection.
/// - `selection.select-all` selects all of the widgets content.
/// - `text.redo` redoes the last change to the contents.
/// - `text.undo` undoes the last change to the contents.
/// - `text.clear` clears the content.
///
/// ## CSS nodes
///
/// ```
/// textview.view
/// ├── border.top
/// ├── border.left
/// ├── text
/// │   ╰── [selection]
/// ├── border.right
/// ├── border.bottom
/// ╰── [window.popup]
/// ```
///
/// `GtkTextView` has a main css node with name textview and style class .view,
/// and subnodes for each of the border windows, and the main text area,
/// with names border and text, respectively. The border nodes each get
/// one of the style classes .left, .right, .top or .bottom.
///
/// A node representing the selection will appear below the text node.
///
/// If a context menu is opened, the window node will appear as a subnode
/// of the main node.
///
/// ## Accessibility
///
/// `GtkTextView` uses the `gtk.@"AccessibleRole.text_box"` role.
pub const TextView = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleText, gtk.Buildable, gtk.ConstraintTarget, gtk.Scrollable };
    pub const Class = gtk.TextViewClass;
    f_parent_instance: gtk.Widget,
    f_priv: ?*gtk.TextViewPrivate,

    pub const virtual_methods = struct {
        /// The class handler for the `GtkTextView::backspace`
        ///   keybinding signal.
        pub const backspace = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_backspace.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_backspace = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::copy-clipboard`
        ///   keybinding signal.
        pub const copy_clipboard = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_copy_clipboard.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_copy_clipboard = @ptrCast(p_implementation);
            }
        };

        /// The create_buffer vfunc is called to create a `GtkTextBuffer`
        ///   for the text view. The default implementation is to just call
        ///   `gtk.TextBuffer.new`.
        pub const create_buffer = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) *gtk.TextBuffer {
                return gobject.ext.as(TextView.Class, p_class).f_create_buffer.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) *gtk.TextBuffer) void {
                gobject.ext.as(TextView.Class, p_class).f_create_buffer = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::cut-clipboard`
        ///   keybinding signal
        pub const cut_clipboard = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_cut_clipboard.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_cut_clipboard = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::delete-from-cursor`
        ///   keybinding signal.
        pub const delete_from_cursor = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_type: gtk.DeleteType, p_count: c_int) void {
                return gobject.ext.as(TextView.Class, p_class).f_delete_from_cursor.?(gobject.ext.as(TextView, p_text_view), p_type, p_count);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_type: gtk.DeleteType, p_count: c_int) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_delete_from_cursor = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::extend-selection` signal.
        pub const extend_selection = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_granularity: gtk.TextExtendSelection, p_location: *const gtk.TextIter, p_start: *gtk.TextIter, p_end: *gtk.TextIter) c_int {
                return gobject.ext.as(TextView.Class, p_class).f_extend_selection.?(gobject.ext.as(TextView, p_text_view), p_granularity, p_location, p_start, p_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_granularity: gtk.TextExtendSelection, p_location: *const gtk.TextIter, p_start: *gtk.TextIter, p_end: *gtk.TextIter) callconv(.c) c_int) void {
                gobject.ext.as(TextView.Class, p_class).f_extend_selection = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::insert-at-cursor`
        ///   keybinding signal.
        pub const insert_at_cursor = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: [*:0]const u8) void {
                return gobject.ext.as(TextView.Class, p_class).f_insert_at_cursor.?(gobject.ext.as(TextView, p_text_view), p_str);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_str: [*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_insert_at_cursor = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::insert-emoji` signal.
        pub const insert_emoji = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_insert_emoji.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_insert_emoji = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::move-cursor`
        ///   keybinding signal.
        pub const move_cursor = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_step: gtk.MovementStep, p_count: c_int, p_extend_selection: c_int) void {
                return gobject.ext.as(TextView.Class, p_class).f_move_cursor.?(gobject.ext.as(TextView, p_text_view), p_step, p_count, p_extend_selection);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_step: gtk.MovementStep, p_count: c_int, p_extend_selection: c_int) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_move_cursor = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::paste-clipboard`
        ///   keybinding signal.
        pub const paste_clipboard = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_paste_clipboard.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_paste_clipboard = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::set-anchor`
        ///   keybinding signal.
        pub const set_anchor = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_set_anchor.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_set_anchor = @ptrCast(p_implementation);
            }
        };

        /// The snapshot_layer vfunc is called before and after the text
        ///   view is drawing its own text. Applications can override this vfunc
        ///   in a subclass to draw customized content underneath or above the
        ///   text. In the `GTK_TEXT_VIEW_LAYER_BELOW_TEXT` and `GTK_TEXT_VIEW_LAYER_ABOVE_TEXT`
        ///   layers the drawing is done in the buffer coordinate space.
        pub const snapshot_layer = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_layer: gtk.TextViewLayer, p_snapshot: *gtk.Snapshot) void {
                return gobject.ext.as(TextView.Class, p_class).f_snapshot_layer.?(gobject.ext.as(TextView, p_text_view), p_layer, p_snapshot);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_layer: gtk.TextViewLayer, p_snapshot: *gtk.Snapshot) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_snapshot_layer = @ptrCast(p_implementation);
            }
        };

        /// The class handler for the `GtkTextView::toggle-overwrite`
        ///   keybinding signal.
        pub const toggle_overwrite = struct {
            pub fn call(p_class: anytype, p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TextView.Class, p_class).f_toggle_overwrite.?(gobject.ext.as(TextView, p_text_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_text_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TextView.Class, p_class).f_toggle_overwrite = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Whether Tab will result in a tab character being entered.
        pub const accepts_tab = struct {
            pub const name = "accepts-tab";

            pub const Type = c_int;
        };

        /// The bottom margin for text in the text view.
        ///
        /// Note that this property is confusingly named. In CSS terms,
        /// the value set here is padding, and it is applied in addition
        /// to the padding from the theme.
        ///
        /// Don't confuse this property with `gtk.Widget.properties.margin_bottom`.
        pub const bottom_margin = struct {
            pub const name = "bottom-margin";

            pub const Type = c_int;
        };

        /// The buffer which is displayed.
        pub const buffer = struct {
            pub const name = "buffer";

            pub const Type = ?*gtk.TextBuffer;
        };

        /// If the insertion cursor is shown.
        pub const cursor_visible = struct {
            pub const name = "cursor-visible";

            pub const Type = c_int;
        };

        /// Whether the text can be modified by the user.
        pub const editable = struct {
            pub const name = "editable";

            pub const Type = c_int;
        };

        /// A menu model whose contents will be appended to the context menu.
        pub const extra_menu = struct {
            pub const name = "extra-menu";

            pub const Type = ?*gio.MenuModel;
        };

        /// Which IM (input method) module should be used for this text_view.
        ///
        /// See `gtk.IMMulticontext`.
        ///
        /// Setting this to a non-`NULL` value overrides the system-wide IM module
        /// setting. See the GtkSettings `gtk.Settings.properties.gtk_im_module` property.
        pub const im_module = struct {
            pub const name = "im-module";

            pub const Type = ?[*:0]u8;
        };

        /// Amount to indent the paragraph, in pixels.
        ///
        /// A negative value of indent will produce a hanging indentation.
        /// That is, the first line will have the full width, and subsequent
        /// lines will be indented by the absolute value of indent.
        pub const indent = struct {
            pub const name = "indent";

            pub const Type = c_int;
        };

        /// Additional hints (beyond `gtk.TextView.properties.input_purpose`)
        /// that allow input methods to fine-tune their behaviour.
        pub const input_hints = struct {
            pub const name = "input-hints";

            pub const Type = gtk.InputHints;
        };

        /// The purpose of this text field.
        ///
        /// This property can be used by on-screen keyboards and other input
        /// methods to adjust their behaviour.
        pub const input_purpose = struct {
            pub const name = "input-purpose";

            pub const Type = gtk.InputPurpose;
        };

        /// Left, right, or center justification.
        pub const justification = struct {
            pub const name = "justification";

            pub const Type = gtk.Justification;
        };

        /// The default left margin for text in the text view.
        ///
        /// Tags in the buffer may override the default.
        ///
        /// Note that this property is confusingly named. In CSS terms,
        /// the value set here is padding, and it is applied in addition
        /// to the padding from the theme.
        pub const left_margin = struct {
            pub const name = "left-margin";

            pub const Type = c_int;
        };

        /// Whether text should be displayed in a monospace font.
        ///
        /// If `TRUE`, set the .monospace style class on the
        /// text view to indicate that a monospace font is desired.
        pub const monospace = struct {
            pub const name = "monospace";

            pub const Type = c_int;
        };

        /// Whether entered text overwrites existing contents.
        pub const overwrite = struct {
            pub const name = "overwrite";

            pub const Type = c_int;
        };

        /// Pixels of blank space above paragraphs.
        pub const pixels_above_lines = struct {
            pub const name = "pixels-above-lines";

            pub const Type = c_int;
        };

        /// Pixels of blank space below paragraphs.
        pub const pixels_below_lines = struct {
            pub const name = "pixels-below-lines";

            pub const Type = c_int;
        };

        /// Pixels of blank space between wrapped lines in a paragraph.
        pub const pixels_inside_wrap = struct {
            pub const name = "pixels-inside-wrap";

            pub const Type = c_int;
        };

        /// The default right margin for text in the text view.
        ///
        /// Tags in the buffer may override the default.
        ///
        /// Note that this property is confusingly named. In CSS terms,
        /// the value set here is padding, and it is applied in addition
        /// to the padding from the theme.
        pub const right_margin = struct {
            pub const name = "right-margin";

            pub const Type = c_int;
        };

        /// Custom tabs for this text.
        pub const tabs = struct {
            pub const name = "tabs";

            pub const Type = ?*pango.TabArray;
        };

        /// The top margin for text in the text view.
        ///
        /// Note that this property is confusingly named. In CSS terms,
        /// the value set here is padding, and it is applied in addition
        /// to the padding from the theme.
        ///
        /// Don't confuse this property with `gtk.Widget.properties.margin_top`.
        pub const top_margin = struct {
            pub const name = "top-margin";

            pub const Type = c_int;
        };

        /// Whether to wrap lines never, at word boundaries, or at character boundaries.
        pub const wrap_mode = struct {
            pub const name = "wrap-mode";

            pub const Type = gtk.WrapMode;
        };
    };

    pub const signals = struct {
        /// Gets emitted when the user asks for it.
        ///
        /// The ::backspace signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Backspace</kbd> and <kbd>Shift</kbd>+<kbd>Backspace</kbd>.
        pub const backspace = struct {
            pub const name = "backspace";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("backspace", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to copy the selection to the clipboard.
        ///
        /// The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>c</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>Insert</kbd>.
        pub const copy_clipboard = struct {
            pub const name = "copy-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("copy-clipboard", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to cut the selection to the clipboard.
        ///
        /// The ::cut-clipboard signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>x</kbd> and
        /// <kbd>Shift</kbd>+<kbd>Delete</kbd>.
        pub const cut_clipboard = struct {
            pub const name = "cut-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("cut-clipboard", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when the user initiates a text deletion.
        ///
        /// The ::delete-from-cursor signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// If the `type` is `GTK_DELETE_CHARS`, GTK deletes the selection
        /// if there is one, otherwise it deletes the requested number
        /// of characters.
        ///
        /// The default bindings for this signal are <kbd>Delete</kbd> for
        /// deleting a character, <kbd>Ctrl</kbd>+<kbd>Delete</kbd> for
        /// deleting a word and <kbd>Ctrl</kbd>+<kbd>Backspace</kbd> for
        /// deleting a word backwards.
        pub const delete_from_cursor = struct {
            pub const name = "delete-from-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_type: gtk.DeleteType, p_count: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("delete-from-cursor", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the selection needs to be extended at `location`.
        pub const extend_selection = struct {
            pub const name = "extend-selection";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_granularity: gtk.TextExtendSelection, p_location: *gtk.TextIter, p_start: *gtk.TextIter, p_end: *gtk.TextIter, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("extend-selection", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when the user initiates the insertion of a
        /// fixed string at the cursor.
        ///
        /// The ::insert-at-cursor signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// This signal has no default bindings.
        pub const insert_at_cursor = struct {
            pub const name = "insert-at-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_string: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("insert-at-cursor", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to present the Emoji chooser for the `text_view`.
        ///
        /// The ::insert-emoji signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>.</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>;</kbd>
        pub const insert_emoji = struct {
            pub const name = "insert-emoji";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("insert-emoji", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when the user initiates a cursor movement.
        ///
        /// The ::move-cursor signal is a [keybinding signal](class.SignalAction.html).
        /// If the cursor is not visible in `text_view`, this signal causes
        /// the viewport to be moved instead.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control the cursor
        /// programmatically.
        ///
        ///
        /// The default bindings for this signal come in two variants,
        /// the variant with the <kbd>Shift</kbd> modifier extends the
        /// selection, the variant without it does not.
        /// There are too many key combinations to list them all here.
        ///
        /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
        ///   move by individual characters/lines
        /// - <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs
        /// - <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer
        /// - <kbd>PgUp</kbd> and <kbd>PgDn</kbd> move vertically by pages
        /// - <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> and <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>
        ///   move horizontally by pages
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_count: c_int, p_extend_selection: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("move-cursor", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to move the viewport.
        ///
        /// The ::move-viewport signal is a [keybinding signal](class.SignalAction.html),
        /// which can be bound to key combinations to allow the user to move the viewport,
        /// i.e. change what part of the text view is visible in a containing scrolled
        /// window.
        ///
        /// There are no default bindings for this signal.
        pub const move_viewport = struct {
            pub const name = "move-viewport";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.ScrollStep, p_count: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("move-viewport", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to paste the contents of the clipboard
        /// into the text view.
        ///
        /// The ::paste-clipboard signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>v</kbd> and
        /// <kbd>Shift</kbd>+<kbd>Insert</kbd>.
        pub const paste_clipboard = struct {
            pub const name = "paste-clipboard";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("paste-clipboard", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when preedit text of the active IM changes.
        ///
        /// If an input method is used, the typed text will not immediately
        /// be committed to the buffer. So if you are interested in the text,
        /// connect to this signal.
        ///
        /// This signal is only emitted if the text at the given position
        /// is actually editable.
        pub const preedit_changed = struct {
            pub const name = "preedit-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_preedit: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("preedit-changed", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to select or unselect the complete contents of the text view.
        ///
        /// The ::select-all signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>a</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>/</kbd> for selecting and
        /// <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>a</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>\</kbd> for unselecting.
        pub const select_all = struct {
            pub const name = "select-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_select: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("select-all", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted when the user initiates settings the "anchor" mark.
        ///
        /// The ::set-anchor signal is a [keybinding signal](class.SignalAction.html)
        /// which gets emitted when the user initiates setting the "anchor"
        /// mark. The "anchor" mark gets placed at the same position as the
        /// "insert" mark.
        ///
        /// This signal has no default bindings.
        pub const set_anchor = struct {
            pub const name = "set-anchor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("set-anchor", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to toggle the `cursor-visible` property.
        ///
        /// The ::toggle-cursor-visible signal is a
        /// [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>F7</kbd>.
        pub const toggle_cursor_visible = struct {
            pub const name = "toggle-cursor-visible";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("toggle-cursor-visible", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Gets emitted to toggle the overwrite mode of the text view.
        ///
        /// The ::toggle-overwrite signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>Insert</kbd>.
        pub const toggle_overwrite = struct {
            pub const name = "toggle-overwrite";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TextView, p_instance))),
                    gobject.signalLookup("toggle-overwrite", TextView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkTextView`.
    ///
    /// If you don’t call `gtk.TextView.setBuffer` before using the
    /// text view, an empty default buffer will be created for you. Get the
    /// buffer with `gtk.TextView.getBuffer`. If you want to specify
    /// your own buffer, consider `gtk.TextView.newWithBuffer`.
    extern fn gtk_text_view_new() *gtk.TextView;
    pub const new = gtk_text_view_new;

    /// Creates a new `GtkTextView` widget displaying the buffer `buffer`.
    ///
    /// One buffer can be shared among many widgets. `buffer` may be `NULL`
    /// to create a default buffer, in which case this function is equivalent
    /// to `gtk.TextView.new`. The text view adds its own reference count
    /// to the buffer; it does not take over an existing reference.
    extern fn gtk_text_view_new_with_buffer(p_buffer: *gtk.TextBuffer) *gtk.TextView;
    pub const newWithBuffer = gtk_text_view_new_with_buffer;

    /// Adds a child widget in the text buffer, at the given `anchor`.
    extern fn gtk_text_view_add_child_at_anchor(p_text_view: *TextView, p_child: *gtk.Widget, p_anchor: *gtk.TextChildAnchor) void;
    pub const addChildAtAnchor = gtk_text_view_add_child_at_anchor;

    /// Adds `child` at a fixed coordinate in the `GtkTextView`'s text window.
    ///
    /// The `xpos` and `ypos` must be in buffer coordinates (see
    /// `gtk.TextView.getIterLocation` to convert to
    /// buffer coordinates).
    ///
    /// `child` will scroll with the text view.
    ///
    /// If instead you want a widget that will not move with the
    /// `GtkTextView` contents see `GtkOverlay`.
    extern fn gtk_text_view_add_overlay(p_text_view: *TextView, p_child: *gtk.Widget, p_xpos: c_int, p_ypos: c_int) void;
    pub const addOverlay = gtk_text_view_add_overlay;

    /// Moves the given `iter` backward by one display (wrapped) line.
    ///
    /// A display line is different from a paragraph. Paragraphs are
    /// separated by newlines or other paragraph separator characters.
    /// Display lines are created by line-wrapping a paragraph. If
    /// wrapping is turned off, display lines and paragraphs will be the
    /// same. Display lines are divided differently for each view, since
    /// they depend on the view’s width; paragraphs are the same in all
    /// views, since they depend on the contents of the `GtkTextBuffer`.
    extern fn gtk_text_view_backward_display_line(p_text_view: *TextView, p_iter: *gtk.TextIter) c_int;
    pub const backwardDisplayLine = gtk_text_view_backward_display_line;

    /// Moves the given `iter` backward to the next display line start.
    ///
    /// A display line is different from a paragraph. Paragraphs are
    /// separated by newlines or other paragraph separator characters.
    /// Display lines are created by line-wrapping a paragraph. If
    /// wrapping is turned off, display lines and paragraphs will be the
    /// same. Display lines are divided differently for each view, since
    /// they depend on the view’s width; paragraphs are the same in all
    /// views, since they depend on the contents of the `GtkTextBuffer`.
    extern fn gtk_text_view_backward_display_line_start(p_text_view: *TextView, p_iter: *gtk.TextIter) c_int;
    pub const backwardDisplayLineStart = gtk_text_view_backward_display_line_start;

    /// Converts buffer coordinates to window coordinates.
    extern fn gtk_text_view_buffer_to_window_coords(p_text_view: *TextView, p_win: gtk.TextWindowType, p_buffer_x: c_int, p_buffer_y: c_int, p_window_x: ?*c_int, p_window_y: ?*c_int) void;
    pub const bufferToWindowCoords = gtk_text_view_buffer_to_window_coords;

    /// Moves the given `iter` forward by one display (wrapped) line.
    ///
    /// A display line is different from a paragraph. Paragraphs are
    /// separated by newlines or other paragraph separator characters.
    /// Display lines are created by line-wrapping a paragraph. If
    /// wrapping is turned off, display lines and paragraphs will be the
    /// same. Display lines are divided differently for each view, since
    /// they depend on the view’s width; paragraphs are the same in all
    /// views, since they depend on the contents of the `GtkTextBuffer`.
    extern fn gtk_text_view_forward_display_line(p_text_view: *TextView, p_iter: *gtk.TextIter) c_int;
    pub const forwardDisplayLine = gtk_text_view_forward_display_line;

    /// Moves the given `iter` forward to the next display line end.
    ///
    /// A display line is different from a paragraph. Paragraphs are
    /// separated by newlines or other paragraph separator characters.
    /// Display lines are created by line-wrapping a paragraph. If
    /// wrapping is turned off, display lines and paragraphs will be the
    /// same. Display lines are divided differently for each view, since
    /// they depend on the view’s width; paragraphs are the same in all
    /// views, since they depend on the contents of the `GtkTextBuffer`.
    extern fn gtk_text_view_forward_display_line_end(p_text_view: *TextView, p_iter: *gtk.TextIter) c_int;
    pub const forwardDisplayLineEnd = gtk_text_view_forward_display_line_end;

    /// Returns whether pressing the <kbd>Tab</kbd> key inserts a tab characters.
    ///
    /// See `gtk.TextView.setAcceptsTab`.
    extern fn gtk_text_view_get_accepts_tab(p_text_view: *TextView) c_int;
    pub const getAcceptsTab = gtk_text_view_get_accepts_tab;

    /// Gets the bottom margin for text in the `text_view`.
    extern fn gtk_text_view_get_bottom_margin(p_text_view: *TextView) c_int;
    pub const getBottomMargin = gtk_text_view_get_bottom_margin;

    /// Returns the `GtkTextBuffer` being displayed by this text view.
    ///
    /// The reference count on the buffer is not incremented; the caller
    /// of this function won’t own a new reference.
    extern fn gtk_text_view_get_buffer(p_text_view: *TextView) *gtk.TextBuffer;
    pub const getBuffer = gtk_text_view_get_buffer;

    /// Determine the positions of the strong and weak cursors if the
    /// insertion point is at `iter`.
    ///
    /// The position of each cursor is stored as a zero-width rectangle.
    /// The strong cursor location is the location where characters of
    /// the directionality equal to the base direction of the paragraph
    /// are inserted. The weak cursor location is the location where
    /// characters of the directionality opposite to the base direction
    /// of the paragraph are inserted.
    ///
    /// If `iter` is `NULL`, the actual cursor position is used.
    ///
    /// Note that if `iter` happens to be the actual cursor position, and
    /// there is currently an IM preedit sequence being entered, the
    /// returned locations will be adjusted to account for the preedit
    /// cursor’s offset within the preedit sequence.
    ///
    /// The rectangle position is in buffer coordinates; use
    /// `gtk.TextView.bufferToWindowCoords` to convert these
    /// coordinates to coordinates for one of the windows in the text view.
    extern fn gtk_text_view_get_cursor_locations(p_text_view: *TextView, p_iter: ?*const gtk.TextIter, p_strong: ?*gdk.Rectangle, p_weak: ?*gdk.Rectangle) void;
    pub const getCursorLocations = gtk_text_view_get_cursor_locations;

    /// Find out whether the cursor should be displayed.
    extern fn gtk_text_view_get_cursor_visible(p_text_view: *TextView) c_int;
    pub const getCursorVisible = gtk_text_view_get_cursor_visible;

    /// Returns the default editability of the `GtkTextView`.
    ///
    /// Tags in the buffer may override this setting for some ranges of text.
    extern fn gtk_text_view_get_editable(p_text_view: *TextView) c_int;
    pub const getEditable = gtk_text_view_get_editable;

    /// Gets the menu model that gets added to the context menu
    /// or `NULL` if none has been set.
    extern fn gtk_text_view_get_extra_menu(p_text_view: *TextView) ?*gio.MenuModel;
    pub const getExtraMenu = gtk_text_view_get_extra_menu;

    /// Gets a `GtkWidget` that has previously been set as gutter.
    ///
    /// See `gtk.TextView.setGutter`.
    ///
    /// `win` must be one of `GTK_TEXT_WINDOW_LEFT`, `GTK_TEXT_WINDOW_RIGHT`,
    /// `GTK_TEXT_WINDOW_TOP`, or `GTK_TEXT_WINDOW_BOTTOM`.
    extern fn gtk_text_view_get_gutter(p_text_view: *TextView, p_win: gtk.TextWindowType) ?*gtk.Widget;
    pub const getGutter = gtk_text_view_get_gutter;

    /// Gets the default indentation of paragraphs in `text_view`.
    ///
    /// Tags in the view’s buffer may override the default.
    /// The indentation may be negative.
    extern fn gtk_text_view_get_indent(p_text_view: *TextView) c_int;
    pub const getIndent = gtk_text_view_get_indent;

    /// Gets the `input-hints` of the `GtkTextView`.
    extern fn gtk_text_view_get_input_hints(p_text_view: *TextView) gtk.InputHints;
    pub const getInputHints = gtk_text_view_get_input_hints;

    /// Gets the `input-purpose` of the `GtkTextView`.
    extern fn gtk_text_view_get_input_purpose(p_text_view: *TextView) gtk.InputPurpose;
    pub const getInputPurpose = gtk_text_view_get_input_purpose;

    /// Retrieves the iterator at buffer coordinates `x` and `y`.
    ///
    /// Buffer coordinates are coordinates for the entire buffer, not just
    /// the currently-displayed portion. If you have coordinates from an
    /// event, you have to convert those to buffer coordinates with
    /// `gtk.TextView.windowToBufferCoords`.
    extern fn gtk_text_view_get_iter_at_location(p_text_view: *TextView, p_iter: *gtk.TextIter, p_x: c_int, p_y: c_int) c_int;
    pub const getIterAtLocation = gtk_text_view_get_iter_at_location;

    /// Retrieves the iterator pointing to the character at buffer
    /// coordinates `x` and `y`.
    ///
    /// Buffer coordinates are coordinates for the entire buffer, not just
    /// the currently-displayed portion. If you have coordinates from an event,
    /// you have to convert those to buffer coordinates with
    /// `gtk.TextView.windowToBufferCoords`.
    ///
    /// Note that this is different from `gtk.TextView.getIterAtLocation`,
    /// which returns cursor locations, i.e. positions between characters.
    extern fn gtk_text_view_get_iter_at_position(p_text_view: *TextView, p_iter: *gtk.TextIter, p_trailing: ?*c_int, p_x: c_int, p_y: c_int) c_int;
    pub const getIterAtPosition = gtk_text_view_get_iter_at_position;

    /// Gets a rectangle which roughly contains the character at `iter`.
    ///
    /// The rectangle position is in buffer coordinates; use
    /// `gtk.TextView.bufferToWindowCoords` to convert these
    /// coordinates to coordinates for one of the windows in the text view.
    extern fn gtk_text_view_get_iter_location(p_text_view: *TextView, p_iter: *const gtk.TextIter, p_location: *gdk.Rectangle) void;
    pub const getIterLocation = gtk_text_view_get_iter_location;

    /// Gets the default justification of paragraphs in `text_view`.
    ///
    /// Tags in the buffer may override the default.
    extern fn gtk_text_view_get_justification(p_text_view: *TextView) gtk.Justification;
    pub const getJustification = gtk_text_view_get_justification;

    /// Gets the default left margin size of paragraphs in the `text_view`.
    ///
    /// Tags in the buffer may override the default.
    extern fn gtk_text_view_get_left_margin(p_text_view: *TextView) c_int;
    pub const getLeftMargin = gtk_text_view_get_left_margin;

    /// Gets the `GtkTextIter` at the start of the line containing
    /// the coordinate `y`.
    ///
    /// `y` is in buffer coordinates, convert from window coordinates with
    /// `gtk.TextView.windowToBufferCoords`. If non-`NULL`,
    /// `line_top` will be filled with the coordinate of the top edge
    /// of the line.
    extern fn gtk_text_view_get_line_at_y(p_text_view: *TextView, p_target_iter: *gtk.TextIter, p_y: c_int, p_line_top: *c_int) void;
    pub const getLineAtY = gtk_text_view_get_line_at_y;

    /// Gets the y coordinate of the top of the line containing `iter`,
    /// and the height of the line.
    ///
    /// The coordinate is a buffer coordinate; convert to window
    /// coordinates with `gtk.TextView.bufferToWindowCoords`.
    extern fn gtk_text_view_get_line_yrange(p_text_view: *TextView, p_iter: *const gtk.TextIter, p_y: *c_int, p_height: *c_int) void;
    pub const getLineYrange = gtk_text_view_get_line_yrange;

    /// Gets the `PangoContext` that is used for rendering LTR directed
    /// text layouts.
    ///
    /// The context may be replaced when CSS changes occur.
    extern fn gtk_text_view_get_ltr_context(p_text_view: *TextView) *pango.Context;
    pub const getLtrContext = gtk_text_view_get_ltr_context;

    /// Gets whether the `GtkTextView` uses monospace styling.
    extern fn gtk_text_view_get_monospace(p_text_view: *TextView) c_int;
    pub const getMonospace = gtk_text_view_get_monospace;

    /// Returns whether the `GtkTextView` is in overwrite mode or not.
    extern fn gtk_text_view_get_overwrite(p_text_view: *TextView) c_int;
    pub const getOverwrite = gtk_text_view_get_overwrite;

    /// Gets the default number of pixels to put above paragraphs.
    ///
    /// Adding this function with `gtk.TextView.getPixelsBelowLines`
    /// is equal to the line space between each paragraph.
    extern fn gtk_text_view_get_pixels_above_lines(p_text_view: *TextView) c_int;
    pub const getPixelsAboveLines = gtk_text_view_get_pixels_above_lines;

    /// Gets the default number of pixels to put below paragraphs.
    ///
    /// The line space is the sum of the value returned by this function and
    /// the value returned by `gtk.TextView.getPixelsAboveLines`.
    extern fn gtk_text_view_get_pixels_below_lines(p_text_view: *TextView) c_int;
    pub const getPixelsBelowLines = gtk_text_view_get_pixels_below_lines;

    /// Gets the default number of pixels to put between wrapped lines
    /// inside a paragraph.
    extern fn gtk_text_view_get_pixels_inside_wrap(p_text_view: *TextView) c_int;
    pub const getPixelsInsideWrap = gtk_text_view_get_pixels_inside_wrap;

    /// Gets the default right margin for text in `text_view`.
    ///
    /// Tags in the buffer may override the default.
    extern fn gtk_text_view_get_right_margin(p_text_view: *TextView) c_int;
    pub const getRightMargin = gtk_text_view_get_right_margin;

    /// Gets the `PangoContext` that is used for rendering RTL directed
    /// text layouts.
    ///
    /// The context may be replaced when CSS changes occur.
    extern fn gtk_text_view_get_rtl_context(p_text_view: *TextView) *pango.Context;
    pub const getRtlContext = gtk_text_view_get_rtl_context;

    /// Gets the default tabs for `text_view`.
    ///
    /// Tags in the buffer may override the defaults. The returned array
    /// will be `NULL` if “standard” (8-space) tabs are used. Free the
    /// return value with `pango.TabArray.free`.
    extern fn gtk_text_view_get_tabs(p_text_view: *TextView) ?*pango.TabArray;
    pub const getTabs = gtk_text_view_get_tabs;

    /// Gets the top margin for text in the `text_view`.
    extern fn gtk_text_view_get_top_margin(p_text_view: *TextView) c_int;
    pub const getTopMargin = gtk_text_view_get_top_margin;

    /// Gets the X,Y offset in buffer coordinates of the top-left corner of
    /// the textview's text contents.
    ///
    /// This allows for more-precise positioning than what is provided by
    /// `gtk.TextView.getVisibleRect` as you can discover what
    /// device pixel is being quantized for text positioning.
    ///
    /// You might want this when making ulterior widgets align with quantized
    /// device pixels of the textview contents such as line numbers.
    extern fn gtk_text_view_get_visible_offset(p_text_view: *TextView, p_x_offset: ?*f64, p_y_offset: ?*f64) void;
    pub const getVisibleOffset = gtk_text_view_get_visible_offset;

    /// Fills `visible_rect` with the currently-visible
    /// region of the buffer, in buffer coordinates.
    ///
    /// Convert to window coordinates with
    /// `gtk.TextView.bufferToWindowCoords`.
    extern fn gtk_text_view_get_visible_rect(p_text_view: *TextView, p_visible_rect: *gdk.Rectangle) void;
    pub const getVisibleRect = gtk_text_view_get_visible_rect;

    /// Gets the line wrapping for the view.
    extern fn gtk_text_view_get_wrap_mode(p_text_view: *TextView) gtk.WrapMode;
    pub const getWrapMode = gtk_text_view_get_wrap_mode;

    /// Allow the `GtkTextView` input method to internally handle key press
    /// and release events.
    ///
    /// If this function returns `TRUE`, then no further processing should be
    /// done for this key event. See `gtk.IMContext.filterKeypress`.
    ///
    /// Note that you are expected to call this function from your handler
    /// when overriding key event handling. This is needed in the case when
    /// you need to insert your own key handling between the input method
    /// and the default key event handling of the `GtkTextView`.
    ///
    /// ```c
    /// static gboolean
    /// gtk_foo_bar_key_press_event (GtkWidget *widget,
    ///                              GdkEvent  *event)
    /// {
    ///   guint keyval;
    ///
    ///   gdk_event_get_keyval ((GdkEvent*)event, &keyval);
    ///
    ///   if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter)
    ///     {
    ///       if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event))
    ///         return TRUE;
    ///     }
    ///
    ///   // Do some stuff
    ///
    ///   return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
    /// }
    /// ```
    extern fn gtk_text_view_im_context_filter_keypress(p_text_view: *TextView, p_event: *gdk.Event) c_int;
    pub const imContextFilterKeypress = gtk_text_view_im_context_filter_keypress;

    /// Moves a mark within the buffer so that it's
    /// located within the currently-visible text area.
    extern fn gtk_text_view_move_mark_onscreen(p_text_view: *TextView, p_mark: *gtk.TextMark) c_int;
    pub const moveMarkOnscreen = gtk_text_view_move_mark_onscreen;

    /// Updates the position of a child.
    ///
    /// See `gtk.TextView.addOverlay`.
    extern fn gtk_text_view_move_overlay(p_text_view: *TextView, p_child: *gtk.Widget, p_xpos: c_int, p_ypos: c_int) void;
    pub const moveOverlay = gtk_text_view_move_overlay;

    /// Move the iterator a given number of characters visually, treating
    /// it as the strong cursor position.
    ///
    /// If `count` is positive, then the new strong cursor position will
    /// be `count` positions to the right of the old cursor position.
    /// If `count` is negative then the new strong cursor position will
    /// be `count` positions to the left of the old cursor position.
    ///
    /// In the presence of bi-directional text, the correspondence
    /// between logical and visual order will depend on the direction
    /// of the current run, and there may be jumps when the cursor
    /// is moved off of the end of a run.
    extern fn gtk_text_view_move_visually(p_text_view: *TextView, p_iter: *gtk.TextIter, p_count: c_int) c_int;
    pub const moveVisually = gtk_text_view_move_visually;

    /// Moves the cursor to the currently visible region of the
    /// buffer.
    extern fn gtk_text_view_place_cursor_onscreen(p_text_view: *TextView) c_int;
    pub const placeCursorOnscreen = gtk_text_view_place_cursor_onscreen;

    /// Removes a child widget from `text_view`.
    extern fn gtk_text_view_remove(p_text_view: *TextView, p_child: *gtk.Widget) void;
    pub const remove = gtk_text_view_remove;

    /// Ensures that the cursor is shown.
    ///
    /// This also resets the time that it will stay blinking (or
    /// visible, in case blinking is disabled).
    ///
    /// This function should be called in response to user input
    /// (e.g. from derived classes that override the textview's
    /// event handlers).
    extern fn gtk_text_view_reset_cursor_blink(p_text_view: *TextView) void;
    pub const resetCursorBlink = gtk_text_view_reset_cursor_blink;

    /// Reset the input method context of the text view if needed.
    ///
    /// This can be necessary in the case where modifying the buffer
    /// would confuse on-going input method behavior.
    extern fn gtk_text_view_reset_im_context(p_text_view: *TextView) void;
    pub const resetImContext = gtk_text_view_reset_im_context;

    /// Scrolls `text_view` the minimum distance such that `mark` is contained
    /// within the visible area of the widget.
    extern fn gtk_text_view_scroll_mark_onscreen(p_text_view: *TextView, p_mark: *gtk.TextMark) void;
    pub const scrollMarkOnscreen = gtk_text_view_scroll_mark_onscreen;

    /// Scrolls `text_view` so that `iter` is on the screen in the position
    /// indicated by `xalign` and `yalign`.
    ///
    /// An alignment of 0.0 indicates left or top, 1.0 indicates right or
    /// bottom, 0.5 means center. If `use_align` is `FALSE`, the text scrolls
    /// the minimal distance to get the mark onscreen, possibly not scrolling
    /// at all. The effective screen for purposes of this function is reduced
    /// by a margin of size `within_margin`.
    ///
    /// Note that this function uses the currently-computed height of the
    /// lines in the text buffer. Line heights are computed in an idle
    /// handler; so this function may not have the desired effect if it’s
    /// called before the height computations. To avoid oddness, consider
    /// using `gtk.TextView.scrollToMark` which saves a point to be
    /// scrolled to after line validation.
    extern fn gtk_text_view_scroll_to_iter(p_text_view: *TextView, p_iter: *gtk.TextIter, p_within_margin: f64, p_use_align: c_int, p_xalign: f64, p_yalign: f64) c_int;
    pub const scrollToIter = gtk_text_view_scroll_to_iter;

    /// Scrolls `text_view` so that `mark` is on the screen in the position
    /// indicated by `xalign` and `yalign`.
    ///
    /// An alignment of 0.0 indicates left or top, 1.0 indicates right or
    /// bottom, 0.5 means center. If `use_align` is `FALSE`, the text scrolls
    /// the minimal distance to get the mark onscreen, possibly not scrolling
    /// at all. The effective screen for purposes of this function is reduced
    /// by a margin of size `within_margin`.
    extern fn gtk_text_view_scroll_to_mark(p_text_view: *TextView, p_mark: *gtk.TextMark, p_within_margin: f64, p_use_align: c_int, p_xalign: f64, p_yalign: f64) void;
    pub const scrollToMark = gtk_text_view_scroll_to_mark;

    /// Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.
    ///
    /// If `accepts_tab` is `TRUE`, a tab character is inserted. If `accepts_tab`
    /// is `FALSE` the keyboard focus is moved to the next widget in the focus
    /// chain.
    ///
    /// Focus can always be moved using <kbd>Ctrl</kbd>+<kbd>Tab</kbd>.
    extern fn gtk_text_view_set_accepts_tab(p_text_view: *TextView, p_accepts_tab: c_int) void;
    pub const setAcceptsTab = gtk_text_view_set_accepts_tab;

    /// Sets the bottom margin for text in `text_view`.
    ///
    /// Note that this function is confusingly named.
    /// In CSS terms, the value set here is padding.
    extern fn gtk_text_view_set_bottom_margin(p_text_view: *TextView, p_bottom_margin: c_int) void;
    pub const setBottomMargin = gtk_text_view_set_bottom_margin;

    /// Sets `buffer` as the buffer being displayed by `text_view`.
    ///
    /// The previous buffer displayed by the text view is unreferenced, and
    /// a reference is added to `buffer`. If you owned a reference to `buffer`
    /// before passing it to this function, you must remove that reference
    /// yourself; `GtkTextView` will not “adopt” it.
    extern fn gtk_text_view_set_buffer(p_text_view: *TextView, p_buffer: ?*gtk.TextBuffer) void;
    pub const setBuffer = gtk_text_view_set_buffer;

    /// Toggles whether the insertion point should be displayed.
    ///
    /// A buffer with no editable text probably shouldn’t have a visible
    /// cursor, so you may want to turn the cursor off.
    ///
    /// Note that this property may be overridden by the
    /// `gtk.Settings.properties.gtk_keynav_use_caret` setting.
    extern fn gtk_text_view_set_cursor_visible(p_text_view: *TextView, p_setting: c_int) void;
    pub const setCursorVisible = gtk_text_view_set_cursor_visible;

    /// Sets the default editability of the `GtkTextView`.
    ///
    /// You can override this default setting with tags in the buffer,
    /// using the “editable” attribute of tags.
    extern fn gtk_text_view_set_editable(p_text_view: *TextView, p_setting: c_int) void;
    pub const setEditable = gtk_text_view_set_editable;

    /// Sets a menu model to add when constructing the context
    /// menu for `text_view`.
    ///
    /// You can pass `NULL` to remove a previously set extra menu.
    extern fn gtk_text_view_set_extra_menu(p_text_view: *TextView, p_model: ?*gio.MenuModel) void;
    pub const setExtraMenu = gtk_text_view_set_extra_menu;

    /// Places `widget` into the gutter specified by `win`.
    ///
    /// `win` must be one of `GTK_TEXT_WINDOW_LEFT`, `GTK_TEXT_WINDOW_RIGHT`,
    /// `GTK_TEXT_WINDOW_TOP`, or `GTK_TEXT_WINDOW_BOTTOM`.
    extern fn gtk_text_view_set_gutter(p_text_view: *TextView, p_win: gtk.TextWindowType, p_widget: ?*gtk.Widget) void;
    pub const setGutter = gtk_text_view_set_gutter;

    /// Sets the default indentation for paragraphs in `text_view`.
    ///
    /// Tags in the buffer may override the default.
    extern fn gtk_text_view_set_indent(p_text_view: *TextView, p_indent: c_int) void;
    pub const setIndent = gtk_text_view_set_indent;

    /// Sets the `input-hints` of the `GtkTextView`.
    ///
    /// The `input-hints` allow input methods to fine-tune
    /// their behaviour.
    extern fn gtk_text_view_set_input_hints(p_text_view: *TextView, p_hints: gtk.InputHints) void;
    pub const setInputHints = gtk_text_view_set_input_hints;

    /// Sets the `input-purpose` of the `GtkTextView`.
    ///
    /// The `input-purpose` can be used by on-screen keyboards
    /// and other input methods to adjust their behaviour.
    extern fn gtk_text_view_set_input_purpose(p_text_view: *TextView, p_purpose: gtk.InputPurpose) void;
    pub const setInputPurpose = gtk_text_view_set_input_purpose;

    /// Sets the default justification of text in `text_view`.
    ///
    /// Tags in the view’s buffer may override the default.
    extern fn gtk_text_view_set_justification(p_text_view: *TextView, p_justification: gtk.Justification) void;
    pub const setJustification = gtk_text_view_set_justification;

    /// Sets the default left margin for text in `text_view`.
    ///
    /// Tags in the buffer may override the default.
    ///
    /// Note that this function is confusingly named.
    /// In CSS terms, the value set here is padding.
    extern fn gtk_text_view_set_left_margin(p_text_view: *TextView, p_left_margin: c_int) void;
    pub const setLeftMargin = gtk_text_view_set_left_margin;

    /// Sets whether the `GtkTextView` should display text in
    /// monospace styling.
    extern fn gtk_text_view_set_monospace(p_text_view: *TextView, p_monospace: c_int) void;
    pub const setMonospace = gtk_text_view_set_monospace;

    /// Changes the `GtkTextView` overwrite mode.
    extern fn gtk_text_view_set_overwrite(p_text_view: *TextView, p_overwrite: c_int) void;
    pub const setOverwrite = gtk_text_view_set_overwrite;

    /// Sets the default number of blank pixels above paragraphs in `text_view`.
    ///
    /// Tags in the buffer for `text_view` may override the defaults.
    extern fn gtk_text_view_set_pixels_above_lines(p_text_view: *TextView, p_pixels_above_lines: c_int) void;
    pub const setPixelsAboveLines = gtk_text_view_set_pixels_above_lines;

    /// Sets the default number of pixels of blank space
    /// to put below paragraphs in `text_view`.
    ///
    /// May be overridden by tags applied to `text_view`’s buffer.
    extern fn gtk_text_view_set_pixels_below_lines(p_text_view: *TextView, p_pixels_below_lines: c_int) void;
    pub const setPixelsBelowLines = gtk_text_view_set_pixels_below_lines;

    /// Sets the default number of pixels of blank space to leave between
    /// display/wrapped lines within a paragraph.
    ///
    /// May be overridden by tags in `text_view`’s buffer.
    extern fn gtk_text_view_set_pixels_inside_wrap(p_text_view: *TextView, p_pixels_inside_wrap: c_int) void;
    pub const setPixelsInsideWrap = gtk_text_view_set_pixels_inside_wrap;

    /// Sets the default right margin for text in the text view.
    ///
    /// Tags in the buffer may override the default.
    ///
    /// Note that this function is confusingly named.
    /// In CSS terms, the value set here is padding.
    extern fn gtk_text_view_set_right_margin(p_text_view: *TextView, p_right_margin: c_int) void;
    pub const setRightMargin = gtk_text_view_set_right_margin;

    /// Sets the default tab stops for paragraphs in `text_view`.
    ///
    /// Tags in the buffer may override the default.
    extern fn gtk_text_view_set_tabs(p_text_view: *TextView, p_tabs: *pango.TabArray) void;
    pub const setTabs = gtk_text_view_set_tabs;

    /// Sets the top margin for text in `text_view`.
    ///
    /// Note that this function is confusingly named.
    /// In CSS terms, the value set here is padding.
    extern fn gtk_text_view_set_top_margin(p_text_view: *TextView, p_top_margin: c_int) void;
    pub const setTopMargin = gtk_text_view_set_top_margin;

    /// Sets the line wrapping for the view.
    extern fn gtk_text_view_set_wrap_mode(p_text_view: *TextView, p_wrap_mode: gtk.WrapMode) void;
    pub const setWrapMode = gtk_text_view_set_wrap_mode;

    /// Determines whether `iter` is at the start of a display line.
    ///
    /// See `gtk.TextView.forwardDisplayLine` for an
    /// explanation of display lines vs. paragraphs.
    extern fn gtk_text_view_starts_display_line(p_text_view: *TextView, p_iter: *const gtk.TextIter) c_int;
    pub const startsDisplayLine = gtk_text_view_starts_display_line;

    /// Converts coordinates on the window identified by `win` to buffer
    /// coordinates.
    extern fn gtk_text_view_window_to_buffer_coords(p_text_view: *TextView, p_win: gtk.TextWindowType, p_window_x: c_int, p_window_y: c_int, p_buffer_x: ?*c_int, p_buffer_y: ?*c_int) void;
    pub const windowToBufferCoords = gtk_text_view_window_to_buffer_coords;

    extern fn gtk_text_view_get_type() usize;
    pub const getGObjectType = gtk_text_view_get_type;

    extern fn g_object_ref(p_self: *gtk.TextView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TextView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TextView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a button which remains “pressed-in” when clicked.
///
/// <picture>
///   <source srcset="toggle-button-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="Example GtkToggleButtons" src="toggle-button.png">
/// </picture>
///
/// Clicking again will cause the toggle button to return to its normal state.
///
/// A toggle button is created by calling either `gtk.ToggleButton.new` or
/// `gtk.ToggleButton.newWithLabel`. If using the former, it is advisable
/// to pack a widget, (such as a `GtkLabel` and/or a `GtkImage`), into the toggle
/// button’s container. (See `gtk.Button` for more information).
///
/// The state of a `GtkToggleButton` can be set specifically using
/// `gtk.ToggleButton.setActive`, and retrieved using
/// `gtk.ToggleButton.getActive`.
///
/// ## Grouping
///
/// Toggle buttons can be grouped together, to form mutually exclusive
/// groups - only one of the buttons can be toggled at a time, and toggling
/// another one will switch the currently toggled one off.
///
/// To add a `GtkToggleButton` to a group, use `gtk.ToggleButton.setGroup`.
///
/// ## CSS nodes
///
/// `GtkToggleButton` has a single CSS node with name button. To differentiate
/// it from a plain `GtkButton`, it gets the `.toggle` style class.
///
/// ## Accessibility
///
/// `GtkToggleButton` uses the `gtk.@"AccessibleRole.toggle_button"` role.
///
/// ## Creating two `GtkToggleButton` widgets.
///
/// ```c
/// static void
/// output_state (GtkToggleButton *source,
///               gpointer         user_data)
/// {
///   g_print ("Toggle button "`s`" is active: `s`",
///            gtk_button_get_label (GTK_BUTTON (source)),
///            gtk_toggle_button_get_active (source) ? "Yes" : "No");
/// }
///
/// static void
/// make_toggles (void)
/// {
///   GtkWidget *window, *toggle1, *toggle2;
///   GtkWidget *box;
///   const char *text;
///
///   window = gtk_window_new ();
///   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
///
///   text = "Hi, I’m toggle button one";
///   toggle1 = gtk_toggle_button_new_with_label (text);
///
///   g_signal_connect (toggle1, "toggled",
///                     G_CALLBACK (output_state),
///                     NULL);
///   gtk_box_append (GTK_BOX (box), toggle1);
///
///   text = "Hi, I’m toggle button two";
///   toggle2 = gtk_toggle_button_new_with_label (text);
///   g_signal_connect (toggle2, "toggled",
///                     G_CALLBACK (output_state),
///                     NULL);
///   gtk_box_append (GTK_BOX (box), toggle2);
///
///   gtk_window_set_child (GTK_WINDOW (window), box);
///   gtk_window_present (GTK_WINDOW (window));
/// }
/// ```
pub const ToggleButton = extern struct {
    pub const Parent = gtk.Button;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Actionable, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.ToggleButtonClass;
    f_button: gtk.Button,

    pub const virtual_methods = struct {
        /// Emits the ::toggled signal on the `GtkToggleButton`.
        pub const toggled = struct {
            pub fn call(p_class: anytype, p_toggle_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(ToggleButton.Class, p_class).f_toggled.?(gobject.ext.as(ToggleButton, p_toggle_button));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_toggle_button: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(ToggleButton.Class, p_class).f_toggled = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// If the toggle button should be pressed in.
        pub const active = struct {
            pub const name = "active";

            pub const Type = c_int;
        };

        /// The toggle button whose group this widget belongs to.
        pub const group = struct {
            pub const name = "group";

            pub const Type = ?*gtk.ToggleButton;
        };
    };

    pub const signals = struct {
        /// Emitted whenever the `GtkToggleButton`'s state is changed.
        pub const toggled = struct {
            pub const name = "toggled";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ToggleButton, p_instance))),
                    gobject.signalLookup("toggled", ToggleButton.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new toggle button.
    ///
    /// A widget should be packed into the button, as in `gtk.Button.new`.
    extern fn gtk_toggle_button_new() *gtk.ToggleButton;
    pub const new = gtk_toggle_button_new;

    /// Creates a new toggle button with a text label.
    extern fn gtk_toggle_button_new_with_label(p_label: [*:0]const u8) *gtk.ToggleButton;
    pub const newWithLabel = gtk_toggle_button_new_with_label;

    /// Creates a new `GtkToggleButton` containing a label.
    ///
    /// The label will be created using `gtk.Label.newWithMnemonic`,
    /// so underscores in `label` indicate the mnemonic for the button.
    extern fn gtk_toggle_button_new_with_mnemonic(p_label: [*:0]const u8) *gtk.ToggleButton;
    pub const newWithMnemonic = gtk_toggle_button_new_with_mnemonic;

    /// Queries a `GtkToggleButton` and returns its current state.
    ///
    /// Returns `TRUE` if the toggle button is pressed in and `FALSE`
    /// if it is raised.
    extern fn gtk_toggle_button_get_active(p_toggle_button: *ToggleButton) c_int;
    pub const getActive = gtk_toggle_button_get_active;

    /// Sets the status of the toggle button.
    ///
    /// Set to `TRUE` if you want the `GtkToggleButton` to be “pressed in”,
    /// and `FALSE` to raise it.
    ///
    /// If the status of the button changes, this action causes the
    /// `gtk.ToggleButton.signals.toggled` signal to be emitted.
    extern fn gtk_toggle_button_set_active(p_toggle_button: *ToggleButton, p_is_active: c_int) void;
    pub const setActive = gtk_toggle_button_set_active;

    /// Adds `self` to the group of `group`.
    ///
    /// In a group of multiple toggle buttons, only one button can be active
    /// at a time.
    ///
    /// Setting up groups in a cycle leads to undefined behavior.
    ///
    /// Note that the same effect can be achieved via the `gtk.Actionable`
    /// API, by using the same action with parameter type and state type 's'
    /// for all buttons in the group, and giving each button its own target
    /// value.
    extern fn gtk_toggle_button_set_group(p_toggle_button: *ToggleButton, p_group: ?*gtk.ToggleButton) void;
    pub const setGroup = gtk_toggle_button_set_group;

    /// Emits the ::toggled signal on the `GtkToggleButton`.
    extern fn gtk_toggle_button_toggled(p_toggle_button: *ToggleButton) void;
    pub const toggled = gtk_toggle_button_toggled;

    extern fn gtk_toggle_button_get_type() usize;
    pub const getGObjectType = gtk_toggle_button_get_type;

    extern fn g_object_ref(p_self: *gtk.ToggleButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ToggleButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ToggleButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents a widget tooltip.
///
/// Basic tooltips can be realized simply by using
/// `gtk.Widget.setTooltipText` or
/// `gtk.Widget.setTooltipMarkup` without
/// any explicit tooltip object.
///
/// When you need a tooltip with a little more fancy contents,
/// like adding an image, or you want the tooltip to have different
/// contents per `GtkTreeView` row or cell, you will have to do a
/// little more work:
///
/// - Set the `gtk.Widget.properties.has_tooltip` property to `TRUE`.
///   This will make GTK monitor the widget for motion and related events
///   which are needed to determine when and where to show a tooltip.
///
/// - Connect to the `gtk.Widget.signals.query_tooltip` signal.
///   This signal will be emitted when a tooltip is supposed to be shown.
///   One of the arguments passed to the signal handler is a `GtkTooltip`
///   object. This is the object that we are about to display as a tooltip,
///   and can be manipulated in your callback using functions like
///   `gtk.Tooltip.setIcon`. There are functions for setting
///   the tooltip’s markup, setting an image from a named icon, or even
///   putting in a custom widget.
///
/// - Return `TRUE` from your ::query-tooltip handler. This causes the tooltip
///   to be show. If you return `FALSE`, it will not be shown.
pub const Tooltip = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = Tooltip;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Replaces the widget packed into the tooltip with
    /// `custom_widget`. `custom_widget` does not get destroyed when the tooltip goes
    /// away.
    /// By default a box with a `GtkImage` and `GtkLabel` is embedded in
    /// the tooltip, which can be configured using `gtk.Tooltip.setMarkup`
    /// and `gtk.Tooltip.setIcon`.
    extern fn gtk_tooltip_set_custom(p_tooltip: *Tooltip, p_custom_widget: ?*gtk.Widget) void;
    pub const setCustom = gtk_tooltip_set_custom;

    /// Sets the icon of the tooltip (which is in front of the text) to be
    /// `paintable`.  If `paintable` is `NULL`, the image will be hidden.
    extern fn gtk_tooltip_set_icon(p_tooltip: *Tooltip, p_paintable: ?*gdk.Paintable) void;
    pub const setIcon = gtk_tooltip_set_icon;

    /// Sets the icon of the tooltip (which is in front of the text)
    /// to be the icon indicated by `gicon` with the size indicated
    /// by `size`. If `gicon` is `NULL`, the image will be hidden.
    extern fn gtk_tooltip_set_icon_from_gicon(p_tooltip: *Tooltip, p_gicon: ?*gio.Icon) void;
    pub const setIconFromGicon = gtk_tooltip_set_icon_from_gicon;

    /// Sets the icon of the tooltip (which is in front of the text) to be
    /// the icon indicated by `icon_name` with the size indicated
    /// by `size`.  If `icon_name` is `NULL`, the image will be hidden.
    extern fn gtk_tooltip_set_icon_from_icon_name(p_tooltip: *Tooltip, p_icon_name: ?[*:0]const u8) void;
    pub const setIconFromIconName = gtk_tooltip_set_icon_from_icon_name;

    /// Sets the text of the tooltip to be `markup`.
    ///
    /// The string must be marked up with Pango markup.
    /// If `markup` is `NULL`, the label will be hidden.
    extern fn gtk_tooltip_set_markup(p_tooltip: *Tooltip, p_markup: ?[*:0]const u8) void;
    pub const setMarkup = gtk_tooltip_set_markup;

    /// Sets the text of the tooltip to be `text`.
    ///
    /// If `text` is `NULL`, the label will be hidden.
    /// See also `gtk.Tooltip.setMarkup`.
    extern fn gtk_tooltip_set_text(p_tooltip: *Tooltip, p_text: ?[*:0]const u8) void;
    pub const setText = gtk_tooltip_set_text;

    /// Sets the area of the widget, where the contents of this tooltip apply,
    /// to be `rect` (in widget coordinates).  This is especially useful for
    /// properly setting tooltips on `GtkTreeView` rows and cells, `GtkIconViews`,
    /// etc.
    ///
    /// For setting tooltips on `GtkTreeView`, please refer to the convenience
    /// functions for this: `gtk.TreeView.setTooltipRow` and
    /// `gtk.TreeView.setTooltipCell`.
    extern fn gtk_tooltip_set_tip_area(p_tooltip: *Tooltip, p_rect: *const gdk.Rectangle) void;
    pub const setTipArea = gtk_tooltip_set_tip_area;

    extern fn gtk_tooltip_get_type() usize;
    pub const getGObjectType = gtk_tooltip_get_type;

    extern fn g_object_ref(p_self: *gtk.Tooltip) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Tooltip) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Tooltip, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides an expander for a tree-like list.
///
/// It is typically placed as a bottommost child into a `GtkListView`
/// to allow users to expand and collapse children in a list with a
/// `gtk.TreeListModel`. `GtkTreeExpander` provides the common UI
/// elements, gestures and keybindings for this purpose.
///
/// On top of this, the "listitem.expand", "listitem.collapse" and
/// "listitem.toggle-expand" actions are provided to allow adding custom
/// UI for managing expanded state.
///
/// It is important to mention that you want to set the
/// `gtk.ListItem.properties.focusable` property to FALSE when using this
/// widget, as you want the keyboard focus to be in the treexpander, and not
/// inside the list to make use of the keybindings.
///
/// The `GtkTreeListModel` must be set to not be passthrough. Then it
/// will provide `gtk.TreeListRow` items which can be set via
/// `gtk.TreeExpander.setListRow` on the expander.
/// The expander will then watch that row item automatically.
/// `gtk.TreeExpander.setChild` sets the widget that displays
/// the actual row contents.
///
/// `GtkTreeExpander` can be modified with properties such as
/// `gtk.TreeExpander.properties.indent_for_icon`,
/// `gtk.TreeExpander.properties.indent_for_depth`, and
/// `gtk.TreeExpander.properties.hide_expander` to achieve a different appearance.
/// This can even be done to influence individual rows, for example by binding
/// the `gtk.TreeExpander.properties.hide_expander` property to the item count of
/// the model of the treelistrow, to hide the expander for rows without children,
/// even if the row is expandable.
///
/// ## Shortcuts and Gestures
///
/// `GtkTreeExpander` supports the following keyboard shortcuts:
///
/// - <kbd>+</kbd> or <kbd>*</kbd> expands the expander.
/// - <kbd>-</kbd> or <kbd>/</kbd> collapses the expander.
/// - Left and right arrow keys, when combined with <kbd>Shift</kbd> or
///   <kbd>Ctrl</kbd>+<kbd>Shift</kbd>, will expand or collapse, depending on
///   the locale's text direction.
/// - <kbd>Ctrl</kbd>+<kbd>␣</kbd> toggles the expander state.
///
/// The row can also expand on drag gestures.
///
/// ## Actions
///
/// `GtkTreeExpander` defines a set of built-in actions:
///
/// - `listitem.expand` expands the expander if it can be expanded.
/// - `listitem.collapse` collapses the expander.
/// - `listitem.toggle-expand` tries to expand the expander if it was collapsed
///   or collapses it if it was expanded.
///
/// ## CSS nodes
///
/// ```
/// treeexpander
/// ├── [indent]*
/// ├── [expander]
/// ╰── <child>
/// ```
///
/// `GtkTreeExpander` has zero or one CSS nodes with the name "expander" that
/// should display the expander icon. The node will be `:checked` when it
/// is expanded. If the node is not expandable, an "indent" node will be
/// displayed instead.
///
/// For every level of depth, another "indent" node is prepended.
///
/// ## Accessibility
///
/// Until GTK 4.10, `GtkTreeExpander` used the `gtk.@"AccessibleRole.group"` role.
///
/// Since GTK 4.12, `GtkTreeExpander` uses the `gtk.@"AccessibleRole.button"` role.
/// Toggling it will change the `GTK_ACCESSIBLE_STATE_EXPANDED` state.
pub const TreeExpander = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.TreeExpanderClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget with the actual contents.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the expander icon should be hidden in a GtkTreeListRow.
        /// Note that this property simply hides the icon.  The actions and keybinding
        /// (i.e. collapse and expand) are not affected by this property.
        ///
        /// A common use for this property would be to bind to the number of children in a
        /// GtkTreeListRow's model in order to hide the expander when a row has no children.
        pub const hide_expander = struct {
            pub const name = "hide-expander";

            pub const Type = c_int;
        };

        /// TreeExpander indents the child according to its depth.
        pub const indent_for_depth = struct {
            pub const name = "indent-for-depth";

            pub const Type = c_int;
        };

        /// TreeExpander indents the child by the width of an expander-icon if it is not expandable.
        pub const indent_for_icon = struct {
            pub const name = "indent-for-icon";

            pub const Type = c_int;
        };

        /// The item held by this expander's row.
        pub const item = struct {
            pub const name = "item";

            pub const Type = ?*gobject.Object;
        };

        /// The list row to track for expander state.
        pub const list_row = struct {
            pub const name = "list-row";

            pub const Type = ?*gtk.TreeListRow;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkTreeExpander`
    extern fn gtk_tree_expander_new() *gtk.TreeExpander;
    pub const new = gtk_tree_expander_new;

    /// Gets the child widget displayed by `self`.
    extern fn gtk_tree_expander_get_child(p_self: *TreeExpander) ?*gtk.Widget;
    pub const getChild = gtk_tree_expander_get_child;

    /// Gets whether the TreeExpander should be hidden in a GtkTreeListRow.
    extern fn gtk_tree_expander_get_hide_expander(p_self: *TreeExpander) c_int;
    pub const getHideExpander = gtk_tree_expander_get_hide_expander;

    /// TreeExpander indents each level of depth with an additional indent.
    extern fn gtk_tree_expander_get_indent_for_depth(p_self: *TreeExpander) c_int;
    pub const getIndentForDepth = gtk_tree_expander_get_indent_for_depth;

    /// TreeExpander indents the child by the width of an expander-icon if it is not expandable.
    extern fn gtk_tree_expander_get_indent_for_icon(p_self: *TreeExpander) c_int;
    pub const getIndentForIcon = gtk_tree_expander_get_indent_for_icon;

    /// Forwards the item set on the `GtkTreeListRow` that `self` is managing.
    ///
    /// This call is essentially equivalent to calling:
    ///
    /// ```c
    /// gtk_tree_list_row_get_item (gtk_tree_expander_get_list_row (`self`));
    /// ```
    extern fn gtk_tree_expander_get_item(p_self: *TreeExpander) ?*gobject.Object;
    pub const getItem = gtk_tree_expander_get_item;

    /// Gets the list row managed by `self`.
    extern fn gtk_tree_expander_get_list_row(p_self: *TreeExpander) ?*gtk.TreeListRow;
    pub const getListRow = gtk_tree_expander_get_list_row;

    /// Sets the content widget to display.
    extern fn gtk_tree_expander_set_child(p_self: *TreeExpander, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_tree_expander_set_child;

    /// Sets whether the expander icon should be visible in a GtkTreeListRow.
    extern fn gtk_tree_expander_set_hide_expander(p_self: *TreeExpander, p_hide_expander: c_int) void;
    pub const setHideExpander = gtk_tree_expander_set_hide_expander;

    /// Sets if the TreeExpander should indent the child according to its depth.
    extern fn gtk_tree_expander_set_indent_for_depth(p_self: *TreeExpander, p_indent_for_depth: c_int) void;
    pub const setIndentForDepth = gtk_tree_expander_set_indent_for_depth;

    /// Sets if the TreeExpander should indent the child by the width of an expander-icon when it is not expandable.
    extern fn gtk_tree_expander_set_indent_for_icon(p_self: *TreeExpander, p_indent_for_icon: c_int) void;
    pub const setIndentForIcon = gtk_tree_expander_set_indent_for_icon;

    /// Sets the tree list row that this expander should manage.
    extern fn gtk_tree_expander_set_list_row(p_self: *TreeExpander, p_list_row: ?*gtk.TreeListRow) void;
    pub const setListRow = gtk_tree_expander_set_list_row;

    extern fn gtk_tree_expander_get_type() usize;
    pub const getGObjectType = gtk_tree_expander_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeExpander) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeExpander) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeExpander, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A list model that can create child models on demand.
pub const TreeListModel = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gio.ListModel};
    pub const Class = gtk.TreeListModelClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If all rows should be expanded by default.
        pub const autoexpand = struct {
            pub const name = "autoexpand";

            pub const Type = c_int;
        };

        /// The type of items. See `gio.ListModel.getItemType`.
        pub const item_type = struct {
            pub const name = "item-type";

            pub const Type = usize;
        };

        /// The root model displayed.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gio.ListModel;
        };

        /// The number of items. See `gio.ListModel.getNItems`.
        pub const n_items = struct {
            pub const name = "n-items";

            pub const Type = c_uint;
        };

        /// Gets whether the model is in passthrough mode.
        ///
        /// If `FALSE`, the `GListModel` functions for this object return custom
        /// `gtk.TreeListRow` objects. If `TRUE`, the values of the child
        /// models are pass through unmodified.
        pub const passthrough = struct {
            pub const name = "passthrough";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new empty `GtkTreeListModel` displaying `root`
    /// with all rows collapsed.
    extern fn gtk_tree_list_model_new(p_root: *gio.ListModel, p_passthrough: c_int, p_autoexpand: c_int, p_create_func: gtk.TreeListModelCreateModelFunc, p_user_data: ?*anyopaque, p_user_destroy: ?glib.DestroyNotify) *gtk.TreeListModel;
    pub const new = gtk_tree_list_model_new;

    /// Gets whether the model is set to automatically expand new rows
    /// that get added.
    ///
    /// This can be either rows added by changes to the underlying
    /// models or via `gtk.TreeListRow.setExpanded`.
    extern fn gtk_tree_list_model_get_autoexpand(p_self: *TreeListModel) c_int;
    pub const getAutoexpand = gtk_tree_list_model_get_autoexpand;

    /// Gets the row item corresponding to the child at index `position` for
    /// `self`'s root model.
    ///
    /// If `position` is greater than the number of children in the root model,
    /// `NULL` is returned.
    ///
    /// Do not confuse this function with `gtk.TreeListModel.getRow`.
    extern fn gtk_tree_list_model_get_child_row(p_self: *TreeListModel, p_position: c_uint) ?*gtk.TreeListRow;
    pub const getChildRow = gtk_tree_list_model_get_child_row;

    /// Gets the root model that `self` was created with.
    extern fn gtk_tree_list_model_get_model(p_self: *TreeListModel) *gio.ListModel;
    pub const getModel = gtk_tree_list_model_get_model;

    /// Gets whether the model is passing through original row items.
    ///
    /// If this function returns `FALSE`, the `GListModel` functions for `self`
    /// return custom `GtkTreeListRow` objects. You need to call
    /// `gtk.TreeListRow.getItem` on these objects to get the original
    /// item.
    ///
    /// If `TRUE`, the values of the child models are passed through in their
    /// original state. You then need to call `gtk.TreeListModel.getRow`
    /// to get the custom `GtkTreeListRow`s.
    extern fn gtk_tree_list_model_get_passthrough(p_self: *TreeListModel) c_int;
    pub const getPassthrough = gtk_tree_list_model_get_passthrough;

    /// Gets the row object for the given row.
    ///
    /// If `position` is greater than the number of items in `self`,
    /// `NULL` is returned.
    ///
    /// The row object can be used to expand and collapse rows as
    /// well as to inspect its position in the tree. See its
    /// documentation for details.
    ///
    /// This row object is persistent and will refer to the current
    /// item as long as the row is present in `self`, independent of
    /// other rows being added or removed.
    ///
    /// If `self` is set to not be passthrough, this function is
    /// equivalent to calling `gio.ListModel.getItem`.
    ///
    /// Do not confuse this function with `gtk.TreeListModel.getChildRow`.
    extern fn gtk_tree_list_model_get_row(p_self: *TreeListModel, p_position: c_uint) ?*gtk.TreeListRow;
    pub const getRow = gtk_tree_list_model_get_row;

    /// Sets whether the model should autoexpand.
    ///
    /// If set to `TRUE`, the model will recursively expand all rows that
    /// get added to the model. This can be either rows added by changes
    /// to the underlying models or via `gtk.TreeListRow.setExpanded`.
    extern fn gtk_tree_list_model_set_autoexpand(p_self: *TreeListModel, p_autoexpand: c_int) void;
    pub const setAutoexpand = gtk_tree_list_model_set_autoexpand;

    extern fn gtk_tree_list_model_get_type() usize;
    pub const getGObjectType = gtk_tree_list_model_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeListModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeListModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeListModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The type of item used by `GtkTreeListModel`.
///
/// It allows navigating the model as a tree and modify the state of rows.
///
/// `GtkTreeListRow` instances are created by a `GtkTreeListModel` only
/// when the `gtk.TreeListModel.properties.passthrough` property is not set.
///
/// There are various support objects that can make use of `GtkTreeListRow`
/// objects, such as the `gtk.TreeExpander` widget that allows displaying
/// an icon to expand or collapse a row or `gtk.TreeListRowSorter` that
/// makes it possible to sort trees properly.
pub const TreeListRow = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.TreeListRowClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The model holding the row's children.
        pub const children = struct {
            pub const name = "children";

            pub const Type = ?*gio.ListModel;
        };

        /// The depth in the tree of this row.
        pub const depth = struct {
            pub const name = "depth";

            pub const Type = c_uint;
        };

        /// If this row can ever be expanded.
        pub const expandable = struct {
            pub const name = "expandable";

            pub const Type = c_int;
        };

        /// If this row is currently expanded.
        pub const expanded = struct {
            pub const name = "expanded";

            pub const Type = c_int;
        };

        /// The item held in this row.
        pub const item = struct {
            pub const name = "item";

            pub const Type = ?*gobject.Object;
        };
    };

    pub const signals = struct {};

    /// If `self` is not expanded or `position` is greater than the
    /// number of children, `NULL` is returned.
    extern fn gtk_tree_list_row_get_child_row(p_self: *TreeListRow, p_position: c_uint) ?*gtk.TreeListRow;
    pub const getChildRow = gtk_tree_list_row_get_child_row;

    /// If the row is expanded, gets the model holding the children of `self`.
    ///
    /// This model is the model created by the
    /// `gtk.TreeListModelCreateModelFunc`
    /// and contains the original items, no matter what value
    /// `gtk.TreeListModel.properties.passthrough` is set to.
    extern fn gtk_tree_list_row_get_children(p_self: *TreeListRow) ?*gio.ListModel;
    pub const getChildren = gtk_tree_list_row_get_children;

    /// Gets the depth of this row.
    ///
    /// Rows that correspond to items in the root model have a depth
    /// of zero, rows corresponding to items of models of direct children
    /// of the root model have a depth of 1 and so on.
    ///
    /// The depth of a row never changes until the row is removed from its model
    /// at which point it will forever return 0.
    extern fn gtk_tree_list_row_get_depth(p_self: *TreeListRow) c_uint;
    pub const getDepth = gtk_tree_list_row_get_depth;

    /// Gets if a row is currently expanded.
    extern fn gtk_tree_list_row_get_expanded(p_self: *TreeListRow) c_int;
    pub const getExpanded = gtk_tree_list_row_get_expanded;

    /// Gets the item corresponding to this row,
    extern fn gtk_tree_list_row_get_item(p_self: *TreeListRow) ?*gobject.Object;
    pub const getItem = gtk_tree_list_row_get_item;

    /// Gets the row representing the parent for `self`.
    ///
    /// That is the row that would need to be collapsed
    /// to make this row disappear.
    ///
    /// If `self` is a row corresponding to the root model,
    /// `NULL` is returned.
    ///
    /// The value returned by this function never changes
    /// until the row is removed from its model at which point
    /// it will forever return `NULL`.
    extern fn gtk_tree_list_row_get_parent(p_self: *TreeListRow) ?*gtk.TreeListRow;
    pub const getParent = gtk_tree_list_row_get_parent;

    /// Returns the position in the `GtkTreeListModel` that `self` occupies
    /// at the moment.
    extern fn gtk_tree_list_row_get_position(p_self: *TreeListRow) c_uint;
    pub const getPosition = gtk_tree_list_row_get_position;

    /// Checks if a row can be expanded.
    ///
    /// This does not mean that the row is actually expanded,
    /// this can be checked with `gtk.TreeListRow.getExpanded`.
    ///
    /// If a row is expandable never changes until the row is removed
    /// from its model at which point it will forever return `FALSE`.
    extern fn gtk_tree_list_row_is_expandable(p_self: *TreeListRow) c_int;
    pub const isExpandable = gtk_tree_list_row_is_expandable;

    /// Expands or collapses a row.
    ///
    /// If a row is expanded, the model of calling the
    /// `gtk.TreeListModelCreateModelFunc` for the row's
    /// item will be inserted after this row. If a row is collapsed,
    /// those items will be removed from the model.
    ///
    /// If the row is not expandable, this function does nothing.
    extern fn gtk_tree_list_row_set_expanded(p_self: *TreeListRow, p_expanded: c_int) void;
    pub const setExpanded = gtk_tree_list_row_set_expanded;

    extern fn gtk_tree_list_row_get_type() usize;
    pub const getGObjectType = gtk_tree_list_row_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeListRow) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeListRow) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeListRow, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Applies a gives sorter to the levels in a tree.
///
/// Here is an example for setting up a column view with a tree model and
/// a `GtkTreeListSorter`:
///
/// ```c
/// column_sorter = gtk_column_view_get_sorter (view);
/// sorter = gtk_tree_list_row_sorter_new (g_object_ref (column_sorter));
/// sort_model = gtk_sort_list_model_new (tree_model, sorter);
/// selection = gtk_single_selection_new (sort_model);
/// gtk_column_view_set_model (view, G_LIST_MODEL (selection));
/// ```
pub const TreeListRowSorter = opaque {
    pub const Parent = gtk.Sorter;
    pub const Implements = [_]type{};
    pub const Class = gtk.TreeListRowSorterClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The underlying sorter
        pub const sorter = struct {
            pub const name = "sorter";

            pub const Type = ?*gtk.Sorter;
        };
    };

    pub const signals = struct {};

    /// Create a special-purpose sorter that applies the sorting
    /// of `sorter` to the levels of a `GtkTreeListModel`.
    ///
    /// Note that this sorter relies on `gtk.TreeListModel.properties.passthrough`
    /// being `FALSE` as it can only sort `gtk.TreeListRow`s.
    extern fn gtk_tree_list_row_sorter_new(p_sorter: ?*gtk.Sorter) *gtk.TreeListRowSorter;
    pub const new = gtk_tree_list_row_sorter_new;

    /// Returns the sorter used by `self`.
    extern fn gtk_tree_list_row_sorter_get_sorter(p_self: *TreeListRowSorter) ?*gtk.Sorter;
    pub const getSorter = gtk_tree_list_row_sorter_get_sorter;

    /// Sets the sorter to use for items with the same parent.
    ///
    /// This sorter will be passed the `gtk.TreeListRow.properties.item` of
    /// the tree list rows passed to `self`.
    extern fn gtk_tree_list_row_sorter_set_sorter(p_self: *TreeListRowSorter, p_sorter: ?*gtk.Sorter) void;
    pub const setSorter = gtk_tree_list_row_sorter_set_sorter;

    extern fn gtk_tree_list_row_sorter_get_type() usize;
    pub const getGObjectType = gtk_tree_list_row_sorter_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeListRowSorter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeListRowSorter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeListRowSorter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkTreeModel` which hides parts of an underlying tree model
///
/// A `GtkTreeModelFilter` is a tree model which wraps another tree model,
/// and can do the following things:
///
/// - Filter specific rows, based on data from a “visible column”, a column
///   storing booleans indicating whether the row should be filtered or not,
///   or based on the return value of a “visible function”, which gets a
///   model, iter and user_data and returns a boolean indicating whether the
///   row should be filtered or not.
///
/// - Modify the “appearance” of the model, using a modify function.
///   This is extremely powerful and allows for just changing some
///   values and also for creating a completely different model based
///   on the given child model.
///
/// - Set a different root node, also known as a “virtual root”. You can pass
///   in a `GtkTreePath` indicating the root node for the filter at construction
///   time.
///
/// The basic API is similar to `GtkTreeModelSort`. For an example on its usage,
/// see the section on `GtkTreeModelSort`.
///
/// When using `GtkTreeModelFilter`, it is important to realize that
/// `GtkTreeModelFilter` maintains an internal cache of all nodes which are
/// visible in its clients. The cache is likely to be a subtree of the tree
/// exposed by the child model. `GtkTreeModelFilter` will not cache the entire
/// child model when unnecessary to not compromise the caching mechanism
/// that is exposed by the reference counting scheme. If the child model
/// implements reference counting, unnecessary signals may not be emitted
/// because of reference counting rule 3, see the `GtkTreeModel`
/// documentation. (Note that e.g. `GtkTreeStore` does not implement
/// reference counting and will always emit all signals, even when
/// the receiving node is not visible).
///
/// Because of this, limitations for possible visible functions do apply.
/// In general, visible functions should only use data or properties from
/// the node for which the visibility state must be determined, its siblings
/// or its parents. Usually, having a dependency on the state of any child
/// node is not possible, unless references are taken on these explicitly.
/// When no such reference exists, no signals may be received for these child
/// nodes (see reference counting rule number 3 in the `GtkTreeModel` section).
///
/// Determining the visibility state of a given node based on the state
/// of its child nodes is a frequently occurring use case. Therefore,
/// `GtkTreeModelFilter` explicitly supports this. For example, when a node
/// does not have any children, you might not want the node to be visible.
/// As soon as the first row is added to the node’s child level (or the
/// last row removed), the node’s visibility should be updated.
///
/// This introduces a dependency from the node on its child nodes. In order
/// to accommodate this, `GtkTreeModelFilter` must make sure the necessary
/// signals are received from the child model. This is achieved by building,
/// for all nodes which are exposed as visible nodes to `GtkTreeModelFilter`'s
/// clients, the child level (if any) and take a reference on the first node
/// in this level. Furthermore, for every row-inserted, row-changed or
/// row-deleted signal (also these which were not handled because the node
/// was not cached), `GtkTreeModelFilter` will check if the visibility state
/// of any parent node has changed.
///
/// Beware, however, that this explicit support is limited to these two
/// cases. For example, if you want a node to be visible only if two nodes
/// in a child’s child level (2 levels deeper) are visible, you are on your
/// own. In this case, either rely on `GtkTreeStore` to emit all signals
/// because it does not implement reference counting, or for models that
/// do implement reference counting, obtain references on these child levels
/// yourself.
pub const TreeModelFilter = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gtk.TreeDragSource, gtk.TreeModel };
    pub const Class = gtk.TreeModelFilterClass;
    f_parent: gobject.Object,
    f_priv: ?*gtk.TreeModelFilterPrivate,

    pub const virtual_methods = struct {
        pub const modify = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_child_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_value: *gobject.Value, p_column: c_int) void {
                return gobject.ext.as(TreeModelFilter.Class, p_class).f_modify.?(gobject.ext.as(TreeModelFilter, p_self), p_child_model, p_iter, p_value, p_column);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_child_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_value: *gobject.Value, p_column: c_int) callconv(.c) void) void {
                gobject.ext.as(TreeModelFilter.Class, p_class).f_modify = @ptrCast(p_implementation);
            }
        };

        pub const visible = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_child_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModelFilter.Class, p_class).f_visible.?(gobject.ext.as(TreeModelFilter, p_self), p_child_model, p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_child_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModelFilter.Class, p_class).f_visible = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The child model of the tree model filter.
        pub const child_model = struct {
            pub const name = "child-model";

            pub const Type = ?*gtk.TreeModel;
        };

        /// The virtual root of the tree model filter.
        pub const virtual_root = struct {
            pub const name = "virtual-root";

            pub const Type = ?*gtk.TreePath;
        };
    };

    pub const signals = struct {};

    /// This function should almost never be called. It clears the `filter`
    /// of any cached iterators that haven’t been reffed with
    /// `gtk.TreeModel.refNode`. This might be useful if the child model
    /// being filtered is static (and doesn’t change often) and there has been
    /// a lot of unreffed access to nodes. As a side effect of this function,
    /// all unreffed iters will be invalid.
    extern fn gtk_tree_model_filter_clear_cache(p_filter: *TreeModelFilter) void;
    pub const clearCache = gtk_tree_model_filter_clear_cache;

    /// Sets `filter_iter` to point to the row in `filter` that corresponds to the
    /// row pointed at by `child_iter`.  If `filter_iter` was not set, `FALSE` is
    /// returned.
    extern fn gtk_tree_model_filter_convert_child_iter_to_iter(p_filter: *TreeModelFilter, p_filter_iter: *gtk.TreeIter, p_child_iter: *gtk.TreeIter) c_int;
    pub const convertChildIterToIter = gtk_tree_model_filter_convert_child_iter_to_iter;

    /// Converts `child_path` to a path relative to `filter`. That is, `child_path`
    /// points to a path in the child model. The rerturned path will point to the
    /// same row in the filtered model. If `child_path` isn’t a valid path on the
    /// child model or points to a row which is not visible in `filter`, then `NULL`
    /// is returned.
    extern fn gtk_tree_model_filter_convert_child_path_to_path(p_filter: *TreeModelFilter, p_child_path: *gtk.TreePath) ?*gtk.TreePath;
    pub const convertChildPathToPath = gtk_tree_model_filter_convert_child_path_to_path;

    /// Sets `child_iter` to point to the row pointed to by `filter_iter`.
    extern fn gtk_tree_model_filter_convert_iter_to_child_iter(p_filter: *TreeModelFilter, p_child_iter: *gtk.TreeIter, p_filter_iter: *gtk.TreeIter) void;
    pub const convertIterToChildIter = gtk_tree_model_filter_convert_iter_to_child_iter;

    /// Converts `filter_path` to a path on the child model of `filter`. That is,
    /// `filter_path` points to a location in `filter`. The returned path will
    /// point to the same location in the model not being filtered. If `filter_path`
    /// does not point to a location in the child model, `NULL` is returned.
    extern fn gtk_tree_model_filter_convert_path_to_child_path(p_filter: *TreeModelFilter, p_filter_path: *gtk.TreePath) ?*gtk.TreePath;
    pub const convertPathToChildPath = gtk_tree_model_filter_convert_path_to_child_path;

    /// Returns a pointer to the child model of `filter`.
    extern fn gtk_tree_model_filter_get_model(p_filter: *TreeModelFilter) *gtk.TreeModel;
    pub const getModel = gtk_tree_model_filter_get_model;

    /// Emits ::row_changed for each row in the child model, which causes
    /// the filter to re-evaluate whether a row is visible or not.
    extern fn gtk_tree_model_filter_refilter(p_filter: *TreeModelFilter) void;
    pub const refilter = gtk_tree_model_filter_refilter;

    /// With the `n_columns` and `types` parameters, you give an array of column
    /// types for this model (which will be exposed to the parent model/view).
    /// The `func`, `data` and `destroy` parameters are for specifying the modify
    /// function. The modify function will get called for each
    /// data access, the goal of the modify function is to return the data which
    /// should be displayed at the location specified using the parameters of the
    /// modify function.
    ///
    /// Note that `gtk.TreeModelFilter.setModifyFunc`
    /// can only be called once for a given filter model.
    extern fn gtk_tree_model_filter_set_modify_func(p_filter: *TreeModelFilter, p_n_columns: c_int, p_types: [*]usize, p_func: gtk.TreeModelFilterModifyFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setModifyFunc = gtk_tree_model_filter_set_modify_func;

    /// Sets `column` of the child_model to be the column where `filter` should
    /// look for visibility information. `columns` should be a column of type
    /// `G_TYPE_BOOLEAN`, where `TRUE` means that a row is visible, and `FALSE`
    /// if not.
    ///
    /// Note that `gtk.TreeModelFilter.setVisibleFunc` or
    /// `gtk.TreeModelFilter.setVisibleColumn` can only be called
    /// once for a given filter model.
    extern fn gtk_tree_model_filter_set_visible_column(p_filter: *TreeModelFilter, p_column: c_int) void;
    pub const setVisibleColumn = gtk_tree_model_filter_set_visible_column;

    /// Sets the visible function used when filtering the `filter` to be `func`.
    /// The function should return `TRUE` if the given row should be visible and
    /// `FALSE` otherwise.
    ///
    /// If the condition calculated by the function changes over time (e.g.
    /// because it depends on some global parameters), you must call
    /// `gtk.TreeModelFilter.refilter` to keep the visibility information
    /// of the model up-to-date.
    ///
    /// Note that `func` is called whenever a row is inserted, when it may still
    /// be empty. The visible function should therefore take special care of empty
    /// rows, like in the example below.
    ///
    /// ```c
    /// static gboolean
    /// visible_func (GtkTreeModel *model,
    ///               GtkTreeIter  *iter,
    ///               gpointer      data)
    /// {
    ///   // Visible if row is non-empty and first column is “HI”
    ///   char *str;
    ///   gboolean visible = FALSE;
    ///
    ///   gtk_tree_model_get (model, iter, 0, &str, -1);
    ///   if (str && strcmp (str, "HI") == 0)
    ///     visible = TRUE;
    ///   g_free (str);
    ///
    ///   return visible;
    /// }
    /// ```
    ///
    /// Note that `gtk.TreeModelFilter.setVisibleFunc` or
    /// `gtk.TreeModelFilter.setVisibleColumn` can only be called
    /// once for a given filter model.
    extern fn gtk_tree_model_filter_set_visible_func(p_filter: *TreeModelFilter, p_func: gtk.TreeModelFilterVisibleFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setVisibleFunc = gtk_tree_model_filter_set_visible_func;

    extern fn gtk_tree_model_filter_get_type() usize;
    pub const getGObjectType = gtk_tree_model_filter_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeModelFilter) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeModelFilter) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeModelFilter, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A GtkTreeModel which makes an underlying tree model sortable
///
/// The `GtkTreeModelSort` is a model which implements the `GtkTreeSortable`
/// interface.  It does not hold any data itself, but rather is created with
/// a child model and proxies its data.  It has identical column types to
/// this child model, and the changes in the child are propagated.  The
/// primary purpose of this model is to provide a way to sort a different
/// model without modifying it. Note that the sort function used by
/// `GtkTreeModelSort` is not guaranteed to be stable.
///
/// The use of this is best demonstrated through an example.  In the
/// following sample code we create two `GtkTreeView` widgets each with a
/// view of the same data.  As the model is wrapped here by a
/// `GtkTreeModelSort`, the two `GtkTreeView`s can each sort their
/// view of the data without affecting the other.  By contrast, if we
/// simply put the same model in each widget, then sorting the first would
/// sort the second.
///
/// ## Using a `GtkTreeModelSort`
///
/// ```c
/// {
///   GtkTreeView *tree_view1;
///   GtkTreeView *tree_view2;
///   GtkTreeModel *sort_model1;
///   GtkTreeModel *sort_model2;
///   GtkTreeModel *child_model;
///
///   // get the child model
///   child_model = get_my_model ();
///
///   // Create the first tree
///   sort_model1 = gtk_tree_model_sort_new_with_model (child_model);
///   tree_view1 = gtk_tree_view_new_with_model (sort_model1);
///
///   // Create the second tree
///   sort_model2 = gtk_tree_model_sort_new_with_model (child_model);
///   tree_view2 = gtk_tree_view_new_with_model (sort_model2);
///
///   // Now we can sort the two models independently
///   gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model1),
///                                         COLUMN_1, GTK_SORT_ASCENDING);
///   gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model2),
///                                         COLUMN_1, GTK_SORT_DESCENDING);
/// }
/// ```
///
/// To demonstrate how to access the underlying child model from the sort
/// model, the next example will be a callback for the `GtkTreeSelection`
/// `GtkTreeSelection::changed` signal.  In this callback, we get a string
/// from COLUMN_1 of the model.  We then modify the string, find the same
/// selected row on the child model, and change the row there.
///
/// ## Accessing the child model of in a selection changed callback
///
/// ```c
/// void
/// selection_changed (GtkTreeSelection *selection, gpointer data)
/// {
///   GtkTreeModel *sort_model = NULL;
///   GtkTreeModel *child_model;
///   GtkTreeIter sort_iter;
///   GtkTreeIter child_iter;
///   char *some_data = NULL;
///   char *modified_data;
///
///   // Get the current selected row and the model.
///   if (! gtk_tree_selection_get_selected (selection,
///                                          &sort_model,
///                                          &sort_iter))
///     return;
///
///   // Look up the current value on the selected row and get
///   // a new value to change it to.
///   gtk_tree_model_get (GTK_TREE_MODEL (sort_model), &sort_iter,
///                       COLUMN_1, &some_data,
///                       -1);
///
///   modified_data = change_the_data (some_data);
///   g_free (some_data);
///
///   // Get an iterator on the child model, instead of the sort model.
///   gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (sort_model),
///                                                   &child_iter,
///                                                   &sort_iter);
///
///   // Get the child model and change the value of the row. In this
///   // example, the child model is a GtkListStore. It could be any other
///   // type of model, though.
///   child_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model));
///   gtk_list_store_set (GTK_LIST_STORE (child_model), &child_iter,
///                       COLUMN_1, &modified_data,
///                       -1);
///   g_free (modified_data);
/// }
/// ```
pub const TreeModelSort = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gtk.TreeDragSource, gtk.TreeModel, gtk.TreeSortable };
    pub const Class = gtk.TreeModelSortClass;
    f_parent: gobject.Object,
    f_priv: ?*gtk.TreeModelSortPrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The model of the tree model sort.
        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkTreeModelSort`, with `child_model` as the child model.
    extern fn gtk_tree_model_sort_new_with_model(p_child_model: *gtk.TreeModel) *gtk.TreeModelSort;
    pub const newWithModel = gtk_tree_model_sort_new_with_model;

    /// This function should almost never be called.  It clears the `tree_model_sort`
    /// of any cached iterators that haven’t been reffed with
    /// `gtk.TreeModel.refNode`.  This might be useful if the child model being
    /// sorted is static (and doesn’t change often) and there has been a lot of
    /// unreffed access to nodes.  As a side effect of this function, all unreffed
    /// iters will be invalid.
    extern fn gtk_tree_model_sort_clear_cache(p_tree_model_sort: *TreeModelSort) void;
    pub const clearCache = gtk_tree_model_sort_clear_cache;

    /// Sets `sort_iter` to point to the row in `tree_model_sort` that corresponds to
    /// the row pointed at by `child_iter`.  If `sort_iter` was not set, `FALSE`
    /// is returned.  Note: a boolean is only returned since 2.14.
    extern fn gtk_tree_model_sort_convert_child_iter_to_iter(p_tree_model_sort: *TreeModelSort, p_sort_iter: *gtk.TreeIter, p_child_iter: *gtk.TreeIter) c_int;
    pub const convertChildIterToIter = gtk_tree_model_sort_convert_child_iter_to_iter;

    /// Converts `child_path` to a path relative to `tree_model_sort`.  That is,
    /// `child_path` points to a path in the child model.  The returned path will
    /// point to the same row in the sorted model.  If `child_path` isn’t a valid
    /// path on the child model, then `NULL` is returned.
    extern fn gtk_tree_model_sort_convert_child_path_to_path(p_tree_model_sort: *TreeModelSort, p_child_path: *gtk.TreePath) ?*gtk.TreePath;
    pub const convertChildPathToPath = gtk_tree_model_sort_convert_child_path_to_path;

    /// Sets `child_iter` to point to the row pointed to by `sorted_iter`.
    extern fn gtk_tree_model_sort_convert_iter_to_child_iter(p_tree_model_sort: *TreeModelSort, p_child_iter: *gtk.TreeIter, p_sorted_iter: *gtk.TreeIter) void;
    pub const convertIterToChildIter = gtk_tree_model_sort_convert_iter_to_child_iter;

    /// Converts `sorted_path` to a path on the child model of `tree_model_sort`.
    /// That is, `sorted_path` points to a location in `tree_model_sort`.  The
    /// returned path will point to the same location in the model not being
    /// sorted.  If `sorted_path` does not point to a location in the child model,
    /// `NULL` is returned.
    extern fn gtk_tree_model_sort_convert_path_to_child_path(p_tree_model_sort: *TreeModelSort, p_sorted_path: *gtk.TreePath) ?*gtk.TreePath;
    pub const convertPathToChildPath = gtk_tree_model_sort_convert_path_to_child_path;

    /// Returns the model the `GtkTreeModelSort` is sorting.
    extern fn gtk_tree_model_sort_get_model(p_tree_model: *TreeModelSort) *gtk.TreeModel;
    pub const getModel = gtk_tree_model_sort_get_model;

    /// > This function is slow. Only use it for debugging and/or testing
    /// > purposes.
    ///
    /// Checks if the given iter is a valid iter for this `GtkTreeModelSort`.
    extern fn gtk_tree_model_sort_iter_is_valid(p_tree_model_sort: *TreeModelSort, p_iter: *gtk.TreeIter) c_int;
    pub const iterIsValid = gtk_tree_model_sort_iter_is_valid;

    /// This resets the default sort function to be in the “unsorted” state.  That
    /// is, it is in the same order as the child model. It will re-sort the model
    /// to be in the same order as the child model only if the `GtkTreeModelSort`
    /// is in “unsorted” state.
    extern fn gtk_tree_model_sort_reset_default_sort_func(p_tree_model_sort: *TreeModelSort) void;
    pub const resetDefaultSortFunc = gtk_tree_model_sort_reset_default_sort_func;

    extern fn gtk_tree_model_sort_get_type() usize;
    pub const getGObjectType = gtk_tree_model_sort_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeModelSort) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeModelSort) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeModelSort, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The selection object for GtkTreeView
///
/// The `GtkTreeSelection` object is a helper object to manage the selection
/// for a `GtkTreeView` widget.  The `GtkTreeSelection` object is
/// automatically created when a new `GtkTreeView` widget is created, and
/// cannot exist independently of this widget.  The primary reason the
/// `GtkTreeSelection` objects exists is for cleanliness of code and API.
/// That is, there is no conceptual reason all these functions could not be
/// methods on the `GtkTreeView` widget instead of a separate function.
///
/// The `GtkTreeSelection` object is gotten from a `GtkTreeView` by calling
/// `gtk.TreeView.getSelection`.  It can be manipulated to check the
/// selection status of the tree, as well as select and deselect individual
/// rows.  Selection is done completely view side.  As a result, multiple
/// views of the same model can have completely different selections.
/// Additionally, you cannot change the selection of a row on the model that
/// is not currently displayed by the view without expanding its parents
/// first.
///
/// One of the important things to remember when monitoring the selection of
/// a view is that the `GtkTreeSelection`::changed signal is mostly a hint.
/// That is, it may only emit one signal when a range of rows is selected.
/// Additionally, it may on occasion emit a `GtkTreeSelection`::changed signal
/// when nothing has happened (mostly as a result of programmers calling
/// select_row on an already selected row).
pub const TreeSelection = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = TreeSelection;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Selection mode.
        /// See `gtk.TreeSelection.setMode` for more information on this property.
        pub const mode = struct {
            pub const name = "mode";

            pub const Type = gtk.SelectionMode;
        };
    };

    pub const signals = struct {
        /// Emitted whenever the selection has (possibly) changed. Please note that
        /// this signal is mostly a hint.  It may only be emitted once when a range
        /// of rows are selected, and it may occasionally be emitted when nothing
        /// has happened.
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeSelection, p_instance))),
                    gobject.signalLookup("changed", TreeSelection.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns the number of rows that have been selected in `tree`.
    extern fn gtk_tree_selection_count_selected_rows(p_selection: *TreeSelection) c_int;
    pub const countSelectedRows = gtk_tree_selection_count_selected_rows;

    /// Gets the selection mode for `selection`. See
    /// `gtk.TreeSelection.setMode`.
    extern fn gtk_tree_selection_get_mode(p_selection: *TreeSelection) gtk.SelectionMode;
    pub const getMode = gtk_tree_selection_get_mode;

    /// Returns the current selection function.
    extern fn gtk_tree_selection_get_select_function(p_selection: *TreeSelection) gtk.TreeSelectionFunc;
    pub const getSelectFunction = gtk_tree_selection_get_select_function;

    /// Sets `iter` to the currently selected node if `selection` is set to
    /// `GTK_SELECTION_SINGLE` or `GTK_SELECTION_BROWSE`.  `iter` may be NULL if you
    /// just want to test if `selection` has any selected nodes.  `model` is filled
    /// with the current model as a convenience.  This function will not work if you
    /// use `selection` is `GTK_SELECTION_MULTIPLE`.
    extern fn gtk_tree_selection_get_selected(p_selection: *TreeSelection, p_model: ?**gtk.TreeModel, p_iter: ?*gtk.TreeIter) c_int;
    pub const getSelected = gtk_tree_selection_get_selected;

    /// Creates a list of path of all selected rows. Additionally, if you are
    /// planning on modifying the model after calling this function, you may
    /// want to convert the returned list into a list of `GtkTreeRowReference`s.
    /// To do this, you can use `gtk.TreeRowReference.new`.
    ///
    /// To free the return value, use:
    ///
    /// ```c
    /// g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
    /// ```
    extern fn gtk_tree_selection_get_selected_rows(p_selection: *TreeSelection, p_model: ?**gtk.TreeModel) *glib.List;
    pub const getSelectedRows = gtk_tree_selection_get_selected_rows;

    /// Returns the tree view associated with `selection`.
    extern fn gtk_tree_selection_get_tree_view(p_selection: *TreeSelection) *gtk.TreeView;
    pub const getTreeView = gtk_tree_selection_get_tree_view;

    /// Returns the user data for the selection function.
    extern fn gtk_tree_selection_get_user_data(p_selection: *TreeSelection) ?*anyopaque;
    pub const getUserData = gtk_tree_selection_get_user_data;

    /// Returns `TRUE` if the row at `iter` is currently selected.
    extern fn gtk_tree_selection_iter_is_selected(p_selection: *TreeSelection, p_iter: *gtk.TreeIter) c_int;
    pub const iterIsSelected = gtk_tree_selection_iter_is_selected;

    /// Returns `TRUE` if the row pointed to by `path` is currently selected.  If `path`
    /// does not point to a valid location, `FALSE` is returned
    extern fn gtk_tree_selection_path_is_selected(p_selection: *TreeSelection, p_path: *gtk.TreePath) c_int;
    pub const pathIsSelected = gtk_tree_selection_path_is_selected;

    /// Selects all the nodes. `selection` must be set to `GTK_SELECTION_MULTIPLE`
    /// mode.
    extern fn gtk_tree_selection_select_all(p_selection: *TreeSelection) void;
    pub const selectAll = gtk_tree_selection_select_all;

    /// Selects the specified iterator.
    extern fn gtk_tree_selection_select_iter(p_selection: *TreeSelection, p_iter: *gtk.TreeIter) void;
    pub const selectIter = gtk_tree_selection_select_iter;

    /// Select the row at `path`.
    extern fn gtk_tree_selection_select_path(p_selection: *TreeSelection, p_path: *gtk.TreePath) void;
    pub const selectPath = gtk_tree_selection_select_path;

    /// Selects a range of nodes, determined by `start_path` and `end_path` inclusive.
    /// `selection` must be set to `GTK_SELECTION_MULTIPLE` mode.
    extern fn gtk_tree_selection_select_range(p_selection: *TreeSelection, p_start_path: *gtk.TreePath, p_end_path: *gtk.TreePath) void;
    pub const selectRange = gtk_tree_selection_select_range;

    /// Calls a function for each selected node. Note that you cannot modify
    /// the tree or selection from within this function. As a result,
    /// `gtk.TreeSelection.getSelectedRows` might be more useful.
    extern fn gtk_tree_selection_selected_foreach(p_selection: *TreeSelection, p_func: gtk.TreeSelectionForeachFunc, p_data: ?*anyopaque) void;
    pub const selectedForeach = gtk_tree_selection_selected_foreach;

    /// Sets the selection mode of the `selection`.  If the previous type was
    /// `GTK_SELECTION_MULTIPLE`, then the anchor is kept selected, if it was
    /// previously selected.
    extern fn gtk_tree_selection_set_mode(p_selection: *TreeSelection, p_type: gtk.SelectionMode) void;
    pub const setMode = gtk_tree_selection_set_mode;

    /// Sets the selection function.
    ///
    /// If set, this function is called before any node is selected or unselected,
    /// giving some control over which nodes are selected. The select function
    /// should return `TRUE` if the state of the node may be toggled, and `FALSE`
    /// if the state of the node should be left unchanged.
    extern fn gtk_tree_selection_set_select_function(p_selection: *TreeSelection, p_func: ?gtk.TreeSelectionFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setSelectFunction = gtk_tree_selection_set_select_function;

    /// Unselects all the nodes.
    extern fn gtk_tree_selection_unselect_all(p_selection: *TreeSelection) void;
    pub const unselectAll = gtk_tree_selection_unselect_all;

    /// Unselects the specified iterator.
    extern fn gtk_tree_selection_unselect_iter(p_selection: *TreeSelection, p_iter: *gtk.TreeIter) void;
    pub const unselectIter = gtk_tree_selection_unselect_iter;

    /// Unselects the row at `path`.
    extern fn gtk_tree_selection_unselect_path(p_selection: *TreeSelection, p_path: *gtk.TreePath) void;
    pub const unselectPath = gtk_tree_selection_unselect_path;

    /// Unselects a range of nodes, determined by `start_path` and `end_path`
    /// inclusive.
    extern fn gtk_tree_selection_unselect_range(p_selection: *TreeSelection, p_start_path: *gtk.TreePath, p_end_path: *gtk.TreePath) void;
    pub const unselectRange = gtk_tree_selection_unselect_range;

    extern fn gtk_tree_selection_get_type() usize;
    pub const getGObjectType = gtk_tree_selection_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeSelection) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeSelection) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeSelection, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A tree-like data structure that can be used with the `gtk.TreeView`.
///
/// The `GtkTreeStore` object is a list model for use with a `GtkTreeView`
/// widget. It implements the `gtk.TreeModel` interface, and consequently,
/// can use all of the methods available there. It also implements the
/// `gtk.TreeSortable` interface so it can be sorted by the view.
/// Finally, it also implements the tree [drag]`gtk.TreeDragSource`
/// and [drop]`gtk.TreeDragDest` interfaces.
///
/// `GtkTreeStore` is deprecated since GTK 4.10, and should not be used in newly
/// written code. You should use `gtk.TreeListModel` for a tree-like model
/// object.
///
/// ## GtkTreeStore as GtkBuildable
///
/// The GtkTreeStore implementation of the `GtkBuildable` interface allows
/// to specify the model columns with a `<columns>` element that may contain
/// multiple `<column>` elements, each specifying one model column. The “type”
/// attribute specifies the data type for the column.
///
/// An example of a UI Definition fragment for a tree store:
///
/// ```xml
/// <object class="GtkTreeStore">
///   <columns>
///     <column type="gchararray"/>
///     <column type="gchararray"/>
///     <column type="gint"/>
///   </columns>
/// </object>
/// ```
pub const TreeStore = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{ gtk.Buildable, gtk.TreeDragDest, gtk.TreeDragSource, gtk.TreeModel, gtk.TreeSortable };
    pub const Class = gtk.TreeStoreClass;
    f_parent: gobject.Object,
    f_priv: ?*gtk.TreeStorePrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new tree store.
    ///
    /// The tree store will have `n_columns`, with each column using the
    /// corresponding type passed to this function.
    ///
    /// Note that only types derived from standard GObject fundamental types
    /// are supported.
    ///
    /// As an example:
    ///
    /// ```c
    /// gtk_tree_store_new (3, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_TEXTURE);
    /// ```
    ///
    /// will create a new `GtkTreeStore` with three columns of type
    /// `int`, `gchararray`, and `GdkTexture` respectively.
    extern fn gtk_tree_store_new(p_n_columns: c_int, ...) *gtk.TreeStore;
    pub const new = gtk_tree_store_new;

    /// Creates a new tree store.
    ///
    /// This constructor is meant for language bindings.
    extern fn gtk_tree_store_newv(p_n_columns: c_int, p_types: [*]usize) *gtk.TreeStore;
    pub const newv = gtk_tree_store_newv;

    /// Appends a new row to `tree_store`.
    ///
    /// If `parent` is non-`NULL`, then it will append the new row after the last
    /// child of `parent`, otherwise it will append a row to the top level.
    ///
    /// The `iter` parameter will be changed to point to this new row. The row will
    /// be empty after this function is called. To fill in values, you need to call
    /// `gtk.TreeStore.set` or `gtk.TreeStore.setValue`.
    extern fn gtk_tree_store_append(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter) void;
    pub const append = gtk_tree_store_append;

    /// Removes all rows from `tree_store`
    extern fn gtk_tree_store_clear(p_tree_store: *TreeStore) void;
    pub const clear = gtk_tree_store_clear;

    /// Creates a new row at `position`.
    ///
    /// If parent is non-`NULL`, then the row will be made a child of `parent`.
    /// Otherwise, the row will be created at the toplevel.
    ///
    /// If `position` is `-1` or is larger than the number of rows at that level,
    /// then the new row will be inserted to the end of the list.
    ///
    /// The `iter` parameter will be changed to point to this new row. The row
    /// will be empty after this function is called. To fill in values, you
    /// need to call `gtk.TreeStore.set` or `gtk.TreeStore.setValue`.
    extern fn gtk_tree_store_insert(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_position: c_int) void;
    pub const insert = gtk_tree_store_insert;

    /// Inserts a new row after `sibling`.
    ///
    /// If `sibling` is `NULL`, then the row will be prepended to `parent`’s children.
    ///
    /// If `parent` and `sibling` are `NULL`, then the row will be prepended to the
    /// toplevel.
    ///
    /// If both `sibling` and `parent` are set, then `parent` must be the parent
    /// of `sibling`. When `sibling` is set, `parent` is optional.
    ///
    /// The `iter` parameter will be changed to point to this new row. The row will
    /// be empty after this function is called. To fill in values, you need to call
    /// `gtk.TreeStore.set` or `gtk.TreeStore.setValue`.
    extern fn gtk_tree_store_insert_after(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_sibling: ?*gtk.TreeIter) void;
    pub const insertAfter = gtk_tree_store_insert_after;

    /// Inserts a new row before `sibling`.
    ///
    /// If `sibling` is `NULL`, then the row will be appended to `parent`’s children.
    ///
    /// If `parent` and `sibling` are `NULL`, then the row will be appended to the
    /// toplevel.
    ///
    /// If both `sibling` and `parent` are set, then `parent` must be the parent
    /// of `sibling`. When `sibling` is set, `parent` is optional.
    ///
    /// The `iter` parameter will be changed to point to this new row. The row will
    /// be empty after this function is called. To fill in values, you need to call
    /// `gtk.TreeStore.set` or `gtk.TreeStore.setValue`.
    extern fn gtk_tree_store_insert_before(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_sibling: ?*gtk.TreeIter) void;
    pub const insertBefore = gtk_tree_store_insert_before;

    /// Creates a new row at the given `position`.
    ///
    /// The `iter` parameter will be changed to point to this  new row.
    ///
    /// If `position` is -1, or larger than the number of rows on the list, then
    /// the new row will be appended to the list. The row will be filled with
    /// the values given to this function.
    ///
    /// Calling
    ///
    ///     gtk_tree_store_insert_with_values (tree_store, iter, position, ...)
    ///
    /// has the same effect as calling
    ///
    /// ```c
    /// gtk_tree_store_insert (tree_store, iter, position);
    /// gtk_tree_store_set (tree_store, iter, ...);
    /// ```
    ///
    /// with the different that the former will only emit a row_inserted signal,
    /// while the latter will emit row_inserted, row_changed and if the tree store
    /// is sorted, rows_reordered.
    ///
    /// Since emitting the rows_reordered signal repeatedly can affect the
    /// performance of the program, `gtk.TreeStore.insertWithValues` should
    /// generally be preferred when inserting rows in a sorted tree store.
    extern fn gtk_tree_store_insert_with_values(p_tree_store: *TreeStore, p_iter: ?*gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_position: c_int, ...) void;
    pub const insertWithValues = gtk_tree_store_insert_with_values;

    /// A variant of `gtk.TreeStore.insertWithValues` which takes
    /// the columns and values as two arrays, instead of varargs.
    ///
    /// This function is mainly intended for language bindings.
    extern fn gtk_tree_store_insert_with_valuesv(p_tree_store: *TreeStore, p_iter: ?*gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_position: c_int, p_columns: [*]c_int, p_values: [*]gobject.Value, p_n_values: c_int) void;
    pub const insertWithValuesv = gtk_tree_store_insert_with_valuesv;

    /// Checks if `iter` is an ancestor of `descendant`.
    extern fn gtk_tree_store_is_ancestor(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_descendant: *gtk.TreeIter) c_int;
    pub const isAncestor = gtk_tree_store_is_ancestor;

    /// Returns the depth of the position pointed by the iterator
    ///
    /// The depth will be 0 for anything on the root level, 1 for anything down
    /// a level, etc.
    extern fn gtk_tree_store_iter_depth(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter) c_int;
    pub const iterDepth = gtk_tree_store_iter_depth;

    /// Checks if the given iter is a valid iter for this `GtkTreeStore`.
    ///
    /// This function is slow. Only use it for debugging and/or testing
    /// purposes.
    extern fn gtk_tree_store_iter_is_valid(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter) c_int;
    pub const iterIsValid = gtk_tree_store_iter_is_valid;

    /// Moves `iter` in `tree_store` to the position after `position`.
    ///
    /// `iter` and `position` should be in the same level.
    ///
    /// Note that this function only works with unsorted stores.
    ///
    /// If `position` is `NULL`, `iter` will be moved to the start of the level.
    extern fn gtk_tree_store_move_after(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_position: ?*gtk.TreeIter) void;
    pub const moveAfter = gtk_tree_store_move_after;

    /// Moves `iter` in `tree_store` to the position before `position`.
    ///
    /// `iter` and `position` should be in the same level.
    ///
    /// Note that this function only works with unsorted stores.
    ///
    /// If `position` is `NULL`, `iter` will be moved to the end of the level.
    extern fn gtk_tree_store_move_before(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_position: ?*gtk.TreeIter) void;
    pub const moveBefore = gtk_tree_store_move_before;

    /// Prepends a new row to `tree_store`.
    ///
    /// If `parent` is non-`NULL`, then it will prepend the new row before the first
    /// child of `parent`, otherwise it will prepend a row to the top level. The
    /// `iter` parameter will be changed to point to this new row.  The row will
    /// be empty after this function is called. To fill in values, you need to
    /// call `gtk.TreeStore.set` or `gtk.TreeStore.setValue`.
    extern fn gtk_tree_store_prepend(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter) void;
    pub const prepend = gtk_tree_store_prepend;

    /// Removes `iter` from `tree_store`.
    ///
    /// After being removed, `iter` is set to the next valid row at that level, or
    /// invalidated if it previously pointed to the last one.
    extern fn gtk_tree_store_remove(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter) c_int;
    pub const remove = gtk_tree_store_remove;

    /// Reorders the children of `parent` in `tree_store` to follow the order
    /// indicated by `new_order`.
    ///
    /// Note that this function only works with unsorted stores.
    extern fn gtk_tree_store_reorder(p_tree_store: *TreeStore, p_parent: ?*gtk.TreeIter, p_new_order: [*]c_int) void;
    pub const reorder = gtk_tree_store_reorder;

    /// Sets the value of one or more cells in the row referenced by `iter`.
    ///
    /// The variable argument list should contain integer column numbers,
    /// each column number followed by the value to be set.
    ///
    /// The list is terminated by a value of `-1`.
    ///
    /// For example, to set column 0 with type `G_TYPE_STRING` to “Foo”, you would
    /// write
    ///
    /// ```c
    /// gtk_tree_store_set (store, iter, 0, "Foo", -1);
    /// ```
    ///
    /// The value will be referenced by the store if it is a `G_TYPE_OBJECT`, and it
    /// will be copied if it is a `G_TYPE_STRING` or `G_TYPE_BOXED`.
    extern fn gtk_tree_store_set(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, ...) void;
    pub const set = gtk_tree_store_set;

    /// Sets the type of the columns in a tree store.
    ///
    /// This function is meant primarily for types that inherit from
    /// `GtkTreeStore`, and should only be used when constructing a new
    /// `GtkTreeStore`.
    ///
    /// This functions cannot be called after a row has been added,
    /// or a method on the `GtkTreeModel` interface is called on the
    /// tree store.
    extern fn gtk_tree_store_set_column_types(p_tree_store: *TreeStore, p_n_columns: c_int, p_types: [*]usize) void;
    pub const setColumnTypes = gtk_tree_store_set_column_types;

    /// A version of `gtk.TreeStore.set` using `va_list`.
    extern fn gtk_tree_store_set_valist(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_var_args: std.builtin.VaList) void;
    pub const setValist = gtk_tree_store_set_valist;

    /// Sets the data in the cell specified by `iter` and `column`.
    ///
    /// The type of `value` must be convertible to the type of the
    /// column.
    extern fn gtk_tree_store_set_value(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_column: c_int, p_value: *gobject.Value) void;
    pub const setValue = gtk_tree_store_set_value;

    /// A variant of `gtk.TreeStore.setValist` which takes
    /// the columns and values as two arrays, instead of using variadic
    /// arguments.
    ///
    /// This function is mainly intended for language bindings or in case
    /// the number of columns to change is not known until run-time.
    extern fn gtk_tree_store_set_valuesv(p_tree_store: *TreeStore, p_iter: *gtk.TreeIter, p_columns: [*]c_int, p_values: [*]gobject.Value, p_n_values: c_int) void;
    pub const setValuesv = gtk_tree_store_set_valuesv;

    /// Swaps `a` and `b` in the same level of `tree_store`.
    ///
    /// Note that this function only works with unsorted stores.
    extern fn gtk_tree_store_swap(p_tree_store: *TreeStore, p_a: *gtk.TreeIter, p_b: *gtk.TreeIter) void;
    pub const swap = gtk_tree_store_swap;

    extern fn gtk_tree_store_get_type() usize;
    pub const getGObjectType = gtk_tree_store_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeStore) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeStore) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeStore, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A widget for displaying both trees and lists
///
/// <picture>
///   <source srcset="list-and-tree-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkTreeView" src="list-and-tree.png">
/// </picture>
///
/// Widget that displays any object that implements the `gtk.TreeModel` interface.
///
/// Please refer to the [tree widget conceptual overview](section-tree-widget.html)
/// for an overview of all the objects and data types related to the tree
/// widget and how they work together.
///
/// ## Coordinate systems in GtkTreeView API
///
/// Several different coordinate systems are exposed in the `GtkTreeView` API.
/// These are:
///
/// ![](tree-view-coordinates.png)
///
/// - Widget coordinates: Coordinates relative to the widget (usually `widget->window`).
///
/// - Bin window coordinates: Coordinates relative to the window that GtkTreeView renders to.
///
/// - Tree coordinates: Coordinates relative to the entire scrollable area of GtkTreeView. These
///   coordinates start at (0, 0) for row 0 of the tree.
///
/// Several functions are available for converting between the different
/// coordinate systems.  The most common translations are between widget and bin
/// window coordinates and between bin window and tree coordinates. For the
/// former you can use `gtk.TreeView.convertWidgetToBinWindowCoords`
/// (and vice versa), for the latter `gtk.TreeView.convertBinWindowToTreeCoords`
/// (and vice versa).
///
/// ## `GtkTreeView` as `GtkBuildable`
///
/// The `GtkTreeView` implementation of the `GtkBuildable` interface accepts
/// `gtk.TreeViewColumn` objects as `<child>` elements and exposes the
/// internal `gtk.TreeSelection` in UI definitions.
///
/// An example of a UI definition fragment with `GtkTreeView`:
///
/// ```xml
/// <object class="GtkTreeView" id="treeview">
///   <property name="model">liststore1</property>
///   <child>
///     <object class="GtkTreeViewColumn" id="test-column">
///       <property name="title">Test</property>
///       <child>
///         <object class="GtkCellRendererText" id="test-renderer"/>
///         <attributes>
///           <attribute name="text">1</attribute>
///         </attributes>
///       </child>
///     </object>
///   </child>
///   <child internal-child="selection">
///     <object class="GtkTreeSelection" id="selection">
///       <signal name="changed" handler="on_treeview_selection_changed"/>
///     </object>
///   </child>
/// </object>
/// ```
///
/// ## CSS nodes
///
/// ```
/// treeview.view
/// ├── header
/// │   ├── button
/// │   │   ╰── [sort-indicator]
/// ┊   ┊
/// │   ╰── button
/// │       ╰── [sort-indicator]
/// │
/// ├── [rubberband]
/// ╰── [dndtarget]
/// ```
///
/// `GtkTreeView` has a main CSS node with name `treeview` and style class `.view`.
/// It has a subnode with name `header`, which is the parent for all the column
/// header widgets' CSS nodes.
///
/// Each column header consists of a `button`, which among other content, has a
/// child with name `sort-indicator`, which carries the `.ascending` or `.descending`
/// style classes when the column header should show a sort indicator. The CSS
/// is expected to provide a suitable image using the `-gtk-icon-source` property.
///
/// For rubberband selection, a subnode with name `rubberband` is used.
///
/// For the drop target location during DND, a subnode with name `dndtarget` is used.
pub const TreeView = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Scrollable };
    pub const Class = gtk.TreeViewClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        pub const columns_changed = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TreeView.Class, p_class).f_columns_changed.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TreeView.Class, p_class).f_columns_changed = @ptrCast(p_implementation);
            }
        };

        pub const cursor_changed = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TreeView.Class, p_class).f_cursor_changed.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TreeView.Class, p_class).f_cursor_changed = @ptrCast(p_implementation);
            }
        };

        pub const expand_collapse_cursor_row = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_logical: c_int, p_expand: c_int, p_open_all: c_int) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_expand_collapse_cursor_row.?(gobject.ext.as(TreeView, p_tree_view), p_logical, p_expand, p_open_all);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_logical: c_int, p_expand: c_int, p_open_all: c_int) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_expand_collapse_cursor_row = @ptrCast(p_implementation);
            }
        };

        pub const move_cursor = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, p_modify: c_int) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_move_cursor.?(gobject.ext.as(TreeView, p_tree_view), p_step, p_count, p_extend, p_modify);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, p_modify: c_int) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_move_cursor = @ptrCast(p_implementation);
            }
        };

        /// Activates the cell determined by `path` and `column`.
        pub const row_activated = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_column: ?*gtk.TreeViewColumn) void {
                return gobject.ext.as(TreeView.Class, p_class).f_row_activated.?(gobject.ext.as(TreeView, p_tree_view), p_path, p_column);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_column: ?*gtk.TreeViewColumn) callconv(.c) void) void {
                gobject.ext.as(TreeView.Class, p_class).f_row_activated = @ptrCast(p_implementation);
            }
        };

        pub const row_collapsed = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) void {
                return gobject.ext.as(TreeView.Class, p_class).f_row_collapsed.?(gobject.ext.as(TreeView, p_tree_view), p_iter, p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) void) void {
                gobject.ext.as(TreeView.Class, p_class).f_row_collapsed = @ptrCast(p_implementation);
            }
        };

        pub const row_expanded = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) void {
                return gobject.ext.as(TreeView.Class, p_class).f_row_expanded.?(gobject.ext.as(TreeView, p_tree_view), p_iter, p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) void) void {
                gobject.ext.as(TreeView.Class, p_class).f_row_expanded = @ptrCast(p_implementation);
            }
        };

        pub const select_all = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_select_all.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_select_all = @ptrCast(p_implementation);
            }
        };

        pub const select_cursor_parent = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_select_cursor_parent.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_select_cursor_parent = @ptrCast(p_implementation);
            }
        };

        pub const select_cursor_row = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_editing: c_int) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_select_cursor_row.?(gobject.ext.as(TreeView, p_tree_view), p_start_editing);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_editing: c_int) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_select_cursor_row = @ptrCast(p_implementation);
            }
        };

        pub const start_interactive_search = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_start_interactive_search.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_start_interactive_search = @ptrCast(p_implementation);
            }
        };

        pub const test_collapse_row = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_test_collapse_row.?(gobject.ext.as(TreeView, p_tree_view), p_iter, p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_test_collapse_row = @ptrCast(p_implementation);
            }
        };

        pub const test_expand_row = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_test_expand_row.?(gobject.ext.as(TreeView, p_tree_view), p_iter, p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_test_expand_row = @ptrCast(p_implementation);
            }
        };

        pub const toggle_cursor_row = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_toggle_cursor_row.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_toggle_cursor_row = @ptrCast(p_implementation);
            }
        };

        pub const unselect_all = struct {
            pub fn call(p_class: anytype, p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeView.Class, p_class).f_unselect_all.?(gobject.ext.as(TreeView, p_tree_view));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_view: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeView.Class, p_class).f_unselect_all = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The activate-on-single-click property specifies whether the "row-activated" signal
        /// will be emitted after a single click.
        pub const activate_on_single_click = struct {
            pub const name = "activate-on-single-click";

            pub const Type = c_int;
        };

        pub const enable_grid_lines = struct {
            pub const name = "enable-grid-lines";

            pub const Type = gtk.TreeViewGridLines;
        };

        pub const enable_search = struct {
            pub const name = "enable-search";

            pub const Type = c_int;
        };

        pub const enable_tree_lines = struct {
            pub const name = "enable-tree-lines";

            pub const Type = c_int;
        };

        pub const expander_column = struct {
            pub const name = "expander-column";

            pub const Type = ?*gtk.TreeViewColumn;
        };

        /// Setting the ::fixed-height-mode property to `TRUE` speeds up
        /// `GtkTreeView` by assuming that all rows have the same height.
        /// Only enable this option if all rows are the same height.
        /// Please see `gtk.TreeView.setFixedHeightMode` for more
        /// information on this option.
        pub const fixed_height_mode = struct {
            pub const name = "fixed-height-mode";

            pub const Type = c_int;
        };

        pub const headers_clickable = struct {
            pub const name = "headers-clickable";

            pub const Type = c_int;
        };

        pub const headers_visible = struct {
            pub const name = "headers-visible";

            pub const Type = c_int;
        };

        /// Enables or disables the hover expansion mode of `tree_view`.
        /// Hover expansion makes rows expand or collapse if the pointer moves
        /// over them.
        ///
        /// This mode is primarily intended for treeviews in popups, e.g.
        /// in `GtkComboBox` or `GtkEntryCompletion`.
        pub const hover_expand = struct {
            pub const name = "hover-expand";

            pub const Type = c_int;
        };

        /// Enables or disables the hover selection mode of `tree_view`.
        /// Hover selection makes the selected row follow the pointer.
        /// Currently, this works only for the selection modes
        /// `GTK_SELECTION_SINGLE` and `GTK_SELECTION_BROWSE`.
        ///
        /// This mode is primarily intended for treeviews in popups, e.g.
        /// in `GtkComboBox` or `GtkEntryCompletion`.
        pub const hover_selection = struct {
            pub const name = "hover-selection";

            pub const Type = c_int;
        };

        /// Extra indentation for each level.
        pub const level_indentation = struct {
            pub const name = "level-indentation";

            pub const Type = c_int;
        };

        pub const model = struct {
            pub const name = "model";

            pub const Type = ?*gtk.TreeModel;
        };

        pub const reorderable = struct {
            pub const name = "reorderable";

            pub const Type = c_int;
        };

        pub const rubber_banding = struct {
            pub const name = "rubber-banding";

            pub const Type = c_int;
        };

        pub const search_column = struct {
            pub const name = "search-column";

            pub const Type = c_int;
        };

        /// `TRUE` if the view has expanders.
        pub const show_expanders = struct {
            pub const name = "show-expanders";

            pub const Type = c_int;
        };

        pub const tooltip_column = struct {
            pub const name = "tooltip-column";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// The number of columns of the treeview has changed.
        pub const columns_changed = struct {
            pub const name = "columns-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("columns-changed", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The position of the cursor (focused cell) has changed.
        pub const cursor_changed = struct {
            pub const name = "cursor-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("cursor-changed", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const expand_collapse_cursor_row = struct {
            pub const name = "expand-collapse-cursor-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_object: c_int, p_p0: c_int, p_p1: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("expand-collapse-cursor-row", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The `GtkTreeView`::move-cursor signal is a [keybinding
        /// signal]`gtk.SignalAction` which gets emitted when the user
        /// presses one of the cursor keys.
        ///
        /// Applications should not connect to it, but may emit it with
        /// `gobject.signalEmitByName` if they need to control the cursor
        /// programmatically. In contrast to `gtk.TreeView.setCursor` and
        /// `gtk.TreeView.setCursorOnCell` when moving horizontally
        /// `GtkTreeView`::move-cursor does not reset the current selection.
        pub const move_cursor = struct {
            pub const name = "move-cursor";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_step: gtk.MovementStep, p_direction: c_int, p_extend: c_int, p_modify: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("move-cursor", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The "row-activated" signal is emitted when the method
        /// `gtk.TreeView.rowActivated` is called.
        ///
        /// This signal is emitted when the user double-clicks a treeview row with the
        /// `gtk.TreeView.properties.activate_on_single_click` property set to `FALSE`,
        /// or when the user single-clicks a row when that property set to `TRUE`.
        ///
        /// This signal is also emitted when a non-editable row is selected and one
        /// of the keys: <kbd>Space</kbd>, <kbd>Shift</kbd>+<kbd>Space</kbd>,
        /// <kbd>Return</kbd> or <kbd>Enter</kbd> is pressed.
        ///
        /// For selection handling refer to the
        /// [tree widget conceptual overview](section-tree-widget.html)
        /// as well as `GtkTreeSelection`.
        pub const row_activated = struct {
            pub const name = "row-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, p_column: ?*gtk.TreeViewColumn, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("row-activated", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The given row has been collapsed (child nodes are hidden).
        pub const row_collapsed = struct {
            pub const name = "row-collapsed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_iter: *gtk.TreeIter, p_path: *gtk.TreePath, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("row-collapsed", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The given row has been expanded (child nodes are shown).
        pub const row_expanded = struct {
            pub const name = "row-expanded";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_iter: *gtk.TreeIter, p_path: *gtk.TreePath, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("row-expanded", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const select_all = struct {
            pub const name = "select-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("select-all", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const select_cursor_parent = struct {
            pub const name = "select-cursor-parent";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("select-cursor-parent", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const select_cursor_row = struct {
            pub const name = "select-cursor-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_object: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("select-cursor-row", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const start_interactive_search = struct {
            pub const name = "start-interactive-search";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("start-interactive-search", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The given row is about to be collapsed (hide its children nodes). Use this
        /// signal if you need to control the collapsibility of individual rows.
        pub const test_collapse_row = struct {
            pub const name = "test-collapse-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_iter: *gtk.TreeIter, p_path: *gtk.TreePath, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("test-collapse-row", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The given row is about to be expanded (show its children nodes). Use this
        /// signal if you need to control the expandability of individual rows.
        pub const test_expand_row = struct {
            pub const name = "test-expand-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_iter: *gtk.TreeIter, p_path: *gtk.TreePath, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("test-expand-row", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const toggle_cursor_row = struct {
            pub const name = "toggle-cursor-row";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("toggle-cursor-row", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        pub const unselect_all = struct {
            pub const name = "unselect-all";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeView, p_instance))),
                    gobject.signalLookup("unselect-all", TreeView.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkTreeView` widget.
    extern fn gtk_tree_view_new() *gtk.TreeView;
    pub const new = gtk_tree_view_new;

    /// Creates a new `GtkTreeView` widget with the model initialized to `model`.
    extern fn gtk_tree_view_new_with_model(p_model: *gtk.TreeModel) *gtk.TreeView;
    pub const newWithModel = gtk_tree_view_new_with_model;

    /// Appends `column` to the list of columns. If `tree_view` has “fixed_height”
    /// mode enabled, then `column` must have its “sizing” property set to be
    /// GTK_TREE_VIEW_COLUMN_FIXED.
    extern fn gtk_tree_view_append_column(p_tree_view: *TreeView, p_column: *gtk.TreeViewColumn) c_int;
    pub const appendColumn = gtk_tree_view_append_column;

    /// Recursively collapses all visible, expanded nodes in `tree_view`.
    extern fn gtk_tree_view_collapse_all(p_tree_view: *TreeView) void;
    pub const collapseAll = gtk_tree_view_collapse_all;

    /// Collapses a row (hides its child rows, if they exist).
    extern fn gtk_tree_view_collapse_row(p_tree_view: *TreeView, p_path: *gtk.TreePath) c_int;
    pub const collapseRow = gtk_tree_view_collapse_row;

    /// Resizes all columns to their optimal width. Only works after the
    /// treeview has been realized.
    extern fn gtk_tree_view_columns_autosize(p_tree_view: *TreeView) void;
    pub const columnsAutosize = gtk_tree_view_columns_autosize;

    /// Converts bin_window coordinates to coordinates for the
    /// tree (the full scrollable area of the tree).
    extern fn gtk_tree_view_convert_bin_window_to_tree_coords(p_tree_view: *TreeView, p_bx: c_int, p_by: c_int, p_tx: *c_int, p_ty: *c_int) void;
    pub const convertBinWindowToTreeCoords = gtk_tree_view_convert_bin_window_to_tree_coords;

    /// Converts bin_window coordinates to widget relative coordinates.
    extern fn gtk_tree_view_convert_bin_window_to_widget_coords(p_tree_view: *TreeView, p_bx: c_int, p_by: c_int, p_wx: *c_int, p_wy: *c_int) void;
    pub const convertBinWindowToWidgetCoords = gtk_tree_view_convert_bin_window_to_widget_coords;

    /// Converts tree coordinates (coordinates in full scrollable area of the tree)
    /// to bin_window coordinates.
    extern fn gtk_tree_view_convert_tree_to_bin_window_coords(p_tree_view: *TreeView, p_tx: c_int, p_ty: c_int, p_bx: *c_int, p_by: *c_int) void;
    pub const convertTreeToBinWindowCoords = gtk_tree_view_convert_tree_to_bin_window_coords;

    /// Converts tree coordinates (coordinates in full scrollable area of the tree)
    /// to widget coordinates.
    extern fn gtk_tree_view_convert_tree_to_widget_coords(p_tree_view: *TreeView, p_tx: c_int, p_ty: c_int, p_wx: *c_int, p_wy: *c_int) void;
    pub const convertTreeToWidgetCoords = gtk_tree_view_convert_tree_to_widget_coords;

    /// Converts widget coordinates to coordinates for the bin_window.
    extern fn gtk_tree_view_convert_widget_to_bin_window_coords(p_tree_view: *TreeView, p_wx: c_int, p_wy: c_int, p_bx: *c_int, p_by: *c_int) void;
    pub const convertWidgetToBinWindowCoords = gtk_tree_view_convert_widget_to_bin_window_coords;

    /// Converts widget coordinates to coordinates for the
    /// tree (the full scrollable area of the tree).
    extern fn gtk_tree_view_convert_widget_to_tree_coords(p_tree_view: *TreeView, p_wx: c_int, p_wy: c_int, p_tx: *c_int, p_ty: *c_int) void;
    pub const convertWidgetToTreeCoords = gtk_tree_view_convert_widget_to_tree_coords;

    /// Creates a `cairo_surface_t` representation of the row at `path`.
    /// This image is used for a drag icon.
    extern fn gtk_tree_view_create_row_drag_icon(p_tree_view: *TreeView, p_path: *gtk.TreePath) ?*gdk.Paintable;
    pub const createRowDragIcon = gtk_tree_view_create_row_drag_icon;

    /// Turns `tree_view` into a drop destination for automatic DND. Calling
    /// this method sets `GtkTreeView`:reorderable to `FALSE`.
    extern fn gtk_tree_view_enable_model_drag_dest(p_tree_view: *TreeView, p_formats: *gdk.ContentFormats, p_actions: gdk.DragAction) void;
    pub const enableModelDragDest = gtk_tree_view_enable_model_drag_dest;

    /// Turns `tree_view` into a drag source for automatic DND. Calling this
    /// method sets `GtkTreeView`:reorderable to `FALSE`.
    extern fn gtk_tree_view_enable_model_drag_source(p_tree_view: *TreeView, p_start_button_mask: gdk.ModifierType, p_formats: *gdk.ContentFormats, p_actions: gdk.DragAction) void;
    pub const enableModelDragSource = gtk_tree_view_enable_model_drag_source;

    /// Recursively expands all nodes in the `tree_view`.
    extern fn gtk_tree_view_expand_all(p_tree_view: *TreeView) void;
    pub const expandAll = gtk_tree_view_expand_all;

    /// Opens the row so its children are visible.
    extern fn gtk_tree_view_expand_row(p_tree_view: *TreeView, p_path: *gtk.TreePath, p_open_all: c_int) c_int;
    pub const expandRow = gtk_tree_view_expand_row;

    /// Expands the row at `path`. This will also expand all parent rows of
    /// `path` as necessary.
    extern fn gtk_tree_view_expand_to_path(p_tree_view: *TreeView, p_path: *gtk.TreePath) void;
    pub const expandToPath = gtk_tree_view_expand_to_path;

    /// Gets the setting set by `gtk.TreeView.setActivateOnSingleClick`.
    extern fn gtk_tree_view_get_activate_on_single_click(p_tree_view: *TreeView) c_int;
    pub const getActivateOnSingleClick = gtk_tree_view_get_activate_on_single_click;

    /// Fills the bounding rectangle in bin_window coordinates for the cell at the
    /// row specified by `path` and the column specified by `column`.  If `path` is
    /// `NULL`, or points to a node not found in the tree, the `y` and `height` fields of
    /// the rectangle will be filled with 0. If `column` is `NULL`, the `x` and `width`
    /// fields will be filled with 0.  The returned rectangle is equivalent to the
    /// `background_area` passed to `gtk_cell_renderer_render`.  These background
    /// areas tile to cover the entire bin window.  Contrast with the `cell_area`,
    /// returned by `gtk.TreeView.getCellArea`, which returns only the cell
    /// itself, excluding surrounding borders and the tree expander area.
    extern fn gtk_tree_view_get_background_area(p_tree_view: *TreeView, p_path: ?*gtk.TreePath, p_column: ?*gtk.TreeViewColumn, p_rect: *gdk.Rectangle) void;
    pub const getBackgroundArea = gtk_tree_view_get_background_area;

    /// Fills the bounding rectangle in bin_window coordinates for the cell at the
    /// row specified by `path` and the column specified by `column`.  If `path` is
    /// `NULL`, or points to a path not currently displayed, the `y` and `height` fields
    /// of the rectangle will be filled with 0. If `column` is `NULL`, the `x` and `width`
    /// fields will be filled with 0.  The sum of all cell rects does not cover the
    /// entire tree; there are extra pixels in between rows, for example. The
    /// returned rectangle is equivalent to the `cell_area` passed to
    /// `gtk_cell_renderer_render`.  This function is only valid if `tree_view` is
    /// realized.
    extern fn gtk_tree_view_get_cell_area(p_tree_view: *TreeView, p_path: ?*gtk.TreePath, p_column: ?*gtk.TreeViewColumn, p_rect: *gdk.Rectangle) void;
    pub const getCellArea = gtk_tree_view_get_cell_area;

    /// Gets the `GtkTreeViewColumn` at the given position in the `tree_view`.
    extern fn gtk_tree_view_get_column(p_tree_view: *TreeView, p_n: c_int) ?*gtk.TreeViewColumn;
    pub const getColumn = gtk_tree_view_get_column;

    /// Returns a `GList` of all the `GtkTreeViewColumn`s currently in `tree_view`.
    /// The returned list must be freed with g_list_free ().
    extern fn gtk_tree_view_get_columns(p_tree_view: *TreeView) *glib.List;
    pub const getColumns = gtk_tree_view_get_columns;

    /// Fills in `path` and `focus_column` with the current path and focus column.  If
    /// the cursor isn’t currently set, then *`path` will be `NULL`.  If no column
    /// currently has focus, then *`focus_column` will be `NULL`.
    ///
    /// The returned `GtkTreePath` must be freed with `gtk.TreePath.free` when
    /// you are done with it.
    extern fn gtk_tree_view_get_cursor(p_tree_view: *TreeView, p_path: ?**gtk.TreePath, p_focus_column: ?**gtk.TreeViewColumn) void;
    pub const getCursor = gtk_tree_view_get_cursor;

    /// Determines the destination row for a given position.  `drag_x` and
    /// `drag_y` are expected to be in widget coordinates.  This function is only
    /// meaningful if `tree_view` is realized.  Therefore this function will always
    /// return `FALSE` if `tree_view` is not realized or does not have a model.
    extern fn gtk_tree_view_get_dest_row_at_pos(p_tree_view: *TreeView, p_drag_x: c_int, p_drag_y: c_int, p_path: ?**gtk.TreePath, p_pos: ?*gtk.TreeViewDropPosition) c_int;
    pub const getDestRowAtPos = gtk_tree_view_get_dest_row_at_pos;

    /// Gets information about the row that is highlighted for feedback.
    extern fn gtk_tree_view_get_drag_dest_row(p_tree_view: *TreeView, p_path: ?**gtk.TreePath, p_pos: ?*gtk.TreeViewDropPosition) void;
    pub const getDragDestRow = gtk_tree_view_get_drag_dest_row;

    /// Returns whether or not the tree allows to start interactive searching
    /// by typing in text.
    extern fn gtk_tree_view_get_enable_search(p_tree_view: *TreeView) c_int;
    pub const getEnableSearch = gtk_tree_view_get_enable_search;

    /// Returns whether or not tree lines are drawn in `tree_view`.
    extern fn gtk_tree_view_get_enable_tree_lines(p_tree_view: *TreeView) c_int;
    pub const getEnableTreeLines = gtk_tree_view_get_enable_tree_lines;

    /// Returns the column that is the current expander column,
    /// or `NULL` if none has been set.
    /// This column has the expander arrow drawn next to it.
    extern fn gtk_tree_view_get_expander_column(p_tree_view: *TreeView) ?*gtk.TreeViewColumn;
    pub const getExpanderColumn = gtk_tree_view_get_expander_column;

    /// Returns whether fixed height mode is turned on for `tree_view`.
    extern fn gtk_tree_view_get_fixed_height_mode(p_tree_view: *TreeView) c_int;
    pub const getFixedHeightMode = gtk_tree_view_get_fixed_height_mode;

    /// Returns which grid lines are enabled in `tree_view`.
    extern fn gtk_tree_view_get_grid_lines(p_tree_view: *TreeView) gtk.TreeViewGridLines;
    pub const getGridLines = gtk_tree_view_get_grid_lines;

    /// Returns whether all header columns are clickable.
    extern fn gtk_tree_view_get_headers_clickable(p_tree_view: *TreeView) c_int;
    pub const getHeadersClickable = gtk_tree_view_get_headers_clickable;

    /// Returns `TRUE` if the headers on the `tree_view` are visible.
    extern fn gtk_tree_view_get_headers_visible(p_tree_view: *TreeView) c_int;
    pub const getHeadersVisible = gtk_tree_view_get_headers_visible;

    /// Returns whether hover expansion mode is turned on for `tree_view`.
    extern fn gtk_tree_view_get_hover_expand(p_tree_view: *TreeView) c_int;
    pub const getHoverExpand = gtk_tree_view_get_hover_expand;

    /// Returns whether hover selection mode is turned on for `tree_view`.
    extern fn gtk_tree_view_get_hover_selection(p_tree_view: *TreeView) c_int;
    pub const getHoverSelection = gtk_tree_view_get_hover_selection;

    /// Returns the amount, in pixels, of extra indentation for child levels
    /// in `tree_view`.
    extern fn gtk_tree_view_get_level_indentation(p_tree_view: *TreeView) c_int;
    pub const getLevelIndentation = gtk_tree_view_get_level_indentation;

    /// Returns the model the `GtkTreeView` is based on.  Returns `NULL` if the
    /// model is unset.
    extern fn gtk_tree_view_get_model(p_tree_view: *TreeView) ?*gtk.TreeModel;
    pub const getModel = gtk_tree_view_get_model;

    /// Queries the number of columns in the given `tree_view`.
    extern fn gtk_tree_view_get_n_columns(p_tree_view: *TreeView) c_uint;
    pub const getNColumns = gtk_tree_view_get_n_columns;

    /// Finds the path at the point (`x`, `y`), relative to bin_window coordinates.
    /// That is, `x` and `y` are relative to an events coordinates. Widget-relative
    /// coordinates must be converted using
    /// `gtk.TreeView.convertWidgetToBinWindowCoords`. It is primarily for
    /// things like popup menus. If `path` is non-`NULL`, then it will be filled
    /// with the `GtkTreePath` at that point.  This path should be freed with
    /// `gtk.TreePath.free`.  If `column` is non-`NULL`, then it will be filled
    /// with the column at that point.  `cell_x` and `cell_y` return the coordinates
    /// relative to the cell background (i.e. the `background_area` passed to
    /// `gtk_cell_renderer_render`).  This function is only meaningful if
    /// `tree_view` is realized.  Therefore this function will always return `FALSE`
    /// if `tree_view` is not realized or does not have a model.
    ///
    /// For converting widget coordinates (eg. the ones you get from
    /// GtkWidget::query-tooltip), please see
    /// `gtk.TreeView.convertWidgetToBinWindowCoords`.
    extern fn gtk_tree_view_get_path_at_pos(p_tree_view: *TreeView, p_x: c_int, p_y: c_int, p_path: ?**gtk.TreePath, p_column: ?**gtk.TreeViewColumn, p_cell_x: ?*c_int, p_cell_y: ?*c_int) c_int;
    pub const getPathAtPos = gtk_tree_view_get_path_at_pos;

    /// Retrieves whether the user can reorder the tree via drag-and-drop. See
    /// `gtk.TreeView.setReorderable`.
    extern fn gtk_tree_view_get_reorderable(p_tree_view: *TreeView) c_int;
    pub const getReorderable = gtk_tree_view_get_reorderable;

    /// Returns the current row separator function.
    extern fn gtk_tree_view_get_row_separator_func(p_tree_view: *TreeView) gtk.TreeViewRowSeparatorFunc;
    pub const getRowSeparatorFunc = gtk_tree_view_get_row_separator_func;

    /// Returns whether rubber banding is turned on for `tree_view`.  If the
    /// selection mode is `GTK_SELECTION_MULTIPLE`, rubber banding will allow the
    /// user to select multiple rows by dragging the mouse.
    extern fn gtk_tree_view_get_rubber_banding(p_tree_view: *TreeView) c_int;
    pub const getRubberBanding = gtk_tree_view_get_rubber_banding;

    /// Gets the column searched on by the interactive search code.
    extern fn gtk_tree_view_get_search_column(p_tree_view: *TreeView) c_int;
    pub const getSearchColumn = gtk_tree_view_get_search_column;

    /// Returns the `GtkEntry` which is currently in use as interactive search
    /// entry for `tree_view`.  In case the built-in entry is being used, `NULL`
    /// will be returned.
    extern fn gtk_tree_view_get_search_entry(p_tree_view: *TreeView) ?*gtk.Editable;
    pub const getSearchEntry = gtk_tree_view_get_search_entry;

    /// Returns the compare function currently in use.
    extern fn gtk_tree_view_get_search_equal_func(p_tree_view: *TreeView) gtk.TreeViewSearchEqualFunc;
    pub const getSearchEqualFunc = gtk_tree_view_get_search_equal_func;

    /// Gets the `GtkTreeSelection` associated with `tree_view`.
    extern fn gtk_tree_view_get_selection(p_tree_view: *TreeView) *gtk.TreeSelection;
    pub const getSelection = gtk_tree_view_get_selection;

    /// Returns whether or not expanders are drawn in `tree_view`.
    extern fn gtk_tree_view_get_show_expanders(p_tree_view: *TreeView) c_int;
    pub const getShowExpanders = gtk_tree_view_get_show_expanders;

    /// Returns the column of `tree_view`’s model which is being used for
    /// displaying tooltips on `tree_view`’s rows.
    extern fn gtk_tree_view_get_tooltip_column(p_tree_view: *TreeView) c_int;
    pub const getTooltipColumn = gtk_tree_view_get_tooltip_column;

    /// This function is supposed to be used in a ::query-tooltip
    /// signal handler for `GtkTreeView`. The `x`, `y` and `keyboard_tip` values
    /// which are received in the signal handler, should be passed to this
    /// function without modification.
    ///
    /// The return value indicates whether there is a tree view row at the given
    /// coordinates (`TRUE`) or not (`FALSE`) for mouse tooltips. For keyboard
    /// tooltips the row returned will be the cursor row. When `TRUE`, then any of
    /// `model`, `path` and `iter` which have been provided will be set to point to
    /// that row and the corresponding model. `x` and `y` will always be converted
    /// to be relative to `tree_view`’s bin_window if `keyboard_tooltip` is `FALSE`.
    extern fn gtk_tree_view_get_tooltip_context(p_tree_view: *TreeView, p_x: c_int, p_y: c_int, p_keyboard_tip: c_int, p_model: ?**gtk.TreeModel, p_path: ?**gtk.TreePath, p_iter: ?*gtk.TreeIter) c_int;
    pub const getTooltipContext = gtk_tree_view_get_tooltip_context;

    /// Sets `start_path` and `end_path` to be the first and last visible path.
    /// Note that there may be invisible paths in between.
    ///
    /// The paths should be freed with `gtk.TreePath.free` after use.
    extern fn gtk_tree_view_get_visible_range(p_tree_view: *TreeView, p_start_path: ?**gtk.TreePath, p_end_path: ?**gtk.TreePath) c_int;
    pub const getVisibleRange = gtk_tree_view_get_visible_range;

    /// Fills `visible_rect` with the currently-visible region of the
    /// buffer, in tree coordinates. Convert to bin_window coordinates with
    /// `gtk.TreeView.convertTreeToBinWindowCoords`.
    /// Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire
    /// scrollable area of the tree.
    extern fn gtk_tree_view_get_visible_rect(p_tree_view: *TreeView, p_visible_rect: *gdk.Rectangle) void;
    pub const getVisibleRect = gtk_tree_view_get_visible_rect;

    /// This inserts the `column` into the `tree_view` at `position`.  If `position` is
    /// -1, then the column is inserted at the end. If `tree_view` has
    /// “fixed_height” mode enabled, then `column` must have its “sizing” property
    /// set to be GTK_TREE_VIEW_COLUMN_FIXED.
    extern fn gtk_tree_view_insert_column(p_tree_view: *TreeView, p_column: *gtk.TreeViewColumn, p_position: c_int) c_int;
    pub const insertColumn = gtk_tree_view_insert_column;

    /// Creates a new `GtkTreeViewColumn` and inserts it into the `tree_view` at
    /// `position`.  If `position` is -1, then the newly created column is inserted at
    /// the end.  The column is initialized with the attributes given. If `tree_view`
    /// has “fixed_height” mode enabled, then the new column will have its sizing
    /// property set to be GTK_TREE_VIEW_COLUMN_FIXED.
    extern fn gtk_tree_view_insert_column_with_attributes(p_tree_view: *TreeView, p_position: c_int, p_title: [*:0]const u8, p_cell: *gtk.CellRenderer, ...) c_int;
    pub const insertColumnWithAttributes = gtk_tree_view_insert_column_with_attributes;

    /// Convenience function that inserts a new column into the `GtkTreeView`
    /// with the given cell renderer and a `GtkTreeCellDataFunc` to set cell renderer
    /// attributes (normally using data from the model). See also
    /// `gtk.TreeViewColumn.setCellDataFunc`, `gtk.TreeViewColumn.packStart`.
    /// If `tree_view` has “fixed_height” mode enabled, then the new column will have its
    /// “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED.
    extern fn gtk_tree_view_insert_column_with_data_func(p_tree_view: *TreeView, p_position: c_int, p_title: [*:0]const u8, p_cell: *gtk.CellRenderer, p_func: gtk.TreeCellDataFunc, p_data: ?*anyopaque, p_dnotify: ?glib.DestroyNotify) c_int;
    pub const insertColumnWithDataFunc = gtk_tree_view_insert_column_with_data_func;

    /// Determine whether the point (`x`, `y`) in `tree_view` is blank, that is no
    /// cell content nor an expander arrow is drawn at the location. If so, the
    /// location can be considered as the background. You might wish to take
    /// special action on clicks on the background, such as clearing a current
    /// selection, having a custom context menu or starting rubber banding.
    ///
    /// The `x` and `y` coordinate that are provided must be relative to bin_window
    /// coordinates.  Widget-relative coordinates must be converted using
    /// `gtk.TreeView.convertWidgetToBinWindowCoords`.
    ///
    /// For converting widget coordinates (eg. the ones you get from
    /// GtkWidget::query-tooltip), please see
    /// `gtk.TreeView.convertWidgetToBinWindowCoords`.
    ///
    /// The `path`, `column`, `cell_x` and `cell_y` arguments will be filled in
    /// likewise as for `gtk.TreeView.getPathAtPos`.  Please see
    /// `gtk.TreeView.getPathAtPos` for more information.
    extern fn gtk_tree_view_is_blank_at_pos(p_tree_view: *TreeView, p_x: c_int, p_y: c_int, p_path: ?**gtk.TreePath, p_column: ?**gtk.TreeViewColumn, p_cell_x: ?*c_int, p_cell_y: ?*c_int) c_int;
    pub const isBlankAtPos = gtk_tree_view_is_blank_at_pos;

    /// Returns whether a rubber banding operation is currently being done
    /// in `tree_view`.
    extern fn gtk_tree_view_is_rubber_banding_active(p_tree_view: *TreeView) c_int;
    pub const isRubberBandingActive = gtk_tree_view_is_rubber_banding_active;

    /// Calls `func` on all expanded rows.
    extern fn gtk_tree_view_map_expanded_rows(p_tree_view: *TreeView, p_func: gtk.TreeViewMappingFunc, p_data: ?*anyopaque) void;
    pub const mapExpandedRows = gtk_tree_view_map_expanded_rows;

    /// Moves `column` to be after to `base_column`.  If `base_column` is `NULL`, then
    /// `column` is placed in the first position.
    extern fn gtk_tree_view_move_column_after(p_tree_view: *TreeView, p_column: *gtk.TreeViewColumn, p_base_column: ?*gtk.TreeViewColumn) void;
    pub const moveColumnAfter = gtk_tree_view_move_column_after;

    /// Removes `column` from `tree_view`.
    extern fn gtk_tree_view_remove_column(p_tree_view: *TreeView, p_column: *gtk.TreeViewColumn) c_int;
    pub const removeColumn = gtk_tree_view_remove_column;

    /// Activates the cell determined by `path` and `column`.
    extern fn gtk_tree_view_row_activated(p_tree_view: *TreeView, p_path: *gtk.TreePath, p_column: ?*gtk.TreeViewColumn) void;
    pub const rowActivated = gtk_tree_view_row_activated;

    /// Returns `TRUE` if the node pointed to by `path` is expanded in `tree_view`.
    extern fn gtk_tree_view_row_expanded(p_tree_view: *TreeView, p_path: *gtk.TreePath) c_int;
    pub const rowExpanded = gtk_tree_view_row_expanded;

    /// Moves the alignments of `tree_view` to the position specified by `column` and
    /// `path`.  If `column` is `NULL`, then no horizontal scrolling occurs.  Likewise,
    /// if `path` is `NULL` no vertical scrolling occurs.  At a minimum, one of `column`
    /// or `path` need to be non-`NULL`.  `row_align` determines where the row is
    /// placed, and `col_align` determines where `column` is placed.  Both are expected
    /// to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means
    /// right/bottom alignment, 0.5 means center.
    ///
    /// If `use_align` is `FALSE`, then the alignment arguments are ignored, and the
    /// tree does the minimum amount of work to scroll the cell onto the screen.
    /// This means that the cell will be scrolled to the edge closest to its current
    /// position.  If the cell is currently visible on the screen, nothing is done.
    ///
    /// This function only works if the model is set, and `path` is a valid row on the
    /// model.  If the model changes before the `tree_view` is realized, the centered
    /// path will be modified to reflect this change.
    extern fn gtk_tree_view_scroll_to_cell(p_tree_view: *TreeView, p_path: ?*gtk.TreePath, p_column: ?*gtk.TreeViewColumn, p_use_align: c_int, p_row_align: f32, p_col_align: f32) void;
    pub const scrollToCell = gtk_tree_view_scroll_to_cell;

    /// Scrolls the tree view such that the top-left corner of the visible
    /// area is `tree_x`, `tree_y`, where `tree_x` and `tree_y` are specified
    /// in tree coordinates.  The `tree_view` must be realized before
    /// this function is called.  If it isn't, you probably want to be
    /// using `gtk.TreeView.scrollToCell`.
    ///
    /// If either `tree_x` or `tree_y` are -1, then that direction isn’t scrolled.
    extern fn gtk_tree_view_scroll_to_point(p_tree_view: *TreeView, p_tree_x: c_int, p_tree_y: c_int) void;
    pub const scrollToPoint = gtk_tree_view_scroll_to_point;

    /// Cause the `GtkTreeView`::row-activated signal to be emitted
    /// on a single click instead of a double click.
    extern fn gtk_tree_view_set_activate_on_single_click(p_tree_view: *TreeView, p_single: c_int) void;
    pub const setActivateOnSingleClick = gtk_tree_view_set_activate_on_single_click;

    /// Sets a user function for determining where a column may be dropped when
    /// dragged.  This function is called on every column pair in turn at the
    /// beginning of a column drag to determine where a drop can take place.  The
    /// arguments passed to `func` are: the `tree_view`, the `GtkTreeViewColumn` being
    /// dragged, the two `GtkTreeViewColumn`s determining the drop spot, and
    /// `user_data`.  If either of the `GtkTreeViewColumn` arguments for the drop spot
    /// are `NULL`, then they indicate an edge.  If `func` is set to be `NULL`, then
    /// `tree_view` reverts to the default behavior of allowing all columns to be
    /// dropped everywhere.
    extern fn gtk_tree_view_set_column_drag_function(p_tree_view: *TreeView, p_func: ?gtk.TreeViewColumnDropFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setColumnDragFunction = gtk_tree_view_set_column_drag_function;

    /// Sets the current keyboard focus to be at `path`, and selects it.  This is
    /// useful when you want to focus the user’s attention on a particular row.  If
    /// `focus_column` is not `NULL`, then focus is given to the column specified by
    /// it. Additionally, if `focus_column` is specified, and `start_editing` is
    /// `TRUE`, then editing should be started in the specified cell.
    /// This function is often followed by `gtk_widget_grab_focus` (`tree_view`)
    /// in order to give keyboard focus to the widget.  Please note that editing
    /// can only happen when the widget is realized.
    ///
    /// If `path` is invalid for `model`, the current cursor (if any) will be unset
    /// and the function will return without failing.
    extern fn gtk_tree_view_set_cursor(p_tree_view: *TreeView, p_path: *gtk.TreePath, p_focus_column: ?*gtk.TreeViewColumn, p_start_editing: c_int) void;
    pub const setCursor = gtk_tree_view_set_cursor;

    /// Sets the current keyboard focus to be at `path`, and selects it.  This is
    /// useful when you want to focus the user’s attention on a particular row.  If
    /// `focus_column` is not `NULL`, then focus is given to the column specified by
    /// it. If `focus_column` and `focus_cell` are not `NULL`, and `focus_column`
    /// contains 2 or more editable or activatable cells, then focus is given to
    /// the cell specified by `focus_cell`. Additionally, if `focus_column` is
    /// specified, and `start_editing` is `TRUE`, then editing should be started in
    /// the specified cell.  This function is often followed by
    /// `gtk_widget_grab_focus` (`tree_view`) in order to give keyboard focus to the
    /// widget.  Please note that editing can only happen when the widget is
    /// realized.
    ///
    /// If `path` is invalid for `model`, the current cursor (if any) will be unset
    /// and the function will return without failing.
    extern fn gtk_tree_view_set_cursor_on_cell(p_tree_view: *TreeView, p_path: *gtk.TreePath, p_focus_column: ?*gtk.TreeViewColumn, p_focus_cell: ?*gtk.CellRenderer, p_start_editing: c_int) void;
    pub const setCursorOnCell = gtk_tree_view_set_cursor_on_cell;

    /// Sets the row that is highlighted for feedback.
    /// If `path` is `NULL`, an existing highlight is removed.
    extern fn gtk_tree_view_set_drag_dest_row(p_tree_view: *TreeView, p_path: ?*gtk.TreePath, p_pos: gtk.TreeViewDropPosition) void;
    pub const setDragDestRow = gtk_tree_view_set_drag_dest_row;

    /// If `enable_search` is set, then the user can type in text to search through
    /// the tree interactively (this is sometimes called "typeahead find").
    ///
    /// Note that even if this is `FALSE`, the user can still initiate a search
    /// using the “start-interactive-search” key binding.
    extern fn gtk_tree_view_set_enable_search(p_tree_view: *TreeView, p_enable_search: c_int) void;
    pub const setEnableSearch = gtk_tree_view_set_enable_search;

    /// Sets whether to draw lines interconnecting the expanders in `tree_view`.
    /// This does not have any visible effects for lists.
    extern fn gtk_tree_view_set_enable_tree_lines(p_tree_view: *TreeView, p_enabled: c_int) void;
    pub const setEnableTreeLines = gtk_tree_view_set_enable_tree_lines;

    /// Sets the column to draw the expander arrow at. It must be in `tree_view`.
    /// If `column` is `NULL`, then the expander arrow is always at the first
    /// visible column.
    ///
    /// If you do not want expander arrow to appear in your tree, set the
    /// expander column to a hidden column.
    extern fn gtk_tree_view_set_expander_column(p_tree_view: *TreeView, p_column: ?*gtk.TreeViewColumn) void;
    pub const setExpanderColumn = gtk_tree_view_set_expander_column;

    /// Enables or disables the fixed height mode of `tree_view`.
    /// Fixed height mode speeds up `GtkTreeView` by assuming that all
    /// rows have the same height.
    /// Only enable this option if all rows are the same height and all
    /// columns are of type `GTK_TREE_VIEW_COLUMN_FIXED`.
    extern fn gtk_tree_view_set_fixed_height_mode(p_tree_view: *TreeView, p_enable: c_int) void;
    pub const setFixedHeightMode = gtk_tree_view_set_fixed_height_mode;

    /// Sets which grid lines to draw in `tree_view`.
    extern fn gtk_tree_view_set_grid_lines(p_tree_view: *TreeView, p_grid_lines: gtk.TreeViewGridLines) void;
    pub const setGridLines = gtk_tree_view_set_grid_lines;

    /// Allow the column title buttons to be clicked.
    extern fn gtk_tree_view_set_headers_clickable(p_tree_view: *TreeView, p_setting: c_int) void;
    pub const setHeadersClickable = gtk_tree_view_set_headers_clickable;

    /// Sets the visibility state of the headers.
    extern fn gtk_tree_view_set_headers_visible(p_tree_view: *TreeView, p_headers_visible: c_int) void;
    pub const setHeadersVisible = gtk_tree_view_set_headers_visible;

    /// Enables or disables the hover expansion mode of `tree_view`.
    /// Hover expansion makes rows expand or collapse if the pointer
    /// moves over them.
    extern fn gtk_tree_view_set_hover_expand(p_tree_view: *TreeView, p_expand: c_int) void;
    pub const setHoverExpand = gtk_tree_view_set_hover_expand;

    /// Enables or disables the hover selection mode of `tree_view`.
    /// Hover selection makes the selected row follow the pointer.
    /// Currently, this works only for the selection modes
    /// `GTK_SELECTION_SINGLE` and `GTK_SELECTION_BROWSE`.
    extern fn gtk_tree_view_set_hover_selection(p_tree_view: *TreeView, p_hover: c_int) void;
    pub const setHoverSelection = gtk_tree_view_set_hover_selection;

    /// Sets the amount of extra indentation for child levels to use in `tree_view`
    /// in addition to the default indentation.  The value should be specified in
    /// pixels, a value of 0 disables this feature and in this case only the default
    /// indentation will be used.
    /// This does not have any visible effects for lists.
    extern fn gtk_tree_view_set_level_indentation(p_tree_view: *TreeView, p_indentation: c_int) void;
    pub const setLevelIndentation = gtk_tree_view_set_level_indentation;

    /// Sets the model for a `GtkTreeView`.  If the `tree_view` already has a model
    /// set, it will remove it before setting the new model.  If `model` is `NULL`,
    /// then it will unset the old model.
    extern fn gtk_tree_view_set_model(p_tree_view: *TreeView, p_model: ?*gtk.TreeModel) void;
    pub const setModel = gtk_tree_view_set_model;

    /// This function is a convenience function to allow you to reorder
    /// models that support the `GtkTreeDragSourceIface` and the
    /// `GtkTreeDragDestIface`.  Both `GtkTreeStore` and `GtkListStore` support
    /// these.  If `reorderable` is `TRUE`, then the user can reorder the
    /// model by dragging and dropping rows. The developer can listen to
    /// these changes by connecting to the model’s `GtkTreeModel::row-inserted`
    /// and `GtkTreeModel::row-deleted` signals. The reordering is implemented
    /// by setting up the tree view as a drag source and destination.
    /// Therefore, drag and drop can not be used in a reorderable view for any
    /// other purpose.
    ///
    /// This function does not give you any degree of control over the order -- any
    /// reordering is allowed.  If more control is needed, you should probably
    /// handle drag and drop manually.
    extern fn gtk_tree_view_set_reorderable(p_tree_view: *TreeView, p_reorderable: c_int) void;
    pub const setReorderable = gtk_tree_view_set_reorderable;

    /// Sets the row separator function, which is used to determine
    /// whether a row should be drawn as a separator. If the row separator
    /// function is `NULL`, no separators are drawn. This is the default value.
    extern fn gtk_tree_view_set_row_separator_func(p_tree_view: *TreeView, p_func: ?gtk.TreeViewRowSeparatorFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setRowSeparatorFunc = gtk_tree_view_set_row_separator_func;

    /// Enables or disables rubber banding in `tree_view`.  If the selection mode
    /// is `GTK_SELECTION_MULTIPLE`, rubber banding will allow the user to select
    /// multiple rows by dragging the mouse.
    extern fn gtk_tree_view_set_rubber_banding(p_tree_view: *TreeView, p_enable: c_int) void;
    pub const setRubberBanding = gtk_tree_view_set_rubber_banding;

    /// Sets `column` as the column where the interactive search code should
    /// search in for the current model.
    ///
    /// If the search column is set, users can use the “start-interactive-search”
    /// key binding to bring up search popup. The enable-search property controls
    /// whether simply typing text will also start an interactive search.
    ///
    /// Note that `column` refers to a column of the current model. The search
    /// column is reset to -1 when the model is changed.
    extern fn gtk_tree_view_set_search_column(p_tree_view: *TreeView, p_column: c_int) void;
    pub const setSearchColumn = gtk_tree_view_set_search_column;

    /// Sets the entry which the interactive search code will use for this
    /// `tree_view`.  This is useful when you want to provide a search entry
    /// in our interface at all time at a fixed position.  Passing `NULL` for
    /// `entry` will make the interactive search code use the built-in popup
    /// entry again.
    extern fn gtk_tree_view_set_search_entry(p_tree_view: *TreeView, p_entry: ?*gtk.Editable) void;
    pub const setSearchEntry = gtk_tree_view_set_search_entry;

    /// Sets the compare function for the interactive search capabilities; note
    /// that somewhat like `strcmp` returning 0 for equality
    /// `GtkTreeView`SearchEqualFunc returns `FALSE` on matches.
    extern fn gtk_tree_view_set_search_equal_func(p_tree_view: *TreeView, p_search_equal_func: gtk.TreeViewSearchEqualFunc, p_search_user_data: ?*anyopaque, p_search_destroy: ?glib.DestroyNotify) void;
    pub const setSearchEqualFunc = gtk_tree_view_set_search_equal_func;

    /// Sets whether to draw and enable expanders and indent child rows in
    /// `tree_view`.  When disabled there will be no expanders visible in trees
    /// and there will be no way to expand and collapse rows by default.  Also
    /// note that hiding the expanders will disable the default indentation.  You
    /// can set a custom indentation in this case using
    /// `gtk.TreeView.setLevelIndentation`.
    /// This does not have any visible effects for lists.
    extern fn gtk_tree_view_set_show_expanders(p_tree_view: *TreeView, p_enabled: c_int) void;
    pub const setShowExpanders = gtk_tree_view_set_show_expanders;

    /// Sets the tip area of `tooltip` to the area `path`, `column` and `cell` have
    /// in common.  For example if `path` is `NULL` and `column` is set, the tip
    /// area will be set to the full area covered by `column`.  See also
    /// `gtk.Tooltip.setTipArea`.
    ///
    /// Note that if `path` is not specified and `cell` is set and part of a column
    /// containing the expander, the tooltip might not show and hide at the correct
    /// position.  In such cases `path` must be set to the current node under the
    /// mouse cursor for this function to operate correctly.
    ///
    /// See also `gtk.TreeView.setTooltipColumn` for a simpler alternative.
    extern fn gtk_tree_view_set_tooltip_cell(p_tree_view: *TreeView, p_tooltip: *gtk.Tooltip, p_path: ?*gtk.TreePath, p_column: ?*gtk.TreeViewColumn, p_cell: ?*gtk.CellRenderer) void;
    pub const setTooltipCell = gtk_tree_view_set_tooltip_cell;

    /// If you only plan to have simple (text-only) tooltips on full rows, you
    /// can use this function to have `GtkTreeView` handle these automatically
    /// for you. `column` should be set to the column in `tree_view`’s model
    /// containing the tooltip texts, or -1 to disable this feature.
    ///
    /// When enabled, `GtkWidget:has-tooltip` will be set to `TRUE` and
    /// `tree_view` will connect a `GtkWidget::query-tooltip` signal handler.
    ///
    /// Note that the signal handler sets the text with `gtk.Tooltip.setMarkup`,
    /// so &, <, etc have to be escaped in the text.
    extern fn gtk_tree_view_set_tooltip_column(p_tree_view: *TreeView, p_column: c_int) void;
    pub const setTooltipColumn = gtk_tree_view_set_tooltip_column;

    /// Sets the tip area of `tooltip` to be the area covered by the row at `path`.
    /// See also `gtk.TreeView.setTooltipColumn` for a simpler alternative.
    /// See also `gtk.Tooltip.setTipArea`.
    extern fn gtk_tree_view_set_tooltip_row(p_tree_view: *TreeView, p_tooltip: *gtk.Tooltip, p_path: *gtk.TreePath) void;
    pub const setTooltipRow = gtk_tree_view_set_tooltip_row;

    /// Undoes the effect of
    /// `gtk.TreeView.enableModelDragDest`. Calling this method sets
    /// `GtkTreeView`:reorderable to `FALSE`.
    extern fn gtk_tree_view_unset_rows_drag_dest(p_tree_view: *TreeView) void;
    pub const unsetRowsDragDest = gtk_tree_view_unset_rows_drag_dest;

    /// Undoes the effect of
    /// `gtk.TreeView.enableModelDragSource`. Calling this method sets
    /// `GtkTreeView`:reorderable to `FALSE`.
    extern fn gtk_tree_view_unset_rows_drag_source(p_tree_view: *TreeView) void;
    pub const unsetRowsDragSource = gtk_tree_view_unset_rows_drag_source;

    extern fn gtk_tree_view_get_type() usize;
    pub const getGObjectType = gtk_tree_view_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeView) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeView) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeView, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A visible column in a `gtk.TreeView` widget
///
/// The `GtkTreeViewColumn` object represents a visible column in a `GtkTreeView` widget.
/// It allows to set properties of the column header, and functions as a holding pen
/// for the cell renderers which determine how the data in the column is displayed.
///
/// Please refer to the [tree widget conceptual overview](section-tree-widget.html)
/// for an overview of all the objects and data types related to the tree widget and
/// how they work together, and to the `gtk.TreeView` documentation for specifics
/// about the CSS node structure for treeviews and their headers.
pub const TreeViewColumn = opaque {
    pub const Parent = gobject.InitiallyUnowned;
    pub const Implements = [_]type{ gtk.Buildable, gtk.CellLayout };
    pub const Class = opaque {
        pub const Instance = TreeViewColumn;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        pub const alignment = struct {
            pub const name = "alignment";

            pub const Type = f32;
        };

        /// The `GtkCellArea` used to layout cell renderers for this column.
        ///
        /// If no area is specified when creating the tree view column with `gtk.TreeViewColumn.newWithArea`
        /// a horizontally oriented `GtkCellAreaBox` will be used.
        pub const cell_area = struct {
            pub const name = "cell-area";

            pub const Type = ?*gtk.CellArea;
        };

        pub const clickable = struct {
            pub const name = "clickable";

            pub const Type = c_int;
        };

        pub const expand = struct {
            pub const name = "expand";

            pub const Type = c_int;
        };

        pub const fixed_width = struct {
            pub const name = "fixed-width";

            pub const Type = c_int;
        };

        pub const max_width = struct {
            pub const name = "max-width";

            pub const Type = c_int;
        };

        pub const min_width = struct {
            pub const name = "min-width";

            pub const Type = c_int;
        };

        pub const reorderable = struct {
            pub const name = "reorderable";

            pub const Type = c_int;
        };

        pub const resizable = struct {
            pub const name = "resizable";

            pub const Type = c_int;
        };

        pub const sizing = struct {
            pub const name = "sizing";

            pub const Type = gtk.TreeViewColumnSizing;
        };

        /// Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
        /// clickable. Set to -1 to make the column unsortable.
        pub const sort_column_id = struct {
            pub const name = "sort-column-id";

            pub const Type = c_int;
        };

        pub const sort_indicator = struct {
            pub const name = "sort-indicator";

            pub const Type = c_int;
        };

        pub const sort_order = struct {
            pub const name = "sort-order";

            pub const Type = gtk.SortType;
        };

        pub const spacing = struct {
            pub const name = "spacing";

            pub const Type = c_int;
        };

        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        pub const visible = struct {
            pub const name = "visible";

            pub const Type = c_int;
        };

        pub const widget = struct {
            pub const name = "widget";

            pub const Type = ?*gtk.Widget;
        };

        pub const width = struct {
            pub const name = "width";

            pub const Type = c_int;
        };

        pub const x_offset = struct {
            pub const name = "x-offset";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when the column's header has been clicked.
        pub const clicked = struct {
            pub const name = "clicked";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeViewColumn, p_instance))),
                    gobject.signalLookup("clicked", TreeViewColumn.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkTreeViewColumn`.
    extern fn gtk_tree_view_column_new() *gtk.TreeViewColumn;
    pub const new = gtk_tree_view_column_new;

    /// Creates a new `GtkTreeViewColumn` using `area` to render its cells.
    extern fn gtk_tree_view_column_new_with_area(p_area: *gtk.CellArea) *gtk.TreeViewColumn;
    pub const newWithArea = gtk_tree_view_column_new_with_area;

    /// Creates a new `GtkTreeViewColumn` with a number of default values.
    /// This is equivalent to calling `gtk.TreeViewColumn.setTitle`,
    /// `gtk.TreeViewColumn.packStart`, and
    /// `gtk.TreeViewColumn.setAttributes` on the newly created `GtkTreeViewColumn`.
    ///
    /// Here’s a simple example:
    ///
    /// ```c
    ///  enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
    ///  // ...
    ///  {
    ///    GtkTreeViewColumn *column;
    ///    GtkCellRenderer   *renderer = gtk_cell_renderer_text_new ();
    ///
    ///    column = gtk_tree_view_column_new_with_attributes ("Title",
    ///                                                       renderer,
    ///                                                       "text", TEXT_COLUMN,
    ///                                                       "foreground", COLOR_COLUMN,
    ///                                                       NULL);
    ///  }
    /// ```
    extern fn gtk_tree_view_column_new_with_attributes(p_title: [*:0]const u8, p_cell: *gtk.CellRenderer, ...) *gtk.TreeViewColumn;
    pub const newWithAttributes = gtk_tree_view_column_new_with_attributes;

    /// Adds an attribute mapping to the list in `tree_column`.
    ///
    /// The `column` is the
    /// column of the model to get a value from, and the `attribute` is the
    /// parameter on `cell_renderer` to be set from the value. So for example
    /// if column 2 of the model contains strings, you could have the
    /// “text” attribute of a `GtkCellRendererText` get its values from
    /// column 2.
    extern fn gtk_tree_view_column_add_attribute(p_tree_column: *TreeViewColumn, p_cell_renderer: *gtk.CellRenderer, p_attribute: [*:0]const u8, p_column: c_int) void;
    pub const addAttribute = gtk_tree_view_column_add_attribute;

    /// Obtains the horizontal position and size of a cell in a column.
    ///
    /// If the  cell is not found in the column, `start_pos` and `width`
    /// are not changed and `FALSE` is returned.
    extern fn gtk_tree_view_column_cell_get_position(p_tree_column: *TreeViewColumn, p_cell_renderer: *gtk.CellRenderer, p_x_offset: ?*c_int, p_width: ?*c_int) c_int;
    pub const cellGetPosition = gtk_tree_view_column_cell_get_position;

    /// Obtains the width and height needed to render the column.  This is used
    /// primarily by the `GtkTreeView`.
    extern fn gtk_tree_view_column_cell_get_size(p_tree_column: *TreeViewColumn, p_x_offset: ?*c_int, p_y_offset: ?*c_int, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const cellGetSize = gtk_tree_view_column_cell_get_size;

    /// Returns `TRUE` if any of the cells packed into the `tree_column` are visible.
    /// For this to be meaningful, you must first initialize the cells with
    /// `gtk.TreeViewColumn.cellSetCellData`
    extern fn gtk_tree_view_column_cell_is_visible(p_tree_column: *TreeViewColumn) c_int;
    pub const cellIsVisible = gtk_tree_view_column_cell_is_visible;

    /// Sets the cell renderer based on the `tree_model` and `iter`.  That is, for
    /// every attribute mapping in `tree_column`, it will get a value from the set
    /// column on the `iter`, and use that value to set the attribute on the cell
    /// renderer.  This is used primarily by the `GtkTreeView`.
    extern fn gtk_tree_view_column_cell_set_cell_data(p_tree_column: *TreeViewColumn, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_is_expander: c_int, p_is_expanded: c_int) void;
    pub const cellSetCellData = gtk_tree_view_column_cell_set_cell_data;

    /// Unsets all the mappings on all renderers on the `tree_column`.
    extern fn gtk_tree_view_column_clear(p_tree_column: *TreeViewColumn) void;
    pub const clear = gtk_tree_view_column_clear;

    /// Clears all existing attributes previously set with
    /// `gtk.TreeViewColumn.setAttributes`.
    extern fn gtk_tree_view_column_clear_attributes(p_tree_column: *TreeViewColumn, p_cell_renderer: *gtk.CellRenderer) void;
    pub const clearAttributes = gtk_tree_view_column_clear_attributes;

    /// Emits the “clicked” signal on the column.  This function will only work if
    /// `tree_column` is clickable.
    extern fn gtk_tree_view_column_clicked(p_tree_column: *TreeViewColumn) void;
    pub const clicked = gtk_tree_view_column_clicked;

    /// Sets the current keyboard focus to be at `cell`, if the column contains
    /// 2 or more editable and activatable cells.
    extern fn gtk_tree_view_column_focus_cell(p_tree_column: *TreeViewColumn, p_cell: *gtk.CellRenderer) void;
    pub const focusCell = gtk_tree_view_column_focus_cell;

    /// Returns the current x alignment of `tree_column`.  This value can range
    /// between 0.0 and 1.0.
    extern fn gtk_tree_view_column_get_alignment(p_tree_column: *TreeViewColumn) f32;
    pub const getAlignment = gtk_tree_view_column_get_alignment;

    /// Returns the button used in the treeview column header
    extern fn gtk_tree_view_column_get_button(p_tree_column: *TreeViewColumn) *gtk.Widget;
    pub const getButton = gtk_tree_view_column_get_button;

    /// Returns `TRUE` if the user can click on the header for the column.
    extern fn gtk_tree_view_column_get_clickable(p_tree_column: *TreeViewColumn) c_int;
    pub const getClickable = gtk_tree_view_column_get_clickable;

    /// Returns `TRUE` if the column expands to fill available space.
    extern fn gtk_tree_view_column_get_expand(p_tree_column: *TreeViewColumn) c_int;
    pub const getExpand = gtk_tree_view_column_get_expand;

    /// Gets the fixed width of the column.  This may not be the actual displayed
    /// width of the column; for that, use `gtk.TreeViewColumn.getWidth`.
    extern fn gtk_tree_view_column_get_fixed_width(p_tree_column: *TreeViewColumn) c_int;
    pub const getFixedWidth = gtk_tree_view_column_get_fixed_width;

    /// Returns the maximum width in pixels of the `tree_column`, or -1 if no maximum
    /// width is set.
    extern fn gtk_tree_view_column_get_max_width(p_tree_column: *TreeViewColumn) c_int;
    pub const getMaxWidth = gtk_tree_view_column_get_max_width;

    /// Returns the minimum width in pixels of the `tree_column`, or -1 if no minimum
    /// width is set.
    extern fn gtk_tree_view_column_get_min_width(p_tree_column: *TreeViewColumn) c_int;
    pub const getMinWidth = gtk_tree_view_column_get_min_width;

    /// Returns `TRUE` if the `tree_column` can be reordered by the user.
    extern fn gtk_tree_view_column_get_reorderable(p_tree_column: *TreeViewColumn) c_int;
    pub const getReorderable = gtk_tree_view_column_get_reorderable;

    /// Returns `TRUE` if the `tree_column` can be resized by the end user.
    extern fn gtk_tree_view_column_get_resizable(p_tree_column: *TreeViewColumn) c_int;
    pub const getResizable = gtk_tree_view_column_get_resizable;

    /// Returns the current type of `tree_column`.
    extern fn gtk_tree_view_column_get_sizing(p_tree_column: *TreeViewColumn) gtk.TreeViewColumnSizing;
    pub const getSizing = gtk_tree_view_column_get_sizing;

    /// Gets the logical `sort_column_id` that the model sorts on
    /// when this column is selected for sorting.
    ///
    /// See `gtk.TreeViewColumn.setSortColumnId`.
    extern fn gtk_tree_view_column_get_sort_column_id(p_tree_column: *TreeViewColumn) c_int;
    pub const getSortColumnId = gtk_tree_view_column_get_sort_column_id;

    /// Gets the value set by `gtk.TreeViewColumn.setSortIndicator`.
    extern fn gtk_tree_view_column_get_sort_indicator(p_tree_column: *TreeViewColumn) c_int;
    pub const getSortIndicator = gtk_tree_view_column_get_sort_indicator;

    /// Gets the value set by `gtk.TreeViewColumn.setSortOrder`.
    extern fn gtk_tree_view_column_get_sort_order(p_tree_column: *TreeViewColumn) gtk.SortType;
    pub const getSortOrder = gtk_tree_view_column_get_sort_order;

    /// Returns the spacing of `tree_column`.
    extern fn gtk_tree_view_column_get_spacing(p_tree_column: *TreeViewColumn) c_int;
    pub const getSpacing = gtk_tree_view_column_get_spacing;

    /// Returns the title of the widget.
    extern fn gtk_tree_view_column_get_title(p_tree_column: *TreeViewColumn) [*:0]const u8;
    pub const getTitle = gtk_tree_view_column_get_title;

    /// Returns the `GtkTreeView` wherein `tree_column` has been inserted.
    /// If `column` is currently not inserted in any tree view, `NULL` is
    /// returned.
    extern fn gtk_tree_view_column_get_tree_view(p_tree_column: *TreeViewColumn) ?*gtk.Widget;
    pub const getTreeView = gtk_tree_view_column_get_tree_view;

    /// Returns `TRUE` if `tree_column` is visible.
    extern fn gtk_tree_view_column_get_visible(p_tree_column: *TreeViewColumn) c_int;
    pub const getVisible = gtk_tree_view_column_get_visible;

    /// Returns the `GtkWidget` in the button on the column header.
    ///
    /// If a custom widget has not been set then `NULL` is returned.
    extern fn gtk_tree_view_column_get_widget(p_tree_column: *TreeViewColumn) ?*gtk.Widget;
    pub const getWidget = gtk_tree_view_column_get_widget;

    /// Returns the current size of `tree_column` in pixels.
    extern fn gtk_tree_view_column_get_width(p_tree_column: *TreeViewColumn) c_int;
    pub const getWidth = gtk_tree_view_column_get_width;

    /// Returns the current X offset of `tree_column` in pixels.
    extern fn gtk_tree_view_column_get_x_offset(p_tree_column: *TreeViewColumn) c_int;
    pub const getXOffset = gtk_tree_view_column_get_x_offset;

    /// Adds the `cell` to end of the column. If `expand` is `FALSE`, then the `cell`
    /// is allocated no more space than it needs. Any unused space is divided
    /// evenly between cells for which `expand` is `TRUE`.
    extern fn gtk_tree_view_column_pack_end(p_tree_column: *TreeViewColumn, p_cell: *gtk.CellRenderer, p_expand: c_int) void;
    pub const packEnd = gtk_tree_view_column_pack_end;

    /// Packs the `cell` into the beginning of the column. If `expand` is `FALSE`, then
    /// the `cell` is allocated no more space than it needs. Any unused space is divided
    /// evenly between cells for which `expand` is `TRUE`.
    extern fn gtk_tree_view_column_pack_start(p_tree_column: *TreeViewColumn, p_cell: *gtk.CellRenderer, p_expand: c_int) void;
    pub const packStart = gtk_tree_view_column_pack_start;

    /// Flags the column, and the cell renderers added to this column, to have
    /// their sizes renegotiated.
    extern fn gtk_tree_view_column_queue_resize(p_tree_column: *TreeViewColumn) void;
    pub const queueResize = gtk_tree_view_column_queue_resize;

    /// Sets the alignment of the title or custom widget inside the column header.
    /// The alignment determines its location inside the button -- 0.0 for left, 0.5
    /// for center, 1.0 for right.
    extern fn gtk_tree_view_column_set_alignment(p_tree_column: *TreeViewColumn, p_xalign: f32) void;
    pub const setAlignment = gtk_tree_view_column_set_alignment;

    /// Sets the attributes in the list as the attributes of `tree_column`.
    ///
    /// The attributes should be in attribute/column order, as in
    /// `gtk.TreeViewColumn.addAttribute`. All existing attributes
    /// are removed, and replaced with the new attributes.
    extern fn gtk_tree_view_column_set_attributes(p_tree_column: *TreeViewColumn, p_cell_renderer: *gtk.CellRenderer, ...) void;
    pub const setAttributes = gtk_tree_view_column_set_attributes;

    /// Sets the `GtkTreeCellDataFunc` to use for the column.
    ///
    /// This
    /// function is used instead of the standard attributes mapping for
    /// setting the column value, and should set the value of `tree_column`'s
    /// cell renderer as appropriate.  `func` may be `NULL` to remove an
    /// older one.
    extern fn gtk_tree_view_column_set_cell_data_func(p_tree_column: *TreeViewColumn, p_cell_renderer: *gtk.CellRenderer, p_func: ?gtk.TreeCellDataFunc, p_func_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setCellDataFunc = gtk_tree_view_column_set_cell_data_func;

    /// Sets the header to be active if `clickable` is `TRUE`.  When the header is
    /// active, then it can take keyboard focus, and can be clicked.
    extern fn gtk_tree_view_column_set_clickable(p_tree_column: *TreeViewColumn, p_clickable: c_int) void;
    pub const setClickable = gtk_tree_view_column_set_clickable;

    /// Sets the column to take available extra space.  This space is shared equally
    /// amongst all columns that have the expand set to `TRUE`.  If no column has this
    /// option set, then the last column gets all extra space.  By default, every
    /// column is created with this `FALSE`.
    ///
    /// Along with “fixed-width”, the “expand” property changes when the column is
    /// resized by the user.
    extern fn gtk_tree_view_column_set_expand(p_tree_column: *TreeViewColumn, p_expand: c_int) void;
    pub const setExpand = gtk_tree_view_column_set_expand;

    /// If `fixed_width` is not -1, sets the fixed width of `tree_column`; otherwise
    /// unsets it.  The effective value of `fixed_width` is clamped between the
    /// minimum and maximum width of the column; however, the value stored in the
    /// “fixed-width” property is not clamped.  If the column sizing is
    /// `GTK_TREE_VIEW_COLUMN_GROW_ONLY` or `GTK_TREE_VIEW_COLUMN_AUTOSIZE`, setting
    /// a fixed width overrides the automatically calculated width.  Note that
    /// `fixed_width` is only a hint to GTK; the width actually allocated to the
    /// column may be greater or less than requested.
    ///
    /// Along with “expand”, the “fixed-width” property changes when the column is
    /// resized by the user.
    extern fn gtk_tree_view_column_set_fixed_width(p_tree_column: *TreeViewColumn, p_fixed_width: c_int) void;
    pub const setFixedWidth = gtk_tree_view_column_set_fixed_width;

    /// Sets the maximum width of the `tree_column`.  If `max_width` is -1, then the
    /// maximum width is unset.  Note, the column can actually be wider than max
    /// width if it’s the last column in a view.  In this case, the column expands to
    /// fill any extra space.
    extern fn gtk_tree_view_column_set_max_width(p_tree_column: *TreeViewColumn, p_max_width: c_int) void;
    pub const setMaxWidth = gtk_tree_view_column_set_max_width;

    /// Sets the minimum width of the `tree_column`.  If `min_width` is -1, then the
    /// minimum width is unset.
    extern fn gtk_tree_view_column_set_min_width(p_tree_column: *TreeViewColumn, p_min_width: c_int) void;
    pub const setMinWidth = gtk_tree_view_column_set_min_width;

    /// If `reorderable` is `TRUE`, then the column can be reordered by the end user
    /// dragging the header.
    extern fn gtk_tree_view_column_set_reorderable(p_tree_column: *TreeViewColumn, p_reorderable: c_int) void;
    pub const setReorderable = gtk_tree_view_column_set_reorderable;

    /// If `resizable` is `TRUE`, then the user can explicitly resize the column by
    /// grabbing the outer edge of the column button.
    ///
    /// If resizable is `TRUE` and
    /// sizing mode of the column is `GTK_TREE_VIEW_COLUMN_AUTOSIZE`, then the sizing
    /// mode is changed to `GTK_TREE_VIEW_COLUMN_GROW_ONLY`.
    extern fn gtk_tree_view_column_set_resizable(p_tree_column: *TreeViewColumn, p_resizable: c_int) void;
    pub const setResizable = gtk_tree_view_column_set_resizable;

    /// Sets the growth behavior of `tree_column` to `type`.
    extern fn gtk_tree_view_column_set_sizing(p_tree_column: *TreeViewColumn, p_type: gtk.TreeViewColumnSizing) void;
    pub const setSizing = gtk_tree_view_column_set_sizing;

    /// Sets the logical `sort_column_id` that this column sorts on when this column
    /// is selected for sorting.  Doing so makes the column header clickable.
    extern fn gtk_tree_view_column_set_sort_column_id(p_tree_column: *TreeViewColumn, p_sort_column_id: c_int) void;
    pub const setSortColumnId = gtk_tree_view_column_set_sort_column_id;

    /// Call this function with a `setting` of `TRUE` to display an arrow in
    /// the header button indicating the column is sorted. Call
    /// `gtk.TreeViewColumn.setSortOrder` to change the direction of
    /// the arrow.
    extern fn gtk_tree_view_column_set_sort_indicator(p_tree_column: *TreeViewColumn, p_setting: c_int) void;
    pub const setSortIndicator = gtk_tree_view_column_set_sort_indicator;

    /// Changes the appearance of the sort indicator.
    ///
    /// This does not actually sort the model.  Use
    /// `gtk.TreeViewColumn.setSortColumnId` if you want automatic sorting
    /// support.  This function is primarily for custom sorting behavior, and should
    /// be used in conjunction with `gtk.TreeSortable.setSortColumnId` to do
    /// that. For custom models, the mechanism will vary.
    ///
    /// The sort indicator changes direction to indicate normal sort or reverse sort.
    /// Note that you must have the sort indicator enabled to see anything when
    /// calling this function; see `gtk.TreeViewColumn.setSortIndicator`.
    extern fn gtk_tree_view_column_set_sort_order(p_tree_column: *TreeViewColumn, p_order: gtk.SortType) void;
    pub const setSortOrder = gtk_tree_view_column_set_sort_order;

    /// Sets the spacing field of `tree_column`, which is the number of pixels to
    /// place between cell renderers packed into it.
    extern fn gtk_tree_view_column_set_spacing(p_tree_column: *TreeViewColumn, p_spacing: c_int) void;
    pub const setSpacing = gtk_tree_view_column_set_spacing;

    /// Sets the title of the `tree_column`.  If a custom widget has been set, then
    /// this value is ignored.
    extern fn gtk_tree_view_column_set_title(p_tree_column: *TreeViewColumn, p_title: [*:0]const u8) void;
    pub const setTitle = gtk_tree_view_column_set_title;

    /// Sets the visibility of `tree_column`.
    extern fn gtk_tree_view_column_set_visible(p_tree_column: *TreeViewColumn, p_visible: c_int) void;
    pub const setVisible = gtk_tree_view_column_set_visible;

    /// Sets the widget in the header to be `widget`.  If widget is `NULL`, then the
    /// header button is set with a `GtkLabel` set to the title of `tree_column`.
    extern fn gtk_tree_view_column_set_widget(p_tree_column: *TreeViewColumn, p_widget: ?*gtk.Widget) void;
    pub const setWidget = gtk_tree_view_column_set_widget;

    extern fn gtk_tree_view_column_get_type() usize;
    pub const getGObjectType = gtk_tree_view_column_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeViewColumn) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeViewColumn) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeViewColumn, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GtkExpression` that tries to evaluate each of its expressions until it succeeds.
///
/// If all expressions fail to evaluate, the `GtkTryExpression`'s evaluation fails as well.
pub const TryExpression = opaque {
    pub const Parent = gtk.Expression;
    pub const Implements = [_]type{};
    pub const Class = opaque {
        pub const Instance = TryExpression;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a `GtkExpression` with an array of expressions.
    ///
    /// When evaluated, the `GtkTryExpression` tries to evaluate each of its expressions until it succeeds.
    /// If all expressions fail to evaluate, the `GtkTryExpression`'s evaluation fails as well.
    ///
    /// The value type of the expressions in the array must match.
    extern fn gtk_try_expression_new(p_n_expressions: c_uint, p_expressions: [*]*gtk.Expression) *gtk.TryExpression;
    pub const new = gtk_try_expression_new;

    extern fn gtk_try_expression_get_type() usize;
    pub const getGObjectType = gtk_try_expression_get_type;

    pub fn as(p_instance: *TryExpression, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Asynchronous API to open a uri with an application.
///
/// `GtkUriLauncher` collects the arguments that are needed to open the uri.
///
/// Depending on system configuration, user preferences and available APIs, this
/// may or may not show an app chooser dialog or launch the default application
/// right away.
///
/// The operation is started with the `gtk.UriLauncher.launch` function.
///
/// To launch a file, use `gtk.FileLauncher`.
pub const UriLauncher = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.UriLauncherClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The uri to launch.
        pub const uri = struct {
            pub const name = "uri";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkUriLauncher` object.
    extern fn gtk_uri_launcher_new(p_uri: ?[*:0]const u8) *gtk.UriLauncher;
    pub const new = gtk_uri_launcher_new;

    /// Returns whether the launcher is likely to succeed
    /// in launching an application for its uri.
    ///
    /// This can be used to disable controls that trigger
    /// the launcher when they are known not to work.
    extern fn gtk_uri_launcher_can_launch(p_self: *UriLauncher, p_parent: ?*gtk.Window) c_int;
    pub const canLaunch = gtk_uri_launcher_can_launch;

    /// Gets the uri that will be opened.
    extern fn gtk_uri_launcher_get_uri(p_self: *UriLauncher) ?[*:0]const u8;
    pub const getUri = gtk_uri_launcher_get_uri;

    /// Launches an application to open the uri.
    ///
    /// This may present an app chooser dialog to the user.
    extern fn gtk_uri_launcher_launch(p_self: *UriLauncher, p_parent: ?*gtk.Window, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
    pub const launch = gtk_uri_launcher_launch;

    /// Finishes the `gtk.UriLauncher.launch` call and
    /// returns the result.
    extern fn gtk_uri_launcher_launch_finish(p_self: *UriLauncher, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) c_int;
    pub const launchFinish = gtk_uri_launcher_launch_finish;

    /// Sets the uri that will be opened.
    extern fn gtk_uri_launcher_set_uri(p_self: *UriLauncher, p_uri: ?[*:0]const u8) void;
    pub const setUri = gtk_uri_launcher_set_uri;

    extern fn gtk_uri_launcher_get_type() usize;
    pub const getGObjectType = gtk_uri_launcher_get_type;

    extern fn g_object_ref(p_self: *gtk.UriLauncher) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.UriLauncher) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *UriLauncher, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows a `GtkMediaStream` with media controls.
///
/// <picture>
///   <source srcset="video-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkVideo" src="video.png">
/// </picture>
///
/// The controls are available separately as `gtk.MediaControls`.
/// If you just want to display a video without controls, you can treat it
/// like any other paintable and for example put it into a `gtk.Picture`.
///
/// `GtkVideo` aims to cover use cases such as previews, embedded animations,
/// etc. It supports autoplay, looping, and simple media controls. It does
/// not have support for video overlays, multichannel audio, device
/// selection, or input. If you are writing a full-fledged video player,
/// you may want to use the `gdk.Paintable` API and a media framework
/// such as Gstreamer directly.
pub const Video = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.VideoClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// If the video should automatically begin playing.
        pub const autoplay = struct {
            pub const name = "autoplay";

            pub const Type = c_int;
        };

        /// The file played by this video if the video is playing a file.
        pub const file = struct {
            pub const name = "file";

            pub const Type = ?*gio.File;
        };

        /// Whether to enable graphics offload.
        pub const graphics_offload = struct {
            pub const name = "graphics-offload";

            pub const Type = gtk.GraphicsOffloadEnabled;
        };

        /// If new media files should be set to loop.
        pub const loop = struct {
            pub const name = "loop";

            pub const Type = c_int;
        };

        /// The media-stream played
        pub const media_stream = struct {
            pub const name = "media-stream";

            pub const Type = ?*gtk.MediaStream;
        };
    };

    pub const signals = struct {};

    /// Creates a new empty `GtkVideo`.
    extern fn gtk_video_new() *gtk.Video;
    pub const new = gtk_video_new;

    /// Creates a `GtkVideo` to play back the given `file`.
    extern fn gtk_video_new_for_file(p_file: ?*gio.File) *gtk.Video;
    pub const newForFile = gtk_video_new_for_file;

    /// Creates a `GtkVideo` to play back the given `filename`.
    ///
    /// This is a utility function that calls `gtk.Video.newForFile`,
    /// See that function for details.
    extern fn gtk_video_new_for_filename(p_filename: ?[*:0]const u8) *gtk.Video;
    pub const newForFilename = gtk_video_new_for_filename;

    /// Creates a `GtkVideo` to play back the given `stream`.
    extern fn gtk_video_new_for_media_stream(p_stream: ?*gtk.MediaStream) *gtk.Video;
    pub const newForMediaStream = gtk_video_new_for_media_stream;

    /// Creates a `GtkVideo` to play back the resource at the
    /// given `resource_path`.
    ///
    /// This is a utility function that calls `gtk.Video.newForFile`.
    extern fn gtk_video_new_for_resource(p_resource_path: ?[*:0]const u8) *gtk.Video;
    pub const newForResource = gtk_video_new_for_resource;

    /// Returns `TRUE` if videos have been set to loop.
    extern fn gtk_video_get_autoplay(p_self: *Video) c_int;
    pub const getAutoplay = gtk_video_get_autoplay;

    /// Gets the file played by `self` or `NULL` if not playing back
    /// a file.
    extern fn gtk_video_get_file(p_self: *Video) ?*gio.File;
    pub const getFile = gtk_video_get_file;

    /// Returns whether graphics offload is enabled.
    ///
    /// See `gtk.GraphicsOffload` for more information on graphics offload.
    extern fn gtk_video_get_graphics_offload(p_self: *Video) gtk.GraphicsOffloadEnabled;
    pub const getGraphicsOffload = gtk_video_get_graphics_offload;

    /// Returns `TRUE` if videos have been set to loop.
    extern fn gtk_video_get_loop(p_self: *Video) c_int;
    pub const getLoop = gtk_video_get_loop;

    /// Gets the media stream managed by `self` or `NULL` if none.
    extern fn gtk_video_get_media_stream(p_self: *Video) ?*gtk.MediaStream;
    pub const getMediaStream = gtk_video_get_media_stream;

    /// Sets whether `self` automatically starts playback when it
    /// becomes visible or when a new file gets loaded.
    extern fn gtk_video_set_autoplay(p_self: *Video, p_autoplay: c_int) void;
    pub const setAutoplay = gtk_video_set_autoplay;

    /// Makes `self` play the given `file`.
    extern fn gtk_video_set_file(p_self: *Video, p_file: ?*gio.File) void;
    pub const setFile = gtk_video_set_file;

    /// Makes `self` play the given `filename`.
    ///
    /// This is a utility function that calls `gtk.Video.setFile`,
    extern fn gtk_video_set_filename(p_self: *Video, p_filename: ?[*:0]const u8) void;
    pub const setFilename = gtk_video_set_filename;

    /// Sets whether to enable graphics offload.
    ///
    /// See `gtk.GraphicsOffload` for more information on graphics offload.
    extern fn gtk_video_set_graphics_offload(p_self: *Video, p_enabled: gtk.GraphicsOffloadEnabled) void;
    pub const setGraphicsOffload = gtk_video_set_graphics_offload;

    /// Sets whether new files loaded by `self` should be set to loop.
    extern fn gtk_video_set_loop(p_self: *Video, p_loop: c_int) void;
    pub const setLoop = gtk_video_set_loop;

    /// Sets the media stream to be played back.
    ///
    /// `self` will take full control of managing the media stream. If you
    /// want to manage a media stream yourself, consider using a
    /// `gtk.Picture` for display.
    ///
    /// If you want to display a file, consider using `gtk.Video.setFile`
    /// instead.
    extern fn gtk_video_set_media_stream(p_self: *Video, p_stream: ?*gtk.MediaStream) void;
    pub const setMediaStream = gtk_video_set_media_stream;

    /// Makes `self` play the resource at the given `resource_path`.
    ///
    /// This is a utility function that calls `gtk.Video.setFile`.
    extern fn gtk_video_set_resource(p_self: *Video, p_resource_path: ?[*:0]const u8) void;
    pub const setResource = gtk_video_set_resource;

    extern fn gtk_video_get_type() usize;
    pub const getGObjectType = gtk_video_get_type;

    extern fn g_object_ref(p_self: *gtk.Video) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Video) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Video, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Implements scrollability for widgets that don't support scrolling
/// on their own.
///
/// Use `GtkViewport` to scroll child widgets such as `GtkGrid`,
/// `GtkBox`, and so on.
///
/// The `GtkViewport` will start scrolling content only if allocated
/// less than the child widget’s minimum size in a given orientation.
///
/// # CSS nodes
///
/// `GtkViewport` has a single CSS node with name `viewport`.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkViewport` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkViewport` uses the `gtk.@"AccessibleRole.generic"` role.
pub const Viewport = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Scrollable };
    pub const Class = opaque {
        pub const Instance = Viewport;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether to scroll when the focus changes.
        ///
        /// Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your
        /// code needs to work with older versions, consider setting it explicitly to
        /// TRUE.
        pub const scroll_to_focus = struct {
            pub const name = "scroll-to-focus";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkViewport`.
    ///
    /// The new viewport uses the given adjustments, or default
    /// adjustments if none are given.
    extern fn gtk_viewport_new(p_hadjustment: ?*gtk.Adjustment, p_vadjustment: ?*gtk.Adjustment) *gtk.Viewport;
    pub const new = gtk_viewport_new;

    /// Gets the child widget of `viewport`.
    extern fn gtk_viewport_get_child(p_viewport: *Viewport) ?*gtk.Widget;
    pub const getChild = gtk_viewport_get_child;

    /// Gets whether the viewport is scrolling to keep the focused
    /// child in view.
    extern fn gtk_viewport_get_scroll_to_focus(p_viewport: *Viewport) c_int;
    pub const getScrollToFocus = gtk_viewport_get_scroll_to_focus;

    /// Scrolls a descendant of the viewport into view.
    ///
    /// The viewport and the descendant must be visible and mapped for
    /// this function to work, otherwise no scrolling will be performed.
    extern fn gtk_viewport_scroll_to(p_viewport: *Viewport, p_descendant: *gtk.Widget, p_scroll: ?*gtk.ScrollInfo) void;
    pub const scrollTo = gtk_viewport_scroll_to;

    /// Sets the child widget of `viewport`.
    extern fn gtk_viewport_set_child(p_viewport: *Viewport, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_viewport_set_child;

    /// Sets whether the viewport should automatically scroll
    /// to keep the focused child in view.
    extern fn gtk_viewport_set_scroll_to_focus(p_viewport: *Viewport, p_scroll_to_focus: c_int) void;
    pub const setScrollToFocus = gtk_viewport_set_scroll_to_focus;

    extern fn gtk_viewport_get_type() usize;
    pub const getGObjectType = gtk_viewport_get_type;

    extern fn g_object_ref(p_self: *gtk.Viewport) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Viewport) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Viewport, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkVolumeButton` is a `GtkScaleButton` subclass tailored for
/// volume control.
///
/// <picture>
///   <source srcset="volumebutton-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkVolumeButton" src="volumebutton.png">
/// </picture>
pub const VolumeButton = extern struct {
    pub const Parent = gtk.ScaleButton;
    pub const Implements = [_]type{ gtk.Accessible, gtk.AccessibleRange, gtk.Buildable, gtk.ConstraintTarget, gtk.Orientable };
    pub const Class = opaque {
        pub const Instance = VolumeButton;
    };
    f_parent: gtk.ScaleButton,

    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// Whether to use symbolic icons as the icons.
        ///
        /// Note that if the symbolic icons are not available in your installed
        /// theme, then the normal (potentially colorful) icons will be used.
        pub const use_symbolic = struct {
            pub const name = "use-symbolic";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a `GtkVolumeButton`.
    ///
    /// The button has a range between 0.0 and 1.0, with a stepping of 0.02.
    /// Volume values can be obtained and modified using the functions from
    /// `gtk.ScaleButton`.
    extern fn gtk_volume_button_new() *gtk.VolumeButton;
    pub const new = gtk_volume_button_new;

    extern fn gtk_volume_button_get_type() usize;
    pub const getGObjectType = gtk_volume_button_get_type;

    extern fn g_object_ref(p_self: *gtk.VolumeButton) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.VolumeButton) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *VolumeButton, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The base class for all widgets.
///
/// It manages the widget lifecycle, layout, states and style.
///
/// ### Height-for-width Geometry Management
///
/// GTK uses a height-for-width (and width-for-height) geometry management
/// system. Height-for-width means that a widget can change how much
/// vertical space it needs, depending on the amount of horizontal space
/// that it is given (and similar for width-for-height). The most common
/// example is a label that reflows to fill up the available width, wraps
/// to fewer lines, and therefore needs less height.
///
/// Height-for-width geometry management is implemented in GTK by way
/// of two virtual methods:
///
/// - `gtk.Widget.virtual_methods.get_request_mode`
/// - `gtk.Widget.virtual_methods.measure`
///
/// There are some important things to keep in mind when implementing
/// height-for-width and when using it in widget implementations.
///
/// If you implement a direct `GtkWidget` subclass that supports
/// height-for-width or width-for-height geometry management for itself
/// or its child widgets, the `gtk.Widget.virtual_methods.get_request_mode` virtual
/// function must be implemented as well and return the widget's preferred
/// request mode. The default implementation of this virtual function
/// returns `GTK_SIZE_REQUEST_CONSTANT_SIZE`, which means that the widget will
/// only ever get -1 passed as the for_size value to its
/// `gtk.Widget.virtual_methods.measure` implementation.
///
/// The geometry management system will query a widget hierarchy in
/// only one orientation at a time. When widgets are initially queried
/// for their minimum sizes it is generally done in two initial passes
/// in the `gtk.SizeRequestMode` chosen by the toplevel.
///
/// For example, when queried in the normal `GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH` mode:
///
/// First, the default minimum and natural width for each widget
/// in the interface will be computed using `gtk.Widget.measure` with an
/// orientation of `GTK_ORIENTATION_HORIZONTAL` and a for_size of -1.
/// Because the preferred widths for each widget depend on the preferred
/// widths of their children, this information propagates up the hierarchy,
/// and finally a minimum and natural width is determined for the entire
/// toplevel. Next, the toplevel will use the minimum width to query for the
/// minimum height contextual to that width using `gtk.Widget.measure` with an
/// orientation of `GTK_ORIENTATION_VERTICAL` and a for_size of the just computed
/// width. This will also be a highly recursive operation. The minimum height
/// for the minimum width is normally used to set the minimum size constraint
/// on the toplevel.
///
/// After the toplevel window has initially requested its size in both
/// dimensions it can go on to allocate itself a reasonable size (or a size
/// previously specified with `gtk.Window.setDefaultSize`). During the
/// recursive allocation process it’s important to note that request cycles
/// will be recursively executed while widgets allocate their children.
/// Each widget, once allocated a size, will go on to first share the
/// space in one orientation among its children and then request each child's
/// height for its target allocated width or its width for allocated height,
/// depending. In this way a widget will typically be requested its size
/// a number of times before actually being allocated a size. The size a
/// widget is finally allocated can of course differ from the size it has
/// requested. For this reason, `GtkWidget` caches a  small number of results
/// to avoid re-querying for the same sizes in one allocation cycle.
///
/// If a widget does move content around to intelligently use up the
/// allocated size then it must support the request in both
/// `GtkSizeRequestMode`s even if the widget in question only
/// trades sizes in a single orientation.
///
/// For instance, a `gtk.Label` that does height-for-width word wrapping
/// will not expect to have `gtk.Widget.virtual_methods.measure` with an orientation of
/// `GTK_ORIENTATION_VERTICAL` called because that call is specific to a
/// width-for-height request. In this case the label must return the height
/// required for its own minimum possible width. By following this rule any
/// widget that handles height-for-width or width-for-height requests will
/// always be allocated at least enough space to fit its own content.
///
/// Here are some examples of how a `GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH` widget
/// generally deals with width-for-height requests:
///
/// ```c
/// static void
/// foo_widget_measure (GtkWidget      *widget,
///                     GtkOrientation  orientation,
///                     int             for_size,
///                     int            *minimum_size,
///                     int            *natural_size,
///                     int            *minimum_baseline,
///                     int            *natural_baseline)
/// {
///   if (orientation == GTK_ORIENTATION_HORIZONTAL)
///     {
///       // Calculate minimum and natural width
///     }
///   else // VERTICAL
///     {
///       if (i_am_in_height_for_width_mode)
///         {
///           int min_width, dummy;
///
///           // First, get the minimum width of our widget
///           GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_HORIZONTAL, -1,
///                                                   &min_width, &dummy, &dummy, &dummy);
///
///           // Now use the minimum width to retrieve the minimum and natural height to display
///           // that width.
///           GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_VERTICAL, min_width,
///                                                   minimum_size, natural_size, &dummy, &dummy);
///         }
///       else
///         {
///           // ... some widgets do both.
///         }
///     }
/// }
/// ```
///
/// Often a widget needs to get its own request during size request or
/// allocation. For example, when computing height it may need to also
/// compute width. Or when deciding how to use an allocation, the widget
/// may need to know its natural size. In these cases, the widget should
/// be careful to call its virtual methods directly, like in the code
/// example above.
///
/// It will not work to use the wrapper function `gtk.Widget.measure`
/// inside your own `gtk.Widget.virtual_methods.size_allocate` implementation.
/// These return a request adjusted by `gtk.SizeGroup`, the widget's
/// align and expand flags, as well as its CSS style.
///
/// If a widget used the wrappers inside its virtual method implementations,
/// then the adjustments (such as widget margins) would be applied
/// twice. GTK therefore does not allow this and will warn if you try
/// to do it.
///
/// Of course if you are getting the size request for another widget, such
/// as a child widget, you must use `gtk.Widget.measure`; otherwise, you
/// would not properly consider widget margins, `gtk.SizeGroup`, and
/// so forth.
///
/// GTK also supports baseline vertical alignment of widgets. This
/// means that widgets are positioned such that the typographical baseline of
/// widgets in the same row are aligned. This happens if a widget supports
/// baselines, has a vertical alignment using baselines, and is inside
/// a widget that supports baselines and has a natural “row” that it aligns to
/// the baseline, or a baseline assigned to it by the grandparent.
///
/// Baseline alignment support for a widget is also done by the
/// `gtk.Widget.virtual_methods.measure` virtual function. It allows you to report
/// both a minimum and natural size.
///
/// If a widget ends up baseline aligned it will be allocated all the space in
/// the parent as if it was `GTK_ALIGN_FILL`, but the selected baseline can be
/// found via `gtk.Widget.getBaseline`. If the baseline has a
/// value other than -1 you need to align the widget such that the baseline
/// appears at the position.
///
/// ### GtkWidget as GtkBuildable
///
/// The `GtkWidget` implementation of the `GtkBuildable` interface
/// supports various custom elements to specify additional aspects of widgets
/// that are not directly expressed as properties.
///
/// If the widget uses a `gtk.LayoutManager`, `GtkWidget` supports
/// a custom `<layout>` element, used to define layout properties:
///
/// ```xml
/// <object class="GtkGrid" id="my_grid">
///   <child>
///     <object class="GtkLabel" id="label1">
///       <property name="label">Description</property>
///       <layout>
///         <property name="column">0</property>
///         <property name="row">0</property>
///         <property name="row-span">1</property>
///         <property name="column-span">1</property>
///       </layout>
///     </object>
///   </child>
///   <child>
///     <object class="GtkEntry" id="description_entry">
///       <layout>
///         <property name="column">1</property>
///         <property name="row">0</property>
///         <property name="row-span">1</property>
///         <property name="column-span">1</property>
///       </layout>
///     </object>
///   </child>
/// </object>
/// ```
///
/// `GtkWidget` allows style information such as style classes to
/// be associated with widgets, using the custom `<style>` element:
///
/// ```xml
/// <object class="GtkButton" id="button1">
///   <style>
///     <class name="my-special-button-class"/>
///     <class name="dark-button"/>
///   </style>
/// </object>
/// ```
///
/// `GtkWidget` allows defining accessibility information, such as properties,
/// relations, and states, using the custom `<accessibility>` element:
///
/// ```xml
/// <object class="GtkButton" id="button1">
///   <accessibility>
///     <property name="label">Download</property>
///     <relation name="labelled-by">label1</relation>
///   </accessibility>
/// </object>
/// ```
///
/// ### Building composite widgets from template XML
///
/// `GtkWidget `exposes some facilities to automate the procedure
/// of creating composite widgets using "templates".
///
/// To create composite widgets with `GtkBuilder` XML, one must associate
/// the interface description with the widget class at class initialization
/// time using `gtk.WidgetClass.setTemplate`.
///
/// The interface description semantics expected in composite template descriptions
/// is slightly different from regular `gtk.Builder` XML.
///
/// Unlike regular interface descriptions, `gtk.WidgetClass.setTemplate`
/// will expect a `<template>` tag as a direct child of the toplevel
/// `<interface>` tag. The `<template>` tag must specify the “class” attribute
/// which must be the type name of the widget. Optionally, the “parent”
/// attribute may be specified to specify the direct parent type of the widget
/// type; this is ignored by `GtkBuilder` but can be used by UI design tools to
/// introspect what kind of properties and internal children exist for a given
/// type when the actual type does not exist.
///
/// The XML which is contained inside the `<template>` tag behaves as if it were
/// added to the `<object>` tag defining the widget itself. You may set properties
/// on a widget by inserting `<property>` tags into the `<template>` tag, and also
/// add `<child>` tags to add children and extend a widget in the normal way you
/// would with `<object>` tags.
///
/// Additionally, `<object>` tags can also be added before and after the initial
/// `<template>` tag in the normal way, allowing one to define auxiliary objects
/// which might be referenced by other widgets declared as children of the
/// `<template>` tag.
///
/// Since, unlike the `<object>` tag, the `<template>` tag does not contain an
/// “id” attribute, if you need to refer to the instance of the object itself that
/// the template will create, simply refer to the template class name in an
/// applicable element content.
///
/// Here is an example of a template definition, which includes an example of
/// this in the `<signal>` tag:
///
/// ```xml
/// <interface>
///   <template class="FooWidget" parent="GtkBox">
///     <property name="orientation">horizontal</property>
///     <property name="spacing">4</property>
///     <child>
///       <object class="GtkButton" id="hello_button">
///         <property name="label">Hello World</property>
///         <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/>
///       </object>
///     </child>
///     <child>
///       <object class="GtkButton" id="goodbye_button">
///         <property name="label">Goodbye World</property>
///       </object>
///     </child>
///   </template>
/// </interface>
/// ```
///
/// Typically, you'll place the template fragment into a file that is
/// bundled with your project, using `GResource`. In order to load the
/// template, you need to call `gtk.WidgetClass.setTemplateFromResource`
/// from the class initialization of your `GtkWidget` type:
///
/// ```c
/// static void
/// foo_widget_class_init (FooWidgetClass *klass)
/// {
///   // ...
///
///   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
///                                                "/com/example/ui/foowidget.ui");
/// }
/// ```
///
/// You will also need to call `gtk.Widget.initTemplate` from the
/// instance initialization function:
///
/// ```c
/// static void
/// foo_widget_init (FooWidget *self)
/// {
///   gtk_widget_init_template (GTK_WIDGET (self));
///
///   // Initialize the rest of the widget...
/// }
/// ```
///
/// as well as calling `gtk.Widget.disposeTemplate` from the dispose
/// function:
///
/// ```c
/// static void
/// foo_widget_dispose (GObject *gobject)
/// {
///   FooWidget *self = FOO_WIDGET (gobject);
///
///   // Dispose objects for which you have a reference...
///
///   // Clear the template children for this widget type
///   gtk_widget_dispose_template (GTK_WIDGET (self), FOO_TYPE_WIDGET);
///
///   G_OBJECT_CLASS (foo_widget_parent_class)->dispose (gobject);
/// }
/// ```
///
/// You can access widgets defined in the template using the
/// `gtk.Widget.getTemplateChild` function, but you will typically declare
/// a pointer in the instance private data structure of your type using the same
/// name as the widget in the template definition, and call
/// `gtk.WidgetClass.bindTemplateChildFull` (or one of its wrapper macros
/// `gtk.widgetClassBindTemplateChild` and `gtk.widgetClassBindTemplateChildPrivate`)
/// with that name, e.g.
///
/// ```c
/// typedef struct {
///   GtkWidget *hello_button;
///   GtkWidget *goodbye_button;
/// } FooWidgetPrivate;
///
/// G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX)
///
/// static void
/// foo_widget_dispose (GObject *gobject)
/// {
///   gtk_widget_dispose_template (GTK_WIDGET (gobject), FOO_TYPE_WIDGET);
///
///   G_OBJECT_CLASS (foo_widget_parent_class)->dispose (gobject);
/// }
///
/// static void
/// foo_widget_class_init (FooWidgetClass *klass)
/// {
///   // ...
///   G_OBJECT_CLASS (klass)->dispose = foo_widget_dispose;
///
///   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
///                                                "/com/example/ui/foowidget.ui");
///   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass),
///                                                 FooWidget, hello_button);
///   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass),
///                                                 FooWidget, goodbye_button);
/// }
///
/// static void
/// foo_widget_init (FooWidget *widget)
/// {
///   gtk_widget_init_template (GTK_WIDGET (widget));
/// }
/// ```
///
/// You can also use `gtk.WidgetClass.bindTemplateCallbackFull` (or
/// is wrapper macro `gtk.widgetClassBindTemplateCallback`) to connect
/// a signal callback defined in the template with a function visible in the
/// scope of the class, e.g.
///
/// ```c
/// // the signal handler has the instance and user data swapped
/// // because of the swapped="yes" attribute in the template XML
/// static void
/// hello_button_clicked (FooWidget *self,
///                       GtkButton *button)
/// {
///   g_print ("Hello, world!\n");
/// }
///
/// static void
/// foo_widget_class_init (FooWidgetClass *klass)
/// {
///   // ...
///   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
///                                                "/com/example/ui/foowidget.ui");
///   gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked);
/// }
/// ```
pub const Widget = extern struct {
    pub const Parent = gobject.InitiallyUnowned;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.WidgetClass;
    f_parent_instance: gobject.InitiallyUnowned,
    f_priv: ?*gtk.WidgetPrivate,

    pub const virtual_methods = struct {
        /// Computes whether a container should give this
        ///   widget extra space when possible.
        pub const compute_expand = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_hexpand_p: *c_int, p_vexpand_p: *c_int) void {
                return gobject.ext.as(Widget.Class, p_class).f_compute_expand.?(gobject.ext.as(Widget, p_widget), p_hexpand_p, p_vexpand_p);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_hexpand_p: *c_int, p_vexpand_p: *c_int) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_compute_expand = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const contains = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: f64, p_y: f64) c_int {
                return gobject.ext.as(Widget.Class, p_class).f_contains.?(gobject.ext.as(Widget, p_widget), p_x, p_y);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: f64, p_y: f64) callconv(.c) c_int) void {
                gobject.ext.as(Widget.Class, p_class).f_contains = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const css_changed = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_change: *gtk.CssStyleChange) void {
                return gobject.ext.as(Widget.Class, p_class).f_css_changed.?(gobject.ext.as(Widget, p_widget), p_change);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_change: *gtk.CssStyleChange) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_css_changed = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when the text direction of a
        ///   widget changes.
        pub const direction_changed = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_previous_direction: gtk.TextDirection) void {
                return gobject.ext.as(Widget.Class, p_class).f_direction_changed.?(gobject.ext.as(Widget, p_widget), p_previous_direction);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_previous_direction: gtk.TextDirection) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_direction_changed = @ptrCast(p_implementation);
            }
        };

        /// Vfunc for `gtk.Widget.childFocus`
        pub const focus = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) c_int {
                return gobject.ext.as(Widget.Class, p_class).f_focus.?(gobject.ext.as(Widget, p_widget), p_direction);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) callconv(.c) c_int) void {
                gobject.ext.as(Widget.Class, p_class).f_focus = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const get_request_mode = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) gtk.SizeRequestMode {
                return gobject.ext.as(Widget.Class, p_class).f_get_request_mode.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) gtk.SizeRequestMode) void {
                gobject.ext.as(Widget.Class, p_class).f_get_request_mode = @ptrCast(p_implementation);
            }
        };

        /// Causes `widget` to have the keyboard focus for the window
        /// that it belongs to.
        ///
        /// If `widget` is not focusable, or its `gtk.Widget.virtual_methods.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 `gtk.Widget.grabFocus` on an already focused widget
        /// is allowed, should not have an effect, and return true.
        pub const grab_focus = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(Widget.Class, p_class).f_grab_focus.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(Widget.Class, p_class).f_grab_focus = @ptrCast(p_implementation);
            }
        };

        /// Reverses the effects of [method.Gtk.Widget.show].
        ///
        /// This is causing the widget to be hidden (invisible to the user).
        pub const hide = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_hide.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_hide = @ptrCast(p_implementation);
            }
        };

        /// Emits the `gtk.Widget.signals.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
        /// `gtk.Widget.childFocus`. 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
        /// `gtk.Widget.childFocus` on the widget’s toplevel.
        ///
        /// The default `gtk.Widget.signals.keynav_failed` handler returns
        /// false for `gtk.@"DirectionType.tab-forward"` and
        /// `gtk.@"DirectionType.tab-backward"`. For the other values
        /// of `gtk.DirectionType` it returns true.
        ///
        /// Whenever the default handler returns true, it also calls
        /// `gtk.Widget.errorBell` 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
        /// `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.
        pub const keynav_failed = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) c_int {
                return gobject.ext.as(Widget.Class, p_class).f_keynav_failed.?(gobject.ext.as(Widget, p_widget), p_direction);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) callconv(.c) c_int) void {
                gobject.ext.as(Widget.Class, p_class).f_keynav_failed = @ptrCast(p_implementation);
            }
        };

        /// Causes a widget to be mapped if it isn’t already.
        ///
        /// This function is only for use in widget implementations.
        pub const map = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_map.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_map = @ptrCast(p_implementation);
            }
        };

        /// 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 [GtkWidget’s geometry management section](class.Widget.html`height`-for-width-geometry-management) for
        /// a more details on implementing `GtkWidgetClass.`measure``.
        pub const measure = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) void {
                return gobject.ext.as(Widget.Class, p_class).f_measure.?(gobject.ext.as(Widget, p_widget), p_orientation, p_for_size, p_minimum, p_natural, p_minimum_baseline, p_natural_baseline);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_measure = @ptrCast(p_implementation);
            }
        };

        /// Emits the `gtk.Widget.signals.mnemonic_activate` signal.
        pub const mnemonic_activate = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_group_cycling: c_int) c_int {
                return gobject.ext.as(Widget.Class, p_class).f_mnemonic_activate.?(gobject.ext.as(Widget, p_widget), p_group_cycling);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_group_cycling: c_int) callconv(.c) c_int) void {
                gobject.ext.as(Widget.Class, p_class).f_mnemonic_activate = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when a change of focus is requested
        pub const move_focus = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) void {
                return gobject.ext.as(Widget.Class, p_class).f_move_focus.?(gobject.ext.as(Widget, p_widget), p_direction);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_direction: gtk.DirectionType) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_move_focus = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const query_tooltip = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: c_int, p_y: c_int, p_keyboard_tooltip: c_int, p_tooltip: *gtk.Tooltip) c_int {
                return gobject.ext.as(Widget.Class, p_class).f_query_tooltip.?(gobject.ext.as(Widget, p_widget), p_x, p_y, p_keyboard_tooltip, p_tooltip);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: c_int, p_y: c_int, p_keyboard_tooltip: c_int, p_tooltip: *gtk.Tooltip) callconv(.c) c_int) void {
                gobject.ext.as(Widget.Class, p_class).f_query_tooltip = @ptrCast(p_implementation);
            }
        };

        /// 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 widget’s parent widgets to be
        /// realized; calling this function realizes the widget’s 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
        /// isn’t 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
        /// `gtk.Widget.signals.realize`.
        pub const realize = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_realize.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_realize = @ptrCast(p_implementation);
            }
        };

        /// Called when the widget gets added to a `GtkRoot` widget. Must
        ///   chain up
        pub const root = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_root.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_root = @ptrCast(p_implementation);
            }
        };

        /// 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
        /// `gtk.Widget.grabFocus` on it.
        pub const set_focus_child = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_child: ?*gtk.Widget) void {
                return gobject.ext.as(Widget.Class, p_class).f_set_focus_child.?(gobject.ext.as(Widget, p_widget), p_child);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_child: ?*gtk.Widget) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_set_focus_child = @ptrCast(p_implementation);
            }
        };

        /// Flags a widget to be displayed.
        ///
        /// Any widget that isn’t 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.
        pub const show = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_show.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_show = @ptrCast(p_implementation);
            }
        };

        /// Called to set the allocation, if the widget does
        ///   not have a layout manager.
        pub const size_allocate = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int, p_baseline: c_int) void {
                return gobject.ext.as(Widget.Class, p_class).f_size_allocate.?(gobject.ext.as(Widget, p_widget), p_width, p_height, p_baseline);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_width: c_int, p_height: c_int, p_baseline: c_int) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_size_allocate = @ptrCast(p_implementation);
            }
        };

        /// Vfunc called when a new snapshot of the widget has to be taken.
        pub const snapshot = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gtk.Snapshot) void {
                return gobject.ext.as(Widget.Class, p_class).f_snapshot.?(gobject.ext.as(Widget, p_widget), p_snapshot);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gtk.Snapshot) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_snapshot = @ptrCast(p_implementation);
            }
        };

        /// Signal emitted when the widget state changes,
        ///   see `gtk.Widget.getStateFlags`.
        pub const state_flags_changed = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_previous_state_flags: gtk.StateFlags) void {
                return gobject.ext.as(Widget.Class, p_class).f_state_flags_changed.?(gobject.ext.as(Widget, p_widget), p_previous_state_flags);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_previous_state_flags: gtk.StateFlags) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_state_flags_changed = @ptrCast(p_implementation);
            }
        };

        /// Emitted when a system setting was changed. Must chain up.
        pub const system_setting_changed = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_settings: gtk.SystemSetting) void {
                return gobject.ext.as(Widget.Class, p_class).f_system_setting_changed.?(gobject.ext.as(Widget, p_widget), p_settings);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_settings: gtk.SystemSetting) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_system_setting_changed = @ptrCast(p_implementation);
            }
        };

        /// Causes a widget to be unmapped if it’s currently mapped.
        ///
        /// This function is only for use in widget implementations.
        pub const unmap = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_unmap.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_unmap = @ptrCast(p_implementation);
            }
        };

        /// Causes a widget to be unrealized.
        ///
        /// This frees all GDK resources associated with the widget.
        ///
        /// This function is only useful in widget implementations.
        pub const unrealize = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_unrealize.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_unrealize = @ptrCast(p_implementation);
            }
        };

        /// Called when the widget is about to be removed from its
        ///   `GtkRoot` widget. Must chain up
        pub const unroot = struct {
            pub fn call(p_class: anytype, p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Widget.Class, p_class).f_unroot.?(gobject.ext.as(Widget, p_widget));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_widget: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Widget.Class, p_class).f_unroot = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// 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.
        pub const can_focus = struct {
            pub const name = "can-focus";

            pub const Type = c_int;
        };

        /// Whether the widget can receive pointer events.
        pub const can_target = struct {
            pub const name = "can-target";

            pub const Type = c_int;
        };

        /// A list of css classes applied to this widget.
        pub const css_classes = struct {
            pub const name = "css-classes";

            pub const Type = ?[*][*:0]u8;
        };

        /// 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.
        pub const css_name = struct {
            pub const name = "css-name";

            pub const Type = ?[*:0]u8;
        };

        /// The cursor used by `widget`.
        pub const cursor = struct {
            pub const name = "cursor";

            pub const Type = ?*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.
        pub const focus_on_click = struct {
            pub const name = "focus-on-click";

            pub const Type = c_int;
        };

        /// Whether this widget itself will accept the input focus.
        pub const focusable = struct {
            pub const name = "focusable";

            pub const Type = c_int;
        };

        /// How to distribute horizontal space if widget gets extra space.
        pub const halign = struct {
            pub const name = "halign";

            pub const Type = gtk.Align;
        };

        /// Whether the widget is the default widget.
        pub const has_default = struct {
            pub const name = "has-default";

            pub const Type = c_int;
        };

        /// Whether the widget has the input focus.
        pub const has_focus = struct {
            pub const name = "has-focus";

            pub const Type = c_int;
        };

        /// Enables or disables the emission of the `gtk.Widget.signals.query_tooltip`
        /// signal on `widget`.
        ///
        /// A true value indicates that `widget` can have a tooltip, in this case
        /// the widget will be queried using `gtk.Widget.signals.query_tooltip` to
        /// determine whether it will provide a tooltip or not.
        pub const has_tooltip = struct {
            pub const name = "has-tooltip";

            pub const Type = c_int;
        };

        /// Overrides for height request of the widget.
        ///
        /// If this is -1, the natural request will be used.
        pub const height_request = struct {
            pub const name = "height-request";

            pub const Type = c_int;
        };

        /// Whether to expand horizontally.
        pub const hexpand = struct {
            pub const name = "hexpand";

            pub const Type = c_int;
        };

        /// Whether to use the `hexpand` property.
        pub const hexpand_set = struct {
            pub const name = "hexpand-set";

            pub const Type = c_int;
        };

        /// The `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.
        pub const layout_manager = struct {
            pub const name = "layout-manager";

            pub const Type = ?*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 `gtk.EventController.setPropagationLimit`.
        pub const limit_events = struct {
            pub const name = "limit-events";

            pub const Type = c_int;
        };

        /// 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
        /// `gtk.Widget.setSizeRequest` for example.
        pub const margin_bottom = struct {
            pub const name = "margin-bottom";

            pub const Type = c_int;
        };

        /// 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
        /// `gtk.Widget.setSizeRequest` for example.
        pub const margin_end = struct {
            pub const name = "margin-end";

            pub const Type = c_int;
        };

        /// 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
        /// `gtk.Widget.setSizeRequest` for example.
        pub const margin_start = struct {
            pub const name = "margin-start";

            pub const Type = c_int;
        };

        /// 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
        /// `gtk.Widget.setSizeRequest` for example.
        pub const margin_top = struct {
            pub const name = "margin-top";

            pub const Type = c_int;
        };

        /// The name of the widget.
        pub const name = struct {
            pub const name = "name";

            pub const Type = ?[*:0]u8;
        };

        /// The requested opacity of the widget.
        pub const opacity = struct {
            pub const name = "opacity";

            pub const Type = f64;
        };

        /// 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.
        pub const overflow = struct {
            pub const name = "overflow";

            pub const Type = gtk.Overflow;
        };

        /// The parent widget of this widget.
        pub const parent = struct {
            pub const name = "parent";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the widget will receive the default action when it is focused.
        pub const receives_default = struct {
            pub const name = "receives-default";

            pub const Type = c_int;
        };

        /// The `GtkRoot` widget of the widget tree containing this widget.
        ///
        /// This will be `NULL` if the widget is not contained in a root widget.
        pub const root = struct {
            pub const name = "root";

            pub const Type = ?*gtk.Root;
        };

        /// The scale factor of the widget.
        pub const scale_factor = struct {
            pub const name = "scale-factor";

            pub const Type = c_int;
        };

        /// Whether the widget responds to input.
        pub const sensitive = struct {
            pub const name = "sensitive";

            pub const Type = c_int;
        };

        /// Sets the text of tooltip to be the given string, which is marked up
        /// with Pango markup.
        ///
        /// Also see `gtk.Tooltip.setMarkup`.
        ///
        /// This is a convenience property which will take care of getting the
        /// tooltip shown if the given string is not `NULL`:
        /// `gtk.Widget.properties.has_tooltip` will automatically be set to true
        /// and there will be taken care of `gtk.Widget.signals.query_tooltip` in
        /// the default signal handler.
        ///
        /// Note that if both `gtk.Widget.properties.tooltip_text` and
        /// `gtk.Widget.properties.tooltip_markup` are set, the last one wins.
        pub const tooltip_markup = struct {
            pub const name = "tooltip-markup";

            pub const Type = ?[*:0]u8;
        };

        /// Sets the text of tooltip to be the given string.
        ///
        /// Also see `gtk.Tooltip.setText`.
        ///
        /// This is a convenience property which will take care of getting the
        /// tooltip shown if the given string is not `NULL`:
        /// `gtk.Widget.properties.has_tooltip` will automatically be set to true
        /// and there will be taken care of `gtk.Widget.signals.query_tooltip` in
        /// the default signal handler.
        ///
        /// Note that if both `gtk.Widget.properties.tooltip_text` and
        /// `gtk.Widget.properties.tooltip_markup` are set, the last one wins.
        pub const tooltip_text = struct {
            pub const name = "tooltip-text";

            pub const Type = ?[*:0]u8;
        };

        /// How to distribute vertical space if widget gets extra space.
        pub const valign = struct {
            pub const name = "valign";

            pub const Type = gtk.Align;
        };

        /// Whether to expand vertically.
        pub const vexpand = struct {
            pub const name = "vexpand";

            pub const Type = c_int;
        };

        /// Whether to use the `vexpand` property.
        pub const vexpand_set = struct {
            pub const name = "vexpand-set";

            pub const Type = c_int;
        };

        /// Whether the widget is visible.
        pub const visible = struct {
            pub const name = "visible";

            pub const Type = c_int;
        };

        /// Overrides for width request of the widget.
        ///
        /// If this is -1, the natural request will be used.
        pub const width_request = struct {
            pub const name = "width-request";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Signals that all holders of a reference to the widget should release
        /// the reference that they hold.
        ///
        /// May result in finalization of the widget if all references are released.
        ///
        /// This signal is not suitable for saving widget state.
        pub const destroy = struct {
            pub const name = "destroy";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("destroy", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the text direction of a widget changes.
        pub const direction_changed = struct {
            pub const name = "direction-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_previous_direction: gtk.TextDirection, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("direction-changed", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when `widget` is hidden.
        pub const hide = struct {
            pub const name = "hide";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("hide", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted if keyboard navigation fails.
        ///
        /// See `gtk.Widget.keynavFailed` for details.
        pub const keynav_failed = struct {
            pub const name = "keynav-failed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_direction: gtk.DirectionType, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("keynav-failed", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when `widget` is going to be mapped.
        ///
        /// A widget is mapped when the widget is visible (which is controlled with
        /// `gtk.Widget.properties.visible`) and all its parents up to the toplevel widget
        /// are also visible.
        ///
        /// The `::map` signal can be used to determine whether a widget will be drawn,
        /// for instance it can resume an animation that was stopped during the
        /// emission of `gtk.Widget.signals.unmap`.
        pub const map = struct {
            pub const name = "map";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("map", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when a widget is activated via a mnemonic.
        ///
        /// The default handler for this signal activates `widget` if `group_cycling`
        /// is false, or just makes `widget` grab focus if `group_cycling` is true.
        pub const mnemonic_activate = struct {
            pub const name = "mnemonic-activate";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_group_cycling: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("mnemonic-activate", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the focus is moved.
        ///
        /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
        /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
        pub const move_focus = struct {
            pub const name = "move-focus";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_direction: gtk.DirectionType, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("move-focus", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the widget’s tooltip is about to be shown.
        ///
        /// This happens when the `gtk.Widget.properties.has_tooltip` property
        /// is true and the hover timeout has expired with the cursor hovering
        /// above `widget`; or emitted when `widget` got focus in keyboard mode.
        ///
        /// Using the given coordinates, the signal handler should determine
        /// whether a tooltip should be shown for `widget`. If this is the case
        /// true should be returned, false otherwise. Note that if `keyboard_mode`
        /// is true, the values of `x` and `y` are undefined and should not be used.
        ///
        /// The signal handler is free to manipulate `tooltip` with the therefore
        /// destined function calls.
        pub const query_tooltip = struct {
            pub const name = "query-tooltip";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_x: c_int, p_y: c_int, p_keyboard_mode: c_int, p_tooltip: *gtk.Tooltip, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("query-tooltip", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when `widget` is associated with a `GdkSurface`.
        ///
        /// This means that `gtk.Widget.realize` has been called
        /// or the widget has been mapped (that is, it is going to be drawn).
        pub const realize = struct {
            pub const name = "realize";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("realize", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when `widget` is shown.
        pub const show = struct {
            pub const name = "show";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("show", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the widget state changes.
        ///
        /// See `gtk.Widget.getStateFlags`.
        pub const state_flags_changed = struct {
            pub const name = "state-flags-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_flags: gtk.StateFlags, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("state-flags-changed", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when `widget` is going to be unmapped.
        ///
        /// A widget is unmapped when either it or any of its parents up to the
        /// toplevel widget have been set as hidden.
        ///
        /// As `::unmap` indicates that a widget will not be shown any longer,
        /// it can be used to, for example, stop an animation on the widget.
        pub const unmap = struct {
            pub const name = "unmap";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("unmap", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the `GdkSurface` associated with `widget` is destroyed.
        ///
        /// This means that `gtk.Widget.unrealize` has been called
        /// or the widget has been unmapped (that is, it is going to be hidden).
        pub const unrealize = struct {
            pub const name = "unrealize";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Widget, p_instance))),
                    gobject.signalLookup("unrealize", Widget.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Obtains the default reading direction.
    ///
    /// See `gtk.Widget.setDefaultDirection`.
    extern fn gtk_widget_get_default_direction() gtk.TextDirection;
    pub const getDefaultDirection = gtk_widget_get_default_direction;

    /// Sets the default reading direction for widgets.
    ///
    /// See `gtk.Widget.setDirection`.
    extern fn gtk_widget_set_default_direction(p_dir: gtk.TextDirection) void;
    pub const setDefaultDirection = gtk_widget_set_default_direction;

    /// Enables or disables an action installed with
    /// `gtk.WidgetClass.installAction`.
    extern fn gtk_widget_action_set_enabled(p_widget: *Widget, p_action_name: [*:0]const u8, p_enabled: c_int) void;
    pub const actionSetEnabled = gtk_widget_action_set_enabled;

    /// Activates the widget.
    ///
    /// The activation will emit the signal set using
    /// `gtk.WidgetClass.setActivateSignal`
    /// 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 `gtk.WidgetClass.addShortcut`
    /// with an action created with `gtk.SignalAction.new`.
    ///
    /// If `widget` is not activatable, the function returns false.
    extern fn gtk_widget_activate(p_widget: *Widget) c_int;
    pub const activate = gtk_widget_activate;

    /// Activates an action for the widget.
    ///
    /// The action is looked up in the action groups associated with
    /// `widget` and its ancestors.
    ///
    /// This is a wrapper around `gtk.Widget.activateActionVariant`
    /// that constructs the `args` variant according to `format_string`.
    extern fn gtk_widget_activate_action(p_widget: *Widget, p_name: [*:0]const u8, p_format_string: ?[*:0]const u8, ...) c_int;
    pub const activateAction = gtk_widget_activate_action;

    /// 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
    /// `gtk.Widget.insertActionGroup`, 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 `gio.Action.getParameterType`.
    extern fn gtk_widget_activate_action_variant(p_widget: *Widget, p_name: [*:0]const u8, p_args: ?*glib.Variant) c_int;
    pub const activateActionVariant = gtk_widget_activate_action_variant;

    /// Activates the `default.activate` action for the widget.
    ///
    /// The action is looked up in the same was as for
    /// `gtk.Widget.activateAction`.
    extern fn gtk_widget_activate_default(p_widget: *Widget) void;
    pub const activateDefault = gtk_widget_activate_default;

    /// 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 `gtk.EventController`.
    extern fn gtk_widget_add_controller(p_widget: *Widget, p_controller: *gtk.EventController) void;
    pub const addController = gtk_widget_add_controller;

    /// Adds a style class to the widget.
    ///
    /// After calling this function, the widget’s style will match
    /// for `css_class`, according to CSS matching rules.
    ///
    /// Use `gtk.Widget.removeCssClass` to remove the
    /// style again.
    extern fn gtk_widget_add_css_class(p_widget: *Widget, p_css_class: [*:0]const u8) void;
    pub const addCssClass = gtk_widget_add_css_class;

    /// Adds a widget to the list of mnemonic labels for this widget.
    ///
    /// See `gtk.Widget.listMnemonicLabels`.
    ///
    /// 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.
    extern fn gtk_widget_add_mnemonic_label(p_widget: *Widget, p_label: *gtk.Widget) void;
    pub const addMnemonicLabel = gtk_widget_add_mnemonic_label;

    /// 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 aren’t changing widget properties
    /// that would trigger that (for example, changing the text of a label),
    /// then you will have to call `gtk.Widget.queueResize` or
    /// `gtk.Widget.queueDraw` yourself.
    ///
    /// `gdk.FrameClock.getFrameTime` should generally be used
    /// for timing continuous animations and
    /// `gdk.FrameTimings.getPredictedPresentationTime` 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
    /// `gdk.FrameClock.signals.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 `gtk.Widget.removeTickCallback`.
    extern fn gtk_widget_add_tick_callback(p_widget: *Widget, p_callback: gtk.TickCallback, p_user_data: ?*anyopaque, p_notify: ?glib.DestroyNotify) c_uint;
    pub const addTickCallback = gtk_widget_add_tick_callback;

    /// 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
    /// `gtk.Widget.sizeAllocate`.
    extern fn gtk_widget_allocate(p_widget: *Widget, p_width: c_int, p_height: c_int, p_baseline: c_int, p_transform: ?*gsk.Transform) void;
    pub const allocate = gtk_widget_allocate;

    /// 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 `gtk.Widget.virtual_methods.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
    /// `gtk.Widget.grabFocus` to place the focus accordingly;
    /// when returning false, they don’t modify the current focus location.
    ///
    /// This function is used by custom widget implementations; if you're
    /// writing an app, you’d use `gtk.Widget.grabFocus` to move
    /// the focus to a particular widget.
    extern fn gtk_widget_child_focus(p_widget: *Widget, p_direction: gtk.DirectionType) c_int;
    pub const childFocus = gtk_widget_child_focus;

    /// 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.
    extern fn gtk_widget_compute_bounds(p_widget: *Widget, p_target: *gtk.Widget, p_out_bounds: *graphene.Rect) c_int;
    pub const computeBounds = gtk_widget_compute_bounds;

    /// Computes whether a parent widget should give this widget
    /// extra space when possible.
    ///
    /// Widgets with children should check this, rather than looking at
    /// `gtk.Widget.getHexpand` or `gtk.Widget.getVexpand`.
    ///
    /// 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.
    extern fn gtk_widget_compute_expand(p_widget: *Widget, p_orientation: gtk.Orientation) c_int;
    pub const computeExpand = gtk_widget_compute_expand;

    /// 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.
    extern fn gtk_widget_compute_point(p_widget: *Widget, p_target: *gtk.Widget, p_point: *const graphene.Point, p_out_point: *graphene.Point) c_int;
    pub const computePoint = gtk_widget_compute_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).
    extern fn gtk_widget_compute_transform(p_widget: *Widget, p_target: *gtk.Widget, p_out_transform: *graphene.Matrix) c_int;
    pub const computeTransform = gtk_widget_compute_transform;

    /// 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.
    extern fn gtk_widget_contains(p_widget: *Widget, p_x: f64, p_y: f64) c_int;
    pub const contains = gtk_widget_contains;

    /// 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 `gtk.Widget.getPangoContext`.
    extern fn gtk_widget_create_pango_context(p_widget: *Widget) *pango.Context;
    pub const createPangoContext = gtk_widget_create_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 `gtk.Widget.properties.root` property on the widget.
    extern fn gtk_widget_create_pango_layout(p_widget: *Widget, p_text: ?[*:0]const u8) *pango.Layout;
    pub const createPangoLayout = gtk_widget_create_pango_layout;

    /// Clears the template children for the widget.
    ///
    /// This function is the opposite of `gtk.Widget.initTemplate`,
    /// 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 `gtk.Widget.initTemplate`.
    /// 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);
    /// }
    /// ```
    extern fn gtk_widget_dispose_template(p_widget: *Widget, p_widget_type: usize) void;
    pub const disposeTemplate = gtk_widget_dispose_template;

    /// Checks to see if a drag movement has passed the GTK drag threshold.
    extern fn gtk_drag_check_threshold(p_widget: *Widget, p_start_x: c_int, p_start_y: c_int, p_current_x: c_int, p_current_y: c_int) c_int;
    pub const dragCheckThreshold = gtk_drag_check_threshold;

    /// Notifies the user about an input-related error on the widget.
    ///
    /// If the `gtk.Settings.properties.gtk_error_bell` setting is true,
    /// it calls `gdk.Surface.beep`, otherwise it does nothing.
    ///
    /// Note that the effect of `gdk.Surface.beep` can be configured
    /// in many ways, depending on the windowing backend and the desktop
    /// environment or window manager that is used.
    extern fn gtk_widget_error_bell(p_widget: *Widget) void;
    pub const errorBell = gtk_widget_error_bell;

    /// 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`.
    extern fn gtk_widget_get_allocated_baseline(p_widget: *Widget) c_int;
    pub const getAllocatedBaseline = gtk_widget_get_allocated_baseline;

    /// Returns the height that has currently been allocated to the widget.
    ///
    /// To learn more about widget sizes, see the coordinate
    /// system [overview](coordinates.html).
    extern fn gtk_widget_get_allocated_height(p_widget: *Widget) c_int;
    pub const getAllocatedHeight = gtk_widget_get_allocated_height;

    /// Returns the width that has currently been allocated to the widget.
    ///
    /// To learn more about widget sizes, see the coordinate
    /// system [overview](coordinates.html).
    extern fn gtk_widget_get_allocated_width(p_widget: *Widget) c_int;
    pub const getAllocatedWidth = gtk_widget_get_allocated_width;

    /// Retrieves the widget’s allocation.
    ///
    /// Note, when implementing a layout widget: a widget’s allocation
    /// will be its “adjusted” allocation, that is, the widget’s parent
    /// typically calls `gtk.Widget.sizeAllocate` with an allocation,
    /// and that allocation is then adjusted (to handle margin
    /// and alignment for example) before assignment to the widget.
    /// `gtk.Widget.getAllocation` returns the adjusted allocation that
    /// was actually assigned to the widget. The adjusted allocation is
    /// guaranteed to be completely contained within the
    /// `gtk.Widget.sizeAllocate` 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.
    extern fn gtk_widget_get_allocation(p_widget: *Widget, p_allocation: *gtk.Allocation) void;
    pub const getAllocation = gtk_widget_get_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` that’s an ancestor of `widget`. No
    /// reference will be added to the returned widget; it should
    /// not be unreferenced.
    ///
    /// Note that unlike `gtk.Widget.isAncestor`, this function
    /// considers `widget` to be an ancestor of itself.
    extern fn gtk_widget_get_ancestor(p_widget: *Widget, p_widget_type: usize) ?*gtk.Widget;
    pub const getAncestor = gtk_widget_get_ancestor;

    /// 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``.
    extern fn gtk_widget_get_baseline(p_widget: *Widget) c_int;
    pub const getBaseline = gtk_widget_get_baseline;

    /// Determines whether the input focus can enter the widget or any
    /// of its children.
    ///
    /// See `gtk.Widget.setCanFocus`.
    extern fn gtk_widget_get_can_focus(p_widget: *Widget) c_int;
    pub const getCanFocus = gtk_widget_get_can_focus;

    /// Queries whether the widget can be the target of pointer events.
    extern fn gtk_widget_get_can_target(p_widget: *Widget) c_int;
    pub const getCanTarget = gtk_widget_get_can_target;

    /// Gets the value set with `gtk.Widget.setChildVisible`.
    ///
    /// 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.
    extern fn gtk_widget_get_child_visible(p_widget: *Widget) c_int;
    pub const getChildVisible = gtk_widget_get_child_visible;

    /// 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.
    extern fn gtk_widget_get_clipboard(p_widget: *Widget) *gdk.Clipboard;
    pub const getClipboard = gtk_widget_get_clipboard;

    /// Gets the current foreground color for the widget’s style.
    ///
    /// This function should only be used in snapshot
    /// implementations that need to do custom drawing
    /// with the foreground color.
    extern fn gtk_widget_get_color(p_widget: *Widget, p_color: *gdk.RGBA) void;
    pub const getColor = gtk_widget_get_color;

    /// Returns the list of style classes applied to the widget.
    extern fn gtk_widget_get_css_classes(p_widget: *Widget) [*][*:0]u8;
    pub const getCssClasses = gtk_widget_get_css_classes;

    /// Returns the CSS name of the widget.
    extern fn gtk_widget_get_css_name(p_self: *Widget) [*:0]const u8;
    pub const getCssName = gtk_widget_get_css_name;

    /// Gets the cursor set on the widget.
    ///
    /// See `gtk.Widget.setCursor` for details.
    extern fn gtk_widget_get_cursor(p_widget: *Widget) ?*gdk.Cursor;
    pub const getCursor = gtk_widget_get_cursor;

    /// Gets the reading direction for the widget.
    ///
    /// See `gtk.Widget.setDirection`.
    extern fn gtk_widget_get_direction(p_widget: *Widget) gtk.TextDirection;
    pub const getDirection = gtk_widget_get_direction;

    /// 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.
    extern fn gtk_widget_get_display(p_widget: *Widget) *gdk.Display;
    pub const getDisplay = gtk_widget_get_display;

    /// Returns the widget’s first child.
    ///
    /// This function is primarily meant for widget implementations.
    extern fn gtk_widget_get_first_child(p_widget: *Widget) ?*gtk.Widget;
    pub const getFirstChild = gtk_widget_get_first_child;

    /// Returns the focus child of the widget.
    extern fn gtk_widget_get_focus_child(p_widget: *Widget) ?*gtk.Widget;
    pub const getFocusChild = gtk_widget_get_focus_child;

    /// Returns whether the widget should grab focus when it is clicked
    /// with the mouse.
    ///
    /// See `gtk.Widget.setFocusOnClick`.
    extern fn gtk_widget_get_focus_on_click(p_widget: *Widget) c_int;
    pub const getFocusOnClick = gtk_widget_get_focus_on_click;

    /// Determines whether the widget can own the input focus.
    ///
    /// See `gtk.Widget.setFocusable`.
    extern fn gtk_widget_get_focusable(p_widget: *Widget) c_int;
    pub const getFocusable = gtk_widget_get_focusable;

    /// Gets the font map of the widget.
    ///
    /// See `gtk.Widget.setFontMap`.
    extern fn gtk_widget_get_font_map(p_widget: *Widget) ?*pango.FontMap;
    pub const getFontMap = gtk_widget_get_font_map;

    /// Returns the `cairo_font_options_t` of the widget.
    ///
    /// Seee `gtk.Widget.setFontOptions`.
    extern fn gtk_widget_get_font_options(p_widget: *Widget) ?*const cairo.FontOptions;
    pub const getFontOptions = gtk_widget_get_font_options;

    /// 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 `gdk.FrameClock.getFrameTime`, 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
    /// `gdk.FrameClock.getFrameTime`, and then update the animation
    /// by calling `gdk.FrameClock.getFrameTime` again during each repaint.
    ///
    /// `gdk.FrameClock.requestPhase` will result in a new frame on the
    /// clock, but won’t necessarily repaint any widgets. To repaint a widget,
    /// you have to use `gtk.Widget.queueDraw` which invalidates the
    /// widget (thus scheduling it to receive a draw on the next frame).
    /// `gtk.Widget.queueDraw` will also end up requesting a frame
    /// on the appropriate frame clock.
    ///
    /// A widget’s frame clock will not change while the widget is mapped.
    /// Reparenting a widget (which implies a temporary unmap) can change
    /// the widget’s frame clock.
    ///
    /// Unrealized widgets do not have a frame clock.
    extern fn gtk_widget_get_frame_clock(p_widget: *Widget) ?*gdk.FrameClock;
    pub const getFrameClock = gtk_widget_get_frame_clock;

    /// 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
    /// `gtk.@"Align.fill"` or `gtk.@"Align.center"`.
    ///
    /// Baselines are not supported for horizontal alignment.
    extern fn gtk_widget_get_halign(p_widget: *Widget) gtk.Align;
    pub const getHalign = gtk_widget_get_halign;

    /// Returns the current value of the `has-tooltip` property.
    extern fn gtk_widget_get_has_tooltip(p_widget: *Widget) c_int;
    pub const getHasTooltip = gtk_widget_get_has_tooltip;

    /// 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 `gtk.Widget.virtual_methods.snapshot`.
    ///
    /// For pointer events, see `gtk.Widget.contains`.
    ///
    /// To learn more about widget sizes, see the coordinate
    /// system [overview](coordinates.html).
    extern fn gtk_widget_get_height(p_widget: *Widget) c_int;
    pub const getHeight = gtk_widget_get_height;

    /// 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 `gtk.Widget.computeExpand`
    /// 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 widget’s own hexpand flag, rather
    /// than computing whether the entire widget tree rooted at this widget
    /// wants to expand.
    extern fn gtk_widget_get_hexpand(p_widget: *Widget) c_int;
    pub const getHexpand = gtk_widget_get_hexpand;

    /// Gets whether the `hexpand` flag has been explicitly set.
    ///
    /// If `gtk.Widget.properties.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 it’s here
    /// for completeness and consistency.
    extern fn gtk_widget_get_hexpand_set(p_widget: *Widget) c_int;
    pub const getHexpandSet = gtk_widget_get_hexpand_set;

    /// Returns the widget’s last child.
    ///
    /// This function is primarily meant for widget implementations.
    extern fn gtk_widget_get_last_child(p_widget: *Widget) ?*gtk.Widget;
    pub const getLastChild = gtk_widget_get_last_child;

    /// Retrieves the layout manager of the widget.
    ///
    /// See `gtk.Widget.setLayoutManager`.
    extern fn gtk_widget_get_layout_manager(p_widget: *Widget) ?*gtk.LayoutManager;
    pub const getLayoutManager = gtk_widget_get_layout_manager;

    /// Gets the value of the `gtk.Widget.properties.limit_events` property.
    extern fn gtk_widget_get_limit_events(p_widget: *Widget) c_int;
    pub const getLimitEvents = gtk_widget_get_limit_events;

    /// Returns whether the widget is mapped.
    extern fn gtk_widget_get_mapped(p_widget: *Widget) c_int;
    pub const getMapped = gtk_widget_get_mapped;

    /// Gets the bottom margin of the widget.
    extern fn gtk_widget_get_margin_bottom(p_widget: *Widget) c_int;
    pub const getMarginBottom = gtk_widget_get_margin_bottom;

    /// Gets the end margin of the widget.
    extern fn gtk_widget_get_margin_end(p_widget: *Widget) c_int;
    pub const getMarginEnd = gtk_widget_get_margin_end;

    /// Gets the start margin of the widget.
    extern fn gtk_widget_get_margin_start(p_widget: *Widget) c_int;
    pub const getMarginStart = gtk_widget_get_margin_start;

    /// Gets the top margin of the widget.
    extern fn gtk_widget_get_margin_top(p_widget: *Widget) c_int;
    pub const getMarginTop = gtk_widget_get_margin_top;

    /// Retrieves the name of a widget.
    ///
    /// See `gtk.Widget.setName` for the significance of widget names.
    extern fn gtk_widget_get_name(p_widget: *Widget) [*:0]const u8;
    pub const getName = gtk_widget_get_name;

    /// 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.
    extern fn gtk_widget_get_native(p_widget: *Widget) ?*gtk.Native;
    pub const getNative = gtk_widget_get_native;

    /// Returns the widget’s next sibling.
    ///
    /// This function is primarily meant for widget implementations.
    extern fn gtk_widget_get_next_sibling(p_widget: *Widget) ?*gtk.Widget;
    pub const getNextSibling = gtk_widget_get_next_sibling;

    /// Fetches the requested opacity for the widget.
    ///
    /// See `gtk.Widget.setOpacity`.
    extern fn gtk_widget_get_opacity(p_widget: *Widget) f64;
    pub const getOpacity = gtk_widget_get_opacity;

    /// Returns the widget’s overflow value.
    extern fn gtk_widget_get_overflow(p_widget: *Widget) gtk.Overflow;
    pub const getOverflow = gtk_widget_get_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 `gtk.Widget.createPangoContext`,
    /// 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 widget’s attributes.
    /// This can be tracked by listening to changes of the
    /// `gtk.Widget.properties.root` property on the widget.
    extern fn gtk_widget_get_pango_context(p_widget: *Widget) *pango.Context;
    pub const getPangoContext = gtk_widget_get_pango_context;

    /// Returns the parent widget of the widget.
    extern fn gtk_widget_get_parent(p_widget: *Widget) ?*gtk.Widget;
    pub const getParent = gtk_widget_get_parent;

    /// Retrieves the minimum and natural size of a widget, taking
    /// into account the widget’s 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 `gtk.Widget.measure` if you want to support baseline alignment.
    extern fn gtk_widget_get_preferred_size(p_widget: *Widget, p_minimum_size: ?*gtk.Requisition, p_natural_size: ?*gtk.Requisition) void;
    pub const getPreferredSize = gtk_widget_get_preferred_size;

    /// Returns the widget’s previous sibling.
    ///
    /// This function is primarily meant for widget implementations.
    extern fn gtk_widget_get_prev_sibling(p_widget: *Widget) ?*gtk.Widget;
    pub const getPrevSibling = gtk_widget_get_prev_sibling;

    /// 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.
    extern fn gtk_widget_get_primary_clipboard(p_widget: *Widget) *gdk.Clipboard;
    pub const getPrimaryClipboard = gtk_widget_get_primary_clipboard;

    /// Determines whether the widget is realized.
    extern fn gtk_widget_get_realized(p_widget: *Widget) c_int;
    pub const getRealized = gtk_widget_get_realized;

    /// 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 `gtk.Widget.setReceivesDefault`.
    extern fn gtk_widget_get_receives_default(p_widget: *Widget) c_int;
    pub const getReceivesDefault = gtk_widget_get_receives_default;

    /// 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.
    extern fn gtk_widget_get_request_mode(p_widget: *Widget) gtk.SizeRequestMode;
    pub const getRequestMode = gtk_widget_get_request_mode;

    /// 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.
    extern fn gtk_widget_get_root(p_widget: *Widget) ?*gtk.Root;
    pub const getRoot = gtk_widget_get_root;

    /// 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 `gdk.Surface.getScaleFactor`.
    ///
    /// 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 `gdk.Surface.getScale`
    /// to get the fractional scale value.
    extern fn gtk_widget_get_scale_factor(p_widget: *Widget) c_int;
    pub const getScaleFactor = gtk_widget_get_scale_factor;

    /// Returns the widget’s sensitivity.
    ///
    /// This function returns the value that has been set using
    /// `gtk.Widget.setSensitive`).
    ///
    /// The effective sensitivity of a widget is however determined
    /// by both its own and its parent widget’s sensitivity.
    /// See `gtk.Widget.isSensitive`.
    extern fn gtk_widget_get_sensitive(p_widget: *Widget) c_int;
    pub const getSensitive = gtk_widget_get_sensitive;

    /// 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.
    extern fn gtk_widget_get_settings(p_widget: *Widget) *gtk.Settings;
    pub const getSettings = gtk_widget_get_settings;

    /// Returns the content width or height of the widget.
    ///
    /// Which dimension is returned depends on `orientation`.
    ///
    /// This is equivalent to calling `gtk.Widget.getWidth`
    /// for `gtk.@"Orientation.horizontal"` or `gtk.Widget.getHeight`
    /// for `gtk.@"Orientation.vertical"`, but can be used when
    /// writing orientation-independent code, such as when
    /// implementing `gtk.Orientable` widgets.
    ///
    /// To learn more about widget sizes, see the coordinate
    /// system [overview](coordinates.html).
    extern fn gtk_widget_get_size(p_widget: *Widget, p_orientation: gtk.Orientation) c_int;
    pub const getSize = gtk_widget_get_size;

    /// 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 `gtk.Widget.setSizeRequest`.
    ///
    /// To get the size a widget will actually request, call
    /// `gtk.Widget.measure` instead of this function.
    extern fn gtk_widget_get_size_request(p_widget: *Widget, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getSizeRequest = gtk_widget_get_size_request;

    /// Returns the widget state as a flag set.
    ///
    /// It is worth mentioning that the effective `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
    /// `gtk.StateFlags` to pass to a `gtk.StyleContext`
    /// method, you should look at `gtk.StyleContext.getState`.
    extern fn gtk_widget_get_state_flags(p_widget: *Widget) gtk.StateFlags;
    pub const getStateFlags = gtk_widget_get_state_flags;

    /// Returns the style context associated to the widget.
    ///
    /// The returned object is guaranteed to be the same
    /// for the lifetime of `widget`.
    extern fn gtk_widget_get_style_context(p_widget: *Widget) *gtk.StyleContext;
    pub const getStyleContext = gtk_widget_get_style_context;

    /// Fetches an object build from the template XML for `widget_type` in
    /// the widget.
    ///
    /// This will only report children which were previously declared
    /// with `gtk.WidgetClass.bindTemplateChildFull` 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.
    extern fn gtk_widget_get_template_child(p_widget: *Widget, p_widget_type: usize, p_name: [*:0]const u8) *gobject.Object;
    pub const getTemplateChild = gtk_widget_get_template_child;

    /// Gets the contents of the tooltip for the widget.
    ///
    /// If the tooltip has not been set using
    /// `gtk.Widget.setTooltipMarkup`, this
    /// function returns `NULL`.
    extern fn gtk_widget_get_tooltip_markup(p_widget: *Widget) ?[*:0]const u8;
    pub const getTooltipMarkup = gtk_widget_get_tooltip_markup;

    /// Gets the contents of the tooltip for the widget.
    ///
    /// If the `widget`'s tooltip was set using
    /// `gtk.Widget.setTooltipMarkup`,
    /// this function will return the escaped text.
    extern fn gtk_widget_get_tooltip_text(p_widget: *Widget) ?[*:0]const u8;
    pub const getTooltipText = gtk_widget_get_tooltip_text;

    /// Gets the vertical alignment of the widget.
    extern fn gtk_widget_get_valign(p_widget: *Widget) gtk.Align;
    pub const getValign = gtk_widget_get_valign;

    /// Gets whether the widget would like any available extra vertical
    /// space.
    ///
    /// See `gtk.Widget.getHexpand` for more detail.
    extern fn gtk_widget_get_vexpand(p_widget: *Widget) c_int;
    pub const getVexpand = gtk_widget_get_vexpand;

    /// Gets whether the `vexpand` flag has been explicitly set.
    ///
    /// See `gtk.Widget.getHexpandSet` for more detail.
    extern fn gtk_widget_get_vexpand_set(p_widget: *Widget) c_int;
    pub const getVexpandSet = gtk_widget_get_vexpand_set;

    /// Determines whether the widget is visible.
    ///
    /// If you want to take into account whether the widget’s
    /// parent is also marked as visible, use
    /// `gtk.Widget.isVisible` instead.
    ///
    /// This function does not check if the widget is
    /// obscured in any way.
    ///
    /// See `gtk.Widget.setVisible`.
    extern fn gtk_widget_get_visible(p_widget: *Widget) c_int;
    pub const getVisible = gtk_widget_get_visible;

    /// 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 `gtk.Widget.virtual_methods.snapshot`.
    ///
    /// For pointer events, see `gtk.Widget.contains`.
    ///
    /// To learn more about widget sizes, see the coordinate
    /// system [overview](coordinates.html).
    extern fn gtk_widget_get_width(p_widget: *Widget) c_int;
    pub const getWidth = gtk_widget_get_width;

    /// Causes `widget` to have the keyboard focus for the window
    /// that it belongs to.
    ///
    /// If `widget` is not focusable, or its `gtk.Widget.virtual_methods.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 `gtk.Widget.grabFocus` on an already focused widget
    /// is allowed, should not have an effect, and return true.
    extern fn gtk_widget_grab_focus(p_widget: *Widget) c_int;
    pub const grabFocus = gtk_widget_grab_focus;

    /// Returns whether a style class is currently applied to the widget.
    extern fn gtk_widget_has_css_class(p_widget: *Widget, p_css_class: [*:0]const u8) c_int;
    pub const hasCssClass = gtk_widget_has_css_class;

    /// Determines whether the widget is the current default widget
    /// within its toplevel.
    extern fn gtk_widget_has_default(p_widget: *Widget) c_int;
    pub const hasDefault = gtk_widget_has_default;

    /// Determines if the widget has the global input focus.
    ///
    /// See `gtk.Widget.isFocus` for the difference between
    /// having the global input focus, and only having the focus
    /// within a toplevel.
    extern fn gtk_widget_has_focus(p_widget: *Widget) c_int;
    pub const hasFocus = gtk_widget_has_focus;

    /// 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 `gtk.Window.getFocusVisible` for more
    /// information about focus indication.
    ///
    /// To find out if the widget has the global input focus, use
    /// `gtk.Widget.hasFocus`.
    extern fn gtk_widget_has_visible_focus(p_widget: *Widget) c_int;
    pub const hasVisibleFocus = gtk_widget_has_visible_focus;

    /// Reverses the effects of [method.Gtk.Widget.show].
    ///
    /// This is causing the widget to be hidden (invisible to the user).
    extern fn gtk_widget_hide(p_widget: *Widget) void;
    pub const hide = gtk_widget_hide;

    /// Returns whether the widget is currently being destroyed.
    ///
    /// This information can sometimes be used to avoid doing
    /// unnecessary work.
    extern fn gtk_widget_in_destruction(p_widget: *Widget) c_int;
    pub const inDestruction = gtk_widget_in_destruction;

    /// 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
    /// `gtk.WidgetClass.setTemplate`.
    ///
    /// 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 ``gobject.Object.new`` on a widget with composite templates,
    ///    it’s important to build the composite widgets before the construct
    ///    properties are set. Properties passed to ``gobject.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.
    extern fn gtk_widget_init_template(p_widget: *Widget) void;
    pub const initTemplate = gtk_widget_init_template;

    /// Inserts an action group into the widget's actions.
    ///
    /// Children of `widget` that implement `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`.
    extern fn gtk_widget_insert_action_group(p_widget: *Widget, p_name: [*:0]const u8, p_group: ?*gio.ActionGroup) void;
    pub const insertActionGroup = gtk_widget_insert_action_group;

    /// Sets the parent widget of the widget.
    ///
    /// In contrast to `gtk.Widget.setParent`, 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.
    extern fn gtk_widget_insert_after(p_widget: *Widget, p_parent: *gtk.Widget, p_previous_sibling: ?*gtk.Widget) void;
    pub const insertAfter = gtk_widget_insert_after;

    /// Sets the parent widget of the widget.
    ///
    /// In contrast to `gtk.Widget.setParent`, 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.
    extern fn gtk_widget_insert_before(p_widget: *Widget, p_parent: *gtk.Widget, p_next_sibling: ?*gtk.Widget) void;
    pub const insertBefore = gtk_widget_insert_before;

    /// Determines whether the widget is a descendent of `ancestor`.
    extern fn gtk_widget_is_ancestor(p_widget: *Widget, p_ancestor: *gtk.Widget) c_int;
    pub const isAncestor = gtk_widget_is_ancestor;

    /// Determines whether the widget can be drawn to.
    ///
    /// A widget can be drawn if it is mapped and visible.
    extern fn gtk_widget_is_drawable(p_widget: *Widget) c_int;
    pub const isDrawable = gtk_widget_is_drawable;

    /// Determines if the widget is the focus widget within its
    /// toplevel.
    ///
    /// This does not mean that the `gtk.Widget.properties.has_focus`
    /// property is necessarily set; `gtk.Widget.properties.has_focus`
    /// will only be set if the toplevel widget additionally has the
    /// global input focus.
    extern fn gtk_widget_is_focus(p_widget: *Widget) c_int;
    pub const isFocus = gtk_widget_is_focus;

    /// Returns the widget’s effective sensitivity.
    ///
    /// This means it is sensitive itself and also its
    /// parent widget is sensitive.
    extern fn gtk_widget_is_sensitive(p_widget: *Widget) c_int;
    pub const isSensitive = gtk_widget_is_sensitive;

    /// 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 `gtk.Widget.getVisible` and
    /// `gtk.Widget.setVisible`.
    extern fn gtk_widget_is_visible(p_widget: *Widget) c_int;
    pub const isVisible = gtk_widget_is_visible;

    /// Emits the `gtk.Widget.signals.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
    /// `gtk.Widget.childFocus`. 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
    /// `gtk.Widget.childFocus` on the widget’s toplevel.
    ///
    /// The default `gtk.Widget.signals.keynav_failed` handler returns
    /// false for `gtk.@"DirectionType.tab-forward"` and
    /// `gtk.@"DirectionType.tab-backward"`. For the other values
    /// of `gtk.DirectionType` it returns true.
    ///
    /// Whenever the default handler returns true, it also calls
    /// `gtk.Widget.errorBell` 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
    /// `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.
    extern fn gtk_widget_keynav_failed(p_widget: *Widget, p_direction: gtk.DirectionType) c_int;
    pub const keynavFailed = gtk_widget_keynav_failed;

    /// Returns the widgets for which this widget is the target of a
    /// mnemonic.
    ///
    /// Typically, these widgets will be labels. See, for example,
    /// `gtk.Label.setMnemonicWidget`.
    ///
    /// 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.
    extern fn gtk_widget_list_mnemonic_labels(p_widget: *Widget) *glib.List;
    pub const listMnemonicLabels = gtk_widget_list_mnemonic_labels;

    /// Causes a widget to be mapped if it isn’t already.
    ///
    /// This function is only for use in widget implementations.
    extern fn gtk_widget_map(p_widget: *Widget) void;
    pub const map = gtk_widget_map;

    /// 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 [GtkWidget’s geometry management section](class.Widget.html`height`-for-width-geometry-management) for
    /// a more details on implementing `GtkWidgetClass.`measure``.
    extern fn gtk_widget_measure(p_widget: *Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) void;
    pub const measure = gtk_widget_measure;

    /// Emits the `gtk.Widget.signals.mnemonic_activate` signal.
    extern fn gtk_widget_mnemonic_activate(p_widget: *Widget, p_group_cycling: c_int) c_int;
    pub const mnemonicActivate = gtk_widget_mnemonic_activate;

    /// 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.
    extern fn gtk_widget_observe_children(p_widget: *Widget) *gio.ListModel;
    pub const observeChildren = gtk_widget_observe_children;

    /// 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.
    extern fn gtk_widget_observe_controllers(p_widget: *Widget) *gio.ListModel;
    pub const observeControllers = gtk_widget_observe_controllers;

    /// 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 `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.
    extern fn gtk_widget_pick(p_widget: *Widget, p_x: f64, p_y: f64, p_flags: gtk.PickFlags) ?*gtk.Widget;
    pub const pick = gtk_widget_pick;

    /// Flags the widget for a rerun of the `gtk.Widget.virtual_methods.size_allocate`
    /// function.
    ///
    /// Use this function instead of `gtk.Widget.queueResize`
    /// when the `widget`'s size request didn't change but it wants to
    /// reposition its contents.
    ///
    /// An example user of this function is `gtk.Widget.setHalign`.
    ///
    /// This function is only for use in widget implementations.
    extern fn gtk_widget_queue_allocate(p_widget: *Widget) void;
    pub const queueAllocate = gtk_widget_queue_allocate;

    /// 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 `gtk.Widget.virtual_methods.snapshot`
    /// implementation will be called.
    extern fn gtk_widget_queue_draw(p_widget: *Widget) void;
    pub const queueDraw = gtk_widget_queue_draw;

    /// 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
    /// `gtk.Label`, the label queues a resize to ensure there’s
    /// enough space for the new text.
    ///
    /// Note that you cannot call `gtk.Widget.queueResize` on a widget
    /// from inside its implementation of the `gtk.Widget.virtual_methods.size_allocate`
    /// virtual method. Calls to `gtk.Widget.queueResize` from inside
    /// `gtk.Widget.virtual_methods.size_allocate` will be silently ignored.
    ///
    /// This function is only for use in widget implementations.
    extern fn gtk_widget_queue_resize(p_widget: *Widget) void;
    pub const queueResize = gtk_widget_queue_resize;

    /// 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 widget’s parent widgets to be
    /// realized; calling this function realizes the widget’s 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
    /// isn’t 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
    /// `gtk.Widget.signals.realize`.
    extern fn gtk_widget_realize(p_widget: *Widget) void;
    pub const realize = gtk_widget_realize;

    /// 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.
    extern fn gtk_widget_remove_controller(p_widget: *Widget, p_controller: *gtk.EventController) void;
    pub const removeController = gtk_widget_remove_controller;

    /// Removes a style from the widget.
    ///
    /// After this, the style of `widget` will stop matching for `css_class`.
    extern fn gtk_widget_remove_css_class(p_widget: *Widget, p_css_class: [*:0]const u8) void;
    pub const removeCssClass = gtk_widget_remove_css_class;

    /// Removes a widget from the list of mnemonic labels for this widget.
    ///
    /// See `gtk.Widget.listMnemonicLabels`.
    ///
    /// The widget must have previously been added to the list with
    /// `gtk.Widget.addMnemonicLabel`.
    extern fn gtk_widget_remove_mnemonic_label(p_widget: *Widget, p_label: *gtk.Widget) void;
    pub const removeMnemonicLabel = gtk_widget_remove_mnemonic_label;

    /// Removes a tick callback previously registered with
    /// `gtk.Widget.addTickCallback`.
    extern fn gtk_widget_remove_tick_callback(p_widget: *Widget, p_id: c_uint) void;
    pub const removeTickCallback = gtk_widget_remove_tick_callback;

    /// 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 `gtk.Widget.grabFocus` for actually setting
    /// the input focus on a widget.
    extern fn gtk_widget_set_can_focus(p_widget: *Widget, p_can_focus: c_int) void;
    pub const setCanFocus = gtk_widget_set_can_focus;

    /// Sets whether the widget can be the target of pointer events.
    extern fn gtk_widget_set_can_target(p_widget: *Widget, p_can_target: c_int) void;
    pub const setCanTarget = gtk_widget_set_can_target;

    /// 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 `gtk.Widget.setParent`, 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.
    extern fn gtk_widget_set_child_visible(p_widget: *Widget, p_child_visible: c_int) void;
    pub const setChildVisible = gtk_widget_set_child_visible;

    /// Replaces the current style classes of the widget with `classes`.
    extern fn gtk_widget_set_css_classes(p_widget: *Widget, p_classes: [*][*:0]const u8) void;
    pub const setCssClasses = gtk_widget_set_css_classes;

    /// 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.
    extern fn gtk_widget_set_cursor(p_widget: *Widget, p_cursor: ?*gdk.Cursor) void;
    pub const setCursor = gtk_widget_set_cursor;

    /// Sets the cursor to be shown when the pointer hovers over
    /// the widget.
    ///
    /// This is a utility function that creates a cursor via
    /// `gdk.Cursor.newFromName` and then sets it on `widget`
    /// with `gtk.Widget.setCursor`. See those functions for
    /// details.
    ///
    /// On top of that, this function allows `name` to be `NULL`, which
    /// will do the same as calling `gtk.Widget.setCursor`
    /// with a `NULL` cursor.
    extern fn gtk_widget_set_cursor_from_name(p_widget: *Widget, p_name: ?[*:0]const u8) void;
    pub const setCursorFromName = gtk_widget_set_cursor_from_name;

    /// 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 `gtk.@"TextDirection.none"`, then
    /// the value set by `gtk.Widget.setDefaultDirection` will be used.
    extern fn gtk_widget_set_direction(p_widget: *Widget, p_dir: gtk.TextDirection) void;
    pub const setDirection = gtk_widget_set_direction;

    /// 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
    /// `gtk.Widget.grabFocus` on it.
    extern fn gtk_widget_set_focus_child(p_widget: *Widget, p_child: ?*gtk.Widget) void;
    pub const setFocusChild = gtk_widget_set_focus_child;

    /// 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 don’t want the keyboard focus removed from
    /// the main area of the application.
    extern fn gtk_widget_set_focus_on_click(p_widget: *Widget, p_focus_on_click: c_int) void;
    pub const setFocusOnClick = gtk_widget_set_focus_on_click;

    /// 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 `gtk.Widget.grabFocus` for actually setting
    /// the input focus on a widget.
    extern fn gtk_widget_set_focusable(p_widget: *Widget, p_focusable: c_int) void;
    pub const setFocusable = gtk_widget_set_focusable;

    /// 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.
    extern fn gtk_widget_set_font_map(p_widget: *Widget, p_font_map: ?*pango.FontMap) void;
    pub const setFontMap = gtk_widget_set_font_map;

    /// 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.
    extern fn gtk_widget_set_font_options(p_widget: *Widget, p_options: ?*const cairo.FontOptions) void;
    pub const setFontOptions = gtk_widget_set_font_options;

    /// Sets the horizontal alignment of the widget.
    extern fn gtk_widget_set_halign(p_widget: *Widget, p_align: gtk.Align) void;
    pub const setHalign = gtk_widget_set_halign;

    /// Sets the `has-tooltip` property on the widget.
    extern fn gtk_widget_set_has_tooltip(p_widget: *Widget, p_has_tooltip: c_int) void;
    pub const setHasTooltip = gtk_widget_set_has_tooltip;

    /// 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 `gtk.Widget.computeExpand`.
    /// 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
    /// `gtk.Widget.setHexpand` sets the hexpand-set property (see
    /// `gtk.Widget.setHexpandSet`) which causes the widget’s hexpand
    /// value to be used, rather than looking at children and widget state.
    extern fn gtk_widget_set_hexpand(p_widget: *Widget, p_expand: c_int) void;
    pub const setHexpand = gtk_widget_set_hexpand;

    /// Sets whether the hexpand flag will be used.
    ///
    /// The `gtk.Widget.properties.hexpand_set` property will be set
    /// automatically when you call `gtk.Widget.setHexpand`
    /// 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 it’s here
    /// for completeness and consistency.
    extern fn gtk_widget_set_hexpand_set(p_widget: *Widget, p_set: c_int) void;
    pub const setHexpandSet = gtk_widget_set_hexpand_set;

    /// Sets the layout manager to use for measuring and allocating children
    /// of the widget.
    extern fn gtk_widget_set_layout_manager(p_widget: *Widget, p_layout_manager: ?*gtk.LayoutManager) void;
    pub const setLayoutManager = gtk_widget_set_layout_manager;

    /// Sets whether the widget acts like a modal dialog,
    /// with respect to event delivery.
    extern fn gtk_widget_set_limit_events(p_widget: *Widget, p_limit_events: c_int) void;
    pub const setLimitEvents = gtk_widget_set_limit_events;

    /// Sets the bottom margin of the widget.
    extern fn gtk_widget_set_margin_bottom(p_widget: *Widget, p_margin: c_int) void;
    pub const setMarginBottom = gtk_widget_set_margin_bottom;

    /// Sets the end margin of the widget.
    extern fn gtk_widget_set_margin_end(p_widget: *Widget, p_margin: c_int) void;
    pub const setMarginEnd = gtk_widget_set_margin_end;

    /// Sets the start margin of the widget.
    extern fn gtk_widget_set_margin_start(p_widget: *Widget, p_margin: c_int) void;
    pub const setMarginStart = gtk_widget_set_margin_start;

    /// Sets the top margin of the widget.
    extern fn gtk_widget_set_margin_top(p_widget: *Widget, p_margin: c_int) void;
    pub const setMarginTop = gtk_widget_set_margin_top;

    /// 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 `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.
    extern fn gtk_widget_set_name(p_widget: *Widget, p_name: [*:0]const u8) void;
    pub const setName = gtk_widget_set_name;

    /// 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
    /// `gdk.Display.isComposited`. On Windows and Wayland it will
    /// always work, although setting a window’s 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, `gtk.Popover`
    /// instances and other `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.
    extern fn gtk_widget_set_opacity(p_widget: *Widget, p_opacity: f64) void;
    pub const setOpacity = gtk_widget_set_opacity;

    /// Sets how the widget treats content that is drawn outside the
    /// it's content area.
    ///
    /// See the definition of `gtk.Overflow` for details.
    ///
    /// This setting is provided for widget implementations and
    /// should not be used by application code.
    ///
    /// The default value is `gtk.@"Overflow.visible"`.
    extern fn gtk_widget_set_overflow(p_widget: *Widget, p_overflow: gtk.Overflow) void;
    pub const setOverflow = gtk_widget_set_overflow;

    /// 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 `gtk.Widget.unparent`.
    ///
    /// This function is useful only when implementing subclasses of
    /// `GtkWidget`.
    extern fn gtk_widget_set_parent(p_widget: *Widget, p_parent: *gtk.Widget) void;
    pub const setParent = gtk_widget_set_parent;

    /// 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.
    extern fn gtk_widget_set_receives_default(p_widget: *Widget, p_receives_default: c_int) void;
    pub const setReceivesDefault = gtk_widget_set_receives_default;

    /// 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 can’t
    /// interact with them. Insensitive widgets are known as
    /// “inactive”, “disabled”, or “ghosted” in some other toolkits.
    extern fn gtk_widget_set_sensitive(p_widget: *Widget, p_sensitive: c_int) void;
    pub const setSensitive = gtk_widget_set_sensitive;

    /// Sets the minimum size of the widget.
    ///
    /// That is, the widget’s 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, `gtk.Window.setDefaultSize` 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
    /// `gtk.Widget.properties.margin_start`,
    /// `gtk.Widget.properties.margin_end`,
    /// `gtk.Widget.properties.margin_top`, and
    /// `gtk.Widget.properties.margin_bottom`, but it does include pretty
    /// much all other padding or border properties set by any subclass
    /// of `GtkWidget`.
    extern fn gtk_widget_set_size_request(p_widget: *Widget, p_width: c_int, p_height: c_int) void;
    pub const setSizeRequest = gtk_widget_set_size_request;

    /// Turns on flag values in the current widget state.
    ///
    /// Typical widget states are insensitive, prelighted, etc.
    ///
    /// This function accepts the values `gtk.@"StateFlags.dir-ltr"` and
    /// `gtk.@"StateFlags.dir-rtl"` but ignores them. If you want to set
    /// the widget's direction, use `gtk.Widget.setDirection`.
    ///
    /// This function is for use in widget implementations.
    extern fn gtk_widget_set_state_flags(p_widget: *Widget, p_flags: gtk.StateFlags, p_clear: c_int) void;
    pub const setStateFlags = gtk_widget_set_state_flags;

    /// Sets the contents of the tooltip for widget.
    ///
    /// `markup` must contain Pango markup.
    ///
    /// This function will take care of setting the
    /// `gtk.Widget.properties.has_tooltip` as a side effect, and of the
    /// default handler for the `gtk.Widget.signals.query_tooltip` signal.
    ///
    /// See also `gtk.Tooltip.setMarkup`.
    extern fn gtk_widget_set_tooltip_markup(p_widget: *Widget, p_markup: ?[*:0]const u8) void;
    pub const setTooltipMarkup = gtk_widget_set_tooltip_markup;

    /// 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
    /// `gtk.Widget.properties.has_tooltip` as a side effect,
    /// and of the default handler for the
    /// `gtk.Widget.signals.query_tooltip` signal.
    ///
    /// See also `gtk.Tooltip.setText`.
    extern fn gtk_widget_set_tooltip_text(p_widget: *Widget, p_text: ?[*:0]const u8) void;
    pub const setTooltipText = gtk_widget_set_tooltip_text;

    /// Sets the vertical alignment of the widget.
    extern fn gtk_widget_set_valign(p_widget: *Widget, p_align: gtk.Align) void;
    pub const setValign = gtk_widget_set_valign;

    /// Sets whether the widget would like any available extra vertical
    /// space.
    ///
    /// See `gtk.Widget.setHexpand` for more detail.
    extern fn gtk_widget_set_vexpand(p_widget: *Widget, p_expand: c_int) void;
    pub const setVexpand = gtk_widget_set_vexpand;

    /// Sets whether the vexpand flag will be used.
    ///
    /// See `gtk.Widget.setHexpandSet` for more detail.
    extern fn gtk_widget_set_vexpand_set(p_widget: *Widget, p_set: c_int) void;
    pub const setVexpandSet = gtk_widget_set_vexpand_set;

    /// Sets the visibility state of `widget`.
    ///
    /// Note that setting this to true doesn’t mean the widget is
    /// actually viewable, see `gtk.Widget.getVisible`.
    extern fn gtk_widget_set_visible(p_widget: *Widget, p_visible: c_int) void;
    pub const setVisible = gtk_widget_set_visible;

    /// 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 `gtk.Popover` instances.
    extern fn gtk_widget_should_layout(p_widget: *Widget) c_int;
    pub const shouldLayout = gtk_widget_should_layout;

    /// Flags a widget to be displayed.
    ///
    /// Any widget that isn’t 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.
    extern fn gtk_widget_show(p_widget: *Widget) void;
    pub const show = gtk_widget_show;

    /// Allocates widget with a transformation that translates
    /// the origin to the position in `allocation`.
    ///
    /// This is a simple form of `gtk.Widget.allocate`.
    extern fn gtk_widget_size_allocate(p_widget: *Widget, p_allocation: *const gtk.Allocation, p_baseline: c_int) void;
    pub const sizeAllocate = gtk_widget_size_allocate;

    /// Snapshots a child of the widget.
    ///
    /// When a widget receives a call to the snapshot function,
    /// it must send synthetic `gtk.Widget.virtual_methods.snapshot` calls
    /// to all children. This function provides a convenient way
    /// of doing this. A widget, when it receives a call to its
    /// `gtk.Widget.virtual_methods.snapshot` function, calls
    /// `gtk.Widget.snapshotChild` 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`.
    extern fn gtk_widget_snapshot_child(p_widget: *Widget, p_child: *gtk.Widget, p_snapshot: *gtk.Snapshot) void;
    pub const snapshotChild = gtk_widget_snapshot_child;

    /// 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.
    extern fn gtk_widget_translate_coordinates(p_src_widget: *Widget, p_dest_widget: *gtk.Widget, p_src_x: f64, p_src_y: f64, p_dest_x: ?*f64, p_dest_y: ?*f64) c_int;
    pub const translateCoordinates = gtk_widget_translate_coordinates;

    /// Triggers a tooltip query on the display of the widget.
    extern fn gtk_widget_trigger_tooltip_query(p_widget: *Widget) void;
    pub const triggerTooltipQuery = gtk_widget_trigger_tooltip_query;

    /// Causes a widget to be unmapped if it’s currently mapped.
    ///
    /// This function is only for use in widget implementations.
    extern fn gtk_widget_unmap(p_widget: *Widget) void;
    pub const unmap = gtk_widget_unmap;

    /// Removes `widget` from its parent.
    ///
    /// This function is only for use in widget implementations,
    /// typically in dispose.
    extern fn gtk_widget_unparent(p_widget: *Widget) void;
    pub const unparent = gtk_widget_unparent;

    /// Causes a widget to be unrealized.
    ///
    /// This frees all GDK resources associated with the widget.
    ///
    /// This function is only useful in widget implementations.
    extern fn gtk_widget_unrealize(p_widget: *Widget) void;
    pub const unrealize = gtk_widget_unrealize;

    /// Turns off flag values for the current widget state.
    ///
    /// See `gtk.Widget.setStateFlags`.
    ///
    /// This function is for use in widget implementations.
    extern fn gtk_widget_unset_state_flags(p_widget: *Widget, p_flags: gtk.StateFlags) void;
    pub const unsetStateFlags = gtk_widget_unset_state_flags;

    extern fn gtk_widget_get_type() usize;
    pub const getGObjectType = gtk_widget_get_type;

    extern fn g_object_ref(p_self: *gtk.Widget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Widget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Widget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A `GdkPaintable` that displays the contents of a widget.
///
/// `GtkWidgetPaintable` will also take care of the widget not being in a
/// state where it can be drawn (like when it isn't shown) and just draw
/// nothing or where it does not have a size (like when it is hidden) and
/// report no size in that case.
///
/// Of course, `GtkWidgetPaintable` allows you to monitor widgets for size
/// changes by emitting the `gdk.Paintable.signals.invalidate_size` signal
/// whenever the size of the widget changes as well as for visual changes by
/// emitting the `gdk.Paintable.signals.invalidate_contents` signal whenever
/// the widget changes.
///
/// You can use a `GtkWidgetPaintable` everywhere a `GdkPaintable` is allowed,
/// including using it on a `GtkPicture` (or one of its parents) that it was
/// set on itself via `gtk.Picture.setPaintable`. The paintable will take care
/// of recursion when this happens. If you do this however, ensure that the
/// `gtk.Picture.properties.can_shrink` property is set to `TRUE` or you might
/// end up with an infinitely growing widget.
pub const WidgetPaintable = opaque {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{gdk.Paintable};
    pub const Class = gtk.WidgetPaintableClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The observed widget or `NULL` if none.
        pub const widget = struct {
            pub const name = "widget";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {};

    /// Creates a new widget paintable observing the given widget.
    extern fn gtk_widget_paintable_new(p_widget: ?*gtk.Widget) *gtk.WidgetPaintable;
    pub const new = gtk_widget_paintable_new;

    /// Returns the widget that is observed or `NULL` if none.
    extern fn gtk_widget_paintable_get_widget(p_self: *WidgetPaintable) ?*gtk.Widget;
    pub const getWidget = gtk_widget_paintable_get_widget;

    /// Sets the widget that should be observed.
    extern fn gtk_widget_paintable_set_widget(p_self: *WidgetPaintable, p_widget: ?*gtk.Widget) void;
    pub const setWidget = gtk_widget_paintable_set_widget;

    extern fn gtk_widget_paintable_get_type() usize;
    pub const getGObjectType = gtk_widget_paintable_get_type;

    extern fn g_object_ref(p_self: *gtk.WidgetPaintable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.WidgetPaintable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *WidgetPaintable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A toplevel window which can contain other widgets.
///
/// <picture>
///   <source srcset="window-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkWindow" src="window.png">
/// </picture>
///
/// Windows normally have decorations that are under the control
/// of the windowing system and allow the user to manipulate the window
/// (resize it, move it, close it,...).
///
/// # GtkWindow as GtkBuildable
///
/// The `GtkWindow` implementation of the `gtk.Buildable` interface supports
/// setting a child as the titlebar by specifying “titlebar” as the “type”
/// attribute of a `<child>` element.
///
/// # Shortcuts and Gestures
///
/// `GtkWindow` supports the following keyboard shortcuts:
///
/// - <kbd>F10</kbd> activates the menubar, if present.
/// - <kbd>Alt</kbd> makes the mnemonics visible while pressed.
///
/// The following signals have default keybindings:
///
/// - `gtk.Window.signals.activate_default`
/// - `gtk.Window.signals.activate_focus`
/// - `gtk.Window.signals.enable_debugging`
///
/// # Actions
///
/// `GtkWindow` defines a set of built-in actions:
///
/// - `default.activate` activates the default widget.
/// - `window.minimize` minimizes the window.
/// - `window.toggle-maximized` maximizes or restores the window.
/// - `window.close` closes the window.
///
/// # CSS nodes
///
/// ```
/// window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled]
/// ├── <child>
/// ╰── <titlebar child>.titlebar [.default-decoration]
/// ```
///
/// `GtkWindow` has a main CSS node with name window and style class .background.
///
/// Style classes that are typically used with the main CSS node are .csd (when
/// client-side decorations are in use), .solid-csd (for client-side decorations
/// without invisible borders), .ssd (used by mutter when rendering server-side
/// decorations). GtkWindow also represents window states with the following
/// style classes on the main node: .maximized, .fullscreen, .tiled (when supported,
/// also .tiled-top, .tiled-left, .tiled-right, .tiled-bottom).
///
/// `GtkWindow` subclasses often add their own discriminating style classes,
/// such as .dialog, .popup or .tooltip.
///
/// Generally, some CSS properties don't make sense on the toplevel window node,
/// such as margins or padding. When client-side decorations without invisible
/// borders are in use (i.e. the .solid-csd style class is added to the
/// main window node), the CSS border of the toplevel window is used for
/// resize drags. In the .csd case, the shadow area outside of the window
/// can be used to resize it.
///
/// `GtkWindow` adds the .titlebar and .default-decoration style classes to the
/// widget that is added as a titlebar child.
///
/// # Accessibility
///
/// `GtkWindow` uses the `gtk.@"AccessibleRole.window"` role.
///
/// From GTK 4.12 to 4.18, it used the `gtk.@"AccessibleRole.application"` role.
pub const Window = extern struct {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget, gtk.Native, gtk.Root, gtk.ShortcutManager };
    pub const Class = gtk.WindowClass;
    f_parent_instance: gtk.Widget,

    pub const virtual_methods = struct {
        /// Activates the default widget for the window.
        pub const activate_default = struct {
            pub fn call(p_class: anytype, p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Window.Class, p_class).f_activate_default.?(gobject.ext.as(Window, p_window));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Window.Class, p_class).f_activate_default = @ptrCast(p_implementation);
            }
        };

        /// Activates the current focused widget within the window.
        pub const activate_focus = struct {
            pub fn call(p_class: anytype, p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Window.Class, p_class).f_activate_focus.?(gobject.ext.as(Window, p_window));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Window.Class, p_class).f_activate_focus = @ptrCast(p_implementation);
            }
        };

        /// Class handler for the `Window.signals.close_request` signal.
        pub const close_request = struct {
            pub fn call(p_class: anytype, p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(Window.Class, p_class).f_close_request.?(gobject.ext.as(Window, p_window));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(Window.Class, p_class).f_close_request = @ptrCast(p_implementation);
            }
        };

        /// Class handler for the `GtkWindow::enable-debugging`
        ///   keybinding signal.
        pub const enable_debugging = struct {
            pub fn call(p_class: anytype, p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_toggle: c_int) c_int {
                return gobject.ext.as(Window.Class, p_class).f_enable_debugging.?(gobject.ext.as(Window, p_window), p_toggle);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_toggle: c_int) callconv(.c) c_int) void {
                gobject.ext.as(Window.Class, p_class).f_enable_debugging = @ptrCast(p_implementation);
            }
        };

        /// Signal gets emitted when the set of accelerators or
        ///   mnemonics that are associated with window changes.
        pub const keys_changed = struct {
            pub fn call(p_class: anytype, p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Window.Class, p_class).f_keys_changed.?(gobject.ext.as(Window, p_window));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_window: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Window.Class, p_class).f_keys_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The `GtkApplication` associated with the window.
        ///
        /// The application will be kept alive for at least as long as it
        /// has any windows associated with it (see `gio.Application.hold`
        /// for a way to keep it alive without windows).
        ///
        /// Normally, the connection between the application and the window
        /// will remain until the window is destroyed, but you can explicitly
        /// remove it by setting the this property to `NULL`.
        pub const application = struct {
            pub const name = "application";

            pub const Type = ?*gtk.Application;
        };

        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the window should have a frame (also known as *decorations*).
        pub const decorated = struct {
            pub const name = "decorated";

            pub const Type = c_int;
        };

        /// The default height of the window.
        pub const default_height = struct {
            pub const name = "default-height";

            pub const Type = c_int;
        };

        /// The default widget.
        pub const default_widget = struct {
            pub const name = "default-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// The default width of the window.
        pub const default_width = struct {
            pub const name = "default-width";

            pub const Type = c_int;
        };

        /// Whether the window frame should have a close button.
        pub const deletable = struct {
            pub const name = "deletable";

            pub const Type = c_int;
        };

        /// If this window should be destroyed when the parent is destroyed.
        pub const destroy_with_parent = struct {
            pub const name = "destroy-with-parent";

            pub const Type = c_int;
        };

        /// The display that will display this window.
        pub const display = struct {
            pub const name = "display";

            pub const Type = ?*gdk.Display;
        };

        /// Whether 'focus rectangles' are currently visible in this window.
        ///
        /// This property is maintained by GTK based on user input
        /// and should not be set by applications.
        pub const focus_visible = struct {
            pub const name = "focus-visible";

            pub const Type = c_int;
        };

        /// The focus widget.
        pub const focus_widget = struct {
            pub const name = "focus-widget";

            pub const Type = ?*gtk.Widget;
        };

        /// Whether the window is fullscreen.
        ///
        /// Setting this property is the equivalent of calling
        /// `gtk.Window.fullscreen` or `gtk.Window.unfullscreen`;
        /// either operation is asynchronous, which means you will need to
        /// connect to the ::notify signal in order to know whether the
        /// operation was successful.
        pub const fullscreened = struct {
            pub const name = "fullscreened";

            pub const Type = c_int;
        };

        /// The gravity to use when resizing the window programmatically.
        ///
        /// Gravity describes which point of the window we want to keep
        /// fixed (meaning that the window will grow in the opposite direction).
        /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
        /// want the to fix top right corner of the window.
        pub const gravity = struct {
            pub const name = "gravity";

            pub const Type = gtk.WindowGravity;
        };

        /// Whether the window frame should handle <kbd>F10</kbd> for activating
        /// menubars.
        pub const handle_menubar_accel = struct {
            pub const name = "handle-menubar-accel";

            pub const Type = c_int;
        };

        /// If this window should be hidden instead of destroyed when the user clicks
        /// the close button.
        pub const hide_on_close = struct {
            pub const name = "hide-on-close";

            pub const Type = c_int;
        };

        /// Specifies the name of the themed icon to use as the window icon.
        ///
        /// See `gtk.IconTheme` for more details.
        pub const icon_name = struct {
            pub const name = "icon-name";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the toplevel is the currently active window.
        pub const is_active = struct {
            pub const name = "is-active";

            pub const Type = c_int;
        };

        /// Whether the window is maximized.
        ///
        /// Setting this property is the equivalent of calling
        /// `gtk.Window.maximize` or `gtk.Window.unmaximize`;
        /// either operation is asynchronous, which means you will need to
        /// connect to the ::notify signal in order to know whether the
        /// operation was successful.
        pub const maximized = struct {
            pub const name = "maximized";

            pub const Type = c_int;
        };

        /// Whether mnemonics are currently visible in this window.
        ///
        /// This property is maintained by GTK based on user input,
        /// and should not be set by applications.
        pub const mnemonics_visible = struct {
            pub const name = "mnemonics-visible";

            pub const Type = c_int;
        };

        /// If true, the window is modal.
        pub const modal = struct {
            pub const name = "modal";

            pub const Type = c_int;
        };

        /// If true, users can resize the window.
        pub const resizable = struct {
            pub const name = "resizable";

            pub const Type = c_int;
        };

        /// A write-only property for setting window's startup notification identifier.
        pub const startup_id = struct {
            pub const name = "startup-id";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the window is suspended.
        ///
        /// See `gtk.Window.isSuspended` for details about what suspended means.
        pub const suspended = struct {
            pub const name = "suspended";

            pub const Type = c_int;
        };

        /// The title of the window.
        pub const title = struct {
            pub const name = "title";

            pub const Type = ?[*:0]u8;
        };

        /// The titlebar widget.
        pub const titlebar = struct {
            pub const name = "titlebar";

            pub const Type = ?*gtk.Widget;
        };

        /// The transient parent of the window.
        pub const transient_for = struct {
            pub const name = "transient-for";

            pub const Type = ?*gtk.Window;
        };
    };

    pub const signals = struct {
        /// Emitted when the user activates the default widget.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
        pub const activate_default = struct {
            pub const name = "activate-default";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Window, p_instance))),
                    gobject.signalLookup("activate-default", Window.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user activates the currently focused
        /// widget of `window`.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default binding for this signal is <kbd>␣</kbd>.
        pub const activate_focus = struct {
            pub const name = "activate-focus";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Window, p_instance))),
                    gobject.signalLookup("activate-focus", Window.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user clicks on the close button of the window.
        pub const close_request = struct {
            pub const name = "close-request";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Window, p_instance))),
                    gobject.signalLookup("close-request", Window.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the user enables or disables interactive debugging.
        ///
        /// When `toggle` is true, interactive debugging is toggled on or off,
        /// when it is false, the debugger will be pointed at the widget
        /// under the pointer.
        ///
        /// This is a [keybinding signal](class.SignalAction.html).
        ///
        /// The default bindings for this signal are
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> and
        /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>.
        pub const enable_debugging = struct {
            pub const name = "enable-debugging";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_toggle: c_int, P_Data) callconv(.c) c_int, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Window, p_instance))),
                    gobject.signalLookup("enable-debugging", Window.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when the set of accelerators or mnemonics that
        /// are associated with the window changes.
        pub const keys_changed = struct {
            pub const name = "keys-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Window, p_instance))),
                    gobject.signalLookup("keys-changed", Window.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Returns the fallback icon name for windows.
    ///
    /// The returned string is owned by GTK and should not
    /// be modified. It is only valid until the next call to
    /// `gtk.Window.setDefaultIconName`.
    extern fn gtk_window_get_default_icon_name() ?[*:0]const u8;
    pub const getDefaultIconName = gtk_window_get_default_icon_name;

    /// Returns the list of all existing toplevel windows.
    ///
    /// If you want to iterate through the list and perform actions involving
    /// callbacks that might destroy the widgets or add new ones, be aware that
    /// the list of toplevels will change and emit the "items-changed" signal.
    extern fn gtk_window_get_toplevels() *gio.ListModel;
    pub const getToplevels = gtk_window_get_toplevels;

    /// Returns the list of all existing toplevel windows.
    ///
    /// 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.
    extern fn gtk_window_list_toplevels() *glib.List;
    pub const listToplevels = gtk_window_list_toplevels;

    /// Sets whether the window should request startup notification.
    ///
    /// By default, after showing the first window, GTK calls
    /// `gdk.Toplevel.setStartupId`. Call this function
    /// to disable the automatic startup notification. You might do this
    /// if your first window is a splash screen, and you want to delay
    /// notification until after your real main window has been shown,
    /// for example.
    ///
    /// In that example, you would disable startup notification
    /// temporarily, show your splash screen, then re-enable it so that
    /// showing the main window would automatically result in notification.
    extern fn gtk_window_set_auto_startup_notification(p_setting: c_int) void;
    pub const setAutoStartupNotification = gtk_window_set_auto_startup_notification;

    /// Sets an icon to be used as fallback.
    ///
    /// The fallback icon is used for windows that
    /// haven't had `gtk.Window.setIconName`
    /// called on them.
    extern fn gtk_window_set_default_icon_name(p_name: [*:0]const u8) void;
    pub const setDefaultIconName = gtk_window_set_default_icon_name;

    /// Opens or closes the [interactive debugger](running.html`interactive`-debugging).
    ///
    /// The debugger offers access to the widget hierarchy of the application
    /// and to useful debugging tools.
    ///
    /// This function allows applications that already use
    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd>
    /// (or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>)
    /// for their own key shortcuts to add a different shortcut to open the Inspector.
    ///
    /// If you are not overriding the default key shortcuts for the Inspector,
    /// you should not use this function.
    extern fn gtk_window_set_interactive_debugging(p_enable: c_int) void;
    pub const setInteractiveDebugging = gtk_window_set_interactive_debugging;

    /// Creates a new `GtkWindow`.
    ///
    /// To get an undecorated window (without window borders),
    /// use `gtk.Window.setDecorated`.
    ///
    /// All top-level windows created by this function are stored
    /// in an internal top-level window list. This list can be obtained
    /// from `gtk.Window.listToplevels`. Due to GTK keeping a
    /// reference to the window internally, this function does not
    /// return a reference to the caller.
    ///
    /// To delete a `GtkWindow`, call `gtk.Window.destroy`.
    extern fn gtk_window_new() *gtk.Window;
    pub const new = gtk_window_new;

    /// Requests that the window is closed.
    ///
    /// This is similar to what happens when a window manager
    /// close button is clicked.
    ///
    /// This function can be used with close buttons in custom
    /// titlebars.
    extern fn gtk_window_close(p_window: *Window) void;
    pub const close = gtk_window_close;

    /// Drops the internal reference GTK holds on toplevel windows.
    extern fn gtk_window_destroy(p_window: *Window) void;
    pub const destroy = gtk_window_destroy;

    /// Asks to place the window in the fullscreen state.
    ///
    /// Note that you shouldn’t assume the window is definitely fullscreen
    /// afterward, because other entities (e.g. the user or window manager)
    /// unfullscreen it again, and not all window managers honor requests
    /// to fullscreen windows.
    ///
    /// If a window is not explicitly fullscreened or unfullscreened before
    /// it is shown, the initial state is at the window managers discretion.
    ///
    /// You can track the result of this operation via the
    /// `gdk.Toplevel.properties.state` property, or by listening to
    /// notifications of the `gtk.Window.properties.fullscreened` property.
    extern fn gtk_window_fullscreen(p_window: *Window) void;
    pub const fullscreen = gtk_window_fullscreen;

    /// Asks to place the window in the fullscreen state on the given monitor.
    ///
    /// Note that you shouldn't assume the window is definitely fullscreen
    /// afterward, or that the windowing system allows fullscreen windows on
    /// any given monitor.
    ///
    /// You can track the result of this operation via the
    /// `gdk.Toplevel.properties.state` property, or by listening to
    /// notifications of the `gtk.Window.properties.fullscreened` property.
    extern fn gtk_window_fullscreen_on_monitor(p_window: *Window, p_monitor: *gdk.Monitor) void;
    pub const fullscreenOnMonitor = gtk_window_fullscreen_on_monitor;

    /// Gets the application object associated with the window.
    extern fn gtk_window_get_application(p_window: *Window) ?*gtk.Application;
    pub const getApplication = gtk_window_get_application;

    /// Gets the child widget of the window.
    extern fn gtk_window_get_child(p_window: *Window) ?*gtk.Widget;
    pub const getChild = gtk_window_get_child;

    /// Returns whether the window has been set to have decorations.
    extern fn gtk_window_get_decorated(p_window: *Window) c_int;
    pub const getDecorated = gtk_window_get_decorated;

    /// Gets the default size of the window.
    ///
    /// A value of 0 for the width or height indicates that a default
    /// size has not been explicitly set for that dimension, so the
    /// “natural” size of the window will be used.
    ///
    /// This function is the recommended way for [saving window state
    /// across restarts of applications](https://developer.gnome.org/documentation/tutorials/save-state.html).
    extern fn gtk_window_get_default_size(p_window: *Window, p_width: ?*c_int, p_height: ?*c_int) void;
    pub const getDefaultSize = gtk_window_get_default_size;

    /// Returns the default widget for `window`.
    extern fn gtk_window_get_default_widget(p_window: *Window) ?*gtk.Widget;
    pub const getDefaultWidget = gtk_window_get_default_widget;

    /// Returns whether the window has been set to have a close button.
    extern fn gtk_window_get_deletable(p_window: *Window) c_int;
    pub const getDeletable = gtk_window_get_deletable;

    /// Returns whether the window will be destroyed with its transient parent.
    extern fn gtk_window_get_destroy_with_parent(p_window: *Window) c_int;
    pub const getDestroyWithParent = gtk_window_get_destroy_with_parent;

    /// Retrieves the current focused widget within the window.
    ///
    /// Note that this is the widget that would have the focus
    /// if the toplevel window focused; if the toplevel window
    /// is not focused then `gtk_widget_has_focus (widget)` will
    /// not be false for the widget.
    extern fn gtk_window_get_focus(p_window: *Window) ?*gtk.Widget;
    pub const getFocus = gtk_window_get_focus;

    /// Gets whether “focus rectangles” are supposed to be visible.
    extern fn gtk_window_get_focus_visible(p_window: *Window) c_int;
    pub const getFocusVisible = gtk_window_get_focus_visible;

    /// Returns the gravity that is used when changing the window size programmatically.
    extern fn gtk_window_get_gravity(p_window: *Window) gtk.WindowGravity;
    pub const getGravity = gtk_window_get_gravity;

    /// Returns the group for the window.
    ///
    /// If the window has no group, then the default group is returned.
    extern fn gtk_window_get_group(p_window: ?*Window) *gtk.WindowGroup;
    pub const getGroup = gtk_window_get_group;

    /// Returns whether this window reacts to <kbd>F10</kbd>
    /// presses by activating a menubar it contains.
    extern fn gtk_window_get_handle_menubar_accel(p_window: *Window) c_int;
    pub const getHandleMenubarAccel = gtk_window_get_handle_menubar_accel;

    /// Returns whether the window will be hidden instead of destroyed when the close
    /// button is clicked.
    extern fn gtk_window_get_hide_on_close(p_window: *Window) c_int;
    pub const getHideOnClose = gtk_window_get_hide_on_close;

    /// Returns the name of the themed icon for the window.
    extern fn gtk_window_get_icon_name(p_window: *Window) ?[*:0]const u8;
    pub const getIconName = gtk_window_get_icon_name;

    /// Gets whether mnemonics are supposed to be visible.
    extern fn gtk_window_get_mnemonics_visible(p_window: *Window) c_int;
    pub const getMnemonicsVisible = gtk_window_get_mnemonics_visible;

    /// Returns whether the window is modal.
    extern fn gtk_window_get_modal(p_window: *Window) c_int;
    pub const getModal = gtk_window_get_modal;

    /// Gets whether the user can resize the window.
    extern fn gtk_window_get_resizable(p_window: *Window) c_int;
    pub const getResizable = gtk_window_get_resizable;

    /// Retrieves the title of the window.
    extern fn gtk_window_get_title(p_window: *Window) ?[*:0]const u8;
    pub const getTitle = gtk_window_get_title;

    /// Returns the titlebar that has been set with
    /// `gtk.Window.setTitlebar`.
    extern fn gtk_window_get_titlebar(p_window: *Window) ?*gtk.Widget;
    pub const getTitlebar = gtk_window_get_titlebar;

    /// Fetches the transient parent for this window.
    extern fn gtk_window_get_transient_for(p_window: *Window) ?*gtk.Window;
    pub const getTransientFor = gtk_window_get_transient_for;

    /// Returns whether the window has an explicit window group.
    extern fn gtk_window_has_group(p_window: *Window) c_int;
    pub const hasGroup = gtk_window_has_group;

    /// Returns whether the window is part of the current active toplevel.
    ///
    /// The active toplevel is the window receiving keystrokes.
    ///
    /// The return value is `TRUE` if the window is active toplevel itself.
    /// You might use this function if you wanted to draw a widget
    /// differently in an active window from a widget in an inactive window.
    extern fn gtk_window_is_active(p_window: *Window) c_int;
    pub const isActive = gtk_window_is_active;

    /// Retrieves the current fullscreen state of the window.
    ///
    /// Note that since fullscreening is ultimately handled by the window
    /// manager and happens asynchronously to an application request, you
    /// shouldn’t assume the return value of this function changing
    /// immediately (or at all), as an effect of calling
    /// `gtk.Window.fullscreen` or `gtk.Window.unfullscreen`.
    ///
    /// If the window isn't yet mapped, the value returned will whether the
    /// initial requested state is fullscreen.
    extern fn gtk_window_is_fullscreen(p_window: *Window) c_int;
    pub const isFullscreen = gtk_window_is_fullscreen;

    /// Retrieves the current maximized state of the window.
    ///
    /// Note that since maximization is ultimately handled by the window
    /// manager and happens asynchronously to an application request, you
    /// shouldn’t assume the return value of this function changing
    /// immediately (or at all), as an effect of calling
    /// `gtk.Window.maximize` or `gtk.Window.unmaximize`.
    ///
    /// If the window isn't yet mapped, the value returned will whether the
    /// initial requested state is maximized.
    extern fn gtk_window_is_maximized(p_window: *Window) c_int;
    pub const isMaximized = gtk_window_is_maximized;

    /// Retrieves the current suspended state of the window.
    ///
    /// A window being suspended means it's currently not visible
    /// to the user, for example by being on a inactive workspace,
    /// minimized, obstructed.
    extern fn gtk_window_is_suspended(p_window: *Window) c_int;
    pub const isSuspended = gtk_window_is_suspended;

    /// Asks to maximize the window, so that it fills the screen.
    ///
    /// Note that you shouldn’t assume the window is definitely maximized
    /// afterward, because other entities (e.g. the user or window manager)
    /// could unmaximize it again, and not all window managers support
    /// maximization.
    ///
    /// It’s permitted to call this function before showing a window,
    /// in which case the window will be maximized when it appears onscreen
    /// initially.
    ///
    /// If a window is not explicitly maximized or unmaximized before it is
    /// shown, the initial state is at the window managers discretion. For
    /// example, it might decide to maximize a window that almost fills the
    /// screen.
    ///
    /// You can track the result of this operation via the
    /// `gdk.Toplevel.properties.state` property, or by listening to
    /// notifications on the `gtk.Window.properties.maximized`
    /// property.
    extern fn gtk_window_maximize(p_window: *Window) void;
    pub const maximize = gtk_window_maximize;

    /// Asks to minimize the window.
    ///
    /// Note that you shouldn’t assume the window is definitely minimized
    /// afterward, because the windowing system might not support this
    /// functionality; other entities (e.g. the user or the window manager)
    /// could unminimize it again, or there may not be a window manager in
    /// which case minimization isn’t possible, etc.
    ///
    /// It’s permitted to call this function before showing a window,
    /// in which case the window will be minimized before it ever appears
    /// onscreen.
    ///
    /// You can track result of this operation via the
    /// `gdk.Toplevel.properties.state` property.
    extern fn gtk_window_minimize(p_window: *Window) void;
    pub const minimize = gtk_window_minimize;

    /// Presents a window to the user.
    ///
    /// This may mean raising the window in the stacking order,
    /// unminimizing it, moving it to the current desktop and/or
    /// giving it the keyboard focus (possibly dependent on the user’s
    /// platform, window manager and preferences).
    ///
    /// If `window` is hidden, this function also makes it visible.
    extern fn gtk_window_present(p_window: *Window) void;
    pub const present = gtk_window_present;

    /// Presents a window to the user in response to an user interaction.
    ///
    /// See `gtk.Window.present` for more details.
    ///
    /// The timestamp should be gathered when the window was requested
    /// to be shown (when clicking a link for example), rather than once
    /// the window is ready to be shown.
    extern fn gtk_window_present_with_time(p_window: *Window, p_timestamp: u32) void;
    pub const presentWithTime = gtk_window_present_with_time;

    /// Sets or unsets the application object associated with the window.
    ///
    /// The application will be kept alive for at least as long as it has
    /// any windows associated with it (see `gio.Application.hold`
    /// for a way to keep it alive without windows).
    ///
    /// Normally, the connection between the application and the window will
    /// remain until the window is destroyed, but you can explicitly remove
    /// it by setting the `application` to `NULL`.
    ///
    /// This is equivalent to calling `gtk.Application.removeWindow`
    /// and/or `gtk.Application.addWindow` on the old/new applications
    /// as relevant.
    extern fn gtk_window_set_application(p_window: *Window, p_application: ?*gtk.Application) void;
    pub const setApplication = gtk_window_set_application;

    /// Sets the child widget of the window.
    extern fn gtk_window_set_child(p_window: *Window, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_window_set_child;

    /// Sets whether the window should be decorated.
    ///
    /// By default, windows are decorated with a title bar, resize
    /// controls, etc. Some window managers allow GTK to disable these
    /// decorations, creating a borderless window. If you set the decorated
    /// property to false using this function, GTK will do its best to
    /// convince the window manager not to decorate the window. Depending on
    /// the system, this function may not have any effect when called on a
    /// window that is already visible, so you should call it before calling
    /// `gtk.Widget.show`.
    ///
    /// On Windows, this function always works, since there’s no window manager
    /// policy involved.
    extern fn gtk_window_set_decorated(p_window: *Window, p_setting: c_int) void;
    pub const setDecorated = gtk_window_set_decorated;

    /// Sets the default size of a window.
    ///
    /// The default size of a window is the size that will be used
    /// if no other constraints apply.
    ///
    /// The default size will be updated whenever the window is resized
    /// to reflect the new size, unless the window is forced to a size,
    /// like when it is maximized or fullscreened.
    ///
    /// If the window’s minimum size request is larger than
    /// the default, the default will be ignored.
    ///
    /// Setting the default size to a value <= 0 will cause it to be
    /// ignored and the natural size request will be used instead. It
    /// is possible to do this while the window is showing to "reset"
    /// it to its initial size.
    ///
    /// Unlike `gtk.Widget.setSizeRequest`, which sets a size
    /// request for a widget and thus would keep users from shrinking
    /// the window, this function only sets the initial size, just as
    /// if the user had resized the window themselves. Users can still
    /// shrink the window again as they normally would. Setting a default
    /// size of -1 means to use the “natural” default size (the size request
    /// of the window).
    ///
    /// If you use this function to reestablish a previously saved window size,
    /// note that the appropriate size to save is the one returned by
    /// `gtk.Window.getDefaultSize`. Using the window allocation
    /// directly will not work in all circumstances and can lead to growing
    /// or shrinking windows.
    extern fn gtk_window_set_default_size(p_window: *Window, p_width: c_int, p_height: c_int) void;
    pub const setDefaultSize = gtk_window_set_default_size;

    /// Sets the default widget.
    ///
    /// The default widget is the widget that is activated
    /// when the user presses <kbd>Enter</kbd> in a dialog
    /// (for example).
    extern fn gtk_window_set_default_widget(p_window: *Window, p_default_widget: ?*gtk.Widget) void;
    pub const setDefaultWidget = gtk_window_set_default_widget;

    /// Sets whether the window should be deletable.
    ///
    /// By default, windows have a close button in the window frame.
    /// Some  window managers allow GTK to disable this button. If you
    /// set the deletable property to false using this function, GTK
    /// will do its best to convince the window manager not to show a
    /// close button. Depending on the system, this function may not
    /// have any effect when called on a window that is already visible,
    /// so you should call it before calling `gtk.Widget.show`.
    ///
    /// On Windows, this function always works, since there’s no window
    /// manager policy involved.
    extern fn gtk_window_set_deletable(p_window: *Window, p_setting: c_int) void;
    pub const setDeletable = gtk_window_set_deletable;

    /// Sets whether to destroy the window when the transient parent is destroyed.
    ///
    /// This is useful for dialogs that shouldn’t persist beyond the lifetime
    /// of the main window they are associated with, for example.
    extern fn gtk_window_set_destroy_with_parent(p_window: *Window, p_setting: c_int) void;
    pub const setDestroyWithParent = gtk_window_set_destroy_with_parent;

    /// Sets the display where the window is displayed.
    ///
    /// If the window is already mapped, it will be unmapped,
    /// and then remapped on the new display.
    extern fn gtk_window_set_display(p_window: *Window, p_display: *gdk.Display) void;
    pub const setDisplay = gtk_window_set_display;

    /// Sets the focus widget.
    ///
    /// If `focus` is not the current focus widget, and is focusable,
    /// sets it as the focus widget for the window. If `focus` is `NULL`,
    /// unsets the focus widget for this window. To set the focus to a
    /// particular widget in the toplevel, it is usually more convenient
    /// to use `gtk.Widget.grabFocus` instead of this function.
    extern fn gtk_window_set_focus(p_window: *Window, p_focus: ?*gtk.Widget) void;
    pub const setFocus = gtk_window_set_focus;

    /// Sets whether “focus rectangles” are supposed to be visible.
    ///
    /// This property is maintained by GTK based on user input,
    /// and should not be set by applications.
    extern fn gtk_window_set_focus_visible(p_window: *Window, p_setting: c_int) void;
    pub const setFocusVisible = gtk_window_set_focus_visible;

    /// Sets the gravity that is used when changing the window size programmatically.
    extern fn gtk_window_set_gravity(p_window: *Window, p_gravity: gtk.WindowGravity) void;
    pub const setGravity = gtk_window_set_gravity;

    /// Sets whether this window should react to <kbd>F10</kbd>
    /// presses by activating a menubar it contains.
    extern fn gtk_window_set_handle_menubar_accel(p_window: *Window, p_handle_menubar_accel: c_int) void;
    pub const setHandleMenubarAccel = gtk_window_set_handle_menubar_accel;

    /// Sets whether clicking the close button will hide the window instead
    /// of destroying it.
    extern fn gtk_window_set_hide_on_close(p_window: *Window, p_setting: c_int) void;
    pub const setHideOnClose = gtk_window_set_hide_on_close;

    /// Sets the icon for the window from a named themed icon.
    ///
    /// See the docs for `gtk.IconTheme` for more details.
    /// On some platforms, the window icon is not used at all.
    ///
    /// Note that this has nothing to do with the WM_ICON_NAME
    /// property which is mentioned in the ICCCM.
    extern fn gtk_window_set_icon_name(p_window: *Window, p_name: ?[*:0]const u8) void;
    pub const setIconName = gtk_window_set_icon_name;

    /// Sets whether mnemonics are supposed to be visible.
    ///
    /// This property is maintained by GTK based on user input,
    /// and should not be set by applications.
    extern fn gtk_window_set_mnemonics_visible(p_window: *Window, p_setting: c_int) void;
    pub const setMnemonicsVisible = gtk_window_set_mnemonics_visible;

    /// Sets a window modal or non-modal.
    ///
    /// Modal windows prevent interaction with other windows in the same
    /// application. To keep modal dialogs on top of main application windows,
    /// use `gtk.Window.setTransientFor` to make the dialog transient
    /// for the parent; most window managers will then disallow lowering the
    /// dialog below the parent.
    extern fn gtk_window_set_modal(p_window: *Window, p_modal: c_int) void;
    pub const setModal = gtk_window_set_modal;

    /// Sets whether the user can resize a window.
    ///
    /// Windows are user resizable by default.
    extern fn gtk_window_set_resizable(p_window: *Window, p_resizable: c_int) void;
    pub const setResizable = gtk_window_set_resizable;

    /// Sets the startup notification ID.
    ///
    /// Startup notification identifiers are used by desktop environment
    /// to track application startup, to provide user feedback and other
    /// features. This function changes the corresponding property on the
    /// underlying `GdkSurface`.
    ///
    /// Normally, startup identifier is managed automatically and you should
    /// only use this function in special cases like transferring focus from
    /// other processes. You should use this function before calling
    /// `gtk.Window.present` or any equivalent function generating
    /// a window map event.
    ///
    /// This function is only useful on Wayland or X11, not with other GDK
    /// backends.
    extern fn gtk_window_set_startup_id(p_window: *Window, p_startup_id: [*:0]const u8) void;
    pub const setStartupId = gtk_window_set_startup_id;

    /// Sets the title of the window.
    ///
    /// The title of a window will be displayed in its title bar; on the
    /// X Window System, the title bar is rendered by the window manager
    /// so exactly how the title appears to users may vary according to a
    /// user’s exact configuration. The title should help a user distinguish
    /// this window from other windows they may have open. A good title might
    /// include the application name and current document filename, for example.
    ///
    /// Passing `NULL` does the same as setting the title to an empty string.
    extern fn gtk_window_set_title(p_window: *Window, p_title: ?[*:0]const u8) void;
    pub const setTitle = gtk_window_set_title;

    /// Sets a custom titlebar for the window.
    ///
    /// A typical widget used here is `gtk.HeaderBar`, as it
    /// provides various features expected of a titlebar while allowing
    /// the addition of child widgets to it.
    ///
    /// If you set a custom titlebar, GTK will do its best to convince
    /// the window manager not to put its own titlebar on the window.
    /// Depending on the system, this function may not work for a window
    /// that is already visible, so you set the titlebar before calling
    /// `gtk.Widget.show`.
    extern fn gtk_window_set_titlebar(p_window: *Window, p_titlebar: ?*gtk.Widget) void;
    pub const setTitlebar = gtk_window_set_titlebar;

    /// Sets a transient parent for the window.
    ///
    /// Dialog windows should be set transient for the main application
    /// window they were spawned from. This allows window managers to e.g.
    /// keep the dialog on top of the main window, or center the dialog
    /// over the main window. `gtk.Dialog.newWithButtons` and other
    /// convenience functions in GTK will sometimes call this function on
    /// your behalf.
    ///
    /// Passing `NULL` for `parent` unsets the current transient window.
    ///
    /// On Windows, this function puts the child window on top of the parent,
    /// much as the window manager would have done on X.
    extern fn gtk_window_set_transient_for(p_window: *Window, p_parent: ?*gtk.Window) void;
    pub const setTransientFor = gtk_window_set_transient_for;

    /// Asks to remove the fullscreen state for the window, and return to
    /// its previous state.
    ///
    /// Note that you shouldn’t assume the window is definitely not
    /// fullscreen afterward, because other entities (e.g. the user or
    /// window manager) could fullscreen it again, and not all window
    /// managers honor requests to unfullscreen windows; normally the
    /// window will end up restored to its normal state. Just don’t
    /// write code that crashes if not.
    ///
    /// If a window is not explicitly fullscreened or unfullscreened before
    /// it is shown, the initial state is at the window managers discretion.
    ///
    /// You can track the result of this operation via the
    /// `gdk.Toplevel.properties.state` property, or by listening to
    /// notifications of the `gtk.Window.properties.fullscreened` property.
    extern fn gtk_window_unfullscreen(p_window: *Window) void;
    pub const unfullscreen = gtk_window_unfullscreen;

    /// Asks to unmaximize the window.
    ///
    /// Note that you shouldn’t assume the window is definitely unmaximized
    /// afterward, because other entities (e.g. the user or window manager)
    /// maximize it again, and not all window managers honor requests to
    /// unmaximize.
    ///
    /// If a window is not explicitly maximized or unmaximized before it is
    /// shown, the initial state is at the window managers discretion. For
    /// example, it might decide to maximize a window that almost fills the
    /// screen.
    ///
    /// You can track the result of this operation via the
    /// `gdk.Toplevel.properties.state` property, or by listening to
    /// notifications on the `gtk.Window.properties.maximized` property.
    extern fn gtk_window_unmaximize(p_window: *Window) void;
    pub const unmaximize = gtk_window_unmaximize;

    /// Asks to unminimize the window.
    ///
    /// Note that you shouldn’t assume the window is definitely unminimized
    /// afterward, because the windowing system might not support this
    /// functionality; other entities (e.g. the user or the window manager)
    /// could minimize it again, or there may not be a window manager in
    /// which case minimization isn’t possible, etc.
    ///
    /// You can track result of this operation via the
    /// `gdk.Toplevel.properties.state` property.
    extern fn gtk_window_unminimize(p_window: *Window) void;
    pub const unminimize = gtk_window_unminimize;

    extern fn gtk_window_get_type() usize;
    pub const getGObjectType = gtk_window_get_type;

    extern fn g_object_ref(p_self: *gtk.Window) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Window) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Window, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Shows window frame controls.
///
/// Typical window frame controls are minimize, maximize and close buttons,
/// and the window icon.
///
/// <picture>
///   <source srcset="windowcontrols-dark.png" media="(prefers-color-scheme: dark)">
///   <img alt="An example GtkWindowControls" src="windowcontrols.png">
/// </picture>
///
/// `GtkWindowControls` only displays start or end side of the controls (see
/// `gtk.WindowControls.properties.side`), so it's intended to be always used
/// in pair with another `GtkWindowControls` for the opposite side, for example:
///
/// ```xml
/// <object class="GtkBox">
///   <child>
///     <object class="GtkWindowControls">
///       <property name="side">start</property>
///     </object>
///   </child>
///
///   ...
///
///   <child>
///     <object class="GtkWindowControls">
///       <property name="side">end</property>
///     </object>
///   </child>
/// </object>
/// ```
///
/// # CSS nodes
///
/// ```
/// windowcontrols
/// ├── [image.icon]
/// ├── [button.minimize]
/// ├── [button.maximize]
/// ╰── [button.close]
/// ```
///
/// A `GtkWindowControls`' CSS node is called windowcontrols. It contains
/// subnodes corresponding to each title button. Which of the title buttons
/// exist and where they are placed exactly depends on the desktop environment
/// and `gtk.WindowControls.properties.decoration_layout` value.
///
/// When `gtk.WindowControls.properties.empty` is true, it gets the .empty
/// style class.
///
/// # Accessibility
///
/// `GtkWindowControls` uses the `gtk.@"AccessibleRole.group"` role.
pub const WindowControls = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.WindowControlsClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The decoration layout for window buttons.
        ///
        /// If this property is not set, the
        /// `gtk.Settings.properties.gtk_decoration_layout` setting is used.
        pub const decoration_layout = struct {
            pub const name = "decoration-layout";

            pub const Type = ?[*:0]u8;
        };

        /// Whether the widget has any window buttons.
        pub const empty = struct {
            pub const name = "empty";

            pub const Type = c_int;
        };

        /// Whether the widget shows start or end side of the decoration layout.
        ///
        /// See `gtk.WindowControls.properties.decoration_layout`.
        pub const side = struct {
            pub const name = "side";

            pub const Type = gtk.PackType;
        };

        /// Whether to show platform native close/minimize/maximize buttons.
        ///
        /// For macOS, the `gtk.HeaderBar.properties.decoration_layout` property
        /// controls the use of native window controls.
        ///
        /// On other platforms, this option has no effect.
        ///
        /// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
        pub const use_native_controls = struct {
            pub const name = "use-native-controls";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkWindowControls`.
    extern fn gtk_window_controls_new(p_side: gtk.PackType) *gtk.WindowControls;
    pub const new = gtk_window_controls_new;

    /// Gets the decoration layout of this window controls widget
    extern fn gtk_window_controls_get_decoration_layout(p_self: *WindowControls) ?[*:0]const u8;
    pub const getDecorationLayout = gtk_window_controls_get_decoration_layout;

    /// Gets whether the widget has any window buttons.
    extern fn gtk_window_controls_get_empty(p_self: *WindowControls) c_int;
    pub const getEmpty = gtk_window_controls_get_empty;

    /// Gets the side to which this window controls widget belongs.
    extern fn gtk_window_controls_get_side(p_self: *WindowControls) gtk.PackType;
    pub const getSide = gtk_window_controls_get_side;

    /// Returns whether platform native window controls are shown.
    extern fn gtk_window_controls_get_use_native_controls(p_self: *WindowControls) c_int;
    pub const getUseNativeControls = gtk_window_controls_get_use_native_controls;

    /// Sets the decoration layout for the title buttons.
    ///
    /// This overrides the `gtk.Settings.properties.gtk_decoration_layout`
    /// setting.
    ///
    /// The format of the string is button names, separated by commas.
    /// A colon separates the buttons that should appear on the left
    /// from those on the right. Recognized button names are minimize,
    /// maximize, close and icon (the window icon).
    ///
    /// For example, “icon:minimize,maximize,close” specifies a icon
    /// on the left, and minimize, maximize and close buttons on the right.
    ///
    /// If `gtk.WindowControls.properties.side` value is `gtk.@"PackType.start"`,
    /// `self` will display the part before the colon, otherwise after that.
    extern fn gtk_window_controls_set_decoration_layout(p_self: *WindowControls, p_layout: ?[*:0]const u8) void;
    pub const setDecorationLayout = gtk_window_controls_set_decoration_layout;

    /// Determines which part of decoration layout
    /// the window controls widget uses.
    ///
    /// See `gtk.WindowControls.properties.decoration_layout`.
    extern fn gtk_window_controls_set_side(p_self: *WindowControls, p_side: gtk.PackType) void;
    pub const setSide = gtk_window_controls_set_side;

    /// Sets whether platform native window controls are used.
    ///
    /// This option shows the "stoplight" buttons on macOS.
    /// For Linux, this option has no effect.
    ///
    /// See also [Using GTK on Apple macOS](osx.html?native-window-controls).
    extern fn gtk_window_controls_set_use_native_controls(p_self: *WindowControls, p_setting: c_int) void;
    pub const setUseNativeControls = gtk_window_controls_set_use_native_controls;

    extern fn gtk_window_controls_get_type() usize;
    pub const getGObjectType = gtk_window_controls_get_type;

    extern fn g_object_ref(p_self: *gtk.WindowControls) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.WindowControls) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *WindowControls, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Creates groups of windows that behave like separate applications.
///
/// It achieves this by limiting the effect of GTK grabs and modality
/// to windows in the same group.
///
/// A window can be a member in at most one window group at a time.
/// Windows that have not been explicitly assigned to a group are
/// implicitly treated like windows of the default window group.
///
/// `GtkWindowGroup` objects are referenced by each window in the group,
/// so once you have added all windows to a `GtkWindowGroup`, you can drop
/// the initial reference to the window group with `gobject.Object.unref`. If the
/// windows in the window group are subsequently destroyed, then they will
/// be removed from the window group and drop their references on the window
/// group; when all window have been removed, the window group will be
/// freed.
pub const WindowGroup = extern struct {
    pub const Parent = gobject.Object;
    pub const Implements = [_]type{};
    pub const Class = gtk.WindowGroupClass;
    f_parent_instance: gobject.Object,
    f_priv: ?*gtk.WindowGroupPrivate,

    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Creates a new `GtkWindowGroup` object.
    ///
    /// Modality of windows only affects windows
    /// within the same `GtkWindowGroup`.
    extern fn gtk_window_group_new() *gtk.WindowGroup;
    pub const new = gtk_window_group_new;

    /// Adds a window to a `GtkWindowGroup`.
    extern fn gtk_window_group_add_window(p_window_group: *WindowGroup, p_window: *gtk.Window) void;
    pub const addWindow = gtk_window_group_add_window;

    /// Returns a list of the `GtkWindows` that belong to `window_group`.
    extern fn gtk_window_group_list_windows(p_window_group: *WindowGroup) *glib.List;
    pub const listWindows = gtk_window_group_list_windows;

    /// Removes a window from a `GtkWindowGroup`.
    extern fn gtk_window_group_remove_window(p_window_group: *WindowGroup, p_window: *gtk.Window) void;
    pub const removeWindow = gtk_window_group_remove_window;

    extern fn gtk_window_group_get_type() usize;
    pub const getGObjectType = gtk_window_group_get_type;

    extern fn g_object_ref(p_self: *gtk.WindowGroup) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.WindowGroup) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *WindowGroup, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Implements titlebar functionality for a window.
///
/// When added into a window, it can be dragged to move the window,
/// and it implements the right click, double click and middle click
/// behaviors that are expected of a titlebar.
///
/// # CSS nodes
///
/// `GtkWindowHandle` has a single CSS node with the name `windowhandle`.
///
/// # Accessibility
///
/// Until GTK 4.10, `GtkWindowHandle` used the `gtk.@"AccessibleRole.group"` role.
///
/// Starting from GTK 4.12, `GtkWindowHandle` uses the `gtk.@"AccessibleRole.generic"`
/// role.
pub const WindowHandle = opaque {
    pub const Parent = gtk.Widget;
    pub const Implements = [_]type{ gtk.Accessible, gtk.Buildable, gtk.ConstraintTarget };
    pub const Class = gtk.WindowHandleClass;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The child widget.
        pub const child = struct {
            pub const name = "child";

            pub const Type = ?*gtk.Widget;
        };
    };

    pub const signals = struct {};

    /// Creates a new `GtkWindowHandle`.
    extern fn gtk_window_handle_new() *gtk.WindowHandle;
    pub const new = gtk_window_handle_new;

    /// Gets the child widget of `self`.
    extern fn gtk_window_handle_get_child(p_self: *WindowHandle) ?*gtk.Widget;
    pub const getChild = gtk_window_handle_get_child;

    /// Sets the child widget of `self`.
    extern fn gtk_window_handle_set_child(p_self: *WindowHandle, p_child: ?*gtk.Widget) void;
    pub const setChild = gtk_window_handle_set_child;

    extern fn gtk_window_handle_get_type() usize;
    pub const getGObjectType = gtk_window_handle_get_type;

    extern fn g_object_ref(p_self: *gtk.WindowHandle) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.WindowHandle) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *WindowHandle, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for describing UI elements for Assistive Technologies.
///
/// Every accessible implementation has:
///
///  - a “role”, represented by a value of the `gtk.AccessibleRole` enumeration
///  - “attributes”, represented by a set of `gtk.AccessibleState`,
///    `gtk.AccessibleProperty` and `gtk.AccessibleRelation` values
///
/// The role cannot be changed after instantiating a `GtkAccessible`
/// implementation.
///
/// The attributes are updated every time a UI element's state changes in
/// a way that should be reflected by assistive technologies. For instance,
/// if a `GtkWidget` visibility changes, the `GTK_ACCESSIBLE_STATE_HIDDEN`
/// state will also change to reflect the `gtk.Widget.properties.visible` property.
///
/// Every accessible implementation is part of a tree of accessible objects.
/// Normally, this tree corresponds to the widget tree, but can be customized
/// by reimplementing the `gtk.Accessible.virtual_methods.get_accessible_parent`,
/// `gtk.Accessible.virtual_methods.get_first_accessible_child` and
/// `gtk.Accessible.virtual_methods.get_next_accessible_sibling` virtual functions.
///
/// Note that you can not create a top-level accessible object as of now,
/// which means that you must always have a parent accessible object.
///
/// Also note that when an accessible object does not correspond to a widget,
/// and it has children, whose implementation you don't control,
/// it is necessary to ensure the correct shape of the a11y tree
/// by calling `gtk.Accessible.setAccessibleParent` and
/// updating the sibling by `gtk.Accessible.updateNextAccessibleSibling`.
pub const Accessible = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.AccessibleInterface;
    pub const virtual_methods = struct {
        /// Retrieves the accessible identifier for the accessible object.
        ///
        /// This functionality can be overridden by `GtkAccessible`
        /// implementations.
        ///
        /// It is left to the accessible implementation to define the scope
        /// and uniqueness of the identifier.
        pub const get_accessible_id = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?[*:0]u8 {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_accessible_id.?(gobject.ext.as(Accessible, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?[*:0]u8) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_accessible_id = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the accessible parent for an accessible object.
        ///
        /// This function returns `NULL` for top level widgets.
        pub const get_accessible_parent = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*gtk.Accessible {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_accessible_parent.?(gobject.ext.as(Accessible, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*gtk.Accessible) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_accessible_parent = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the implementation for the given accessible object.
        pub const get_at_context = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*gtk.ATContext {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_at_context.?(gobject.ext.as(Accessible, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*gtk.ATContext) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_at_context = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const get_bounds = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: *c_int, p_y: *c_int, p_width: *c_int, p_height: *c_int) c_int {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_bounds.?(gobject.ext.as(Accessible, p_self), p_x, p_y, p_width, p_height);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_x: *c_int, p_y: *c_int, p_width: *c_int, p_height: *c_int) callconv(.c) c_int) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_bounds = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the first accessible child of an accessible object.
        pub const get_first_accessible_child = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*gtk.Accessible {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_first_accessible_child.?(gobject.ext.as(Accessible, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*gtk.Accessible) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_first_accessible_child = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the next accessible sibling of an accessible object
        pub const get_next_accessible_sibling = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*gtk.Accessible {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_next_accessible_sibling.?(gobject.ext.as(Accessible, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*gtk.Accessible) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_next_accessible_sibling = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const get_platform_state = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_state: gtk.AccessiblePlatformState) c_int {
                return gobject.ext.as(Accessible.Iface, p_class).f_get_platform_state.?(gobject.ext.as(Accessible, p_self), p_state);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_state: gtk.AccessiblePlatformState) callconv(.c) c_int) void {
                gobject.ext.as(Accessible.Iface, p_class).f_get_platform_state = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The accessible role of the given `GtkAccessible` implementation.
        ///
        /// The accessible role cannot be changed once set.
        pub const accessible_role = struct {
            pub const name = "accessible-role";

            pub const Type = gtk.AccessibleRole;
        };
    };

    pub const signals = struct {};

    /// 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.
    extern fn gtk_accessible_announce(p_self: *Accessible, p_message: [*:0]const u8, p_priority: gtk.AccessibleAnnouncementPriority) void;
    pub const announce = gtk_accessible_announce;

    /// Retrieves the accessible identifier for the accessible object.
    ///
    /// This functionality can be overridden by `GtkAccessible`
    /// implementations.
    ///
    /// It is left to the accessible implementation to define the scope
    /// and uniqueness of the identifier.
    extern fn gtk_accessible_get_accessible_id(p_self: *Accessible) ?[*:0]u8;
    pub const getAccessibleId = gtk_accessible_get_accessible_id;

    /// Retrieves the accessible parent for an accessible object.
    ///
    /// This function returns `NULL` for top level widgets.
    extern fn gtk_accessible_get_accessible_parent(p_self: *Accessible) ?*gtk.Accessible;
    pub const getAccessibleParent = gtk_accessible_get_accessible_parent;

    /// Retrieves the accessible role of an accessible object.
    extern fn gtk_accessible_get_accessible_role(p_self: *Accessible) gtk.AccessibleRole;
    pub const getAccessibleRole = gtk_accessible_get_accessible_role;

    /// Retrieves the implementation for the given accessible object.
    extern fn gtk_accessible_get_at_context(p_self: *Accessible) *gtk.ATContext;
    pub const getAtContext = gtk_accessible_get_at_context;

    /// 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.
    extern fn gtk_accessible_get_bounds(p_self: *Accessible, p_x: *c_int, p_y: *c_int, p_width: *c_int, p_height: *c_int) c_int;
    pub const getBounds = gtk_accessible_get_bounds;

    /// Retrieves the first accessible child of an accessible object.
    extern fn gtk_accessible_get_first_accessible_child(p_self: *Accessible) ?*gtk.Accessible;
    pub const getFirstAccessibleChild = gtk_accessible_get_first_accessible_child;

    /// Retrieves the next accessible sibling of an accessible object
    extern fn gtk_accessible_get_next_accessible_sibling(p_self: *Accessible) ?*gtk.Accessible;
    pub const getNextAccessibleSibling = gtk_accessible_get_next_accessible_sibling;

    /// 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.
    extern fn gtk_accessible_get_platform_state(p_self: *Accessible, p_state: gtk.AccessiblePlatformState) c_int;
    pub const getPlatformState = gtk_accessible_get_platform_state;

    /// Resets the accessible property to its default value.
    extern fn gtk_accessible_reset_property(p_self: *Accessible, p_property: gtk.AccessibleProperty) void;
    pub const resetProperty = gtk_accessible_reset_property;

    /// Resets the accessible relation to its default value.
    extern fn gtk_accessible_reset_relation(p_self: *Accessible, p_relation: gtk.AccessibleRelation) void;
    pub const resetRelation = gtk_accessible_reset_relation;

    /// Resets the accessible state to its default value.
    extern fn gtk_accessible_reset_state(p_self: *Accessible, p_state: gtk.AccessibleState) void;
    pub const resetState = gtk_accessible_reset_state;

    /// 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.
    extern fn gtk_accessible_set_accessible_parent(p_self: *Accessible, p_parent: ?*gtk.Accessible, p_next_sibling: ?*gtk.Accessible) void;
    pub const setAccessibleParent = gtk_accessible_set_accessible_parent;

    /// 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.
    extern fn gtk_accessible_update_next_accessible_sibling(p_self: *Accessible, p_new_sibling: ?*gtk.Accessible) void;
    pub const updateNextAccessibleSibling = gtk_accessible_update_next_accessible_sibling;

    /// 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.
    extern fn gtk_accessible_update_platform_state(p_self: *Accessible, p_state: gtk.AccessiblePlatformState) void;
    pub const updatePlatformState = gtk_accessible_update_platform_state;

    /// Updates a list of accessible properties.
    ///
    /// See the `gtk.AccessibleProperty` documentation for the
    /// value types of accessible properties.
    ///
    /// This function should be called by `GtkWidget` types whenever
    /// an accessible property change must be communicated to assistive
    /// technologies.
    ///
    /// Example:
    /// ```c
    /// value = gtk_adjustment_get_value (adjustment);
    /// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
    ///                                    GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
    ///                                    -1);
    /// ```
    extern fn gtk_accessible_update_property(p_self: *Accessible, p_first_property: gtk.AccessibleProperty, ...) void;
    pub const updateProperty = gtk_accessible_update_property;

    /// 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.
    extern fn gtk_accessible_update_property_value(p_self: *Accessible, p_n_properties: c_int, p_properties: [*]gtk.AccessibleProperty, p_values: [*]const gobject.Value) void;
    pub const updatePropertyValue = gtk_accessible_update_property_value;

    /// Updates a list of accessible relations.
    ///
    /// This function should be called by `GtkWidget` types whenever an accessible
    /// relation change must be communicated to assistive technologies.
    ///
    /// If the `gtk.AccessibleRelation` requires a list of references,
    /// you should pass each reference individually, followed by `NULL`, e.g.
    ///
    /// ```c
    /// gtk_accessible_update_relation (accessible,
    ///                                 GTK_ACCESSIBLE_RELATION_CONTROLS,
    ///                                   ref1, NULL,
    ///                                 GTK_ACCESSIBLE_RELATION_LABELLED_BY,
    ///                                   ref1, ref2, ref3, NULL,
    ///                                 -1);
    /// ```
    extern fn gtk_accessible_update_relation(p_self: *Accessible, p_first_relation: gtk.AccessibleRelation, ...) void;
    pub const updateRelation = gtk_accessible_update_relation;

    /// 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.
    extern fn gtk_accessible_update_relation_value(p_self: *Accessible, p_n_relations: c_int, p_relations: [*]gtk.AccessibleRelation, p_values: [*]const gobject.Value) void;
    pub const updateRelationValue = gtk_accessible_update_relation_value;

    /// Updates a list of accessible states.
    ///
    /// See the `gtk.AccessibleState` documentation for the
    /// value types of accessible states.
    ///
    /// This function should be called by `GtkWidget` types whenever
    /// an accessible state change must be communicated to assistive
    /// technologies.
    ///
    /// Example:
    ///
    /// ```c
    /// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
    /// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
    ///                              GTK_ACCESSIBLE_STATE_CHECKED, value,
    ///                              -1);
    /// ```
    extern fn gtk_accessible_update_state(p_self: *Accessible, p_first_state: gtk.AccessibleState, ...) void;
    pub const updateState = gtk_accessible_update_state;

    /// 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.
    extern fn gtk_accessible_update_state_value(p_self: *Accessible, p_n_states: c_int, p_states: [*]gtk.AccessibleState, p_values: [*]const gobject.Value) void;
    pub const updateStateValue = gtk_accessible_update_state_value;

    extern fn gtk_accessible_get_type() usize;
    pub const getGObjectType = gtk_accessible_get_type;

    extern fn g_object_ref(p_self: *gtk.Accessible) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Accessible) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Accessible, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for accessible objects containing links.
///
/// The `GtkAccessibleHypertext` interfaces is meant to be implemented by accessible
/// objects that contain links. Those links don't necessarily have to be part
/// of text, they can be associated with images and other things.
pub const AccessibleHypertext = opaque {
    pub const Prerequisites = [_]type{gtk.Accessible};
    pub const Iface = gtk.AccessibleHypertextInterface;
    pub const virtual_methods = struct {
        /// Retrieve the n-th link in the accessible object.
        ///
        /// `index` must be smaller than the number of links.
        pub const get_link = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_index: c_uint) *gtk.AccessibleHyperlink {
                return gobject.ext.as(AccessibleHypertext.Iface, p_class).f_get_link.?(gobject.ext.as(AccessibleHypertext, p_self), p_index);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_index: c_uint) callconv(.c) *gtk.AccessibleHyperlink) void {
                gobject.ext.as(AccessibleHypertext.Iface, p_class).f_get_link = @ptrCast(p_implementation);
            }
        };

        pub const get_link_at = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint) c_uint {
                return gobject.ext.as(AccessibleHypertext.Iface, p_class).f_get_link_at.?(gobject.ext.as(AccessibleHypertext, p_self), p_offset);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint) callconv(.c) c_uint) void {
                gobject.ext.as(AccessibleHypertext.Iface, p_class).f_get_link_at = @ptrCast(p_implementation);
            }
        };

        /// Retrieve the number of links in the accessible object.
        pub const get_n_links = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_uint {
                return gobject.ext.as(AccessibleHypertext.Iface, p_class).f_get_n_links.?(gobject.ext.as(AccessibleHypertext, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_uint) void {
                gobject.ext.as(AccessibleHypertext.Iface, p_class).f_get_n_links = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_accessible_hypertext_get_type() usize;
    pub const getGObjectType = gtk_accessible_hypertext_get_type;

    extern fn g_object_ref(p_self: *gtk.AccessibleHypertext) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AccessibleHypertext) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AccessibleHypertext, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for accessible objects containing a numeric value.
///
/// `GtkAccessibleRange` describes ranged controls for Assistive Technologies.
///
/// Ranged controls have a single value within an allowed range that can
/// optionally be changed by the user.
///
/// This interface is expected to be implemented by controls using the
/// following roles:
///
/// - `GTK_ACCESSIBLE_ROLE_METER`
/// - `GTK_ACCESSIBLE_ROLE_PROGRESS_BAR`
/// - `GTK_ACCESSIBLE_ROLE_SCROLLBAR`
/// - `GTK_ACCESSIBLE_ROLE_SLIDER`
/// - `GTK_ACCESSIBLE_ROLE_SPIN_BUTTON`
///
/// If that is not the case, a warning will be issued at run time.
///
/// In addition to this interface, its implementers are expected to provide the
/// correct values for the following properties:
///
/// - `GTK_ACCESSIBLE_PROPERTY_VALUE_MAX`
/// - `GTK_ACCESSIBLE_PROPERTY_VALUE_MIN`
/// - `GTK_ACCESSIBLE_PROPERTY_VALUE_NOW`
/// - `GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT`
pub const AccessibleRange = opaque {
    pub const Prerequisites = [_]type{gtk.Accessible};
    pub const Iface = gtk.AccessibleRangeInterface;
    pub const virtual_methods = struct {
        /// Sets the current value of the accessible range.
        ///
        /// This operation should behave similarly as if the user performed the
        /// action.
        pub const set_current_value = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_value: f64) c_int {
                return gobject.ext.as(AccessibleRange.Iface, p_class).f_set_current_value.?(gobject.ext.as(AccessibleRange, p_self), p_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_value: f64) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleRange.Iface, p_class).f_set_current_value = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_accessible_range_get_type() usize;
    pub const getGObjectType = gtk_accessible_range_get_type;

    extern fn g_object_ref(p_self: *gtk.AccessibleRange) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AccessibleRange) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AccessibleRange, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for accessible objects containing formatted text.
///
/// The `GtkAccessibleText` interfaces is meant to be implemented by accessible
/// objects that have text formatted with attributes, or non-trivial text contents.
///
/// You should use the `gtk.@"AccessibleProperty.LABEL"` or the
/// `gtk.@"AccessibleProperty.DESCRIPTION"` properties for accessible
/// objects containing simple, unformatted text.
pub const AccessibleText = opaque {
    pub const Prerequisites = [_]type{gtk.Accessible};
    pub const Iface = gtk.AccessibleTextInterface;
    pub const virtual_methods = struct {
        /// Retrieves the text attributes inside the accessible object.
        ///
        /// Each attribute is composed by:
        ///
        /// - a range
        /// - a name
        /// - a value
        ///
        /// It is left to the implementation to determine the serialization format
        /// of the value to a string.
        ///
        /// GTK provides support for various text attribute names and values, but
        /// implementations of this interface are free to add their own attributes.
        ///
        /// If this function returns true, `n_ranges` will be set to a value
        /// greater than or equal to one, `ranges` will be set to a newly
        /// allocated array of [struct`Gtk.AccessibleTextRange`].
        pub const get_attributes = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint, p_n_ranges: *usize, p_ranges: ?*[*]gtk.AccessibleTextRange, p_attribute_names: ?*[*][*:0]u8, p_attribute_values: ?*[*][*:0]u8) c_int {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_attributes.?(gobject.ext.as(AccessibleText, p_self), p_offset, p_n_ranges, p_ranges, p_attribute_names, p_attribute_values);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint, p_n_ranges: *usize, p_ranges: ?*[*]gtk.AccessibleTextRange, p_attribute_names: ?*[*][*:0]u8, p_attribute_values: ?*[*][*:0]u8) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_attributes = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the position of the caret inside the accessible object.
        pub const get_caret_position = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_uint {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_caret_position.?(gobject.ext.as(AccessibleText, p_self));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_uint) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_caret_position = @ptrCast(p_implementation);
            }
        };

        /// Retrieve the current contents of the accessible object within
        /// the given range.
        ///
        /// If `end` is `G_MAXUINT`, the end of the range is the full content
        /// of the accessible object.
        pub const get_contents = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start: c_uint, p_end: c_uint) *glib.Bytes {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_contents.?(gobject.ext.as(AccessibleText, p_self), p_start, p_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start: c_uint, p_end: c_uint) callconv(.c) *glib.Bytes) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_contents = @ptrCast(p_implementation);
            }
        };

        /// Retrieve the current contents of the accessible object starting
        /// from the given offset, and using the given granularity.
        ///
        /// The `start` and `end` values contain the boundaries of the text.
        pub const get_contents_at = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint, p_granularity: gtk.AccessibleTextGranularity, p_start: *c_uint, p_end: *c_uint) *glib.Bytes {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_contents_at.?(gobject.ext.as(AccessibleText, p_self), p_offset, p_granularity, p_start, p_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint, p_granularity: gtk.AccessibleTextGranularity, p_start: *c_uint, p_end: *c_uint) callconv(.c) *glib.Bytes) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_contents_at = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the default text attributes inside the accessible object.
        ///
        /// Each attribute is composed by:
        ///
        /// - a name
        /// - a value
        ///
        /// It is left to the implementation to determine the serialization format
        /// of the value to a string.
        ///
        /// GTK provides support for various text attribute names and values, but
        /// implementations of this interface are free to add their own attributes.
        pub const get_default_attributes = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_attribute_names: ?*[*][*:0]u8, p_attribute_values: ?*[*][*:0]u8) void {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_default_attributes.?(gobject.ext.as(AccessibleText, p_self), p_attribute_names, p_attribute_values);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_attribute_names: ?*[*][*:0]u8, p_attribute_values: ?*[*][*:0]u8) callconv(.c) void) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_default_attributes = @ptrCast(p_implementation);
            }
        };

        /// Obtains the extents of a range of text, in widget coordinates.
        pub const get_extents = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start: c_uint, p_end: c_uint, p_extents: *graphene.Rect) c_int {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_extents.?(gobject.ext.as(AccessibleText, p_self), p_start, p_end, p_extents);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start: c_uint, p_end: c_uint, p_extents: *graphene.Rect) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_extents = @ptrCast(p_implementation);
            }
        };

        /// Gets the text offset at a given point.
        pub const get_offset = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_point: *const graphene.Point, p_offset: *c_uint) c_int {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_offset.?(gobject.ext.as(AccessibleText, p_self), p_point, p_offset);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_point: *const graphene.Point, p_offset: *c_uint) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_offset = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the selection ranges in the accessible object.
        ///
        /// If this function returns true, `n_ranges` will be set to a value
        /// greater than or equal to one, and `ranges` will be set to a newly
        /// allocated array of [struct`Gtk.AccessibleTextRange`].
        pub const get_selection = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_n_ranges: *usize, p_ranges: ?*[*]gtk.AccessibleTextRange) c_int {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_get_selection.?(gobject.ext.as(AccessibleText, p_self), p_n_ranges, p_ranges);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_n_ranges: *usize, p_ranges: ?*[*]gtk.AccessibleTextRange) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_get_selection = @ptrCast(p_implementation);
            }
        };

        /// Sets the caret position.
        pub const set_caret_position = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint) c_int {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_set_caret_position.?(gobject.ext.as(AccessibleText, p_self), p_offset);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_offset: c_uint) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_set_caret_position = @ptrCast(p_implementation);
            }
        };

        /// Sets the caret position.
        pub const set_selection = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_i: usize, p_range: *gtk.AccessibleTextRange) c_int {
                return gobject.ext.as(AccessibleText.Iface, p_class).f_set_selection.?(gobject.ext.as(AccessibleText, p_self), p_i, p_range);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_i: usize, p_range: *gtk.AccessibleTextRange) callconv(.c) c_int) void {
                gobject.ext.as(AccessibleText.Iface, p_class).f_set_selection = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// Updates the position of the caret.
    ///
    /// Implementations of the `GtkAccessibleText` interface should call this
    /// function every time the caret has moved, in order to notify assistive
    /// technologies.
    extern fn gtk_accessible_text_update_caret_position(p_self: *AccessibleText) void;
    pub const updateCaretPosition = gtk_accessible_text_update_caret_position;

    /// Notifies assistive technologies of a change in contents.
    ///
    /// Implementations of the `GtkAccessibleText` interface should call this
    /// function every time their contents change as the result of an operation,
    /// like an insertion or a removal.
    ///
    /// Note: If the change is a deletion, this function must be called *before*
    /// removing the contents, if it is an insertion, it must be called *after*
    /// inserting the new contents.
    extern fn gtk_accessible_text_update_contents(p_self: *AccessibleText, p_change: gtk.AccessibleTextContentChange, p_start: c_uint, p_end: c_uint) void;
    pub const updateContents = gtk_accessible_text_update_contents;

    /// Updates the boundary of the selection.
    ///
    /// Implementations of the `GtkAccessibleText` interface should call this
    /// function every time the selection has moved, in order to notify assistive
    /// technologies.
    extern fn gtk_accessible_text_update_selection_bound(p_self: *AccessibleText) void;
    pub const updateSelectionBound = gtk_accessible_text_update_selection_bound;

    extern fn gtk_accessible_text_get_type() usize;
    pub const getGObjectType = gtk_accessible_text_get_type;

    extern fn g_object_ref(p_self: *gtk.AccessibleText) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AccessibleText) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AccessibleText, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides a way to associate widgets with actions.
///
/// It primarily consists of two properties: `gtk.Actionable.properties.action_name`
/// and `gtk.Actionable.properties.action_target`. There are also some convenience
/// APIs for setting these properties.
///
/// The action will be looked up in action groups that are found among
/// the widgets ancestors. Most commonly, these will be the actions with
/// the “win.” or “app.” prefix that are associated with the
/// `GtkApplicationWindow` or `GtkApplication`, but other action groups that
/// are added with `gtk.Widget.insertActionGroup` will be consulted
/// as well.
pub const Actionable = opaque {
    pub const Prerequisites = [_]type{gtk.Widget};
    pub const Iface = gtk.ActionableInterface;
    pub const virtual_methods = struct {
        /// Gets the action name for `actionable`.
        pub const get_action_name = struct {
            pub fn call(p_class: anytype, p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?[*:0]const u8 {
                return gobject.ext.as(Actionable.Iface, p_class).f_get_action_name.?(gobject.ext.as(Actionable, p_actionable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?[*:0]const u8) void {
                gobject.ext.as(Actionable.Iface, p_class).f_get_action_name = @ptrCast(p_implementation);
            }
        };

        /// Gets the current target value of `actionable`.
        pub const get_action_target_value = struct {
            pub fn call(p_class: anytype, p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*glib.Variant {
                return gobject.ext.as(Actionable.Iface, p_class).f_get_action_target_value.?(gobject.ext.as(Actionable, p_actionable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*glib.Variant) void {
                gobject.ext.as(Actionable.Iface, p_class).f_get_action_target_value = @ptrCast(p_implementation);
            }
        };

        /// 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 `ApplicationWindow` or its associated `Application`,
        /// respectively. This is the same form used for actions in the `gio.Menu`
        /// associated with the window.
        pub const set_action_name = struct {
            pub fn call(p_class: anytype, p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_action_name: ?[*:0]const u8) void {
                return gobject.ext.as(Actionable.Iface, p_class).f_set_action_name.?(gobject.ext.as(Actionable, p_actionable), p_action_name);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_action_name: ?[*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(Actionable.Iface, p_class).f_set_action_name = @ptrCast(p_implementation);
            }
        };

        /// 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 `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 action’s state to change to that value. Since the action’s 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).
        pub const set_action_target_value = struct {
            pub fn call(p_class: anytype, p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_target_value: ?*glib.Variant) void {
                return gobject.ext.as(Actionable.Iface, p_class).f_set_action_target_value.?(gobject.ext.as(Actionable, p_actionable), p_target_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_actionable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_target_value: ?*glib.Variant) callconv(.c) void) void {
                gobject.ext.as(Actionable.Iface, p_class).f_set_action_target_value = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The name of the action with which this widget should be associated.
        pub const action_name = struct {
            pub const name = "action-name";

            pub const Type = ?[*:0]u8;
        };

        /// The target value of the actionable widget's action.
        pub const action_target = struct {
            pub const name = "action-target";

            pub const Type = ?*glib.Variant;
        };
    };

    pub const signals = struct {};

    /// Gets the action name for `actionable`.
    extern fn gtk_actionable_get_action_name(p_actionable: *Actionable) ?[*:0]const u8;
    pub const getActionName = gtk_actionable_get_action_name;

    /// Gets the current target value of `actionable`.
    extern fn gtk_actionable_get_action_target_value(p_actionable: *Actionable) ?*glib.Variant;
    pub const getActionTargetValue = gtk_actionable_get_action_target_value;

    /// 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 `ApplicationWindow` or its associated `Application`,
    /// respectively. This is the same form used for actions in the `gio.Menu`
    /// associated with the window.
    extern fn gtk_actionable_set_action_name(p_actionable: *Actionable, p_action_name: ?[*:0]const u8) void;
    pub const setActionName = gtk_actionable_set_action_name;

    /// Sets the target of an actionable widget.
    ///
    /// This is a convenience function that calls `glib.Variant.new` for
    /// `format_string` and uses the result to call
    /// `gtk.Actionable.setActionTargetValue`.
    ///
    /// If you are setting a string-valued target and want to set
    /// the action name at the same time, you can use
    /// `gtk.Actionable.setDetailedActionName`.
    extern fn gtk_actionable_set_action_target(p_actionable: *Actionable, p_format_string: [*:0]const u8, ...) void;
    pub const setActionTarget = gtk_actionable_set_action_target;

    /// 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 `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 action’s state to change to that value. Since the action’s 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).
    extern fn gtk_actionable_set_action_target_value(p_actionable: *Actionable, p_target_value: ?*glib.Variant) void;
    pub const setActionTargetValue = gtk_actionable_set_action_target_value;

    /// Sets the action-name and associated string target value of an
    /// actionable widget.
    ///
    /// `detailed_action_name` is a string in the format accepted by
    /// `gio.Action.parseDetailedName`.
    extern fn gtk_actionable_set_detailed_action_name(p_actionable: *Actionable, p_detailed_action_name: [*:0]const u8) void;
    pub const setDetailedActionName = gtk_actionable_set_detailed_action_name;

    extern fn gtk_actionable_get_type() usize;
    pub const getGObjectType = gtk_actionable_get_type;

    extern fn g_object_ref(p_self: *gtk.Actionable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Actionable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Actionable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkAppChooser` is an interface for widgets which allow the user to
/// choose an application.
///
/// The main objects that implement this interface are
/// `gtk.AppChooserWidget`,
/// `gtk.AppChooserDialog` and `gtk.AppChooserButton`.
///
/// Applications are represented by GIO `GAppInfo` objects here.
/// GIO has a concept of recommended and fallback applications for a
/// given content type. Recommended applications are those that claim
/// to handle the content type itself, while fallback also includes
/// applications that handle a more generic content type. GIO also
/// knows the default and last-used application for a given content
/// type. The `GtkAppChooserWidget` provides detailed control over
/// whether the shown list of applications should include default,
/// recommended or fallback applications.
///
/// To obtain the application that has been selected in a `GtkAppChooser`,
/// use `gtk.AppChooser.getAppInfo`.
pub const AppChooser = opaque {
    pub const Prerequisites = [_]type{gtk.Widget};
    pub const Iface = opaque {
        pub const Instance = AppChooser;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The content type of the `GtkAppChooser` object.
        ///
        /// See `GContentType` for more information about content types.
        pub const content_type = struct {
            pub const name = "content-type";

            pub const Type = ?[*:0]u8;
        };
    };

    pub const signals = struct {};

    /// Returns the currently selected application.
    extern fn gtk_app_chooser_get_app_info(p_self: *AppChooser) ?*gio.AppInfo;
    pub const getAppInfo = gtk_app_chooser_get_app_info;

    /// Returns the content type for which the `GtkAppChooser`
    /// shows applications.
    extern fn gtk_app_chooser_get_content_type(p_self: *AppChooser) [*:0]u8;
    pub const getContentType = gtk_app_chooser_get_content_type;

    /// Reloads the list of applications.
    extern fn gtk_app_chooser_refresh(p_self: *AppChooser) void;
    pub const refresh = gtk_app_chooser_refresh;

    extern fn gtk_app_chooser_get_type() usize;
    pub const getGObjectType = gtk_app_chooser_get_type;

    extern fn g_object_ref(p_self: *gtk.AppChooser) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.AppChooser) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *AppChooser, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Allows objects to extend and customize deserialization from ui files.
///
/// The `GtkBuildable` interface includes methods for setting names and
/// properties of objects, parsing custom tags and constructing child objects.
///
/// It is implemented by all widgets and many of the non-widget objects that are
/// provided by GTK. The main user of this interface is `gtk.Builder`.
/// There should be very little need for applications to call any of these
/// functions directly.
///
/// An object only needs to implement this interface if it needs to extend the
/// `GtkBuilder` XML format or run any extra routines at deserialization time.
pub const Buildable = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.BuildableIface;
    pub const virtual_methods = struct {
        /// Adds a child to `buildable`. `type` is an optional string
        /// describing how the child should be added.
        pub const add_child = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: *gobject.Object, p_type: ?[*:0]const u8) void {
                return gobject.ext.as(Buildable.Iface, p_class).f_add_child.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_child, p_type);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: *gobject.Object, p_type: ?[*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(Buildable.Iface, p_class).f_add_child = @ptrCast(p_implementation);
            }
        };

        /// Constructs a child of a buildable that has been
        ///  specified as “constructor” in the UI definition. This can be used to
        ///  reference a widget created in a `<ui>` tag which is outside
        ///  of the normal GtkBuilder UI definition hierarchy.  A reference to the
        ///  constructed object is returned and becomes owned by the caller.
        pub const construct_child = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_name: [*:0]const u8) *gobject.Object {
                return gobject.ext.as(Buildable.Iface, p_class).f_construct_child.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_name);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_name: [*:0]const u8) callconv(.c) *gobject.Object) void {
                gobject.ext.as(Buildable.Iface, p_class).f_construct_child = @ptrCast(p_implementation);
            }
        };

        /// Similar to `gtk_buildable_parser_finished` but is
        /// called once for each custom tag handled by the `buildable`.
        pub const custom_finished = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_data: ?*anyopaque) void {
                return gobject.ext.as(Buildable.Iface, p_class).f_custom_finished.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_child, p_tagname, p_data);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_data: ?*anyopaque) callconv(.c) void) void {
                gobject.ext.as(Buildable.Iface, p_class).f_custom_finished = @ptrCast(p_implementation);
            }
        };

        /// Called at the end of each custom element handled by
        /// the buildable.
        pub const custom_tag_end = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_data: ?*anyopaque) void {
                return gobject.ext.as(Buildable.Iface, p_class).f_custom_tag_end.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_child, p_tagname, p_data);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_data: ?*anyopaque) callconv(.c) void) void {
                gobject.ext.as(Buildable.Iface, p_class).f_custom_tag_end = @ptrCast(p_implementation);
            }
        };

        /// Called for each unknown element under `<child>`.
        pub const custom_tag_start = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_parser: *gtk.BuildableParser, p_data: ?*anyopaque) c_int {
                return gobject.ext.as(Buildable.Iface, p_class).f_custom_tag_start.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_child, p_tagname, p_parser, p_data);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_parser: *gtk.BuildableParser, p_data: ?*anyopaque) callconv(.c) c_int) void {
                gobject.ext.as(Buildable.Iface, p_class).f_custom_tag_start = @ptrCast(p_implementation);
            }
        };

        /// The getter corresponding to `set_id`. Implement this
        ///   if you implement `set_id`.
        pub const get_id = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) [*:0]const u8 {
                return gobject.ext.as(Buildable.Iface, p_class).f_get_id.?(gobject.ext.as(Buildable, p_buildable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) [*:0]const u8) void {
                gobject.ext.as(Buildable.Iface, p_class).f_get_id = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the internal child called `childname` of the `buildable` object.
        pub const get_internal_child = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_childname: [*:0]const u8) *gobject.Object {
                return gobject.ext.as(Buildable.Iface, p_class).f_get_internal_child.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_childname);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_childname: [*:0]const u8) callconv(.c) *gobject.Object) void {
                gobject.ext.as(Buildable.Iface, p_class).f_get_internal_child = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const parser_finished = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder) void {
                return gobject.ext.as(Buildable.Iface, p_class).f_parser_finished.?(gobject.ext.as(Buildable, p_buildable), p_builder);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder) callconv(.c) void) void {
                gobject.ext.as(Buildable.Iface, p_class).f_parser_finished = @ptrCast(p_implementation);
            }
        };

        /// Sets a property of a buildable object.
        ///  It is normally not necessary to implement this, `gobject.Object.setProperty`
        ///  is used by default. `GtkWindow` implements this to delay showing itself
        ///  (i.e. setting the `gtk.Widget.properties.visible` property) until the whole
        ///  interface is created.
        pub const set_buildable_property = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_name: [*:0]const u8, p_value: *const gobject.Value) void {
                return gobject.ext.as(Buildable.Iface, p_class).f_set_buildable_property.?(gobject.ext.as(Buildable, p_buildable), p_builder, p_name, p_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_name: [*:0]const u8, p_value: *const gobject.Value) callconv(.c) void) void {
                gobject.ext.as(Buildable.Iface, p_class).f_set_buildable_property = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const set_id = struct {
            pub fn call(p_class: anytype, p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_id: [*:0]const u8) void {
                return gobject.ext.as(Buildable.Iface, p_class).f_set_id.?(gobject.ext.as(Buildable, p_buildable), p_id);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_buildable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_id: [*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(Buildable.Iface, p_class).f_set_id = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// 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`.
    extern fn gtk_buildable_get_buildable_id(p_buildable: *Buildable) ?[*:0]const u8;
    pub const getBuildableId = gtk_buildable_get_buildable_id;

    extern fn gtk_buildable_get_type() usize;
    pub const getGObjectType = gtk_buildable_get_type;

    extern fn g_object_ref(p_self: *gtk.Buildable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Buildable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Buildable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides language binding support to `GtkBuilder`.
///
/// The goal of `GtkBuilderScope` is to look up programming-language-specific
/// values for strings that are given in a `GtkBuilder` UI file.
///
/// The primary intended audience is bindings that want to provide deeper
/// integration of `GtkBuilder` into the language.
///
/// A `GtkBuilderScope` instance may be used with multiple `GtkBuilder` objects,
/// even at once.
///
/// By default, GTK will use its own implementation of `GtkBuilderScope`
/// for the C language which can be created via `gtk.BuilderCScope.new`.
///
/// If you implement `GtkBuilderScope` for a language binding, you
/// may want to (partially) derive from or fall back to a `gtk.BuilderCScope`,
/// as that class implements support for automatic lookups from C symbols.
pub const BuilderScope = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.BuilderScopeInterface;
    pub const virtual_methods = struct {
        /// Create a closure with the given arguments. See `gtk.Builder.createClosure`
        ///   for more details on those.
        ///   The C implementation will try to use `dlsym` to locate the function name and then
        ///   `gobject.cclosureNew` to create a closure for the symbol.
        ///   The default implementation just fails and returns `NULL`.
        pub const create_closure = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_function_name: [*:0]const u8, p_flags: gtk.BuilderClosureFlags, p_object: *gobject.Object, p_error: ?*?*glib.Error) ?*gobject.Closure {
                return gobject.ext.as(BuilderScope.Iface, p_class).f_create_closure.?(gobject.ext.as(BuilderScope, p_self), p_builder, p_function_name, p_flags, p_object, p_error);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_function_name: [*:0]const u8, p_flags: gtk.BuilderClosureFlags, p_object: *gobject.Object, p_error: ?*?*glib.Error) callconv(.c) ?*gobject.Closure) void {
                gobject.ext.as(BuilderScope.Iface, p_class).f_create_closure = @ptrCast(p_implementation);
            }
        };

        /// Try to lookup a `GType` via the given function name, specified
        ///   explicitly in a GtkBuilder file, like via the "type-func" attribute in the `<object>` tag.
        ///   This function is very rarely used.
        ///   The C implementation will use `dlsym` and call the resulting function as a `GTypeFunc`.
        ///   The default implementation will fail and just return `G_TYPE_INVALID`.
        pub const get_type_from_function = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_function_name: [*:0]const u8) usize {
                return gobject.ext.as(BuilderScope.Iface, p_class).f_get_type_from_function.?(gobject.ext.as(BuilderScope, p_self), p_builder, p_function_name);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_function_name: [*:0]const u8) callconv(.c) usize) void {
                gobject.ext.as(BuilderScope.Iface, p_class).f_get_type_from_function = @ptrCast(p_implementation);
            }
        };

        /// Try to lookup a `GType` via the its name. See
        ///   `gtk.Builder.getTypeFromName` for more details.
        ///   The C implementation will use `gobject.typeFromName` and if that fails try to guess the
        ///   correct function name for registering the type and then use `dlsym` to load it.
        ///   The default implementation just tries `gobject.typeFromName` and otherwise fails.
        pub const get_type_from_name = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_type_name: [*:0]const u8) usize {
                return gobject.ext.as(BuilderScope.Iface, p_class).f_get_type_from_name.?(gobject.ext.as(BuilderScope, p_self), p_builder, p_type_name);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_builder: *gtk.Builder, p_type_name: [*:0]const u8) callconv(.c) usize) void {
                gobject.ext.as(BuilderScope.Iface, p_class).f_get_type_from_name = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_builder_scope_get_type() usize;
    pub const getGObjectType = gtk_builder_scope_get_type;

    extern fn g_object_ref(p_self: *gtk.BuilderScope) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.BuilderScope) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *BuilderScope, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Interface for widgets that can be used for editing cells
///
/// The `GtkCellEditable` interface must be implemented for widgets to be usable
/// to edit the contents of a `GtkTreeView` cell. It provides a way to specify how
/// temporary widgets should be configured for editing, get the new value, etc.
pub const CellEditable = opaque {
    pub const Prerequisites = [_]type{gtk.Widget};
    pub const Iface = gtk.CellEditableIface;
    pub const virtual_methods = struct {
        /// Emits the `GtkCellEditable::editing-done` signal.
        pub const editing_done = struct {
            pub fn call(p_class: anytype, p_cell_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CellEditable.Iface, p_class).f_editing_done.?(gobject.ext.as(CellEditable, p_cell_editable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CellEditable.Iface, p_class).f_editing_done = @ptrCast(p_implementation);
            }
        };

        /// Emits the `GtkCellEditable::remove-widget` signal.
        pub const remove_widget = struct {
            pub fn call(p_class: anytype, p_cell_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CellEditable.Iface, p_class).f_remove_widget.?(gobject.ext.as(CellEditable, p_cell_editable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CellEditable.Iface, p_class).f_remove_widget = @ptrCast(p_implementation);
            }
        };

        /// Begins editing on a `cell_editable`.
        ///
        /// The `GtkCellRenderer` for the cell creates and returns a `GtkCellEditable` from
        /// `gtk.CellRenderer.startEditing`, configured for the `GtkCellRenderer` type.
        ///
        /// `gtk.CellEditable.startEditing` can then set up `cell_editable` suitably for
        /// editing a cell, e.g. making the Esc key emit `GtkCellEditable::editing-done`.
        ///
        /// Note that the `cell_editable` is created on-demand for the current edit; its
        /// lifetime is temporary and does not persist across other edits and/or cells.
        pub const start_editing = struct {
            pub fn call(p_class: anytype, p_cell_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: ?*gdk.Event) void {
                return gobject.ext.as(CellEditable.Iface, p_class).f_start_editing.?(gobject.ext.as(CellEditable, p_cell_editable), p_event);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_event: ?*gdk.Event) callconv(.c) void) void {
                gobject.ext.as(CellEditable.Iface, p_class).f_start_editing = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Indicates whether editing on the cell has been canceled.
        pub const editing_canceled = struct {
            pub const name = "editing-canceled";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// This signal is a sign for the cell renderer to update its
        /// value from the `cell_editable`.
        ///
        /// Implementations of `GtkCellEditable` are responsible for
        /// emitting this signal when they are done editing, e.g.
        /// `GtkEntry` emits this signal when the user presses Enter. Typical things to
        /// do in a handler for ::editing-done are to capture the edited value,
        /// disconnect the `cell_editable` from signals on the `GtkCellRenderer`, etc.
        ///
        /// `gtk.CellEditable.editingDone` is a convenience method
        /// for emitting `GtkCellEditable::editing-done`.
        pub const editing_done = struct {
            pub const name = "editing-done";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellEditable, p_instance))),
                    gobject.signalLookup("editing-done", CellEditable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is meant to indicate that the cell is finished
        /// editing, and the `cell_editable` widget is being removed and may
        /// subsequently be destroyed.
        ///
        /// Implementations of `GtkCellEditable` are responsible for
        /// emitting this signal when they are done editing. It must
        /// be emitted after the `GtkCellEditable::editing-done` signal,
        /// to give the cell renderer a chance to update the cell's value
        /// before the widget is removed.
        ///
        /// `gtk.CellEditable.removeWidget` is a convenience method
        /// for emitting `GtkCellEditable::remove-widget`.
        pub const remove_widget = struct {
            pub const name = "remove-widget";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(CellEditable, p_instance))),
                    gobject.signalLookup("remove-widget", CellEditable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Emits the `GtkCellEditable::editing-done` signal.
    extern fn gtk_cell_editable_editing_done(p_cell_editable: *CellEditable) void;
    pub const editingDone = gtk_cell_editable_editing_done;

    /// Emits the `GtkCellEditable::remove-widget` signal.
    extern fn gtk_cell_editable_remove_widget(p_cell_editable: *CellEditable) void;
    pub const removeWidget = gtk_cell_editable_remove_widget;

    /// Begins editing on a `cell_editable`.
    ///
    /// The `GtkCellRenderer` for the cell creates and returns a `GtkCellEditable` from
    /// `gtk.CellRenderer.startEditing`, configured for the `GtkCellRenderer` type.
    ///
    /// `gtk.CellEditable.startEditing` can then set up `cell_editable` suitably for
    /// editing a cell, e.g. making the Esc key emit `GtkCellEditable::editing-done`.
    ///
    /// Note that the `cell_editable` is created on-demand for the current edit; its
    /// lifetime is temporary and does not persist across other edits and/or cells.
    extern fn gtk_cell_editable_start_editing(p_cell_editable: *CellEditable, p_event: ?*gdk.Event) void;
    pub const startEditing = gtk_cell_editable_start_editing;

    extern fn gtk_cell_editable_get_type() usize;
    pub const getGObjectType = gtk_cell_editable_get_type;

    extern fn g_object_ref(p_self: *gtk.CellEditable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellEditable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellEditable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for packing cells
///
/// `GtkCellLayout` is an interface to be implemented by all objects which
/// want to provide a `GtkTreeViewColumn` like API for packing cells,
/// setting attributes and data funcs.
///
/// One of the notable features provided by implementations of
/// `GtkCellLayout` are attributes. Attributes let you set the properties
/// in flexible ways. They can just be set to constant values like regular
/// properties. But they can also be mapped to a column of the underlying
/// tree model with `gtk.CellLayout.setAttributes`, which means that the value
/// of the attribute can change from cell to cell as they are rendered by
/// the cell renderer. Finally, it is possible to specify a function with
/// `gtk.CellLayout.setCellDataFunc` that is called to determine the
/// value of the attribute for each cell that is rendered.
///
/// ## GtkCellLayouts as GtkBuildable
///
/// Implementations of GtkCellLayout which also implement the GtkBuildable
/// interface (`GtkCellView`, `GtkIconView`, `GtkComboBox`,
/// `GtkEntryCompletion`, `GtkTreeViewColumn`) accept `GtkCellRenderer` objects
/// as `<child>` elements in UI definitions. They support a custom `<attributes>`
/// element for their children, which can contain multiple `<attribute>`
/// elements. Each `<attribute>` element has a name attribute which specifies
/// a property of the cell renderer; the content of the element is the
/// attribute value.
///
/// This is an example of a UI definition fragment specifying attributes:
///
/// ```xml
/// <object class="GtkCellView">
///   <child>
///     <object class="GtkCellRendererText"/>
///     <attributes>
///       <attribute name="text">0</attribute>
///     </attributes>
///   </child>
/// </object>
/// ```
///
/// Furthermore for implementations of `GtkCellLayout` that use a `GtkCellArea`
/// to lay out cells (all `GtkCellLayout`s in GTK use a `GtkCellArea`)
/// [cell properties](class.CellArea.html`cell`-properties) can also be defined
/// in the format by specifying the custom `<cell-packing>` attribute which can
/// contain multiple `<property>` elements.
///
/// Here is a UI definition fragment specifying cell properties:
///
/// ```xml
/// <object class="GtkTreeViewColumn">
///   <child>
///     <object class="GtkCellRendererText"/>
///     <cell-packing>
///       <property name="align">True</property>
///       <property name="expand">False</property>
///     </cell-packing>
///   </child>
/// </object>
/// ```
///
/// ## Subclassing GtkCellLayout implementations
///
/// When subclassing a widget that implements `GtkCellLayout` like
/// `GtkIconView` or `GtkComboBox`, there are some considerations related
/// to the fact that these widgets internally use a `GtkCellArea`.
/// The cell area is exposed as a construct-only property by these
/// widgets. This means that it is possible to e.g. do
///
/// ```c
/// GtkWIdget *combo =
///   g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", my_cell_area, NULL);
/// ```
///
/// to use a custom cell area with a combo box. But construct properties
/// are only initialized after instance ``init``
/// functions have run, which means that using functions which rely on
/// the existence of the cell area in your subclass ``init`` function will
/// cause the default cell area to be instantiated. In this case, a provided
/// construct property value will be ignored (with a warning, to alert
/// you to the problem).
///
/// ```c
/// static void
/// my_combo_box_init (MyComboBox *b)
/// {
///   GtkCellRenderer *cell;
///
///   cell = gtk_cell_renderer_pixbuf_new ();
///
///   // The following call causes the default cell area for combo boxes,
///   // a GtkCellAreaBox, to be instantiated
///   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (b), cell, FALSE);
///   ...
/// }
///
/// GtkWidget *
/// my_combo_box_new (GtkCellArea *area)
/// {
///   // This call is going to cause a warning about area being ignored
///   return g_object_new (MY_TYPE_COMBO_BOX, "cell-area", area, NULL);
/// }
/// ```
///
/// If supporting alternative cell areas with your derived widget is
/// not important, then this does not have to concern you. If you want
/// to support alternative cell areas, you can do so by moving the
/// problematic calls out of ``init`` and into a ``constructor``
/// for your class.
pub const CellLayout = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.CellLayoutIface;
    pub const virtual_methods = struct {
        /// Adds an attribute mapping to the list in `cell_layout`.
        ///
        /// The `column` is the column of the model to get a value from, and the
        /// `attribute` is the property on `cell` to be set from that value. So for
        /// example if column 2 of the model contains strings, you could have the
        /// “text” attribute of a `GtkCellRendererText` get its values from column 2.
        /// In this context "attribute" and "property" are used interchangeably.
        pub const add_attribute = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_attribute: [*:0]const u8, p_column: c_int) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_add_attribute.?(gobject.ext.as(CellLayout, p_cell_layout), p_cell, p_attribute, p_column);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_attribute: [*:0]const u8, p_column: c_int) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_add_attribute = @ptrCast(p_implementation);
            }
        };

        /// Unsets all the mappings on all renderers on `cell_layout` and
        /// removes all renderers from `cell_layout`.
        pub const clear = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_clear.?(gobject.ext.as(CellLayout, p_cell_layout));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_clear = @ptrCast(p_implementation);
            }
        };

        /// Clears all existing attributes previously set with
        /// `gtk.CellLayout.setAttributes`.
        pub const clear_attributes = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_clear_attributes.?(gobject.ext.as(CellLayout, p_cell_layout), p_cell);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_clear_attributes = @ptrCast(p_implementation);
            }
        };

        /// Returns the underlying `GtkCellArea` which might be `cell_layout`
        /// if called on a `GtkCellArea` or might be `NULL` if no `GtkCellArea`
        /// is used by `cell_layout`.
        pub const get_area = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*gtk.CellArea {
                return gobject.ext.as(CellLayout.Iface, p_class).f_get_area.?(gobject.ext.as(CellLayout, p_cell_layout));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*gtk.CellArea) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_get_area = @ptrCast(p_implementation);
            }
        };

        /// Returns the cell renderers which have been added to `cell_layout`.
        pub const get_cells = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) *glib.List {
                return gobject.ext.as(CellLayout.Iface, p_class).f_get_cells.?(gobject.ext.as(CellLayout, p_cell_layout));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) *glib.List) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_get_cells = @ptrCast(p_implementation);
            }
        };

        /// Adds the `cell` to the end of `cell_layout`. If `expand` is `FALSE`, then the
        /// `cell` is allocated no more space than it needs. Any unused space is
        /// divided evenly between cells for which `expand` is `TRUE`.
        ///
        /// Note that reusing the same cell renderer is not supported.
        pub const pack_end = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_expand: c_int) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_pack_end.?(gobject.ext.as(CellLayout, p_cell_layout), p_cell, p_expand);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_expand: c_int) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_pack_end = @ptrCast(p_implementation);
            }
        };

        /// Packs the `cell` into the beginning of `cell_layout`. If `expand` is `FALSE`,
        /// then the `cell` is allocated no more space than it needs. Any unused space
        /// is divided evenly between cells for which `expand` is `TRUE`.
        ///
        /// Note that reusing the same cell renderer is not supported.
        pub const pack_start = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_expand: c_int) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_pack_start.?(gobject.ext.as(CellLayout, p_cell_layout), p_cell, p_expand);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_expand: c_int) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_pack_start = @ptrCast(p_implementation);
            }
        };

        /// Re-inserts `cell` at `position`.
        ///
        /// Note that `cell` has already to be packed into `cell_layout`
        /// for this to function properly.
        pub const reorder = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_position: c_int) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_reorder.?(gobject.ext.as(CellLayout, p_cell_layout), p_cell, p_position);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_position: c_int) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_reorder = @ptrCast(p_implementation);
            }
        };

        /// Sets the `GtkCellLayout`DataFunc to use for `cell_layout`.
        ///
        /// This function is used instead of the standard attributes mapping
        /// for setting the column value, and should set the value of `cell_layout`’s
        /// cell renderer(s) as appropriate.
        ///
        /// `func` may be `NULL` to remove a previously set function.
        pub const set_cell_data_func = struct {
            pub fn call(p_class: anytype, p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_func: ?gtk.CellLayoutDataFunc, p_func_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void {
                return gobject.ext.as(CellLayout.Iface, p_class).f_set_cell_data_func.?(gobject.ext.as(CellLayout, p_cell_layout), p_cell, p_func, p_func_data, p_destroy);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_cell_layout: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_cell: *gtk.CellRenderer, p_func: ?gtk.CellLayoutDataFunc, p_func_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void) void {
                gobject.ext.as(CellLayout.Iface, p_class).f_set_cell_data_func = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// Adds an attribute mapping to the list in `cell_layout`.
    ///
    /// The `column` is the column of the model to get a value from, and the
    /// `attribute` is the property on `cell` to be set from that value. So for
    /// example if column 2 of the model contains strings, you could have the
    /// “text” attribute of a `GtkCellRendererText` get its values from column 2.
    /// In this context "attribute" and "property" are used interchangeably.
    extern fn gtk_cell_layout_add_attribute(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer, p_attribute: [*:0]const u8, p_column: c_int) void;
    pub const addAttribute = gtk_cell_layout_add_attribute;

    /// Unsets all the mappings on all renderers on `cell_layout` and
    /// removes all renderers from `cell_layout`.
    extern fn gtk_cell_layout_clear(p_cell_layout: *CellLayout) void;
    pub const clear = gtk_cell_layout_clear;

    /// Clears all existing attributes previously set with
    /// `gtk.CellLayout.setAttributes`.
    extern fn gtk_cell_layout_clear_attributes(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer) void;
    pub const clearAttributes = gtk_cell_layout_clear_attributes;

    /// Returns the underlying `GtkCellArea` which might be `cell_layout`
    /// if called on a `GtkCellArea` or might be `NULL` if no `GtkCellArea`
    /// is used by `cell_layout`.
    extern fn gtk_cell_layout_get_area(p_cell_layout: *CellLayout) ?*gtk.CellArea;
    pub const getArea = gtk_cell_layout_get_area;

    /// Returns the cell renderers which have been added to `cell_layout`.
    extern fn gtk_cell_layout_get_cells(p_cell_layout: *CellLayout) *glib.List;
    pub const getCells = gtk_cell_layout_get_cells;

    /// Adds the `cell` to the end of `cell_layout`. If `expand` is `FALSE`, then the
    /// `cell` is allocated no more space than it needs. Any unused space is
    /// divided evenly between cells for which `expand` is `TRUE`.
    ///
    /// Note that reusing the same cell renderer is not supported.
    extern fn gtk_cell_layout_pack_end(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer, p_expand: c_int) void;
    pub const packEnd = gtk_cell_layout_pack_end;

    /// Packs the `cell` into the beginning of `cell_layout`. If `expand` is `FALSE`,
    /// then the `cell` is allocated no more space than it needs. Any unused space
    /// is divided evenly between cells for which `expand` is `TRUE`.
    ///
    /// Note that reusing the same cell renderer is not supported.
    extern fn gtk_cell_layout_pack_start(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer, p_expand: c_int) void;
    pub const packStart = gtk_cell_layout_pack_start;

    /// Re-inserts `cell` at `position`.
    ///
    /// Note that `cell` has already to be packed into `cell_layout`
    /// for this to function properly.
    extern fn gtk_cell_layout_reorder(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer, p_position: c_int) void;
    pub const reorder = gtk_cell_layout_reorder;

    /// Sets the attributes in the parameter list as the attributes
    /// of `cell_layout`.
    ///
    /// See `gtk.CellLayout.addAttribute` for more details.
    ///
    /// The attributes should be in attribute/column order, as in
    /// `gtk.CellLayout.addAttribute`. All existing attributes are
    /// removed, and replaced with the new attributes.
    extern fn gtk_cell_layout_set_attributes(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer, ...) void;
    pub const setAttributes = gtk_cell_layout_set_attributes;

    /// Sets the `GtkCellLayout`DataFunc to use for `cell_layout`.
    ///
    /// This function is used instead of the standard attributes mapping
    /// for setting the column value, and should set the value of `cell_layout`’s
    /// cell renderer(s) as appropriate.
    ///
    /// `func` may be `NULL` to remove a previously set function.
    extern fn gtk_cell_layout_set_cell_data_func(p_cell_layout: *CellLayout, p_cell: *gtk.CellRenderer, p_func: ?gtk.CellLayoutDataFunc, p_func_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setCellDataFunc = gtk_cell_layout_set_cell_data_func;

    extern fn gtk_cell_layout_get_type() usize;
    pub const getGObjectType = gtk_cell_layout_get_type;

    extern fn g_object_ref(p_self: *gtk.CellLayout) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.CellLayout) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *CellLayout, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkColorChooser` is an interface that is implemented by widgets
/// for choosing colors.
///
/// Depending on the situation, colors may be allowed to have alpha (translucency).
///
/// In GTK, the main widgets that implement this interface are
/// `gtk.ColorChooserWidget`, `gtk.ColorChooserDialog` and
/// `gtk.ColorButton`.
pub const ColorChooser = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.ColorChooserInterface;
    pub const virtual_methods = struct {
        /// Adds a palette to the color chooser.
        ///
        /// If `orientation` is horizontal, the colors are grouped in rows,
        /// with `colors_per_line` colors in each row. If `horizontal` is `FALSE`,
        /// the colors are grouped in columns instead.
        ///
        /// The default color palette of `gtk.ColorChooserWidget` has
        /// 45 colors, organized in columns of 5 colors (this includes some
        /// grays).
        ///
        /// The layout of the color chooser widget works best when the
        /// palettes have 9-10 columns.
        ///
        /// Calling this function for the first time has the side effect
        /// of removing the default color palette from the color chooser.
        ///
        /// If `colors` is `NULL`, removes all previously added palettes.
        pub const add_palette = struct {
            pub fn call(p_class: anytype, p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_orientation: gtk.Orientation, p_colors_per_line: c_int, p_n_colors: c_int, p_colors: ?[*]gdk.RGBA) void {
                return gobject.ext.as(ColorChooser.Iface, p_class).f_add_palette.?(gobject.ext.as(ColorChooser, p_chooser), p_orientation, p_colors_per_line, p_n_colors, p_colors);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_orientation: gtk.Orientation, p_colors_per_line: c_int, p_n_colors: c_int, p_colors: ?[*]gdk.RGBA) callconv(.c) void) void {
                gobject.ext.as(ColorChooser.Iface, p_class).f_add_palette = @ptrCast(p_implementation);
            }
        };

        pub const color_activated = struct {
            pub fn call(p_class: anytype, p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_color: *const gdk.RGBA) void {
                return gobject.ext.as(ColorChooser.Iface, p_class).f_color_activated.?(gobject.ext.as(ColorChooser, p_chooser), p_color);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_color: *const gdk.RGBA) callconv(.c) void) void {
                gobject.ext.as(ColorChooser.Iface, p_class).f_color_activated = @ptrCast(p_implementation);
            }
        };

        /// Gets the currently-selected color.
        pub const get_rgba = struct {
            pub fn call(p_class: anytype, p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_color: *gdk.RGBA) void {
                return gobject.ext.as(ColorChooser.Iface, p_class).f_get_rgba.?(gobject.ext.as(ColorChooser, p_chooser), p_color);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_color: *gdk.RGBA) callconv(.c) void) void {
                gobject.ext.as(ColorChooser.Iface, p_class).f_get_rgba = @ptrCast(p_implementation);
            }
        };

        /// Sets the color.
        pub const set_rgba = struct {
            pub fn call(p_class: anytype, p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_color: *const gdk.RGBA) void {
                return gobject.ext.as(ColorChooser.Iface, p_class).f_set_rgba.?(gobject.ext.as(ColorChooser, p_chooser), p_color);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_color: *const gdk.RGBA) callconv(.c) void) void {
                gobject.ext.as(ColorChooser.Iface, p_class).f_set_rgba = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The currently selected color, as a `GdkRGBA` struct.
        ///
        /// The property can be set to change the current selection
        /// programmatically.
        pub const rgba = struct {
            pub const name = "rgba";

            pub const Type = ?*gdk.RGBA;
        };

        /// Whether colors may have alpha (translucency).
        ///
        /// When ::use-alpha is `FALSE`, the `GdkRGBA` struct obtained
        /// via the `gtk.ColorChooser.properties.rgba` property will be
        /// forced to have alpha == 1.
        ///
        /// Implementations are expected to show alpha by rendering the color
        /// over a non-uniform background (like a checkerboard pattern).
        pub const use_alpha = struct {
            pub const name = "use-alpha";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when a color is activated from the color chooser.
        ///
        /// This usually happens when the user clicks a color swatch,
        /// or a color is selected and the user presses one of the keys
        /// Space, Shift+Space, Return or Enter.
        pub const color_activated = struct {
            pub const name = "color-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_color: *gdk.RGBA, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(ColorChooser, p_instance))),
                    gobject.signalLookup("color-activated", ColorChooser.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Adds a palette to the color chooser.
    ///
    /// If `orientation` is horizontal, the colors are grouped in rows,
    /// with `colors_per_line` colors in each row. If `horizontal` is `FALSE`,
    /// the colors are grouped in columns instead.
    ///
    /// The default color palette of `gtk.ColorChooserWidget` has
    /// 45 colors, organized in columns of 5 colors (this includes some
    /// grays).
    ///
    /// The layout of the color chooser widget works best when the
    /// palettes have 9-10 columns.
    ///
    /// Calling this function for the first time has the side effect
    /// of removing the default color palette from the color chooser.
    ///
    /// If `colors` is `NULL`, removes all previously added palettes.
    extern fn gtk_color_chooser_add_palette(p_chooser: *ColorChooser, p_orientation: gtk.Orientation, p_colors_per_line: c_int, p_n_colors: c_int, p_colors: ?[*]gdk.RGBA) void;
    pub const addPalette = gtk_color_chooser_add_palette;

    /// Gets the currently-selected color.
    extern fn gtk_color_chooser_get_rgba(p_chooser: *ColorChooser, p_color: *gdk.RGBA) void;
    pub const getRgba = gtk_color_chooser_get_rgba;

    /// Returns whether the color chooser shows the alpha channel.
    extern fn gtk_color_chooser_get_use_alpha(p_chooser: *ColorChooser) c_int;
    pub const getUseAlpha = gtk_color_chooser_get_use_alpha;

    /// Sets the color.
    extern fn gtk_color_chooser_set_rgba(p_chooser: *ColorChooser, p_color: *const gdk.RGBA) void;
    pub const setRgba = gtk_color_chooser_set_rgba;

    /// Sets whether or not the color chooser should use the alpha channel.
    extern fn gtk_color_chooser_set_use_alpha(p_chooser: *ColorChooser, p_use_alpha: c_int) void;
    pub const setUseAlpha = gtk_color_chooser_set_use_alpha;

    extern fn gtk_color_chooser_get_type() usize;
    pub const getGObjectType = gtk_color_chooser_get_type;

    extern fn g_object_ref(p_self: *gtk.ColorChooser) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ColorChooser) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ColorChooser, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Makes it possible to use an object as source or target in a
/// `gtk.Constraint`.
///
/// Besides `GtkWidget`, it is also implemented by `GtkConstraintGuide`.
pub const ConstraintTarget = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.ConstraintTargetInterface;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_constraint_target_get_type() usize;
    pub const getGObjectType = gtk_constraint_target_get_type;

    extern fn g_object_ref(p_self: *gtk.ConstraintTarget) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ConstraintTarget) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ConstraintTarget, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Interface for single-line text editing widgets.
///
/// Typical examples of editable widgets are `gtk.Entry` and
/// `gtk.SpinButton`. It contains functions for generically manipulating
/// an editable widget, a large number of action signals used for key bindings,
/// and several signals that an application can connect to modify the behavior
/// of a widget.
///
/// As an example of the latter usage, by connecting the following handler to
/// `gtk.Editable.signals.insert_text`, an application can convert all entry
/// into a widget into uppercase.
///
/// ## Forcing entry to uppercase.
///
/// ```c
/// `include` <ctype.h>
///
/// void
/// insert_text_handler (GtkEditable *editable,
///                      const char  *text,
///                      int          length,
///                      int         *position,
///                      gpointer     data)
/// {
///   char *result = g_utf8_strup (text, length);
///
///   g_signal_handlers_block_by_func (editable,
///                                (gpointer) insert_text_handler, data);
///   gtk_editable_insert_text (editable, result, length, position);
///   g_signal_handlers_unblock_by_func (editable,
///                                      (gpointer) insert_text_handler, data);
///
///   g_signal_stop_emission_by_name (editable, "insert_text");
///
///   g_free (result);
/// }
/// ```
///
/// ## Implementing GtkEditable
///
/// The most likely scenario for implementing `GtkEditable` on your own widget
/// is that you will embed a `GtkText` inside a complex widget, and want to
/// delegate the editable functionality to that text widget. `GtkEditable`
/// provides some utility functions to make this easy.
///
/// In your class_init function, call `gtk.Editable.installProperties`,
/// passing the first available property ID:
///
/// ```c
/// static void
/// my_class_init (MyClass *class)
/// {
///   ...
///   g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
///   gtk_editable_install_properties (object_clas, NUM_PROPERTIES);
///   ...
/// }
/// ```
///
/// In your interface_init function for the `GtkEditable` interface, provide
/// an implementation for the get_delegate vfunc that returns your text widget:
///
/// ```c
/// GtkEditable *
/// get_editable_delegate (GtkEditable *editable)
/// {
///   return GTK_EDITABLE (MY_WIDGET (editable)->text_widget);
/// }
///
/// static void
/// my_editable_init (GtkEditableInterface *iface)
/// {
///   iface->get_delegate = get_editable_delegate;
/// }
/// ```
///
/// You don't need to provide any other vfuncs. The default implementations
/// work by forwarding to the delegate that the GtkEditableInterface.`get_delegate`
/// vfunc returns.
///
/// In your instance_init function, create your text widget, and then call
/// `gtk.Editable.initDelegate`:
///
/// ```c
/// static void
/// my_widget_init (MyWidget *self)
/// {
///   ...
///   self->text_widget = gtk_text_new ();
///   gtk_editable_init_delegate (GTK_EDITABLE (self));
///   ...
/// }
/// ```
///
/// In your dispose function, call `gtk.Editable.finishDelegate` before
/// destroying your text widget:
///
/// ```c
/// static void
/// my_widget_dispose (GObject *object)
/// {
///   ...
///   gtk_editable_finish_delegate (GTK_EDITABLE (self));
///   g_clear_pointer (&self->text_widget, gtk_widget_unparent);
///   ...
/// }
/// ```
///
/// Finally, use `gtk.Editable.delegateSetProperty` in your `set_property`
/// function (and similar for `get_property`), to set the editable properties:
///
/// ```c
///   ...
///   if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
///     return;
///
///   switch (prop_id)
///   ...
/// ```
///
/// It is important to note that if you create a `GtkEditable` that uses
/// a delegate, the low level `gtk.Editable.signals.insert_text` and
/// `gtk.Editable.signals.delete_text` signals will be propagated from the
/// "wrapper" editable to the delegate, but they will not be propagated from
/// the delegate to the "wrapper" editable, as they would cause an infinite
/// recursion. If you wish to connect to the `gtk.Editable.signals.insert_text`
/// and `gtk.Editable.signals.delete_text` signals, you will need to connect
/// to them on the delegate obtained via `gtk.Editable.getDelegate`.
pub const Editable = opaque {
    pub const Prerequisites = [_]type{gtk.Widget};
    pub const Iface = gtk.EditableInterface;
    pub const virtual_methods = struct {
        pub const changed = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(Editable.Iface, p_class).f_changed.?(gobject.ext.as(Editable, p_editable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(Editable.Iface, p_class).f_changed = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const delete_text = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: c_int, p_end_pos: c_int) void {
                return gobject.ext.as(Editable.Iface, p_class).f_delete_text.?(gobject.ext.as(Editable, p_editable), p_start_pos, p_end_pos);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: c_int, p_end_pos: c_int) callconv(.c) void) void {
                gobject.ext.as(Editable.Iface, p_class).f_delete_text = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const do_delete_text = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: c_int, p_end_pos: c_int) void {
                return gobject.ext.as(Editable.Iface, p_class).f_do_delete_text.?(gobject.ext.as(Editable, p_editable), p_start_pos, p_end_pos);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: c_int, p_end_pos: c_int) callconv(.c) void) void {
                gobject.ext.as(Editable.Iface, p_class).f_do_delete_text = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const do_insert_text = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) void {
                return gobject.ext.as(Editable.Iface, p_class).f_do_insert_text.?(gobject.ext.as(Editable, p_editable), p_text, p_length, p_position);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) callconv(.c) void) void {
                gobject.ext.as(Editable.Iface, p_class).f_do_insert_text = @ptrCast(p_implementation);
            }
        };

        /// Gets the `GtkEditable` that `editable` is delegating its
        /// implementation to.
        ///
        /// Typically, the delegate is a `gtk.Text` widget.
        pub const get_delegate = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*gtk.Editable {
                return gobject.ext.as(Editable.Iface, p_class).f_get_delegate.?(gobject.ext.as(Editable, p_editable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*gtk.Editable) void {
                gobject.ext.as(Editable.Iface, p_class).f_get_delegate = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const get_selection_bounds = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: ?*c_int, p_end_pos: ?*c_int) c_int {
                return gobject.ext.as(Editable.Iface, p_class).f_get_selection_bounds.?(gobject.ext.as(Editable, p_editable), p_start_pos, p_end_pos);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: ?*c_int, p_end_pos: ?*c_int) callconv(.c) c_int) void {
                gobject.ext.as(Editable.Iface, p_class).f_get_selection_bounds = @ptrCast(p_implementation);
            }
        };

        /// Retrieves the contents of `editable`.
        ///
        /// The returned string is owned by GTK and must not be modified or freed.
        pub const get_text = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) [*:0]const u8 {
                return gobject.ext.as(Editable.Iface, p_class).f_get_text.?(gobject.ext.as(Editable, p_editable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) [*:0]const u8) void {
                gobject.ext.as(Editable.Iface, p_class).f_get_text = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const insert_text = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) void {
                return gobject.ext.as(Editable.Iface, p_class).f_insert_text.?(gobject.ext.as(Editable, p_editable), p_text, p_length, p_position);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) callconv(.c) void) void {
                gobject.ext.as(Editable.Iface, p_class).f_insert_text = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const set_selection_bounds = struct {
            pub fn call(p_class: anytype, p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: c_int, p_end_pos: c_int) void {
                return gobject.ext.as(Editable.Iface, p_class).f_set_selection_bounds.?(gobject.ext.as(Editable, p_editable), p_start_pos, p_end_pos);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_editable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_start_pos: c_int, p_end_pos: c_int) callconv(.c) void) void {
                gobject.ext.as(Editable.Iface, p_class).f_set_selection_bounds = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The current position of the insertion cursor in chars.
        pub const cursor_position = struct {
            pub const name = "cursor-position";

            pub const Type = c_int;
        };

        /// Whether the entry contents can be edited.
        pub const editable = struct {
            pub const name = "editable";

            pub const Type = c_int;
        };

        /// If undo/redo should be enabled for the editable.
        pub const enable_undo = struct {
            pub const name = "enable-undo";

            pub const Type = c_int;
        };

        /// The desired maximum width of the entry, in characters.
        pub const max_width_chars = struct {
            pub const name = "max-width-chars";

            pub const Type = c_int;
        };

        /// The position of the opposite end of the selection from the cursor in chars.
        pub const selection_bound = struct {
            pub const name = "selection-bound";

            pub const Type = c_int;
        };

        /// The contents of the entry.
        pub const text = struct {
            pub const name = "text";

            pub const Type = ?[*:0]u8;
        };

        /// Number of characters to leave space for in the entry.
        pub const width_chars = struct {
            pub const name = "width-chars";

            pub const Type = c_int;
        };

        /// The horizontal alignment, from 0 (left) to 1 (right).
        ///
        /// Reversed for RTL layouts.
        pub const xalign = struct {
            pub const name = "xalign";

            pub const Type = f32;
        };
    };

    pub const signals = struct {
        /// Emitted at the end of a single user-visible operation on the
        /// contents.
        ///
        /// E.g., a paste operation that replaces the contents of the
        /// selection will cause only one signal emission (even though it
        /// is implemented by first deleting the selection, then inserting
        /// the new content, and may cause multiple ::notify::text signals
        /// to be emitted).
        pub const changed = struct {
            pub const name = "changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Editable, p_instance))),
                    gobject.signalLookup("changed", Editable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when text is deleted from the widget by the user.
        ///
        /// The default handler for this signal will normally be responsible for
        /// deleting the text, so by connecting to this signal and then stopping
        /// the signal with `gobject.signalStopEmission`, it is possible to modify the
        /// range of deleted text, or prevent it from being deleted entirely.
        ///
        /// The `start_pos` and `end_pos` parameters are interpreted as for
        /// `gtk.Editable.deleteText`.
        pub const delete_text = struct {
            pub const name = "delete-text";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_start_pos: c_int, p_end_pos: c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Editable, p_instance))),
                    gobject.signalLookup("delete-text", Editable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// Emitted when text is inserted into the widget by the user.
        ///
        /// The default handler for this signal will normally be responsible
        /// for inserting the text, so by connecting to this signal and then
        /// stopping the signal with `gobject.signalStopEmission`, it is possible
        /// to modify the inserted text, or prevent it from being inserted entirely.
        pub const insert_text = struct {
            pub const name = "insert-text";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_text: [*:0]u8, p_length: c_int, p_position: *c_int, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(Editable, p_instance))),
                    gobject.signalLookup("insert-text", Editable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Gets a property of the `GtkEditable` delegate for `object`.
    ///
    /// This is helper function that should be called in the `get_property`
    /// function of your `GtkEditable` implementation, before handling your
    /// own properties.
    extern fn gtk_editable_delegate_get_property(p_object: *gobject.Object, p_prop_id: c_uint, p_value: *gobject.Value, p_pspec: *gobject.ParamSpec) c_int;
    pub const delegateGetProperty = gtk_editable_delegate_get_property;

    /// Sets a property on the `GtkEditable` delegate for `object`.
    ///
    /// This is a helper function that should be called in the `set_property`
    /// function of your `GtkEditable` implementation, before handling your
    /// own properties.
    extern fn gtk_editable_delegate_set_property(p_object: *gobject.Object, p_prop_id: c_uint, p_value: *const gobject.Value, p_pspec: *gobject.ParamSpec) c_int;
    pub const delegateSetProperty = gtk_editable_delegate_set_property;

    /// Overrides the `GtkEditable` properties for `class`.
    ///
    /// This is a helper function that should be called in class_init,
    /// after installing your own properties.
    ///
    /// Note that your class must have "text", "cursor-position",
    /// "selection-bound", "editable", "width-chars", "max-width-chars",
    /// "xalign" and "enable-undo" properties for this function to work.
    ///
    /// To handle the properties in your set_property and get_property
    /// functions, you can either use `gtk.Editable.delegateSetProperty`
    /// and `gtk.Editable.delegateGetProperty` (if you are using
    /// a delegate), or remember the `first_prop` offset and add it to the
    /// values in the `gtk.EditableProperties` enumeration to get the
    /// property IDs for these properties.
    extern fn gtk_editable_install_properties(p_object_class: *gobject.ObjectClass, p_first_prop: c_uint) c_uint;
    pub const installProperties = gtk_editable_install_properties;

    /// 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 `gtk.Accessible.virtual_methods.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 `gtk.Accessible.virtual_methods.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.
    extern fn gtk_editable_delegate_get_accessible_platform_state(p_editable: *Editable, p_state: gtk.AccessiblePlatformState) c_int;
    pub const delegateGetAccessiblePlatformState = gtk_editable_delegate_get_accessible_platform_state;

    /// Deletes the currently selected text of the editable.
    ///
    /// This call doesn’t do anything if there is no selected text.
    extern fn gtk_editable_delete_selection(p_editable: *Editable) void;
    pub const deleteSelection = gtk_editable_delete_selection;

    /// 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.
    extern fn gtk_editable_delete_text(p_editable: *Editable, p_start_pos: c_int, p_end_pos: c_int) void;
    pub const deleteText = gtk_editable_delete_text;

    /// Undoes the setup done by `gtk.Editable.initDelegate`.
    ///
    /// This is a helper function that should be called from dispose,
    /// before removing the delegate object.
    extern fn gtk_editable_finish_delegate(p_editable: *Editable) void;
    pub const finishDelegate = gtk_editable_finish_delegate;

    /// Gets the alignment of the editable.
    extern fn gtk_editable_get_alignment(p_editable: *Editable) f32;
    pub const getAlignment = gtk_editable_get_alignment;

    /// 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.
    extern fn gtk_editable_get_chars(p_editable: *Editable, p_start_pos: c_int, p_end_pos: c_int) [*:0]u8;
    pub const getChars = gtk_editable_get_chars;

    /// Gets the `GtkEditable` that `editable` is delegating its
    /// implementation to.
    ///
    /// Typically, the delegate is a `gtk.Text` widget.
    extern fn gtk_editable_get_delegate(p_editable: *Editable) ?*gtk.Editable;
    pub const getDelegate = gtk_editable_get_delegate;

    /// Retrieves whether `editable` is editable.
    extern fn gtk_editable_get_editable(p_editable: *Editable) c_int;
    pub const getEditable = gtk_editable_get_editable;

    /// Gets if undo/redo actions are enabled for `editable`
    extern fn gtk_editable_get_enable_undo(p_editable: *Editable) c_int;
    pub const getEnableUndo = gtk_editable_get_enable_undo;

    /// Retrieves the desired maximum width of `editable`, in characters.
    extern fn gtk_editable_get_max_width_chars(p_editable: *Editable) c_int;
    pub const getMaxWidthChars = gtk_editable_get_max_width_chars;

    /// 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.
    extern fn gtk_editable_get_position(p_editable: *Editable) c_int;
    pub const getPosition = gtk_editable_get_position;

    /// 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.
    extern fn gtk_editable_get_selection_bounds(p_editable: *Editable, p_start_pos: ?*c_int, p_end_pos: ?*c_int) c_int;
    pub const getSelectionBounds = gtk_editable_get_selection_bounds;

    /// Retrieves the contents of `editable`.
    ///
    /// The returned string is owned by GTK and must not be modified or freed.
    extern fn gtk_editable_get_text(p_editable: *Editable) [*:0]const u8;
    pub const getText = gtk_editable_get_text;

    /// Gets the number of characters of space reserved
    /// for the contents of the editable.
    extern fn gtk_editable_get_width_chars(p_editable: *Editable) c_int;
    pub const getWidthChars = gtk_editable_get_width_chars;

    /// 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.
    extern fn gtk_editable_init_delegate(p_editable: *Editable) void;
    pub const initDelegate = gtk_editable_init_delegate;

    /// 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.
    extern fn gtk_editable_insert_text(p_editable: *Editable, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) void;
    pub const insertText = gtk_editable_insert_text;

    /// 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.
    extern fn gtk_editable_select_region(p_editable: *Editable, p_start_pos: c_int, p_end_pos: c_int) void;
    pub const selectRegion = gtk_editable_select_region;

    /// 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.
    extern fn gtk_editable_set_alignment(p_editable: *Editable, p_xalign: f32) void;
    pub const setAlignment = gtk_editable_set_alignment;

    /// Determines if the user can edit the text in the editable widget.
    extern fn gtk_editable_set_editable(p_editable: *Editable, p_is_editable: c_int) void;
    pub const setEditable = gtk_editable_set_editable;

    /// 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 `gtk.Text.properties.visibility` is set to `FALSE`.
    extern fn gtk_editable_set_enable_undo(p_editable: *Editable, p_enable_undo: c_int) void;
    pub const setEnableUndo = gtk_editable_set_enable_undo;

    /// Sets the desired maximum width in characters of `editable`.
    extern fn gtk_editable_set_max_width_chars(p_editable: *Editable, p_n_chars: c_int) void;
    pub const setMaxWidthChars = gtk_editable_set_max_width_chars;

    /// 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.
    extern fn gtk_editable_set_position(p_editable: *Editable, p_position: c_int) void;
    pub const setPosition = gtk_editable_set_position;

    /// Sets the text in the editable to the given value.
    ///
    /// This is replacing the current contents.
    extern fn gtk_editable_set_text(p_editable: *Editable, p_text: [*:0]const u8) void;
    pub const setText = gtk_editable_set_text;

    /// 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.
    extern fn gtk_editable_set_width_chars(p_editable: *Editable, p_n_chars: c_int) void;
    pub const setWidthChars = gtk_editable_set_width_chars;

    extern fn gtk_editable_get_type() usize;
    pub const getGObjectType = gtk_editable_get_type;

    extern fn g_object_ref(p_self: *gtk.Editable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Editable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Editable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkFileChooser` is an interface that can be implemented by file
/// selection widgets.
///
/// In GTK, the main objects that implement this interface are
/// `gtk.FileChooserWidget` and `gtk.FileChooserDialog`.
///
/// You do not need to write an object that implements the `GtkFileChooser`
/// interface unless you are trying to adapt an existing file selector to
/// expose a standard programming interface.
///
/// `GtkFileChooser` allows for shortcuts to various places in the filesystem.
/// In the default implementation these are displayed in the left pane. It
/// may be a bit confusing at first that these shortcuts come from various
/// sources and in various flavours, so lets explain the terminology here:
///
/// - Bookmarks: are created by the user, by dragging folders from the
///   right pane to the left pane, or by using the “Add”. Bookmarks
///   can be renamed and deleted by the user.
///
/// - Shortcuts: can be provided by the application. For example, a Paint
///   program may want to add a shortcut for a Clipart folder. Shortcuts
///   cannot be modified by the user.
///
/// - Volumes: are provided by the underlying filesystem abstraction. They are
///   the “roots” of the filesystem.
///
/// # File Names and Encodings
///
/// When the user is finished selecting files in a `GtkFileChooser`, your
/// program can get the selected filenames as `GFile`s.
///
/// # Adding options
///
/// You can add extra widgets to a file chooser to provide options
/// that are not present in the default design, by using
/// `gtk.FileChooser.addChoice`. Each choice has an identifier and
/// a user visible label; additionally, each choice can have multiple
/// options. If a choice has no option, it will be rendered as a
/// check button with the given label; if a choice has options, it will
/// be rendered as a combo box.
pub const FileChooser = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = opaque {
        pub const Instance = FileChooser;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The type of operation that the file chooser is performing.
        pub const action = struct {
            pub const name = "action";

            pub const Type = gtk.FileChooserAction;
        };

        /// Whether a file chooser not in `GTK_FILE_CHOOSER_ACTION_OPEN` mode
        /// will offer the user to create new folders.
        pub const create_folders = struct {
            pub const name = "create-folders";

            pub const Type = c_int;
        };

        /// The current filter for selecting files that are displayed.
        pub const filter = struct {
            pub const name = "filter";

            pub const Type = ?*gtk.FileFilter;
        };

        /// A `GListModel` containing the filters that have been
        /// added with `gtk.FileChooser.addFilter`.
        ///
        /// The returned object should not be modified. It may
        /// or may not be updated for later changes.
        pub const filters = struct {
            pub const name = "filters";

            pub const Type = ?*gio.ListModel;
        };

        /// Whether to allow multiple files to be selected.
        pub const select_multiple = struct {
            pub const name = "select-multiple";

            pub const Type = c_int;
        };

        /// A `GListModel` containing the shortcut folders that have been
        /// added with `gtk.FileChooser.addShortcutFolder`.
        ///
        /// The returned object should not be modified. It may
        /// or may not be updated for later changes.
        pub const shortcut_folders = struct {
            pub const name = "shortcut-folders";

            pub const Type = ?*gio.ListModel;
        };
    };

    pub const signals = struct {};

    /// Adds a 'choice' to the file chooser.
    ///
    /// This is typically implemented as a combobox or, for boolean choices,
    /// as a checkbutton. You can select a value using
    /// `gtk.FileChooser.setChoice` before the dialog is shown,
    /// and you can obtain the user-selected value in the
    /// `gtk.Dialog.signals.response` signal handler using
    /// `gtk.FileChooser.getChoice`.
    extern fn gtk_file_chooser_add_choice(p_chooser: *FileChooser, p_id: [*:0]const u8, p_label: [*:0]const u8, p_options: ?[*][*:0]const u8, p_option_labels: ?[*][*:0]const u8) void;
    pub const addChoice = gtk_file_chooser_add_choice;

    /// Adds `filter` to the list of filters that the user can select between.
    ///
    /// When a filter is selected, only files that are passed by that
    /// filter are displayed.
    ///
    /// Note that the `chooser` takes ownership of the filter if it is floating,
    /// so you have to ref and sink it if you want to keep a reference.
    extern fn gtk_file_chooser_add_filter(p_chooser: *FileChooser, p_filter: *gtk.FileFilter) void;
    pub const addFilter = gtk_file_chooser_add_filter;

    /// Adds a folder to be displayed with the shortcut folders
    /// in a file chooser.
    extern fn gtk_file_chooser_add_shortcut_folder(p_chooser: *FileChooser, p_folder: *gio.File, p_error: ?*?*glib.Error) c_int;
    pub const addShortcutFolder = gtk_file_chooser_add_shortcut_folder;

    /// Gets the type of operation that the file chooser is performing.
    extern fn gtk_file_chooser_get_action(p_chooser: *FileChooser) gtk.FileChooserAction;
    pub const getAction = gtk_file_chooser_get_action;

    /// Gets the currently selected option in the 'choice' with the given ID.
    extern fn gtk_file_chooser_get_choice(p_chooser: *FileChooser, p_id: [*:0]const u8) ?[*:0]const u8;
    pub const getChoice = gtk_file_chooser_get_choice;

    /// Gets whether file chooser will offer to create new folders.
    extern fn gtk_file_chooser_get_create_folders(p_chooser: *FileChooser) c_int;
    pub const getCreateFolders = gtk_file_chooser_get_create_folders;

    /// Gets the current folder of `chooser` as `GFile`.
    extern fn gtk_file_chooser_get_current_folder(p_chooser: *FileChooser) ?*gio.File;
    pub const getCurrentFolder = gtk_file_chooser_get_current_folder;

    /// Gets the current name in the file selector, as entered by the user.
    ///
    /// This is meant to be used in save dialogs, to get the currently typed
    /// filename when the file itself does not exist yet.
    extern fn gtk_file_chooser_get_current_name(p_chooser: *FileChooser) ?[*:0]u8;
    pub const getCurrentName = gtk_file_chooser_get_current_name;

    /// Gets the `GFile` for the currently selected file in
    /// the file selector.
    ///
    /// If multiple files are selected, one of the files will be
    /// returned at random.
    ///
    /// If the file chooser is in folder mode, this function returns
    /// the selected folder.
    extern fn gtk_file_chooser_get_file(p_chooser: *FileChooser) ?*gio.File;
    pub const getFile = gtk_file_chooser_get_file;

    /// Lists all the selected files and subfolders in the current folder
    /// of `chooser` as `GFile`.
    extern fn gtk_file_chooser_get_files(p_chooser: *FileChooser) *gio.ListModel;
    pub const getFiles = gtk_file_chooser_get_files;

    /// Gets the current filter.
    extern fn gtk_file_chooser_get_filter(p_chooser: *FileChooser) ?*gtk.FileFilter;
    pub const getFilter = gtk_file_chooser_get_filter;

    /// Gets the current set of user-selectable filters, as a list model.
    ///
    /// See `gtk.FileChooser.addFilter` and
    /// `gtk.FileChooser.removeFilter` for changing individual filters.
    ///
    /// You should not modify the returned list model. Future changes to
    /// `chooser` may or may not affect the returned model.
    extern fn gtk_file_chooser_get_filters(p_chooser: *FileChooser) *gio.ListModel;
    pub const getFilters = gtk_file_chooser_get_filters;

    /// Gets whether multiple files can be selected in the file
    /// chooser.
    extern fn gtk_file_chooser_get_select_multiple(p_chooser: *FileChooser) c_int;
    pub const getSelectMultiple = gtk_file_chooser_get_select_multiple;

    /// Queries the list of shortcut folders in the file chooser.
    ///
    /// You should not modify the returned list model. Future changes to
    /// `chooser` may or may not affect the returned model.
    extern fn gtk_file_chooser_get_shortcut_folders(p_chooser: *FileChooser) *gio.ListModel;
    pub const getShortcutFolders = gtk_file_chooser_get_shortcut_folders;

    /// Removes a 'choice' that has been added with `gtk.FileChooser.addChoice`.
    extern fn gtk_file_chooser_remove_choice(p_chooser: *FileChooser, p_id: [*:0]const u8) void;
    pub const removeChoice = gtk_file_chooser_remove_choice;

    /// Removes `filter` from the list of filters that the user can select between.
    extern fn gtk_file_chooser_remove_filter(p_chooser: *FileChooser, p_filter: *gtk.FileFilter) void;
    pub const removeFilter = gtk_file_chooser_remove_filter;

    /// Removes a folder from the shortcut folders in a file chooser.
    extern fn gtk_file_chooser_remove_shortcut_folder(p_chooser: *FileChooser, p_folder: *gio.File, p_error: ?*?*glib.Error) c_int;
    pub const removeShortcutFolder = gtk_file_chooser_remove_shortcut_folder;

    /// Sets the type of operation that the chooser is performing.
    ///
    /// The user interface is adapted to suit the selected action.
    ///
    /// For example, an option to create a new folder might be shown
    /// if the action is `GTK_FILE_CHOOSER_ACTION_SAVE` but not if the
    /// action is `GTK_FILE_CHOOSER_ACTION_OPEN`.
    extern fn gtk_file_chooser_set_action(p_chooser: *FileChooser, p_action: gtk.FileChooserAction) void;
    pub const setAction = gtk_file_chooser_set_action;

    /// Selects an option in a 'choice' that has been added with
    /// `gtk.FileChooser.addChoice`.
    ///
    /// For a boolean choice, the possible options are "true" and "false".
    extern fn gtk_file_chooser_set_choice(p_chooser: *FileChooser, p_id: [*:0]const u8, p_option: [*:0]const u8) void;
    pub const setChoice = gtk_file_chooser_set_choice;

    /// Sets whether file chooser will offer to create new folders.
    ///
    /// This is only relevant if the action is not set to be
    /// `GTK_FILE_CHOOSER_ACTION_OPEN`.
    extern fn gtk_file_chooser_set_create_folders(p_chooser: *FileChooser, p_create_folders: c_int) void;
    pub const setCreateFolders = gtk_file_chooser_set_create_folders;

    /// Sets the current folder for `chooser` from a `GFile`.
    extern fn gtk_file_chooser_set_current_folder(p_chooser: *FileChooser, p_file: ?*gio.File, p_error: ?*?*glib.Error) c_int;
    pub const setCurrentFolder = gtk_file_chooser_set_current_folder;

    /// Sets the current name in the file selector, as if entered
    /// by the user.
    ///
    /// Note that the name passed in here is a UTF-8 string rather
    /// than a filename. This function is meant for such uses as a
    /// suggested name in a “Save As...” dialog.  You can pass
    /// “Untitled.doc” or a similarly suitable suggestion for the `name`.
    ///
    /// If you want to preselect a particular existing file, you should
    /// use `gtk.FileChooser.setFile` instead.
    ///
    /// Please see the documentation for those functions for an example
    /// of using `gtk.FileChooser.setCurrentName` as well.
    extern fn gtk_file_chooser_set_current_name(p_chooser: *FileChooser, p_name: [*:0]const u8) void;
    pub const setCurrentName = gtk_file_chooser_set_current_name;

    /// Sets `file` as the current filename for the file chooser.
    ///
    /// This includes changing to the file’s parent folder and actually selecting
    /// the file in list. If the `chooser` is in `GTK_FILE_CHOOSER_ACTION_SAVE` mode,
    /// the file’s base name will also appear in the dialog’s file name entry.
    ///
    /// If the file name isn’t in the current folder of `chooser`, then the current
    /// folder of `chooser` will be changed to the folder containing `file`.
    ///
    /// Note that the file must exist, or nothing will be done except
    /// for the directory change.
    ///
    /// If you are implementing a save dialog, you should use this function if
    /// you already have a file name to which the user may save; for example,
    /// when the user opens an existing file and then does “Save As…”. If you
    /// don’t have a file name already — for example, if the user just created
    /// a new file and is saving it for the first time, do not call this function.
    ///
    /// Instead, use something similar to this:
    ///
    /// ```c
    /// static void
    /// prepare_file_chooser (GtkFileChooser *chooser,
    ///                       GFile          *existing_file)
    /// {
    ///   gboolean document_is_new = (existing_file == NULL);
    ///
    ///   if (document_is_new)
    ///     {
    ///       GFile *default_file_for_saving = g_file_new_for_path ("./out.txt");
    ///       // the user just created a new document
    ///       gtk_file_chooser_set_current_folder (chooser, default_file_for_saving, NULL);
    ///       gtk_file_chooser_set_current_name (chooser, "Untitled document");
    ///       g_object_unref (default_file_for_saving);
    ///     }
    ///   else
    ///     {
    ///       // the user edited an existing document
    ///       gtk_file_chooser_set_file (chooser, existing_file, NULL);
    ///     }
    /// }
    /// ```
    extern fn gtk_file_chooser_set_file(p_chooser: *FileChooser, p_file: *gio.File, p_error: ?*?*glib.Error) c_int;
    pub const setFile = gtk_file_chooser_set_file;

    /// Sets the current filter.
    ///
    /// Only the files that pass the filter will be displayed.
    /// If the user-selectable list of filters is non-empty, then
    /// the filter should be one of the filters in that list.
    ///
    /// Setting the current filter when the list of filters is
    /// empty is useful if you want to restrict the displayed
    /// set of files without letting the user change it.
    extern fn gtk_file_chooser_set_filter(p_chooser: *FileChooser, p_filter: *gtk.FileFilter) void;
    pub const setFilter = gtk_file_chooser_set_filter;

    /// Sets whether multiple files can be selected in the file chooser.
    ///
    /// This is only relevant if the action is set to be
    /// `GTK_FILE_CHOOSER_ACTION_OPEN` or
    /// `GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER`.
    extern fn gtk_file_chooser_set_select_multiple(p_chooser: *FileChooser, p_select_multiple: c_int) void;
    pub const setSelectMultiple = gtk_file_chooser_set_select_multiple;

    extern fn gtk_file_chooser_get_type() usize;
    pub const getGObjectType = gtk_file_chooser_get_type;

    extern fn g_object_ref(p_self: *gtk.FileChooser) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FileChooser) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FileChooser, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkFontChooser` is an interface that can be implemented by widgets
/// for choosing fonts.
///
/// In GTK, the main objects that implement this interface are
/// `gtk.FontChooserWidget`, `gtk.FontChooserDialog` and
/// `gtk.FontButton`.
pub const FontChooser = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.FontChooserIface;
    pub const virtual_methods = struct {
        pub const font_activated = struct {
            pub fn call(p_class: anytype, p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_fontname: [*:0]const u8) void {
                return gobject.ext.as(FontChooser.Iface, p_class).f_font_activated.?(gobject.ext.as(FontChooser, p_chooser), p_fontname);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_chooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_fontname: [*:0]const u8) callconv(.c) void) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_font_activated = @ptrCast(p_implementation);
            }
        };

        /// Gets the `PangoFontFace` representing the selected font group
        /// details (i.e. family, slant, weight, width, etc).
        ///
        /// If the selected font is not installed, returns `NULL`.
        pub const get_font_face = struct {
            pub fn call(p_class: anytype, p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*pango.FontFace {
                return gobject.ext.as(FontChooser.Iface, p_class).f_get_font_face.?(gobject.ext.as(FontChooser, p_fontchooser));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*pango.FontFace) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_get_font_face = @ptrCast(p_implementation);
            }
        };

        /// Gets the `PangoFontFamily` representing the selected font family.
        ///
        /// Font families are a collection of font faces.
        ///
        /// If the selected font is not installed, returns `NULL`.
        pub const get_font_family = struct {
            pub fn call(p_class: anytype, p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*pango.FontFamily {
                return gobject.ext.as(FontChooser.Iface, p_class).f_get_font_family.?(gobject.ext.as(FontChooser, p_fontchooser));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*pango.FontFamily) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_get_font_family = @ptrCast(p_implementation);
            }
        };

        /// Gets the custom font map of this font chooser widget,
        /// or `NULL` if it does not have one.
        pub const get_font_map = struct {
            pub fn call(p_class: anytype, p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) ?*pango.FontMap {
                return gobject.ext.as(FontChooser.Iface, p_class).f_get_font_map.?(gobject.ext.as(FontChooser, p_fontchooser));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) ?*pango.FontMap) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_get_font_map = @ptrCast(p_implementation);
            }
        };

        /// The selected font size.
        pub const get_font_size = struct {
            pub fn call(p_class: anytype, p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(FontChooser.Iface, p_class).f_get_font_size.?(gobject.ext.as(FontChooser, p_fontchooser));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_get_font_size = @ptrCast(p_implementation);
            }
        };

        /// Adds a filter function that decides which fonts to display
        /// in the font chooser.
        pub const set_filter_func = struct {
            pub fn call(p_class: anytype, p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_filter: ?gtk.FontFilterFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void {
                return gobject.ext.as(FontChooser.Iface, p_class).f_set_filter_func.?(gobject.ext.as(FontChooser, p_fontchooser), p_filter, p_user_data, p_destroy);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_filter: ?gtk.FontFilterFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_set_filter_func = @ptrCast(p_implementation);
            }
        };

        /// Sets a custom font map to use for this font chooser widget.
        ///
        /// A custom font map can be used to present application-specific
        /// fonts instead of or in addition to the normal system fonts.
        ///
        /// ```c
        /// FcConfig *config;
        /// PangoFontMap *fontmap;
        ///
        /// config = FcInitLoadConfigAndFonts ();
        /// FcConfigAppFontAddFile (config, my_app_font_file);
        ///
        /// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
        /// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
        ///
        /// gtk_font_chooser_set_font_map (font_chooser, fontmap);
        /// ```
        ///
        /// Note that other GTK widgets will only be able to use the
        /// application-specific font if it is present in the font map they use:
        ///
        /// ```c
        /// context = gtk_widget_get_pango_context (label);
        /// pango_context_set_font_map (context, fontmap);
        /// ```
        pub const set_font_map = struct {
            pub fn call(p_class: anytype, p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_fontmap: ?*pango.FontMap) void {
                return gobject.ext.as(FontChooser.Iface, p_class).f_set_font_map.?(gobject.ext.as(FontChooser, p_fontchooser), p_fontmap);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_fontchooser: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_fontmap: ?*pango.FontMap) callconv(.c) void) void {
                gobject.ext.as(FontChooser.Iface, p_class).f_set_font_map = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// The font description as a string, e.g. "Sans Italic 12".
        pub const font = struct {
            pub const name = "font";

            pub const Type = ?[*:0]u8;
        };

        /// The font description as a `PangoFontDescription`.
        pub const font_desc = struct {
            pub const name = "font-desc";

            pub const Type = ?*pango.FontDescription;
        };

        /// The selected font features.
        ///
        /// The format of the string is compatible with
        /// CSS and with Pango attributes.
        pub const font_features = struct {
            pub const name = "font-features";

            pub const Type = ?[*:0]u8;
        };

        /// The language for which the font features were selected.
        pub const language = struct {
            pub const name = "language";

            pub const Type = ?[*:0]u8;
        };

        /// The level of granularity to offer for selecting fonts.
        pub const level = struct {
            pub const name = "level";

            pub const Type = gtk.FontChooserLevel;
        };

        /// The string with which to preview the font.
        pub const preview_text = struct {
            pub const name = "preview-text";

            pub const Type = ?[*:0]u8;
        };

        /// Whether to show an entry to change the preview text.
        pub const show_preview_entry = struct {
            pub const name = "show-preview-entry";

            pub const Type = c_int;
        };
    };

    pub const signals = struct {
        /// Emitted when a font is activated.
        ///
        /// This usually happens when the user double clicks an item,
        /// or an item is selected and the user presses one of the keys
        /// Space, Shift+Space, Return or Enter.
        pub const font_activated = struct {
            pub const name = "font-activated";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_fontname: [*:0]u8, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(FontChooser, p_instance))),
                    gobject.signalLookup("font-activated", FontChooser.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Gets the currently-selected font name.
    ///
    /// Note that this can be a different string than what you set with
    /// `gtk.FontChooser.setFont`, as the font chooser widget may
    /// normalize font names and thus return a string with a different
    /// structure. For example, “Helvetica Italic Bold 12” could be
    /// normalized to “Helvetica Bold Italic 12”.
    ///
    /// Use `pango.FontDescription.equal` if you want to compare two
    /// font descriptions.
    extern fn gtk_font_chooser_get_font(p_fontchooser: *FontChooser) ?[*:0]u8;
    pub const getFont = gtk_font_chooser_get_font;

    /// Gets the currently-selected font.
    ///
    /// Note that this can be a different string than what you set with
    /// `gtk.FontChooser.setFont`, as the font chooser widget may
    /// normalize font names and thus return a string with a different
    /// structure. For example, “Helvetica Italic Bold 12” could be
    /// normalized to “Helvetica Bold Italic 12”.
    ///
    /// Use `pango.FontDescription.equal` if you want to compare two
    /// font descriptions.
    extern fn gtk_font_chooser_get_font_desc(p_fontchooser: *FontChooser) ?*pango.FontDescription;
    pub const getFontDesc = gtk_font_chooser_get_font_desc;

    /// Gets the `PangoFontFace` representing the selected font group
    /// details (i.e. family, slant, weight, width, etc).
    ///
    /// If the selected font is not installed, returns `NULL`.
    extern fn gtk_font_chooser_get_font_face(p_fontchooser: *FontChooser) ?*pango.FontFace;
    pub const getFontFace = gtk_font_chooser_get_font_face;

    /// Gets the `PangoFontFamily` representing the selected font family.
    ///
    /// Font families are a collection of font faces.
    ///
    /// If the selected font is not installed, returns `NULL`.
    extern fn gtk_font_chooser_get_font_family(p_fontchooser: *FontChooser) ?*pango.FontFamily;
    pub const getFontFamily = gtk_font_chooser_get_font_family;

    /// Gets the currently-selected font features.
    ///
    /// The format of the returned string is compatible with the
    /// [CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/`font`-rend-desc).
    /// It can be passed to `pango.AttrFontFeatures.new`.
    extern fn gtk_font_chooser_get_font_features(p_fontchooser: *FontChooser) [*:0]u8;
    pub const getFontFeatures = gtk_font_chooser_get_font_features;

    /// Gets the custom font map of this font chooser widget,
    /// or `NULL` if it does not have one.
    extern fn gtk_font_chooser_get_font_map(p_fontchooser: *FontChooser) ?*pango.FontMap;
    pub const getFontMap = gtk_font_chooser_get_font_map;

    /// The selected font size.
    extern fn gtk_font_chooser_get_font_size(p_fontchooser: *FontChooser) c_int;
    pub const getFontSize = gtk_font_chooser_get_font_size;

    /// Gets the language that is used for font features.
    extern fn gtk_font_chooser_get_language(p_fontchooser: *FontChooser) [*:0]u8;
    pub const getLanguage = gtk_font_chooser_get_language;

    /// Returns the current level of granularity for selecting fonts.
    extern fn gtk_font_chooser_get_level(p_fontchooser: *FontChooser) gtk.FontChooserLevel;
    pub const getLevel = gtk_font_chooser_get_level;

    /// Gets the text displayed in the preview area.
    extern fn gtk_font_chooser_get_preview_text(p_fontchooser: *FontChooser) [*:0]u8;
    pub const getPreviewText = gtk_font_chooser_get_preview_text;

    /// Returns whether the preview entry is shown or not.
    extern fn gtk_font_chooser_get_show_preview_entry(p_fontchooser: *FontChooser) c_int;
    pub const getShowPreviewEntry = gtk_font_chooser_get_show_preview_entry;

    /// Adds a filter function that decides which fonts to display
    /// in the font chooser.
    extern fn gtk_font_chooser_set_filter_func(p_fontchooser: *FontChooser, p_filter: ?gtk.FontFilterFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setFilterFunc = gtk_font_chooser_set_filter_func;

    /// Sets the currently-selected font.
    extern fn gtk_font_chooser_set_font(p_fontchooser: *FontChooser, p_fontname: [*:0]const u8) void;
    pub const setFont = gtk_font_chooser_set_font;

    /// Sets the currently-selected font from `font_desc`.
    extern fn gtk_font_chooser_set_font_desc(p_fontchooser: *FontChooser, p_font_desc: *const pango.FontDescription) void;
    pub const setFontDesc = gtk_font_chooser_set_font_desc;

    /// Sets a custom font map to use for this font chooser widget.
    ///
    /// A custom font map can be used to present application-specific
    /// fonts instead of or in addition to the normal system fonts.
    ///
    /// ```c
    /// FcConfig *config;
    /// PangoFontMap *fontmap;
    ///
    /// config = FcInitLoadConfigAndFonts ();
    /// FcConfigAppFontAddFile (config, my_app_font_file);
    ///
    /// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
    /// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
    ///
    /// gtk_font_chooser_set_font_map (font_chooser, fontmap);
    /// ```
    ///
    /// Note that other GTK widgets will only be able to use the
    /// application-specific font if it is present in the font map they use:
    ///
    /// ```c
    /// context = gtk_widget_get_pango_context (label);
    /// pango_context_set_font_map (context, fontmap);
    /// ```
    extern fn gtk_font_chooser_set_font_map(p_fontchooser: *FontChooser, p_fontmap: ?*pango.FontMap) void;
    pub const setFontMap = gtk_font_chooser_set_font_map;

    /// Sets the language to use for font features.
    extern fn gtk_font_chooser_set_language(p_fontchooser: *FontChooser, p_language: [*:0]const u8) void;
    pub const setLanguage = gtk_font_chooser_set_language;

    /// Sets the desired level of granularity for selecting fonts.
    extern fn gtk_font_chooser_set_level(p_fontchooser: *FontChooser, p_level: gtk.FontChooserLevel) void;
    pub const setLevel = gtk_font_chooser_set_level;

    /// Sets the text displayed in the preview area.
    ///
    /// The `text` is used to show how the selected font looks.
    extern fn gtk_font_chooser_set_preview_text(p_fontchooser: *FontChooser, p_text: [*:0]const u8) void;
    pub const setPreviewText = gtk_font_chooser_set_preview_text;

    /// Shows or hides the editable preview entry.
    extern fn gtk_font_chooser_set_show_preview_entry(p_fontchooser: *FontChooser, p_show_preview_entry: c_int) void;
    pub const setShowPreviewEntry = gtk_font_chooser_set_show_preview_entry;

    extern fn gtk_font_chooser_get_type() usize;
    pub const getGObjectType = gtk_font_chooser_get_type;

    extern fn g_object_ref(p_self: *gtk.FontChooser) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.FontChooser) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *FontChooser, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for widgets that have their own `gdk.Surface`.
///
/// The obvious example of a `GtkNative` is `GtkWindow`.
///
/// Every widget that is not itself a `GtkNative` is contained in one,
/// and you can get it with `gtk.Widget.getNative`.
///
/// To get the surface of a `GtkNative`, use `gtk.Native.getSurface`.
/// It is also possible to find the `GtkNative` to which a surface
/// belongs, with `gtk.Native.getForSurface`.
///
/// In addition to a `gdk.Surface`, a `GtkNative` also provides
/// a `gsk.Renderer` for rendering on that surface. To get the
/// renderer, use `gtk.Native.getRenderer`.
pub const Native = opaque {
    pub const Prerequisites = [_]type{gtk.Widget};
    pub const Iface = gtk.NativeInterface;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Finds the `GtkNative` associated with the surface.
    extern fn gtk_native_get_for_surface(p_surface: *gdk.Surface) ?*gtk.Native;
    pub const getForSurface = gtk_native_get_for_surface;

    /// Returns the renderer that is used for this `GtkNative`.
    extern fn gtk_native_get_renderer(p_self: *Native) ?*gsk.Renderer;
    pub const getRenderer = gtk_native_get_renderer;

    /// Returns the surface of this `GtkNative`.
    extern fn gtk_native_get_surface(p_self: *Native) ?*gdk.Surface;
    pub const getSurface = gtk_native_get_surface;

    /// Retrieves the surface transform of `self`.
    ///
    /// This is the translation from `self`'s surface coordinates into
    /// `self`'s widget coordinates.
    extern fn gtk_native_get_surface_transform(p_self: *Native, p_x: *f64, p_y: *f64) void;
    pub const getSurfaceTransform = gtk_native_get_surface_transform;

    /// Realizes a `GtkNative`.
    ///
    /// This should only be used by subclasses.
    extern fn gtk_native_realize(p_self: *Native) void;
    pub const realize = gtk_native_realize;

    /// Unrealizes a `GtkNative`.
    ///
    /// This should only be used by subclasses.
    extern fn gtk_native_unrealize(p_self: *Native) void;
    pub const unrealize = gtk_native_unrealize;

    extern fn gtk_native_get_type() usize;
    pub const getGObjectType = gtk_native_get_type;

    extern fn g_object_ref(p_self: *gtk.Native) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Native) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Native, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for widgets that can be oriented horizontally or vertically.
///
/// `GtkOrientable` is more flexible in that it allows the orientation to be
/// changed at runtime, allowing the widgets to “flip”.
///
/// ## CSS nodes
///
/// `GtkWidget` types implementing the `GtkOrientable` interface will
/// automatically acquire the `horizontal` or `vertical` CSS class depending on
/// the value of the `gtk.Orientable.properties.orientation` property.
pub const Orientable = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.OrientableIface;
    pub const virtual_methods = struct {};

    pub const properties = struct {
        /// The orientation of the orientable.
        pub const orientation = struct {
            pub const name = "orientation";

            pub const Type = gtk.Orientation;
        };
    };

    pub const signals = struct {};

    /// Retrieves the orientation of the `orientable`.
    extern fn gtk_orientable_get_orientation(p_orientable: *Orientable) gtk.Orientation;
    pub const getOrientation = gtk_orientable_get_orientation;

    /// Sets the orientation of the `orientable`.
    extern fn gtk_orientable_set_orientation(p_orientable: *Orientable, p_orientation: gtk.Orientation) void;
    pub const setOrientation = gtk_orientable_set_orientation;

    extern fn gtk_orientable_get_type() usize;
    pub const getGObjectType = gtk_orientable_get_type;

    extern fn g_object_ref(p_self: *gtk.Orientable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Orientable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Orientable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The interface that is used to implement print preview.
///
/// A `GtkPrintOperationPreview` object is passed to the
/// `gtk.PrintOperation.signals.preview` signal by
/// `gtk.PrintOperation`.
pub const PrintOperationPreview = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.PrintOperationPreviewIface;
    pub const virtual_methods = struct {
        /// Ends a preview.
        ///
        /// This function must be called to finish a custom print preview.
        pub const end_preview = struct {
            pub fn call(p_class: anytype, p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(PrintOperationPreview.Iface, p_class).f_end_preview.?(gobject.ext.as(PrintOperationPreview, p_preview));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(PrintOperationPreview.Iface, p_class).f_end_preview = @ptrCast(p_implementation);
            }
        };

        pub const got_page_size = struct {
            pub fn call(p_class: anytype, p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext, p_page_setup: *gtk.PageSetup) void {
                return gobject.ext.as(PrintOperationPreview.Iface, p_class).f_got_page_size.?(gobject.ext.as(PrintOperationPreview, p_preview), p_context, p_page_setup);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext, p_page_setup: *gtk.PageSetup) callconv(.c) void) void {
                gobject.ext.as(PrintOperationPreview.Iface, p_class).f_got_page_size = @ptrCast(p_implementation);
            }
        };

        /// Returns whether the given page is included in the set of pages that
        /// have been selected for printing.
        pub const is_selected = struct {
            pub fn call(p_class: anytype, p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_page_nr: c_int) c_int {
                return gobject.ext.as(PrintOperationPreview.Iface, p_class).f_is_selected.?(gobject.ext.as(PrintOperationPreview, p_preview), p_page_nr);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_page_nr: c_int) callconv(.c) c_int) void {
                gobject.ext.as(PrintOperationPreview.Iface, p_class).f_is_selected = @ptrCast(p_implementation);
            }
        };

        pub const ready = struct {
            pub fn call(p_class: anytype, p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) void {
                return gobject.ext.as(PrintOperationPreview.Iface, p_class).f_ready.?(gobject.ext.as(PrintOperationPreview, p_preview), p_context);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_context: *gtk.PrintContext) callconv(.c) void) void {
                gobject.ext.as(PrintOperationPreview.Iface, p_class).f_ready = @ptrCast(p_implementation);
            }
        };

        /// Renders a page to the preview.
        ///
        /// This is using the print context that was passed to the
        /// `gtk.PrintOperation.signals.preview` handler together
        /// with `preview`.
        ///
        /// A custom print preview should use this function to render
        /// the currently selected page.
        ///
        /// Note that this function requires a suitable cairo context to
        /// be associated with the print context.
        pub const render_page = struct {
            pub fn call(p_class: anytype, p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_page_nr: c_int) void {
                return gobject.ext.as(PrintOperationPreview.Iface, p_class).f_render_page.?(gobject.ext.as(PrintOperationPreview, p_preview), p_page_nr);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_preview: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_page_nr: c_int) callconv(.c) void) void {
                gobject.ext.as(PrintOperationPreview.Iface, p_class).f_render_page = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted once for each page that gets rendered to the preview.
        ///
        /// A handler for this signal should update the `context`
        /// according to `page_setup` and set up a suitable cairo
        /// context, using `gtk.PrintContext.setCairoContext`.
        pub const got_page_size = struct {
            pub const name = "got-page-size";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, p_page_setup: *gtk.PageSetup, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperationPreview, p_instance))),
                    gobject.signalLookup("got-page-size", PrintOperationPreview.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// The ::ready signal gets emitted once per preview operation,
        /// before the first page is rendered.
        ///
        /// A handler for this signal can be used for setup tasks.
        pub const ready = struct {
            pub const name = "ready";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_context: *gtk.PrintContext, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(PrintOperationPreview, p_instance))),
                    gobject.signalLookup("ready", PrintOperationPreview.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Ends a preview.
    ///
    /// This function must be called to finish a custom print preview.
    extern fn gtk_print_operation_preview_end_preview(p_preview: *PrintOperationPreview) void;
    pub const endPreview = gtk_print_operation_preview_end_preview;

    /// Returns whether the given page is included in the set of pages that
    /// have been selected for printing.
    extern fn gtk_print_operation_preview_is_selected(p_preview: *PrintOperationPreview, p_page_nr: c_int) c_int;
    pub const isSelected = gtk_print_operation_preview_is_selected;

    /// Renders a page to the preview.
    ///
    /// This is using the print context that was passed to the
    /// `gtk.PrintOperation.signals.preview` handler together
    /// with `preview`.
    ///
    /// A custom print preview should use this function to render
    /// the currently selected page.
    ///
    /// Note that this function requires a suitable cairo context to
    /// be associated with the print context.
    extern fn gtk_print_operation_preview_render_page(p_preview: *PrintOperationPreview, p_page_nr: c_int) void;
    pub const renderPage = gtk_print_operation_preview_render_page;

    extern fn gtk_print_operation_preview_get_type() usize;
    pub const getGObjectType = gtk_print_operation_preview_get_type;

    extern fn g_object_ref(p_self: *gtk.PrintOperationPreview) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.PrintOperationPreview) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *PrintOperationPreview, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for widgets that can act as the root of a widget hierarchy.
///
/// The root widget takes care of providing the connection to the windowing
/// system and manages layout, drawing and event delivery for its widget
/// hierarchy.
///
/// The obvious example of a `GtkRoot` is `GtkWindow`.
///
/// To get the display to which a `GtkRoot` belongs, use
/// `gtk.Root.getDisplay`.
///
/// `GtkRoot` also maintains the location of keyboard focus inside its widget
/// hierarchy, with `gtk.Root.setFocus` and `gtk.Root.getFocus`.
pub const Root = opaque {
    pub const Prerequisites = [_]type{ gtk.Native, gtk.Widget };
    pub const Iface = gtk.RootInterface;
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {};

    /// Returns the display that this `GtkRoot` is on.
    extern fn gtk_root_get_display(p_self: *Root) *gdk.Display;
    pub const getDisplay = gtk_root_get_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.
    extern fn gtk_root_get_focus(p_self: *Root) ?*gtk.Widget;
    pub const getFocus = gtk_root_get_focus;

    /// 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 `gtk.Widget.grabFocus` instead of
    /// this function.
    extern fn gtk_root_set_focus(p_self: *Root, p_focus: ?*gtk.Widget) void;
    pub const setFocus = gtk_root_set_focus;

    extern fn gtk_root_get_type() usize;
    pub const getGObjectType = gtk_root_get_type;

    extern fn g_object_ref(p_self: *gtk.Root) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Root) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Root, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for widgets with native scrolling ability.
///
/// To implement this interface you should override the
/// `gtk.Scrollable.properties.hadjustment` and
/// `gtk.Scrollable.properties.vadjustment` properties.
///
/// ## Creating a scrollable widget
///
/// All scrollable widgets should do the following.
///
/// - When a parent widget sets the scrollable child widget’s adjustments,
///   the widget should connect to the `gtk.Adjustment.signals.value_changed`
///   signal. The child widget should then populate the adjustments’ properties
///   as soon as possible, which usually means queueing an allocation right away
///   and populating the properties in the `gtk.Widget.virtual_methods.size_allocate`
///   implementation.
///
/// - Because its preferred size is the size for a fully expanded widget,
///   the scrollable widget must be able to cope with underallocations.
///   This means that it must accept any value passed to its
///   `gtk.Widget.virtual_methods.size_allocate` implementation.
///
/// - When the parent allocates space to the scrollable child widget,
///   the widget must ensure the adjustments’ property values are correct and up
///   to date, for example using `gtk.Adjustment.configure`.
///
/// - When any of the adjustments emits the `gtk.Adjustment.signals.value_changed`
///   signal, the scrollable widget should scroll its contents.
pub const Scrollable = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.ScrollableInterface;
    pub const virtual_methods = struct {
        /// 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.
        pub const get_border = struct {
            pub fn call(p_class: anytype, p_scrollable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_border: *gtk.Border) c_int {
                return gobject.ext.as(Scrollable.Iface, p_class).f_get_border.?(gobject.ext.as(Scrollable, p_scrollable), p_border);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_scrollable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_border: *gtk.Border) callconv(.c) c_int) void {
                gobject.ext.as(Scrollable.Iface, p_class).f_get_border = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {
        /// Horizontal `GtkAdjustment` of the scrollable widget.
        ///
        /// This adjustment is shared between the scrollable widget and its parent.
        pub const hadjustment = struct {
            pub const name = "hadjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// Determines when horizontal scrolling should start.
        pub const hscroll_policy = struct {
            pub const name = "hscroll-policy";

            pub const Type = gtk.ScrollablePolicy;
        };

        /// Vertical `GtkAdjustment` of the scrollable widget.
        ///
        /// This adjustment is shared between the scrollable widget and its parent.
        pub const vadjustment = struct {
            pub const name = "vadjustment";

            pub const Type = ?*gtk.Adjustment;
        };

        /// Determines when vertical scrolling should start.
        pub const vscroll_policy = struct {
            pub const name = "vscroll-policy";

            pub const Type = gtk.ScrollablePolicy;
        };
    };

    pub const signals = struct {};

    /// 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.
    extern fn gtk_scrollable_get_border(p_scrollable: *Scrollable, p_border: *gtk.Border) c_int;
    pub const getBorder = gtk_scrollable_get_border;

    /// Retrieves the `GtkAdjustment` used for horizontal scrolling.
    extern fn gtk_scrollable_get_hadjustment(p_scrollable: *Scrollable) ?*gtk.Adjustment;
    pub const getHadjustment = gtk_scrollable_get_hadjustment;

    /// Gets the horizontal `GtkScrollablePolicy`.
    extern fn gtk_scrollable_get_hscroll_policy(p_scrollable: *Scrollable) gtk.ScrollablePolicy;
    pub const getHscrollPolicy = gtk_scrollable_get_hscroll_policy;

    /// Retrieves the `GtkAdjustment` used for vertical scrolling.
    extern fn gtk_scrollable_get_vadjustment(p_scrollable: *Scrollable) ?*gtk.Adjustment;
    pub const getVadjustment = gtk_scrollable_get_vadjustment;

    /// Gets the vertical `GtkScrollablePolicy`.
    extern fn gtk_scrollable_get_vscroll_policy(p_scrollable: *Scrollable) gtk.ScrollablePolicy;
    pub const getVscrollPolicy = gtk_scrollable_get_vscroll_policy;

    /// Sets the horizontal adjustment of the `GtkScrollable`.
    extern fn gtk_scrollable_set_hadjustment(p_scrollable: *Scrollable, p_hadjustment: ?*gtk.Adjustment) void;
    pub const setHadjustment = gtk_scrollable_set_hadjustment;

    /// Sets the `GtkScrollablePolicy`.
    ///
    /// The policy determines whether horizontal scrolling should start
    /// below the minimum width or below the natural width.
    extern fn gtk_scrollable_set_hscroll_policy(p_scrollable: *Scrollable, p_policy: gtk.ScrollablePolicy) void;
    pub const setHscrollPolicy = gtk_scrollable_set_hscroll_policy;

    /// Sets the vertical adjustment of the `GtkScrollable`.
    extern fn gtk_scrollable_set_vadjustment(p_scrollable: *Scrollable, p_vadjustment: ?*gtk.Adjustment) void;
    pub const setVadjustment = gtk_scrollable_set_vadjustment;

    /// Sets the `GtkScrollablePolicy`.
    ///
    /// The policy determines whether vertical scrolling should start
    /// below the minimum height or below the natural height.
    extern fn gtk_scrollable_set_vscroll_policy(p_scrollable: *Scrollable, p_policy: gtk.ScrollablePolicy) void;
    pub const setVscrollPolicy = gtk_scrollable_set_vscroll_policy;

    extern fn gtk_scrollable_get_type() usize;
    pub const getGObjectType = gtk_scrollable_get_type;

    extern fn g_object_ref(p_self: *gtk.Scrollable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.Scrollable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *Scrollable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface that adds support for sections to list models.
///
/// A `GtkSectionModel` groups successive items into so-called sections. List widgets
/// like `GtkListView` and `GtkGridView` then allow displaying section headers for
/// these sections by installing a header factory.
///
/// Many GTK list models support sections inherently, or they pass through the sections
/// of a model they are wrapping.
///
/// When the section groupings of a model change, the model will emit the
/// `gtk.SectionModel.signals.sections_changed` signal by calling the
/// `gtk.SectionModel.sectionsChanged` function. All sections in the given range
/// then need to be queried again.
/// The `gio.ListModel.signals.items_changed` signal has the same effect, all sections in
/// that range are invalidated, too.
pub const SectionModel = opaque {
    pub const Prerequisites = [_]type{gio.ListModel};
    pub const Iface = gtk.SectionModelInterface;
    pub const virtual_methods = struct {
        /// Query the section that covers the given position. The number of
        /// items in the section can be computed by `out_end - out_start`.
        ///
        /// If the position is larger than the number of items, a single
        /// range from n_items to G_MAXUINT will be returned.
        pub const get_section = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_out_start: *c_uint, p_out_end: *c_uint) void {
                return gobject.ext.as(SectionModel.Iface, p_class).f_get_section.?(gobject.ext.as(SectionModel, p_self), p_position, p_out_start, p_out_end);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_out_start: *c_uint, p_out_end: *c_uint) callconv(.c) void) void {
                gobject.ext.as(SectionModel.Iface, p_class).f_get_section = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted when the start-of-section state of some of the items in `model` changes.
        ///
        /// Note that this signal does not specify the new section state of the
        /// items, they need to be queried manually. It is also not necessary for
        /// a model to change the section state of any of the items in the section
        /// model, though it would be rather useless to emit such a signal.
        ///
        /// The `gio.ListModel.signals.items_changed` implies the effect of the
        /// `gtk.SectionModel.signals.sections_changed` signal for all the items
        /// it covers.
        pub const sections_changed = struct {
            pub const name = "sections-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, p_n_items: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SectionModel, p_instance))),
                    gobject.signalLookup("sections-changed", SectionModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Query the section that covers the given position. The number of
    /// items in the section can be computed by `out_end - out_start`.
    ///
    /// If the position is larger than the number of items, a single
    /// range from n_items to G_MAXUINT will be returned.
    extern fn gtk_section_model_get_section(p_self: *SectionModel, p_position: c_uint, p_out_start: *c_uint, p_out_end: *c_uint) void;
    pub const getSection = gtk_section_model_get_section;

    /// This function emits the `gtk.SectionModel.signals.sections_changed`
    /// signal to notify about changes to sections.
    ///
    /// It must cover all positions that used to be a section start or that
    /// are now a section start. It does not have to cover all positions for
    /// which the section has changed.
    ///
    /// The `gio.ListModel.signals.items_changed` implies the effect of the
    /// `gtk.SectionModel.signals.sections_changed` signal for all the items
    /// it covers.
    ///
    /// It is recommended that when changes to the items cause section changes
    /// in a larger range, that the larger range is included in the emission
    /// of the `gio.ListModel.signals.items_changed` instead of emitting
    /// two signals.
    extern fn gtk_section_model_sections_changed(p_self: *SectionModel, p_position: c_uint, p_n_items: c_uint) void;
    pub const sectionsChanged = gtk_section_model_sections_changed;

    extern fn gtk_section_model_get_type() usize;
    pub const getGObjectType = gtk_section_model_get_type;

    extern fn g_object_ref(p_self: *gtk.SectionModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SectionModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SectionModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface that adds support for selection to list models.
///
/// This support is then used by widgets using list models to add the ability
/// to select and unselect various items.
///
/// GTK provides default implementations of the most common selection modes such
/// as `gtk.SingleSelection`, so you will only need to implement this
/// interface if you want detailed control about how selections should be handled.
///
/// A `GtkSelectionModel` supports a single boolean per item indicating if an item is
/// selected or not. This can be queried via `gtk.SelectionModel.isSelected`.
/// When the selected state of one or more items changes, the model will emit the
/// `gtk.SelectionModel.signals.selection_changed` signal by calling the
/// `gtk.SelectionModel.selectionChanged` function. The positions given
/// in that signal may have their selection state changed, though that is not a
/// requirement. If new items added to the model via the
/// `gio.ListModel.signals.items_changed` signal are selected or not is up to the
/// implementation.
///
/// Note that items added via `gio.ListModel.signals.items_changed` may already
/// be selected and no `gtk.SelectionModel.signals.selection_changed` will be
/// emitted for them. So to track which items are selected, it is necessary to
/// listen to both signals.
///
/// Additionally, the interface can expose functionality to select and unselect
/// items. If these functions are implemented, GTK's list widgets will allow users
/// to select and unselect items. However, `GtkSelectionModel`s are free to only
/// implement them partially or not at all. In that case the widgets will not
/// support the unimplemented operations.
///
/// When selecting or unselecting is supported by a model, the return values of
/// the selection functions do *not* indicate if selection or unselection happened.
/// They are only meant to indicate complete failure, like when this mode of
/// selecting is not supported by the model.
///
/// Selections may happen asynchronously, so the only reliable way to find out
/// when an item was selected is to listen to the signals that indicate selection.
pub const SelectionModel = opaque {
    pub const Prerequisites = [_]type{gio.ListModel};
    pub const Iface = gtk.SelectionModelInterface;
    pub const virtual_methods = struct {
        /// Gets the set of selected items in a range.
        ///
        /// This function is an optimization for
        /// `gtk.SelectionModel.getSelection` when you are only
        /// interested in part of the model's selected state. A common use
        /// case is in response to the `gtk.SelectionModel.signals.selection_changed`
        /// signal.
        pub const get_selection_in_range = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_items: c_uint) *gtk.Bitset {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_get_selection_in_range.?(gobject.ext.as(SelectionModel, p_model), p_position, p_n_items);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_items: c_uint) callconv(.c) *gtk.Bitset) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_get_selection_in_range = @ptrCast(p_implementation);
            }
        };

        /// Checks if the given item is selected.
        pub const is_selected = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_is_selected.?(gobject.ext.as(SelectionModel, p_model), p_position);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_is_selected = @ptrCast(p_implementation);
            }
        };

        /// Requests to select all items in the model.
        pub const select_all = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_select_all.?(gobject.ext.as(SelectionModel, p_model));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_select_all = @ptrCast(p_implementation);
            }
        };

        /// Requests to select an item in the model.
        pub const select_item = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_unselect_rest: c_int) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_select_item.?(gobject.ext.as(SelectionModel, p_model), p_position, p_unselect_rest);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_unselect_rest: c_int) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_select_item = @ptrCast(p_implementation);
            }
        };

        /// Requests to select a range of items in the model.
        pub const select_range = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_items: c_uint, p_unselect_rest: c_int) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_select_range.?(gobject.ext.as(SelectionModel, p_model), p_position, p_n_items, p_unselect_rest);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_items: c_uint, p_unselect_rest: c_int) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_select_range = @ptrCast(p_implementation);
            }
        };

        /// 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.
        pub const set_selection = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_selected: *gtk.Bitset, p_mask: *gtk.Bitset) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_set_selection.?(gobject.ext.as(SelectionModel, p_model), p_selected, p_mask);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_selected: *gtk.Bitset, p_mask: *gtk.Bitset) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_set_selection = @ptrCast(p_implementation);
            }
        };

        /// Requests to unselect all items in the model.
        pub const unselect_all = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_unselect_all.?(gobject.ext.as(SelectionModel, p_model));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_unselect_all = @ptrCast(p_implementation);
            }
        };

        /// Requests to unselect an item in the model.
        pub const unselect_item = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_unselect_item.?(gobject.ext.as(SelectionModel, p_model), p_position);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_unselect_item = @ptrCast(p_implementation);
            }
        };

        /// Requests to unselect a range of items in the model.
        pub const unselect_range = struct {
            pub fn call(p_class: anytype, p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_items: c_uint) c_int {
                return gobject.ext.as(SelectionModel.Iface, p_class).f_unselect_range.?(gobject.ext.as(SelectionModel, p_model), p_position, p_n_items);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_position: c_uint, p_n_items: c_uint) callconv(.c) c_int) void {
                gobject.ext.as(SelectionModel.Iface, p_class).f_unselect_range = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// Emitted when the selection state of some of the items in `model` changes.
        ///
        /// Note that this signal does not specify the new selection state of the
        /// items, they need to be queried manually. It is also not necessary for
        /// a model to change the selection state of any of the items in the selection
        /// model, though it would be rather useless to emit such a signal.
        pub const selection_changed = struct {
            pub const name = "selection-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_position: c_uint, p_n_items: c_uint, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(SelectionModel, p_instance))),
                    gobject.signalLookup("selection-changed", SelectionModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// 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 `gtk.SelectionModel.isSelected` or if you are only
    /// interested in a few, consider `gtk.SelectionModel.getSelectionInRange`.
    extern fn gtk_selection_model_get_selection(p_model: *SelectionModel) *gtk.Bitset;
    pub const getSelection = gtk_selection_model_get_selection;

    /// Gets the set of selected items in a range.
    ///
    /// This function is an optimization for
    /// `gtk.SelectionModel.getSelection` when you are only
    /// interested in part of the model's selected state. A common use
    /// case is in response to the `gtk.SelectionModel.signals.selection_changed`
    /// signal.
    extern fn gtk_selection_model_get_selection_in_range(p_model: *SelectionModel, p_position: c_uint, p_n_items: c_uint) *gtk.Bitset;
    pub const getSelectionInRange = gtk_selection_model_get_selection_in_range;

    /// Checks if the given item is selected.
    extern fn gtk_selection_model_is_selected(p_model: *SelectionModel, p_position: c_uint) c_int;
    pub const isSelected = gtk_selection_model_is_selected;

    /// Requests to select all items in the model.
    extern fn gtk_selection_model_select_all(p_model: *SelectionModel) c_int;
    pub const selectAll = gtk_selection_model_select_all;

    /// Requests to select an item in the model.
    extern fn gtk_selection_model_select_item(p_model: *SelectionModel, p_position: c_uint, p_unselect_rest: c_int) c_int;
    pub const selectItem = gtk_selection_model_select_item;

    /// Requests to select a range of items in the model.
    extern fn gtk_selection_model_select_range(p_model: *SelectionModel, p_position: c_uint, p_n_items: c_uint, p_unselect_rest: c_int) c_int;
    pub const selectRange = gtk_selection_model_select_range;

    /// Helper function for implementations of `GtkSelectionModel`.
    ///
    /// Call this when the selection changes to emit the
    /// `gtk.SelectionModel.signals.selection_changed` signal.
    extern fn gtk_selection_model_selection_changed(p_model: *SelectionModel, p_position: c_uint, p_n_items: c_uint) void;
    pub const selectionChanged = gtk_selection_model_selection_changed;

    /// 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.
    extern fn gtk_selection_model_set_selection(p_model: *SelectionModel, p_selected: *gtk.Bitset, p_mask: *gtk.Bitset) c_int;
    pub const setSelection = gtk_selection_model_set_selection;

    /// Requests to unselect all items in the model.
    extern fn gtk_selection_model_unselect_all(p_model: *SelectionModel) c_int;
    pub const unselectAll = gtk_selection_model_unselect_all;

    /// Requests to unselect an item in the model.
    extern fn gtk_selection_model_unselect_item(p_model: *SelectionModel, p_position: c_uint) c_int;
    pub const unselectItem = gtk_selection_model_unselect_item;

    /// Requests to unselect a range of items in the model.
    extern fn gtk_selection_model_unselect_range(p_model: *SelectionModel, p_position: c_uint, p_n_items: c_uint) c_int;
    pub const unselectRange = gtk_selection_model_unselect_range;

    extern fn gtk_selection_model_get_type() usize;
    pub const getGObjectType = gtk_selection_model_get_type;

    extern fn g_object_ref(p_self: *gtk.SelectionModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SelectionModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SelectionModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface that is used to implement shortcut scopes.
///
/// This is important for `gtk.Native` widgets that have their
/// own surface, since the event controllers that are used to implement
/// managed and global scopes are limited to the same native.
///
/// Examples for widgets implementing `GtkShortcutManager` are
/// `gtk.Window` and `gtk.Popover`.
///
/// Every widget that implements `GtkShortcutManager` will be used as a
/// `GTK_SHORTCUT_SCOPE_MANAGED`.
pub const ShortcutManager = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.ShortcutManagerInterface;
    pub const virtual_methods = struct {
        /// Add a `GtkShortcutController` to be managed.
        pub const add_controller = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_controller: *gtk.ShortcutController) void {
                return gobject.ext.as(ShortcutManager.Iface, p_class).f_add_controller.?(gobject.ext.as(ShortcutManager, p_self), p_controller);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_controller: *gtk.ShortcutController) callconv(.c) void) void {
                gobject.ext.as(ShortcutManager.Iface, p_class).f_add_controller = @ptrCast(p_implementation);
            }
        };

        /// Remove a `GtkShortcutController` that had previously
        ///   been added
        pub const remove_controller = struct {
            pub fn call(p_class: anytype, p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_controller: *gtk.ShortcutController) void {
                return gobject.ext.as(ShortcutManager.Iface, p_class).f_remove_controller.?(gobject.ext.as(ShortcutManager, p_self), p_controller);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_self: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_controller: *gtk.ShortcutController) callconv(.c) void) void {
                gobject.ext.as(ShortcutManager.Iface, p_class).f_remove_controller = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    extern fn gtk_shortcut_manager_get_type() usize;
    pub const getGObjectType = gtk_shortcut_manager_get_type;

    extern fn g_object_ref(p_self: *gtk.ShortcutManager) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.ShortcutManager) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *ShortcutManager, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface for style information used by `gtk.StyleContext`.
///
/// See `gtk.StyleContext.addProvider` and
/// `gtk.StyleContext.addProviderForDisplay` for
/// adding `GtkStyleProviders`.
///
/// GTK uses the `GtkStyleProvider` implementation for CSS in
/// `gtk.CssProvider`.
pub const StyleProvider = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = opaque {
        pub const Instance = StyleProvider;
    };
    pub const virtual_methods = struct {};

    pub const properties = struct {};

    pub const signals = struct {
        pub const gtk_private_changed = struct {
            pub const name = "gtk-private-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(StyleProvider, p_instance))),
                    gobject.signalLookup("gtk-private-changed", StyleProvider.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    extern fn gtk_style_provider_get_type() usize;
    pub const getGObjectType = gtk_style_provider_get_type;

    extern fn g_object_ref(p_self: *gtk.StyleProvider) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.StyleProvider) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *StyleProvider, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An interface that supports symbolic colors in paintables.
///
/// `GdkPaintable`s implementing the interface will have the
/// `gtk.SymbolicPaintable.virtual_methods.snapshot_symbolic` function called and
/// have the colors for drawing symbolic icons passed. At least 5 colors
/// are guaranteed to be passed every time. These 5 colors are the
/// foreground color, and the colors to use for errors, warnings
/// and success information in that order, followed by the system
/// accent color.
///
/// The system accent color has been added in GTK 4.22.
/// More colors may be added in the future.
pub const SymbolicPaintable = opaque {
    pub const Prerequisites = [_]type{gdk.Paintable};
    pub const Iface = gtk.SymbolicPaintableInterface;
    pub const virtual_methods = struct {
        /// Snapshots the paintable with the given colors.
        ///
        /// If less than 5 colors are provided, GTK will pad the array with default
        /// colors.
        pub const snapshot_symbolic = struct {
            pub fn call(p_class: anytype, p_paintable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize) void {
                return gobject.ext.as(SymbolicPaintable.Iface, p_class).f_snapshot_symbolic.?(gobject.ext.as(SymbolicPaintable, p_paintable), p_snapshot, p_width, p_height, p_colors, p_n_colors);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_paintable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize) callconv(.c) void) void {
                gobject.ext.as(SymbolicPaintable.Iface, p_class).f_snapshot_symbolic = @ptrCast(p_implementation);
            }
        };

        /// Snapshots the paintable with the given colors and weight.
        ///
        /// If less than 5 colors are provided, GTK will pad the array with default
        /// colors.
        pub const snapshot_with_weight = struct {
            pub fn call(p_class: anytype, p_paintable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize, p_weight: f64) void {
                return gobject.ext.as(SymbolicPaintable.Iface, p_class).f_snapshot_with_weight.?(gobject.ext.as(SymbolicPaintable, p_paintable), p_snapshot, p_width, p_height, p_colors, p_n_colors, p_weight);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_paintable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize, p_weight: f64) callconv(.c) void) void {
                gobject.ext.as(SymbolicPaintable.Iface, p_class).f_snapshot_with_weight = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// Snapshots the paintable with the given colors.
    ///
    /// If less than 5 colors are provided, GTK will pad the array with default
    /// colors.
    extern fn gtk_symbolic_paintable_snapshot_symbolic(p_paintable: *SymbolicPaintable, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize) void;
    pub const snapshotSymbolic = gtk_symbolic_paintable_snapshot_symbolic;

    /// Snapshots the paintable with the given colors and weight.
    ///
    /// If less than 5 colors are provided, GTK will pad the array with default
    /// colors.
    extern fn gtk_symbolic_paintable_snapshot_with_weight(p_paintable: *SymbolicPaintable, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize, p_weight: f64) void;
    pub const snapshotWithWeight = gtk_symbolic_paintable_snapshot_with_weight;

    extern fn gtk_symbolic_paintable_get_type() usize;
    pub const getGObjectType = gtk_symbolic_paintable_get_type;

    extern fn g_object_ref(p_self: *gtk.SymbolicPaintable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.SymbolicPaintable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *SymbolicPaintable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Interface for Drag-and-Drop destinations in `GtkTreeView`.
pub const TreeDragDest = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.TreeDragDestIface;
    pub const virtual_methods = struct {
        /// Asks the `GtkTreeDragDest` to insert a row before the path `dest`,
        /// deriving the contents of the row from `value`. If `dest` is
        /// outside the tree so that inserting before it is impossible, `FALSE`
        /// will be returned. Also, `FALSE` may be returned if the new row is
        /// not created for some model-specific reason.  Should robustly handle
        /// a `dest` no longer found in the model!
        pub const drag_data_received = struct {
            pub fn call(p_class: anytype, p_drag_dest: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_dest: *gtk.TreePath, p_value: *const gobject.Value) c_int {
                return gobject.ext.as(TreeDragDest.Iface, p_class).f_drag_data_received.?(gobject.ext.as(TreeDragDest, p_drag_dest), p_dest, p_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_drag_dest: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_dest: *gtk.TreePath, p_value: *const gobject.Value) callconv(.c) c_int) void {
                gobject.ext.as(TreeDragDest.Iface, p_class).f_drag_data_received = @ptrCast(p_implementation);
            }
        };

        /// Determines whether a drop is possible before the given `dest_path`,
        /// at the same depth as `dest_path`. i.e., can we drop the data in
        /// `value` at that location. `dest_path` does not have to
        /// exist; the return value will almost certainly be `FALSE` if the
        /// parent of `dest_path` doesn’t exist, though.
        pub const row_drop_possible = struct {
            pub fn call(p_class: anytype, p_drag_dest: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_dest_path: *gtk.TreePath, p_value: *const gobject.Value) c_int {
                return gobject.ext.as(TreeDragDest.Iface, p_class).f_row_drop_possible.?(gobject.ext.as(TreeDragDest, p_drag_dest), p_dest_path, p_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_drag_dest: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_dest_path: *gtk.TreePath, p_value: *const gobject.Value) callconv(.c) c_int) void {
                gobject.ext.as(TreeDragDest.Iface, p_class).f_row_drop_possible = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// Asks the `GtkTreeDragDest` to insert a row before the path `dest`,
    /// deriving the contents of the row from `value`. If `dest` is
    /// outside the tree so that inserting before it is impossible, `FALSE`
    /// will be returned. Also, `FALSE` may be returned if the new row is
    /// not created for some model-specific reason.  Should robustly handle
    /// a `dest` no longer found in the model!
    extern fn gtk_tree_drag_dest_drag_data_received(p_drag_dest: *TreeDragDest, p_dest: *gtk.TreePath, p_value: *const gobject.Value) c_int;
    pub const dragDataReceived = gtk_tree_drag_dest_drag_data_received;

    /// Determines whether a drop is possible before the given `dest_path`,
    /// at the same depth as `dest_path`. i.e., can we drop the data in
    /// `value` at that location. `dest_path` does not have to
    /// exist; the return value will almost certainly be `FALSE` if the
    /// parent of `dest_path` doesn’t exist, though.
    extern fn gtk_tree_drag_dest_row_drop_possible(p_drag_dest: *TreeDragDest, p_dest_path: *gtk.TreePath, p_value: *const gobject.Value) c_int;
    pub const rowDropPossible = gtk_tree_drag_dest_row_drop_possible;

    extern fn gtk_tree_drag_dest_get_type() usize;
    pub const getGObjectType = gtk_tree_drag_dest_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeDragDest) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeDragDest) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeDragDest, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Interface for Drag-and-Drop destinations in `GtkTreeView`.
pub const TreeDragSource = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.TreeDragSourceIface;
    pub const virtual_methods = struct {
        /// Asks the `GtkTreeDragSource` to delete the row at `path`, because
        /// it was moved somewhere else via drag-and-drop. Returns `FALSE`
        /// if the deletion fails because `path` no longer exists, or for
        /// some model-specific reason. Should robustly handle a `path` no
        /// longer found in the model!
        pub const drag_data_delete = struct {
            pub fn call(p_class: anytype, p_drag_source: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) c_int {
                return gobject.ext.as(TreeDragSource.Iface, p_class).f_drag_data_delete.?(gobject.ext.as(TreeDragSource, p_drag_source), p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_drag_source: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) callconv(.c) c_int) void {
                gobject.ext.as(TreeDragSource.Iface, p_class).f_drag_data_delete = @ptrCast(p_implementation);
            }
        };

        /// Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing
        /// the row at `path`. Should robustly handle a `path` no
        /// longer found in the model!
        pub const drag_data_get = struct {
            pub fn call(p_class: anytype, p_drag_source: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) ?*gdk.ContentProvider {
                return gobject.ext.as(TreeDragSource.Iface, p_class).f_drag_data_get.?(gobject.ext.as(TreeDragSource, p_drag_source), p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_drag_source: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) callconv(.c) ?*gdk.ContentProvider) void {
                gobject.ext.as(TreeDragSource.Iface, p_class).f_drag_data_get = @ptrCast(p_implementation);
            }
        };

        /// Asks the `GtkTreeDragSource` whether a particular row can be used as
        /// the source of a DND operation. If the source doesn’t implement
        /// this interface, the row is assumed draggable.
        pub const row_draggable = struct {
            pub fn call(p_class: anytype, p_drag_source: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) c_int {
                return gobject.ext.as(TreeDragSource.Iface, p_class).f_row_draggable.?(gobject.ext.as(TreeDragSource, p_drag_source), p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_drag_source: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) callconv(.c) c_int) void {
                gobject.ext.as(TreeDragSource.Iface, p_class).f_row_draggable = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {};

    /// Asks the `GtkTreeDragSource` to delete the row at `path`, because
    /// it was moved somewhere else via drag-and-drop. Returns `FALSE`
    /// if the deletion fails because `path` no longer exists, or for
    /// some model-specific reason. Should robustly handle a `path` no
    /// longer found in the model!
    extern fn gtk_tree_drag_source_drag_data_delete(p_drag_source: *TreeDragSource, p_path: *gtk.TreePath) c_int;
    pub const dragDataDelete = gtk_tree_drag_source_drag_data_delete;

    /// Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing
    /// the row at `path`. Should robustly handle a `path` no
    /// longer found in the model!
    extern fn gtk_tree_drag_source_drag_data_get(p_drag_source: *TreeDragSource, p_path: *gtk.TreePath) ?*gdk.ContentProvider;
    pub const dragDataGet = gtk_tree_drag_source_drag_data_get;

    /// Asks the `GtkTreeDragSource` whether a particular row can be used as
    /// the source of a DND operation. If the source doesn’t implement
    /// this interface, the row is assumed draggable.
    extern fn gtk_tree_drag_source_row_draggable(p_drag_source: *TreeDragSource, p_path: *gtk.TreePath) c_int;
    pub const rowDraggable = gtk_tree_drag_source_row_draggable;

    extern fn gtk_tree_drag_source_get_type() usize;
    pub const getGObjectType = gtk_tree_drag_source_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeDragSource) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeDragSource) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeDragSource, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The tree interface used by GtkTreeView
///
/// The `GtkTreeModel` interface defines a generic tree interface for
/// use by the `GtkTreeView` widget. It is an abstract interface, and
/// is designed to be usable with any appropriate data structure. The
/// programmer just has to implement this interface on their own data
/// type for it to be viewable by a `GtkTreeView` widget.
///
/// The model is represented as a hierarchical tree of strongly-typed,
/// columned data. In other words, the model can be seen as a tree where
/// every node has different values depending on which column is being
/// queried. The type of data found in a column is determined by using
/// the GType system (ie. `G_TYPE_INT`, `GTK_TYPE_BUTTON`, `G_TYPE_POINTER`,
/// etc). The types are homogeneous per column across all nodes. It is
/// important to note that this interface only provides a way of examining
/// a model and observing changes. The implementation of each individual
/// model decides how and if changes are made.
///
/// In order to make life simpler for programmers who do not need to
/// write their own specialized model, two generic models are provided
/// — the `GtkTreeStore` and the `GtkListStore`. To use these, the
/// developer simply pushes data into these models as necessary. These
/// models provide the data structure as well as all appropriate tree
/// interfaces. As a result, implementing drag and drop, sorting, and
/// storing data is trivial. For the vast majority of trees and lists,
/// these two models are sufficient.
///
/// Models are accessed on a node/column level of granularity. One can
/// query for the value of a model at a certain node and a certain
/// column on that node. There are two structures used to reference a
/// particular node in a model. They are the `gtk.TreePath` and
/// the `gtk.TreeIter` (“iter” is short for iterator). Most of the
/// interface consists of operations on a `gtk.TreeIter`.
///
/// A path is essentially a potential node. It is a location on a model
/// that may or may not actually correspond to a node on a specific
/// model. A `gtk.TreePath` can be converted into either an
/// array of unsigned integers or a string. The string form is a list
/// of numbers separated by a colon. Each number refers to the offset
/// at that level. Thus, the path `0` refers to the root
/// node and the path `2:4` refers to the fifth child of
/// the third node.
///
/// By contrast, a `gtk.TreeIter` is a reference to a specific node on
/// a specific model. It is a generic struct with an integer and three
/// generic pointers. These are filled in by the model in a model-specific
/// way. One can convert a path to an iterator by calling
/// `gtk.TreeModel.getIter`. These iterators are the primary way
/// of accessing a model and are similar to the iterators used by
/// `GtkTextBuffer`. They are generally statically allocated on the
/// stack and only used for a short time. The model interface defines
/// a set of operations using them for navigating the model.
///
/// It is expected that models fill in the iterator with private data.
/// For example, the `GtkListStore` model, which is internally a simple
/// linked list, stores a list node in one of the pointers. The
/// `GtkTreeModel`Sort stores an array and an offset in two of the
/// pointers. Additionally, there is an integer field. This field is
/// generally filled with a unique stamp per model. This stamp is for
/// catching errors resulting from using invalid iterators with a model.
///
/// The lifecycle of an iterator can be a little confusing at first.
/// Iterators are expected to always be valid for as long as the model
/// is unchanged (and doesn’t emit a signal). The model is considered
/// to own all outstanding iterators and nothing needs to be done to
/// free them from the user’s point of view. Additionally, some models
/// guarantee that an iterator is valid for as long as the node it refers
/// to is valid (most notably the `GtkTreeStore` and `GtkListStore`).
/// Although generally uninteresting, as one always has to allow for
/// the case where iterators do not persist beyond a signal, some very
/// important performance enhancements were made in the sort model.
/// As a result, the `GTK_TREE_MODEL_ITERS_PERSIST` flag was added to
/// indicate this behavior.
///
/// To help show some common operation of a model, some examples are
/// provided. The first example shows three ways of getting the iter at
/// the location `3:2:5`. While the first method shown is
/// easier, the second is much more common, as you often get paths from
/// callbacks.
///
/// ## Acquiring a `GtkTreeIter`
///
/// ```c
/// // Three ways of getting the iter pointing to the location
/// GtkTreePath *path;
/// GtkTreeIter iter;
/// GtkTreeIter parent_iter;
///
/// // get the iterator from a string
/// gtk_tree_model_get_iter_from_string (model,
///                                      &iter,
///                                      "3:2:5");
///
/// // get the iterator from a path
/// path = gtk_tree_path_new_from_string ("3:2:5");
/// gtk_tree_model_get_iter (model, &iter, path);
/// gtk_tree_path_free (path);
///
/// // walk the tree to find the iterator
/// gtk_tree_model_iter_nth_child (model, &iter,
///                                NULL, 3);
/// parent_iter = iter;
/// gtk_tree_model_iter_nth_child (model, &iter,
///                                &parent_iter, 2);
/// parent_iter = iter;
/// gtk_tree_model_iter_nth_child (model, &iter,
///                                &parent_iter, 5);
/// ```
///
/// This second example shows a quick way of iterating through a list
/// and getting a string and an integer from each row. The
/// `populate_model` function used below is not
/// shown, as it is specific to the `GtkListStore`. For information on
/// how to write such a function, see the `GtkListStore` documentation.
///
/// ## Reading data from a `GtkTreeModel`
///
/// ```c
/// enum
/// {
///   STRING_COLUMN,
///   INT_COLUMN,
///   N_COLUMNS
/// };
///
/// ...
///
/// GtkTreeModel *list_store;
/// GtkTreeIter iter;
/// gboolean valid;
/// int row_count = 0;
///
/// // make a new list_store
/// list_store = gtk_list_store_new (N_COLUMNS,
///                                  G_TYPE_STRING,
///                                  G_TYPE_INT);
///
/// // Fill the list store with data
/// populate_model (list_store);
///
/// // Get the first iter in the list, check it is valid and walk
/// // through the list, reading each row.
///
/// valid = gtk_tree_model_get_iter_first (list_store,
///                                        &iter);
/// while (valid)
///  {
///    char *str_data;
///    int    int_data;
///
///    // Make sure you terminate calls to `gtk.TreeModel.get` with a “-1” value
///    gtk_tree_model_get (list_store, &iter,
///                        STRING_COLUMN, &str_data,
///                        INT_COLUMN, &int_data,
///                        -1);
///
///    // Do something with the data
///    g_print ("Row `d`: (`s`,`d`)\n",
///             row_count, str_data, int_data);
///    g_free (str_data);
///
///    valid = gtk_tree_model_iter_next (list_store,
///                                      &iter);
///    row_count++;
///  }
/// ```
///
/// The `GtkTreeModel` interface contains two methods for reference
/// counting: `gtk.TreeModel.refNode` and `gtk.TreeModel.unrefNode`.
/// These two methods are optional to implement. The reference counting
/// is meant as a way for views to let models know when nodes are being
/// displayed. `GtkTreeView` will take a reference on a node when it is
/// visible, which means the node is either in the toplevel or expanded.
/// Being displayed does not mean that the node is currently directly
/// visible to the user in the viewport. Based on this reference counting
/// scheme a caching model, for example, can decide whether or not to cache
/// a node based on the reference count. A file-system based model would
/// not want to keep the entire file hierarchy in memory, but just the
/// folders that are currently expanded in every current view.
///
/// When working with reference counting, the following rules must be taken
/// into account:
///
/// - Never take a reference on a node without owning a reference on its parent.
///   This means that all parent nodes of a referenced node must be referenced
///   as well.
///
/// - Outstanding references on a deleted node are not released. This is not
///   possible because the node has already been deleted by the time the
///   row-deleted signal is received.
///
/// - Models are not obligated to emit a signal on rows of which none of its
///   siblings are referenced. To phrase this differently, signals are only
///   required for levels in which nodes are referenced. For the root level
///   however, signals must be emitted at all times (however the root level
///   is always referenced when any view is attached).
pub const TreeModel = opaque {
    pub const Prerequisites = [_]type{gobject.Object};
    pub const Iface = gtk.TreeModelIface;
    pub const virtual_methods = struct {
        /// Returns the type of the column.
        pub const get_column_type = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_index_: c_int) usize {
                return gobject.ext.as(TreeModel.Iface, p_class).f_get_column_type.?(gobject.ext.as(TreeModel, p_tree_model), p_index_);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_index_: c_int) callconv(.c) usize) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_get_column_type = @ptrCast(p_implementation);
            }
        };

        /// Returns a set of flags supported by this interface.
        ///
        /// The flags are a bitwise combination of `GtkTreeModel`Flags.
        /// The flags supported should not change during the lifetime
        /// of the `tree_model`.
        pub const get_flags = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) gtk.TreeModelFlags {
                return gobject.ext.as(TreeModel.Iface, p_class).f_get_flags.?(gobject.ext.as(TreeModel, p_tree_model));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) gtk.TreeModelFlags) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_get_flags = @ptrCast(p_implementation);
            }
        };

        /// Sets `iter` to a valid iterator pointing to `path`.
        ///
        /// If `path` does not exist, `iter` is set to an invalid
        /// iterator and `FALSE` is returned.
        pub const get_iter = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_get_iter.?(gobject.ext.as(TreeModel, p_tree_model), p_iter, p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_get_iter = @ptrCast(p_implementation);
            }
        };

        /// Returns the number of columns supported by `tree_model`.
        pub const get_n_columns = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_get_n_columns.?(gobject.ext.as(TreeModel, p_tree_model));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_get_n_columns = @ptrCast(p_implementation);
            }
        };

        /// Returns a newly-created `GtkTreePath` referenced by `iter`.
        ///
        /// This path should be freed with `gtk.TreePath.free`.
        pub const get_path = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) *gtk.TreePath {
                return gobject.ext.as(TreeModel.Iface, p_class).f_get_path.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) callconv(.c) *gtk.TreePath) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_get_path = @ptrCast(p_implementation);
            }
        };

        /// Initializes and sets `value` to that at `column`.
        ///
        /// When done with `value`, `gobject.Value.unset` needs to be called
        /// to free any allocated memory.
        pub const get_value = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_column: c_int, p_value: *gobject.Value) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_get_value.?(gobject.ext.as(TreeModel, p_tree_model), p_iter, p_column, p_value);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_column: c_int, p_value: *gobject.Value) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_get_value = @ptrCast(p_implementation);
            }
        };

        /// Sets `iter` to point to the first child of `parent`.
        ///
        /// If `parent` has no children, `FALSE` is returned and `iter` is
        /// set to be invalid. `parent` will remain a valid node after this
        /// function has been called.
        ///
        /// If `parent` is `NULL` returns the first node, equivalent to
        /// `gtk_tree_model_get_iter_first (tree_model, iter);`
        pub const iter_children = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_children.?(gobject.ext.as(TreeModel, p_tree_model), p_iter, p_parent);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_children = @ptrCast(p_implementation);
            }
        };

        /// Returns `TRUE` if `iter` has children, `FALSE` otherwise.
        pub const iter_has_child = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_has_child.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_has_child = @ptrCast(p_implementation);
            }
        };

        /// Returns the number of children that `iter` has.
        ///
        /// As a special case, if `iter` is `NULL`, then the number
        /// of toplevel nodes is returned.
        pub const iter_n_children = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: ?*gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_n_children.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: ?*gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_n_children = @ptrCast(p_implementation);
            }
        };

        /// Sets `iter` to point to the node following it at the current level.
        ///
        /// If there is no next `iter`, `FALSE` is returned and `iter` is set
        /// to be invalid.
        pub const iter_next = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_next.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_next = @ptrCast(p_implementation);
            }
        };

        /// Sets `iter` to be the child of `parent`, using the given index.
        ///
        /// The first index is 0. If `n` is too big, or `parent` has no children,
        /// `iter` is set to an invalid iterator and `FALSE` is returned. `parent`
        /// will remain a valid node after this function has been called. As a
        /// special case, if `parent` is `NULL`, then the `n`-th root node
        /// is set.
        pub const iter_nth_child = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_n: c_int) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_nth_child.?(gobject.ext.as(TreeModel, p_tree_model), p_iter, p_parent, p_n);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_n: c_int) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_nth_child = @ptrCast(p_implementation);
            }
        };

        /// Sets `iter` to be the parent of `child`.
        ///
        /// If `child` is at the toplevel, and doesn’t have a parent, then
        /// `iter` is set to an invalid iterator and `FALSE` is returned.
        /// `child` will remain a valid node after this function has been
        /// called.
        ///
        /// `iter` will be initialized before the lookup is performed, so `child`
        /// and `iter` cannot point to the same memory location.
        pub const iter_parent = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_child: *gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_parent.?(gobject.ext.as(TreeModel, p_tree_model), p_iter, p_child);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter, p_child: *gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_parent = @ptrCast(p_implementation);
            }
        };

        /// Sets `iter` to point to the previous node at the current level.
        ///
        /// If there is no previous `iter`, `FALSE` is returned and `iter` is
        /// set to be invalid.
        pub const iter_previous = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) c_int {
                return gobject.ext.as(TreeModel.Iface, p_class).f_iter_previous.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) callconv(.c) c_int) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_iter_previous = @ptrCast(p_implementation);
            }
        };

        /// Lets the tree ref the node.
        ///
        /// This is an optional method for models to implement.
        /// To be more specific, models may ignore this call as it exists
        /// primarily for performance reasons.
        ///
        /// This function is primarily meant as a way for views to let
        /// caching models know when nodes are being displayed (and hence,
        /// whether or not to cache that node). Being displayed means a node
        /// is in an expanded branch, regardless of whether the node is currently
        /// visible in the viewport. For example, a file-system based model
        /// would not want to keep the entire file-hierarchy in memory,
        /// just the sections that are currently being displayed by
        /// every current view.
        ///
        /// A model should be expected to be able to get an iter independent
        /// of its reffed state.
        pub const ref_node = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_ref_node.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_ref_node = @ptrCast(p_implementation);
            }
        };

        /// Emits the ::row-changed signal on `tree_model`.
        ///
        /// See `gtk.TreeModel.signals.row_changed`.
        pub const row_changed = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_row_changed.?(gobject.ext.as(TreeModel, p_tree_model), p_path, p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_row_changed = @ptrCast(p_implementation);
            }
        };

        /// Emits the ::row-deleted signal on `tree_model`.
        ///
        /// See `gtk.TreeModel.signals.row_deleted`.
        ///
        /// This should be called by models after a row has been removed.
        /// The location pointed to by `path` should be the location that
        /// the row previously was at. It may not be a valid location anymore.
        ///
        /// Nodes that are deleted are not unreffed, this means that any
        /// outstanding references on the deleted node should not be released.
        pub const row_deleted = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_row_deleted.?(gobject.ext.as(TreeModel, p_tree_model), p_path);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_row_deleted = @ptrCast(p_implementation);
            }
        };

        /// Emits the ::row-has-child-toggled signal on `tree_model`.
        ///
        /// See `gtk.TreeModel.signals.row_has_child_toggled`.
        ///
        /// This should be called by models after the child
        /// state of a node changes.
        pub const row_has_child_toggled = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_row_has_child_toggled.?(gobject.ext.as(TreeModel, p_tree_model), p_path, p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_row_has_child_toggled = @ptrCast(p_implementation);
            }
        };

        /// Emits the ::row-inserted signal on `tree_model`.
        ///
        /// See `gtk.TreeModel.signals.row_inserted`.
        pub const row_inserted = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_row_inserted.?(gobject.ext.as(TreeModel, p_tree_model), p_path, p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_row_inserted = @ptrCast(p_implementation);
            }
        };

        /// Emits the ::rows-reordered signal on `tree_model`.
        ///
        /// See `gtk.TreeModel.signals.rows_reordered`.
        ///
        /// This should be called by models when their rows have been
        /// reordered.
        pub const rows_reordered = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_new_order: *c_int) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_rows_reordered.?(gobject.ext.as(TreeModel, p_tree_model), p_path, p_iter, p_new_order);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_new_order: *c_int) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_rows_reordered = @ptrCast(p_implementation);
            }
        };

        /// Lets the tree unref the node.
        ///
        /// This is an optional method for models to implement.
        /// To be more specific, models may ignore this call as it exists
        /// primarily for performance reasons. For more information on what
        /// this means, see `gtk.TreeModel.refNode`.
        ///
        /// Please note that nodes that are deleted are not unreffed.
        pub const unref_node = struct {
            pub fn call(p_class: anytype, p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) void {
                return gobject.ext.as(TreeModel.Iface, p_class).f_unref_node.?(gobject.ext.as(TreeModel, p_tree_model), p_iter);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_tree_model: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_iter: *gtk.TreeIter) callconv(.c) void) void {
                gobject.ext.as(TreeModel.Iface, p_class).f_unref_node = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// This signal is emitted when a row in the model has changed.
        pub const row_changed = struct {
            pub const name = "row-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeModel, p_instance))),
                    gobject.signalLookup("row-changed", TreeModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is emitted when a row has been deleted.
        ///
        /// Note that no iterator is passed to the signal handler,
        /// since the row is already deleted.
        ///
        /// This should be called by models after a row has been removed.
        /// The location pointed to by `path` should be the location that
        /// the row previously was at. It may not be a valid location anymore.
        pub const row_deleted = struct {
            pub const name = "row-deleted";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeModel, p_instance))),
                    gobject.signalLookup("row-deleted", TreeModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is emitted when a row has gotten the first child
        /// row or lost its last child row.
        pub const row_has_child_toggled = struct {
            pub const name = "row-has-child-toggled";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeModel, p_instance))),
                    gobject.signalLookup("row-has-child-toggled", TreeModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is emitted when a new row has been inserted in
        /// the model.
        ///
        /// Note that the row may still be empty at this point, since
        /// it is a common pattern to first insert an empty row, and
        /// then fill it with the desired values.
        pub const row_inserted = struct {
            pub const name = "row-inserted";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeModel, p_instance))),
                    gobject.signalLookup("row-inserted", TreeModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };

        /// This signal is emitted when the children of a node in the
        /// `GtkTreeModel` have been reordered.
        ///
        /// Note that this signal is not emitted
        /// when rows are reordered by DND, since this is implemented
        /// by removing and then reinserting the row.
        pub const rows_reordered = struct {
            pub const name = "rows-reordered";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_new_order: ?*anyopaque, P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeModel, p_instance))),
                    gobject.signalLookup("rows-reordered", TreeModel.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Creates a new `GtkTreeModel`, with `child_model` as the child_model
    /// and `root` as the virtual root.
    extern fn gtk_tree_model_filter_new(p_child_model: *TreeModel, p_root: ?*gtk.TreePath) *gtk.TreeModel;
    pub const filterNew = gtk_tree_model_filter_new;

    /// Calls `func` on each node in model in a depth-first fashion.
    ///
    /// If `func` returns `TRUE`, then the tree ceases to be walked,
    /// and `gtk.TreeModel.foreach` returns.
    extern fn gtk_tree_model_foreach(p_model: *TreeModel, p_func: gtk.TreeModelForeachFunc, p_user_data: ?*anyopaque) void;
    pub const foreach = gtk_tree_model_foreach;

    /// Gets the value of one or more cells in the row referenced by `iter`.
    ///
    /// The variable argument list should contain integer column numbers,
    /// each column number followed by a place to store the value being
    /// retrieved.  The list is terminated by a -1. For example, to get a
    /// value from column 0 with type `G_TYPE_STRING`, you would
    /// write: `gtk_tree_model_get (model, iter, 0, &place_string_here, -1)`,
    /// where `place_string_here` is a `gchararray`
    /// to be filled with the string.
    ///
    /// Returned values with type `G_TYPE_OBJECT` have to be unreferenced,
    /// values with type `G_TYPE_STRING` or `G_TYPE_BOXED` have to be freed.
    /// Other values are passed by value.
    extern fn gtk_tree_model_get(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, ...) void;
    pub const get = gtk_tree_model_get;

    /// Returns the type of the column.
    extern fn gtk_tree_model_get_column_type(p_tree_model: *TreeModel, p_index_: c_int) usize;
    pub const getColumnType = gtk_tree_model_get_column_type;

    /// Returns a set of flags supported by this interface.
    ///
    /// The flags are a bitwise combination of `GtkTreeModel`Flags.
    /// The flags supported should not change during the lifetime
    /// of the `tree_model`.
    extern fn gtk_tree_model_get_flags(p_tree_model: *TreeModel) gtk.TreeModelFlags;
    pub const getFlags = gtk_tree_model_get_flags;

    /// Sets `iter` to a valid iterator pointing to `path`.
    ///
    /// If `path` does not exist, `iter` is set to an invalid
    /// iterator and `FALSE` is returned.
    extern fn gtk_tree_model_get_iter(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) c_int;
    pub const getIter = gtk_tree_model_get_iter;

    /// Initializes `iter` with the first iterator in the tree
    /// (the one at the path "0").
    ///
    /// Returns `FALSE` if the tree is empty, `TRUE` otherwise.
    extern fn gtk_tree_model_get_iter_first(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) c_int;
    pub const getIterFirst = gtk_tree_model_get_iter_first;

    /// Sets `iter` to a valid iterator pointing to `path_string`, if it
    /// exists.
    ///
    /// Otherwise, `iter` is left invalid and `FALSE` is returned.
    extern fn gtk_tree_model_get_iter_from_string(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_path_string: [*:0]const u8) c_int;
    pub const getIterFromString = gtk_tree_model_get_iter_from_string;

    /// Returns the number of columns supported by `tree_model`.
    extern fn gtk_tree_model_get_n_columns(p_tree_model: *TreeModel) c_int;
    pub const getNColumns = gtk_tree_model_get_n_columns;

    /// Returns a newly-created `GtkTreePath` referenced by `iter`.
    ///
    /// This path should be freed with `gtk.TreePath.free`.
    extern fn gtk_tree_model_get_path(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) *gtk.TreePath;
    pub const getPath = gtk_tree_model_get_path;

    /// Generates a string representation of the iter.
    ///
    /// This string is a “:” separated list of numbers.
    /// For example, “4:10:0:3” would be an acceptable
    /// return value for this string.
    extern fn gtk_tree_model_get_string_from_iter(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) ?[*:0]u8;
    pub const getStringFromIter = gtk_tree_model_get_string_from_iter;

    /// Gets the value of one or more cells in the row referenced by `iter`.
    ///
    /// See `gtk.TreeModel.get`, this version takes a va_list
    /// for language bindings to use.
    extern fn gtk_tree_model_get_valist(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_var_args: std.builtin.VaList) void;
    pub const getValist = gtk_tree_model_get_valist;

    /// Initializes and sets `value` to that at `column`.
    ///
    /// When done with `value`, `gobject.Value.unset` needs to be called
    /// to free any allocated memory.
    extern fn gtk_tree_model_get_value(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_column: c_int, p_value: *gobject.Value) void;
    pub const getValue = gtk_tree_model_get_value;

    /// Sets `iter` to point to the first child of `parent`.
    ///
    /// If `parent` has no children, `FALSE` is returned and `iter` is
    /// set to be invalid. `parent` will remain a valid node after this
    /// function has been called.
    ///
    /// If `parent` is `NULL` returns the first node, equivalent to
    /// `gtk_tree_model_get_iter_first (tree_model, iter);`
    extern fn gtk_tree_model_iter_children(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter) c_int;
    pub const iterChildren = gtk_tree_model_iter_children;

    /// Returns `TRUE` if `iter` has children, `FALSE` otherwise.
    extern fn gtk_tree_model_iter_has_child(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) c_int;
    pub const iterHasChild = gtk_tree_model_iter_has_child;

    /// Returns the number of children that `iter` has.
    ///
    /// As a special case, if `iter` is `NULL`, then the number
    /// of toplevel nodes is returned.
    extern fn gtk_tree_model_iter_n_children(p_tree_model: *TreeModel, p_iter: ?*gtk.TreeIter) c_int;
    pub const iterNChildren = gtk_tree_model_iter_n_children;

    /// Sets `iter` to point to the node following it at the current level.
    ///
    /// If there is no next `iter`, `FALSE` is returned and `iter` is set
    /// to be invalid.
    extern fn gtk_tree_model_iter_next(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) c_int;
    pub const iterNext = gtk_tree_model_iter_next;

    /// Sets `iter` to be the child of `parent`, using the given index.
    ///
    /// The first index is 0. If `n` is too big, or `parent` has no children,
    /// `iter` is set to an invalid iterator and `FALSE` is returned. `parent`
    /// will remain a valid node after this function has been called. As a
    /// special case, if `parent` is `NULL`, then the `n`-th root node
    /// is set.
    extern fn gtk_tree_model_iter_nth_child(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_n: c_int) c_int;
    pub const iterNthChild = gtk_tree_model_iter_nth_child;

    /// Sets `iter` to be the parent of `child`.
    ///
    /// If `child` is at the toplevel, and doesn’t have a parent, then
    /// `iter` is set to an invalid iterator and `FALSE` is returned.
    /// `child` will remain a valid node after this function has been
    /// called.
    ///
    /// `iter` will be initialized before the lookup is performed, so `child`
    /// and `iter` cannot point to the same memory location.
    extern fn gtk_tree_model_iter_parent(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter, p_child: *gtk.TreeIter) c_int;
    pub const iterParent = gtk_tree_model_iter_parent;

    /// Sets `iter` to point to the previous node at the current level.
    ///
    /// If there is no previous `iter`, `FALSE` is returned and `iter` is
    /// set to be invalid.
    extern fn gtk_tree_model_iter_previous(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) c_int;
    pub const iterPrevious = gtk_tree_model_iter_previous;

    /// Lets the tree ref the node.
    ///
    /// This is an optional method for models to implement.
    /// To be more specific, models may ignore this call as it exists
    /// primarily for performance reasons.
    ///
    /// This function is primarily meant as a way for views to let
    /// caching models know when nodes are being displayed (and hence,
    /// whether or not to cache that node). Being displayed means a node
    /// is in an expanded branch, regardless of whether the node is currently
    /// visible in the viewport. For example, a file-system based model
    /// would not want to keep the entire file-hierarchy in memory,
    /// just the sections that are currently being displayed by
    /// every current view.
    ///
    /// A model should be expected to be able to get an iter independent
    /// of its reffed state.
    extern fn gtk_tree_model_ref_node(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) void;
    pub const refNode = gtk_tree_model_ref_node;

    /// Emits the ::row-changed signal on `tree_model`.
    ///
    /// See `gtk.TreeModel.signals.row_changed`.
    extern fn gtk_tree_model_row_changed(p_tree_model: *TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) void;
    pub const rowChanged = gtk_tree_model_row_changed;

    /// Emits the ::row-deleted signal on `tree_model`.
    ///
    /// See `gtk.TreeModel.signals.row_deleted`.
    ///
    /// This should be called by models after a row has been removed.
    /// The location pointed to by `path` should be the location that
    /// the row previously was at. It may not be a valid location anymore.
    ///
    /// Nodes that are deleted are not unreffed, this means that any
    /// outstanding references on the deleted node should not be released.
    extern fn gtk_tree_model_row_deleted(p_tree_model: *TreeModel, p_path: *gtk.TreePath) void;
    pub const rowDeleted = gtk_tree_model_row_deleted;

    /// Emits the ::row-has-child-toggled signal on `tree_model`.
    ///
    /// See `gtk.TreeModel.signals.row_has_child_toggled`.
    ///
    /// This should be called by models after the child
    /// state of a node changes.
    extern fn gtk_tree_model_row_has_child_toggled(p_tree_model: *TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) void;
    pub const rowHasChildToggled = gtk_tree_model_row_has_child_toggled;

    /// Emits the ::row-inserted signal on `tree_model`.
    ///
    /// See `gtk.TreeModel.signals.row_inserted`.
    extern fn gtk_tree_model_row_inserted(p_tree_model: *TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) void;
    pub const rowInserted = gtk_tree_model_row_inserted;

    /// Emits the ::rows-reordered signal on `tree_model`.
    ///
    /// See `gtk.TreeModel.signals.rows_reordered`.
    ///
    /// This should be called by models when their rows have been
    /// reordered.
    extern fn gtk_tree_model_rows_reordered(p_tree_model: *TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_new_order: *c_int) void;
    pub const rowsReordered = gtk_tree_model_rows_reordered;

    /// Emits the ::rows-reordered signal on `tree_model`.
    ///
    /// See `gtk.TreeModel.signals.rows_reordered`.
    ///
    /// This should be called by models when their rows have been
    /// reordered.
    extern fn gtk_tree_model_rows_reordered_with_length(p_tree_model: *TreeModel, p_path: *gtk.TreePath, p_iter: ?*gtk.TreeIter, p_new_order: [*]c_int, p_length: c_int) void;
    pub const rowsReorderedWithLength = gtk_tree_model_rows_reordered_with_length;

    /// Lets the tree unref the node.
    ///
    /// This is an optional method for models to implement.
    /// To be more specific, models may ignore this call as it exists
    /// primarily for performance reasons. For more information on what
    /// this means, see `gtk.TreeModel.refNode`.
    ///
    /// Please note that nodes that are deleted are not unreffed.
    extern fn gtk_tree_model_unref_node(p_tree_model: *TreeModel, p_iter: *gtk.TreeIter) void;
    pub const unrefNode = gtk_tree_model_unref_node;

    extern fn gtk_tree_model_get_type() usize;
    pub const getGObjectType = gtk_tree_model_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeModel) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeModel) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeModel, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The interface for sortable models used by GtkTreeView
///
/// `GtkTreeSortable` is an interface to be implemented by tree models which
/// support sorting. The `GtkTreeView` uses the methods provided by this interface
/// to sort the model.
pub const TreeSortable = opaque {
    pub const Prerequisites = [_]type{gtk.TreeModel};
    pub const Iface = gtk.TreeSortableIface;
    pub const virtual_methods = struct {
        /// Fills in `sort_column_id` and `order` with the current sort column and the
        /// order. It returns `TRUE` unless the `sort_column_id` is
        /// `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID` or
        /// `GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID`.
        pub const get_sort_column_id = struct {
            pub fn call(p_class: anytype, p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_column_id: *c_int, p_order: *gtk.SortType) c_int {
                return gobject.ext.as(TreeSortable.Iface, p_class).f_get_sort_column_id.?(gobject.ext.as(TreeSortable, p_sortable), p_sort_column_id, p_order);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_column_id: *c_int, p_order: *gtk.SortType) callconv(.c) c_int) void {
                gobject.ext.as(TreeSortable.Iface, p_class).f_get_sort_column_id = @ptrCast(p_implementation);
            }
        };

        /// Returns `TRUE` if the model has a default sort function. This is used
        /// primarily by GtkTreeViewColumns in order to determine if a model can
        /// go back to the default state, or not.
        pub const has_default_sort_func = struct {
            pub fn call(p_class: anytype, p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) c_int {
                return gobject.ext.as(TreeSortable.Iface, p_class).f_has_default_sort_func.?(gobject.ext.as(TreeSortable, p_sortable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) c_int) void {
                gobject.ext.as(TreeSortable.Iface, p_class).f_has_default_sort_func = @ptrCast(p_implementation);
            }
        };

        /// Sets the default comparison function used when sorting to be `sort_func`.
        /// If the current sort column id of `sortable` is
        /// `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`, then the model will sort using
        /// this function.
        ///
        /// If `sort_func` is `NULL`, then there will be no default comparison function.
        /// This means that once the model  has been sorted, it can’t go back to the
        /// default state. In this case, when the current sort column id of `sortable`
        /// is `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`, the model will be unsorted.
        pub const set_default_sort_func = struct {
            pub fn call(p_class: anytype, p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void {
                return gobject.ext.as(TreeSortable.Iface, p_class).f_set_default_sort_func.?(gobject.ext.as(TreeSortable, p_sortable), p_sort_func, p_user_data, p_destroy);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void) void {
                gobject.ext.as(TreeSortable.Iface, p_class).f_set_default_sort_func = @ptrCast(p_implementation);
            }
        };

        /// Sets the current sort column to be `sort_column_id`. The `sortable` will
        /// resort itself to reflect this change, after emitting a
        /// `GtkTreeSortable::sort-column-changed` signal. `sort_column_id` may either be
        /// a regular column id, or one of the following special values:
        ///
        /// - `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`: the default sort function
        ///   will be used, if it is set
        ///
        /// - `GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID`: no sorting will occur
        pub const set_sort_column_id = struct {
            pub fn call(p_class: anytype, p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_column_id: c_int, p_order: gtk.SortType) void {
                return gobject.ext.as(TreeSortable.Iface, p_class).f_set_sort_column_id.?(gobject.ext.as(TreeSortable, p_sortable), p_sort_column_id, p_order);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_column_id: c_int, p_order: gtk.SortType) callconv(.c) void) void {
                gobject.ext.as(TreeSortable.Iface, p_class).f_set_sort_column_id = @ptrCast(p_implementation);
            }
        };

        /// Sets the comparison function used when sorting to be `sort_func`. If the
        /// current sort column id of `sortable` is the same as `sort_column_id`, then
        /// the model will sort using this function.
        pub const set_sort_func = struct {
            pub fn call(p_class: anytype, p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_column_id: c_int, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void {
                return gobject.ext.as(TreeSortable.Iface, p_class).f_set_sort_func.?(gobject.ext.as(TreeSortable, p_sortable), p_sort_column_id, p_sort_func, p_user_data, p_destroy);
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance, p_sort_column_id: c_int, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void) void {
                gobject.ext.as(TreeSortable.Iface, p_class).f_set_sort_func = @ptrCast(p_implementation);
            }
        };

        /// Emits a `GtkTreeSortable::sort-column-changed` signal on `sortable`.
        pub const sort_column_changed = struct {
            pub fn call(p_class: anytype, p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) void {
                return gobject.ext.as(TreeSortable.Iface, p_class).f_sort_column_changed.?(gobject.ext.as(TreeSortable, p_sortable));
            }

            pub fn implement(p_class: anytype, p_implementation: *const fn (p_sortable: *@typeInfo(@TypeOf(p_class)).pointer.child.Instance) callconv(.c) void) void {
                gobject.ext.as(TreeSortable.Iface, p_class).f_sort_column_changed = @ptrCast(p_implementation);
            }
        };
    };

    pub const properties = struct {};

    pub const signals = struct {
        /// The ::sort-column-changed signal is emitted when the sort column
        /// or sort order of `sortable` is changed. The signal is emitted before
        /// the contents of `sortable` are resorted.
        pub const sort_column_changed = struct {
            pub const name = "sort-column-changed";

            pub fn connect(p_instance: anytype, comptime P_Data: type, p_callback: *const fn (@TypeOf(p_instance), P_Data) callconv(.c) void, p_data: P_Data, p_options: gobject.ext.ConnectSignalOptions(P_Data)) c_ulong {
                return gobject.signalConnectClosureById(
                    @ptrCast(@alignCast(gobject.ext.as(TreeSortable, p_instance))),
                    gobject.signalLookup("sort-column-changed", TreeSortable.getGObjectType()),
                    glib.quarkFromString(p_options.detail orelse null),
                    gobject.CClosure.new(@ptrCast(p_callback), p_data, @ptrCast(p_options.destroyData)),
                    @intFromBool(p_options.after),
                );
            }
        };
    };

    /// Fills in `sort_column_id` and `order` with the current sort column and the
    /// order. It returns `TRUE` unless the `sort_column_id` is
    /// `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID` or
    /// `GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID`.
    extern fn gtk_tree_sortable_get_sort_column_id(p_sortable: *TreeSortable, p_sort_column_id: *c_int, p_order: *gtk.SortType) c_int;
    pub const getSortColumnId = gtk_tree_sortable_get_sort_column_id;

    /// Returns `TRUE` if the model has a default sort function. This is used
    /// primarily by GtkTreeViewColumns in order to determine if a model can
    /// go back to the default state, or not.
    extern fn gtk_tree_sortable_has_default_sort_func(p_sortable: *TreeSortable) c_int;
    pub const hasDefaultSortFunc = gtk_tree_sortable_has_default_sort_func;

    /// Sets the default comparison function used when sorting to be `sort_func`.
    /// If the current sort column id of `sortable` is
    /// `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`, then the model will sort using
    /// this function.
    ///
    /// If `sort_func` is `NULL`, then there will be no default comparison function.
    /// This means that once the model  has been sorted, it can’t go back to the
    /// default state. In this case, when the current sort column id of `sortable`
    /// is `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`, the model will be unsorted.
    extern fn gtk_tree_sortable_set_default_sort_func(p_sortable: *TreeSortable, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setDefaultSortFunc = gtk_tree_sortable_set_default_sort_func;

    /// Sets the current sort column to be `sort_column_id`. The `sortable` will
    /// resort itself to reflect this change, after emitting a
    /// `GtkTreeSortable::sort-column-changed` signal. `sort_column_id` may either be
    /// a regular column id, or one of the following special values:
    ///
    /// - `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`: the default sort function
    ///   will be used, if it is set
    ///
    /// - `GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID`: no sorting will occur
    extern fn gtk_tree_sortable_set_sort_column_id(p_sortable: *TreeSortable, p_sort_column_id: c_int, p_order: gtk.SortType) void;
    pub const setSortColumnId = gtk_tree_sortable_set_sort_column_id;

    /// Sets the comparison function used when sorting to be `sort_func`. If the
    /// current sort column id of `sortable` is the same as `sort_column_id`, then
    /// the model will sort using this function.
    extern fn gtk_tree_sortable_set_sort_func(p_sortable: *TreeSortable, p_sort_column_id: c_int, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) void;
    pub const setSortFunc = gtk_tree_sortable_set_sort_func;

    /// Emits a `GtkTreeSortable::sort-column-changed` signal on `sortable`.
    extern fn gtk_tree_sortable_sort_column_changed(p_sortable: *TreeSortable) void;
    pub const sortColumnChanged = gtk_tree_sortable_sort_column_changed;

    extern fn gtk_tree_sortable_get_type() usize;
    pub const getGObjectType = gtk_tree_sortable_get_type;

    extern fn g_object_ref(p_self: *gtk.TreeSortable) void;
    pub const ref = g_object_ref;

    extern fn g_object_unref(p_self: *gtk.TreeSortable) void;
    pub const unref = g_object_unref;

    pub fn as(p_instance: *TreeSortable, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ATContextClass = opaque {
    pub const Instance = gtk.ATContext;

    pub fn as(p_instance: *ATContextClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const AccessibleHyperlinkClass = extern struct {
    pub const Instance = gtk.AccessibleHyperlink;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *AccessibleHyperlinkClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The interface vtable for accessible objects containing links.
pub const AccessibleHypertextInterface = extern struct {
    pub const Instance = gtk.AccessibleHypertext;

    f_g_iface: gobject.TypeInterface,
    f_get_n_links: ?*const fn (p_self: *gtk.AccessibleHypertext) callconv(.c) c_uint,
    f_get_link: ?*const fn (p_self: *gtk.AccessibleHypertext, p_index: c_uint) callconv(.c) *gtk.AccessibleHyperlink,
    f_get_link_at: ?*const fn (p_self: *gtk.AccessibleHypertext, p_offset: c_uint) callconv(.c) c_uint,

    pub fn as(p_instance: *AccessibleHypertextInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The common interface for accessible objects.
pub const AccessibleInterface = extern struct {
    pub const Instance = gtk.Accessible;

    f_g_iface: gobject.TypeInterface,
    /// retrieve the platform-specific accessibility context
    ///   for the accessible implementation
    f_get_at_context: ?*const fn (p_self: *gtk.Accessible) callconv(.c) ?*gtk.ATContext,
    /// retrieve the accessible state
    f_get_platform_state: ?*const fn (p_self: *gtk.Accessible, p_state: gtk.AccessiblePlatformState) callconv(.c) c_int,
    f_get_accessible_parent: ?*const fn (p_self: *gtk.Accessible) callconv(.c) ?*gtk.Accessible,
    f_get_first_accessible_child: ?*const fn (p_self: *gtk.Accessible) callconv(.c) ?*gtk.Accessible,
    f_get_next_accessible_sibling: ?*const fn (p_self: *gtk.Accessible) callconv(.c) ?*gtk.Accessible,
    f_get_bounds: ?*const fn (p_self: *gtk.Accessible, p_x: *c_int, p_y: *c_int, p_width: *c_int, p_height: *c_int) callconv(.c) c_int,
    f_get_accessible_id: ?*const fn (p_self: *gtk.Accessible) callconv(.c) ?[*:0]u8,

    pub fn as(p_instance: *AccessibleInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Wraps a list of references to `gtk.Accessible` objects.
pub const AccessibleList = opaque {
    /// Allocates a new list of accessible objects.
    extern fn gtk_accessible_list_new_from_array(p_accessibles: [*]*gtk.Accessible, p_n_accessibles: usize) *gtk.AccessibleList;
    pub const newFromArray = gtk_accessible_list_new_from_array;

    /// Allocates a new `GtkAccessibleList`, doing a shallow copy
    /// of the passed list of accessible objects
    extern fn gtk_accessible_list_new_from_list(p_list: *glib.List) *gtk.AccessibleList;
    pub const newFromList = gtk_accessible_list_new_from_list;

    /// Gets the list of objects this boxed type holds.
    extern fn gtk_accessible_list_get_objects(p_accessible_list: *AccessibleList) *glib.List;
    pub const getObjects = gtk_accessible_list_get_objects;

    extern fn gtk_accessible_list_get_type() usize;
    pub const getGObjectType = gtk_accessible_list_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const AccessibleRangeInterface = extern struct {
    pub const Instance = gtk.AccessibleRange;

    f_g_iface: gobject.TypeInterface,
    f_set_current_value: ?*const fn (p_self: *gtk.AccessibleRange, p_value: f64) callconv(.c) c_int,

    pub fn as(p_instance: *AccessibleRangeInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The interface vtable for accessible objects containing text.
pub const AccessibleTextInterface = extern struct {
    pub const Instance = gtk.AccessibleText;

    f_g_iface: gobject.TypeInterface,
    f_get_contents: ?*const fn (p_self: *gtk.AccessibleText, p_start: c_uint, p_end: c_uint) callconv(.c) *glib.Bytes,
    f_get_contents_at: ?*const fn (p_self: *gtk.AccessibleText, p_offset: c_uint, p_granularity: gtk.AccessibleTextGranularity, p_start: *c_uint, p_end: *c_uint) callconv(.c) *glib.Bytes,
    f_get_caret_position: ?*const fn (p_self: *gtk.AccessibleText) callconv(.c) c_uint,
    f_get_selection: ?*const fn (p_self: *gtk.AccessibleText, p_n_ranges: *usize, p_ranges: ?*[*]gtk.AccessibleTextRange) callconv(.c) c_int,
    f_get_attributes: ?*const fn (p_self: *gtk.AccessibleText, p_offset: c_uint, p_n_ranges: *usize, p_ranges: ?*[*]gtk.AccessibleTextRange, p_attribute_names: ?*[*][*:0]u8, p_attribute_values: ?*[*][*:0]u8) callconv(.c) c_int,
    f_get_default_attributes: ?*const fn (p_self: *gtk.AccessibleText, p_attribute_names: ?*[*][*:0]u8, p_attribute_values: ?*[*][*:0]u8) callconv(.c) void,
    f_get_extents: ?*const fn (p_self: *gtk.AccessibleText, p_start: c_uint, p_end: c_uint, p_extents: *graphene.Rect) callconv(.c) c_int,
    f_get_offset: ?*const fn (p_self: *gtk.AccessibleText, p_point: *const graphene.Point, p_offset: *c_uint) callconv(.c) c_int,
    f_set_caret_position: ?*const fn (p_self: *gtk.AccessibleText, p_offset: c_uint) callconv(.c) c_int,
    f_set_selection: ?*const fn (p_self: *gtk.AccessibleText, p_i: usize, p_range: *gtk.AccessibleTextRange) callconv(.c) c_int,

    pub fn as(p_instance: *AccessibleTextInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A range inside the text of an accessible object.
pub const AccessibleTextRange = extern struct {
    /// the start of the range, in characters
    f_start: usize,
    /// the length of the range, in characters
    f_length: usize,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The interface vtable for `GtkActionable`.
pub const ActionableInterface = extern struct {
    pub const Instance = gtk.Actionable;

    f_g_iface: gobject.TypeInterface,
    /// virtual function for `Actionable.getActionName`
    f_get_action_name: ?*const fn (p_actionable: *gtk.Actionable) callconv(.c) ?[*:0]const u8,
    /// virtual function for `Actionable.setActionName`
    f_set_action_name: ?*const fn (p_actionable: *gtk.Actionable, p_action_name: ?[*:0]const u8) callconv(.c) void,
    /// virtual function for `Actionable.getActionTargetValue`
    f_get_action_target_value: ?*const fn (p_actionable: *gtk.Actionable) callconv(.c) ?*glib.Variant,
    /// virtual function for `Actionable.setActionTargetValue`
    f_set_action_target_value: ?*const fn (p_actionable: *gtk.Actionable, p_target_value: ?*glib.Variant) callconv(.c) void,

    pub fn as(p_instance: *ActionableInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ActivateActionClass = opaque {
    pub const Instance = gtk.ActivateAction;

    pub fn as(p_instance: *ActivateActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const AdjustmentClass = extern struct {
    pub const Instance = gtk.Adjustment;

    f_parent_class: gobject.InitiallyUnownedClass,
    f_changed: ?*const fn (p_adjustment: *gtk.Adjustment) callconv(.c) void,
    f_value_changed: ?*const fn (p_adjustment: *gtk.Adjustment) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *AdjustmentClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const AlertDialogClass = extern struct {
    pub const Instance = gtk.AlertDialog;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *AlertDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const AlternativeTriggerClass = opaque {
    pub const Instance = gtk.AlternativeTrigger;

    pub fn as(p_instance: *AlternativeTriggerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const AnyFilterClass = opaque {
    pub const Instance = gtk.AnyFilter;

    pub fn as(p_instance: *AnyFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ApplicationClass = extern struct {
    pub const Instance = gtk.Application;

    /// The parent class.
    f_parent_class: gio.ApplicationClass,
    /// Signal emitted when a `GtkWindow` is added to
    ///    application through `gtk.Application.addWindow`.
    f_window_added: ?*const fn (p_application: *gtk.Application, p_window: *gtk.Window) callconv(.c) void,
    /// Signal emitted when a `GtkWindow` is removed from
    ///    application, either as a side-effect of being destroyed or
    ///    explicitly through `gtk.Application.removeWindow`.
    f_window_removed: ?*const fn (p_application: *gtk.Application, p_window: *gtk.Window) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ApplicationClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ApplicationWindowClass = extern struct {
    pub const Instance = gtk.ApplicationWindow;

    /// The parent class.
    f_parent_class: gtk.WindowClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ApplicationWindowClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BinLayoutClass = extern struct {
    pub const Instance = gtk.BinLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *BinLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A set of unsigned integers.
///
/// Another name for this data structure is “bitmap”.
///
/// The current implementation is based on [roaring bitmaps](https://roaringbitmap.org/).
///
/// A bitset allows adding a set of integers and provides support for set operations
/// like unions, intersections and checks for equality or if a value is contained
/// in the set. `GtkBitset` also contains various functions to query metadata about
/// the bitset, such as the minimum or maximum values or its size.
///
/// The fastest way to iterate values in a bitset is `gtk.BitsetIter`.
///
/// The main use case for `GtkBitset` is implementing complex selections for
/// `gtk.SelectionModel`.
pub const Bitset = opaque {
    /// Creates a new empty bitset.
    extern fn gtk_bitset_new_empty() *gtk.Bitset;
    pub const newEmpty = gtk_bitset_new_empty;

    /// Creates a bitset with the given range set.
    extern fn gtk_bitset_new_range(p_start: c_uint, p_n_items: c_uint) *gtk.Bitset;
    pub const newRange = gtk_bitset_new_range;

    /// Adds `value` to `self` if it wasn't part of it before.
    extern fn gtk_bitset_add(p_self: *Bitset, p_value: c_uint) c_int;
    pub const add = gtk_bitset_add;

    /// Adds all values from `start` (inclusive) to `start` + `n_items`
    /// (exclusive) in `self`.
    extern fn gtk_bitset_add_range(p_self: *Bitset, p_start: c_uint, p_n_items: c_uint) void;
    pub const addRange = gtk_bitset_add_range;

    /// Adds the closed range [`first`, `last`], so `first`, `last` and all
    /// values in between. `first` must be smaller than `last`.
    extern fn gtk_bitset_add_range_closed(p_self: *Bitset, p_first: c_uint, p_last: c_uint) void;
    pub const addRangeClosed = gtk_bitset_add_range_closed;

    /// Interprets the values as a 2-dimensional boolean grid with the given `stride`
    /// and inside that grid, adds a rectangle with the given `width` and `height`.
    extern fn gtk_bitset_add_rectangle(p_self: *Bitset, p_start: c_uint, p_width: c_uint, p_height: c_uint, p_stride: c_uint) void;
    pub const addRectangle = gtk_bitset_add_rectangle;

    /// Checks if the given `value` has been added to `self`
    extern fn gtk_bitset_contains(p_self: *const Bitset, p_value: c_uint) c_int;
    pub const contains = gtk_bitset_contains;

    /// Creates a copy of `self`.
    extern fn gtk_bitset_copy(p_self: *const Bitset) *gtk.Bitset;
    pub const copy = gtk_bitset_copy;

    /// Sets `self` to be the symmetric difference of `self` and `other`.
    ///
    /// The symmetric difference is set `self` to contain all values that
    /// were either contained in `self` or in `other`, but not in both.
    /// This operation is also called an XOR.
    ///
    /// It is allowed for `self` and `other` to be the same bitset. The bitset
    /// will be emptied in that case.
    extern fn gtk_bitset_difference(p_self: *Bitset, p_other: *const gtk.Bitset) void;
    pub const difference = gtk_bitset_difference;

    /// Returns `TRUE` if `self` and `other` contain the same values.
    extern fn gtk_bitset_equals(p_self: *const Bitset, p_other: *const gtk.Bitset) c_int;
    pub const equals = gtk_bitset_equals;

    /// Returns the largest value in `self`.
    ///
    /// If `self` is empty, 0 is returned.
    extern fn gtk_bitset_get_maximum(p_self: *const Bitset) c_uint;
    pub const getMaximum = gtk_bitset_get_maximum;

    /// Returns the smallest value in `self`.
    ///
    /// If `self` is empty, `G_MAXUINT` is returned.
    extern fn gtk_bitset_get_minimum(p_self: *const Bitset) c_uint;
    pub const getMinimum = gtk_bitset_get_minimum;

    /// Returns the value of the `nth` item in self.
    ///
    /// If `nth` is >= the size of `self`, 0 is returned.
    extern fn gtk_bitset_get_nth(p_self: *const Bitset, p_nth: c_uint) c_uint;
    pub const getNth = gtk_bitset_get_nth;

    /// Gets the number of values that were added to the set.
    ///
    /// For example, if the set is empty, 0 is returned.
    ///
    /// Note that this function returns a `guint64`, because when all
    /// values are set, the return value is `G_MAXUINT + 1`. Unless you
    /// are sure this cannot happen (it can't with `GListModel`), be sure
    /// to use a 64bit type.
    extern fn gtk_bitset_get_size(p_self: *const Bitset) u64;
    pub const getSize = gtk_bitset_get_size;

    /// Gets the number of values that are part of the set from `first` to `last`
    /// (inclusive).
    ///
    /// Note that this function returns a `guint64`, because when all values are
    /// set, the return value is `G_MAXUINT + 1`. Unless you are sure this cannot
    /// happen (it can't with `GListModel`), be sure to use a 64bit type.
    extern fn gtk_bitset_get_size_in_range(p_self: *const Bitset, p_first: c_uint, p_last: c_uint) u64;
    pub const getSizeInRange = gtk_bitset_get_size_in_range;

    /// Sets `self` to be the intersection of `self` and `other`.
    ///
    /// In other words, remove all values from `self` that are not part of `other`.
    ///
    /// It is allowed for `self` and `other` to be the same bitset. Nothing will
    /// happen in that case.
    extern fn gtk_bitset_intersect(p_self: *Bitset, p_other: *const gtk.Bitset) void;
    pub const intersect = gtk_bitset_intersect;

    /// Check if no value is contained in bitset.
    extern fn gtk_bitset_is_empty(p_self: *const Bitset) c_int;
    pub const isEmpty = gtk_bitset_is_empty;

    /// Acquires a reference on the given `GtkBitset`.
    extern fn gtk_bitset_ref(p_self: *Bitset) *gtk.Bitset;
    pub const ref = gtk_bitset_ref;

    /// Removes `value` from `self` if it was part of it before.
    extern fn gtk_bitset_remove(p_self: *Bitset, p_value: c_uint) c_int;
    pub const remove = gtk_bitset_remove;

    /// Removes all values from the bitset so that it is empty again.
    extern fn gtk_bitset_remove_all(p_self: *Bitset) void;
    pub const removeAll = gtk_bitset_remove_all;

    /// Removes all values from `start` (inclusive) to `start` + `n_items` (exclusive)
    /// in `self`.
    extern fn gtk_bitset_remove_range(p_self: *Bitset, p_start: c_uint, p_n_items: c_uint) void;
    pub const removeRange = gtk_bitset_remove_range;

    /// Removes the closed range [`first`, `last`], so `first`, `last` and all
    /// values in between. `first` must be smaller than `last`.
    extern fn gtk_bitset_remove_range_closed(p_self: *Bitset, p_first: c_uint, p_last: c_uint) void;
    pub const removeRangeClosed = gtk_bitset_remove_range_closed;

    /// Interprets the values as a 2-dimensional boolean grid with the given `stride`
    /// and inside that grid, removes a rectangle with the given `width` and `height`.
    extern fn gtk_bitset_remove_rectangle(p_self: *Bitset, p_start: c_uint, p_width: c_uint, p_height: c_uint, p_stride: c_uint) void;
    pub const removeRectangle = gtk_bitset_remove_rectangle;

    /// Shifts all values in `self` to the left by `amount`.
    ///
    /// Values smaller than `amount` are discarded.
    extern fn gtk_bitset_shift_left(p_self: *Bitset, p_amount: c_uint) void;
    pub const shiftLeft = gtk_bitset_shift_left;

    /// Shifts all values in `self` to the right by `amount`.
    ///
    /// Values that end up too large to be held in a `guint` are discarded.
    extern fn gtk_bitset_shift_right(p_self: *Bitset, p_amount: c_uint) void;
    pub const shiftRight = gtk_bitset_shift_right;

    /// This is a support function for `GListModel` handling, by mirroring
    /// the `GlistModel::items-changed` signal.
    ///
    /// First, it "cuts" the values from `position` to `removed` from
    /// the bitset. That is, it removes all those values and shifts
    /// all larger values to the left by `removed` places.
    ///
    /// Then, it "pastes" new room into the bitset by shifting all values
    /// larger than `position` by `added` spaces to the right. This frees
    /// up space that can then be filled.
    extern fn gtk_bitset_splice(p_self: *Bitset, p_position: c_uint, p_removed: c_uint, p_added: c_uint) void;
    pub const splice = gtk_bitset_splice;

    /// Sets `self` to be the subtraction of `other` from `self`.
    ///
    /// In other words, remove all values from `self` that are part of `other`.
    ///
    /// It is allowed for `self` and `other` to be the same bitset. The bitset
    /// will be emptied in that case.
    extern fn gtk_bitset_subtract(p_self: *Bitset, p_other: *const gtk.Bitset) void;
    pub const subtract = gtk_bitset_subtract;

    /// Sets `self` to be the union of `self` and `other`.
    ///
    /// That is, add all values from `other` into `self` that weren't part of it.
    ///
    /// It is allowed for `self` and `other` to be the same bitset. Nothing will
    /// happen in that case.
    extern fn gtk_bitset_union(p_self: *Bitset, p_other: *const gtk.Bitset) void;
    pub const @"union" = gtk_bitset_union;

    /// Releases a reference on the given `GtkBitset`.
    ///
    /// If the reference was the last, the resources associated to the `self` are
    /// freed.
    extern fn gtk_bitset_unref(p_self: *Bitset) void;
    pub const unref = gtk_bitset_unref;

    extern fn gtk_bitset_get_type() usize;
    pub const getGObjectType = gtk_bitset_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Iterates over the elements of a `gtk.Bitset`.
///
/// `GtkBitSetIter is an opaque, stack-allocated struct.
///
/// Before a `GtkBitsetIter` can be used, it needs to be initialized with
/// `gtk.BitsetIter.initFirst`, `gtk.BitsetIter.initLast`
/// or `gtk.BitsetIter.initAt`.
pub const BitsetIter = extern struct {
    f_private_data: [10]*anyopaque,

    /// Initializes `iter` to point to `target`.
    ///
    /// If `target` is not found, finds the next value after it.
    /// If no value >= `target` exists in `set`, this function returns `FALSE`.
    extern fn gtk_bitset_iter_init_at(p_iter: *gtk.BitsetIter, p_set: *const gtk.Bitset, p_target: c_uint, p_value: ?*c_uint) c_int;
    pub const initAt = gtk_bitset_iter_init_at;

    /// Initializes an iterator for `set` and points it to the first
    /// value in `set`.
    ///
    /// If `set` is empty, `FALSE` is returned and `value` is set to `G_MAXUINT`.
    extern fn gtk_bitset_iter_init_first(p_iter: *gtk.BitsetIter, p_set: *const gtk.Bitset, p_value: ?*c_uint) c_int;
    pub const initFirst = gtk_bitset_iter_init_first;

    /// Initializes an iterator for `set` and points it to the last
    /// value in `set`.
    ///
    /// If `set` is empty, `FALSE` is returned.
    extern fn gtk_bitset_iter_init_last(p_iter: *gtk.BitsetIter, p_set: *const gtk.Bitset, p_value: ?*c_uint) c_int;
    pub const initLast = gtk_bitset_iter_init_last;

    /// Gets the current value that `iter` points to.
    ///
    /// If `iter` is not valid and `gtk.BitsetIter.isValid`
    /// returns `FALSE`, this function returns 0.
    extern fn gtk_bitset_iter_get_value(p_iter: *const BitsetIter) c_uint;
    pub const getValue = gtk_bitset_iter_get_value;

    /// Checks if `iter` points to a valid value.
    extern fn gtk_bitset_iter_is_valid(p_iter: *const BitsetIter) c_int;
    pub const isValid = gtk_bitset_iter_is_valid;

    /// Moves `iter` to the next value in the set.
    ///
    /// If it was already pointing to the last value in the set,
    /// `FALSE` is returned and `iter` is invalidated.
    extern fn gtk_bitset_iter_next(p_iter: *BitsetIter, p_value: ?*c_uint) c_int;
    pub const next = gtk_bitset_iter_next;

    /// Moves `iter` to the previous value in the set.
    ///
    /// If it was already pointing to the first value in the set,
    /// `FALSE` is returned and `iter` is invalidated.
    extern fn gtk_bitset_iter_previous(p_iter: *BitsetIter, p_value: ?*c_uint) c_int;
    pub const previous = gtk_bitset_iter_previous;

    extern fn gtk_bitset_iter_get_type() usize;
    pub const getGObjectType = gtk_bitset_iter_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BookmarkListClass = extern struct {
    pub const Instance = gtk.BookmarkList;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *BookmarkListClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BoolFilterClass = extern struct {
    pub const Instance = gtk.BoolFilter;

    f_parent_class: gtk.FilterClass,

    pub fn as(p_instance: *BoolFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies a border around a rectangular area.
///
/// Each side can have a different width.
pub const Border = extern struct {
    /// The width of the left border
    f_left: i16,
    /// The width of the right border
    f_right: i16,
    /// The width of the top border
    f_top: i16,
    /// The width of the bottom border
    f_bottom: i16,

    /// Allocates a new `GtkBorder` struct and initializes its elements to zero.
    extern fn gtk_border_new() *gtk.Border;
    pub const new = gtk_border_new;

    /// Copies a `GtkBorder`.
    extern fn gtk_border_copy(p_border_: *const Border) *gtk.Border;
    pub const copy = gtk_border_copy;

    /// Frees a `GtkBorder`.
    extern fn gtk_border_free(p_border_: *Border) void;
    pub const free = gtk_border_free;

    extern fn gtk_border_get_type() usize;
    pub const getGObjectType = gtk_border_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BoxClass = extern struct {
    pub const Instance = gtk.Box;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *BoxClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BoxLayoutClass = extern struct {
    pub const Instance = gtk.BoxLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *BoxLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Contains methods to let `GtkBuilder` construct an object from
/// a `GtkBuilder` UI definition.
pub const BuildableIface = extern struct {
    pub const Instance = gtk.Buildable;

    /// the parent class
    f_g_iface: gobject.TypeInterface,
    /// 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.
    f_set_id: ?*const fn (p_buildable: *gtk.Buildable, p_id: [*:0]const u8) callconv(.c) void,
    /// The getter corresponding to `set_id`. Implement this
    ///   if you implement `set_id`.
    f_get_id: ?*const fn (p_buildable: *gtk.Buildable) callconv(.c) [*:0]const u8,
    /// Adds a child. The `type` parameter can be used to
    ///   differentiate the kind of child. `GtkWidget` implements this
    ///   to add event controllers to the widget, `GtkNotebook` uses
    ///   the `type` to distinguish between page labels (of type "page-label")
    ///   and normal children.
    f_add_child: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_child: *gobject.Object, p_type: ?[*:0]const u8) callconv(.c) void,
    /// Sets a property of a buildable object.
    ///  It is normally not necessary to implement this, `gobject.Object.setProperty`
    ///  is used by default. `GtkWindow` implements this to delay showing itself
    ///  (i.e. setting the `gtk.Widget.properties.visible` property) until the whole
    ///  interface is created.
    f_set_buildable_property: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_name: [*:0]const u8, p_value: *const gobject.Value) callconv(.c) void,
    /// Constructs a child of a buildable that has been
    ///  specified as “constructor” in the UI definition. This can be used to
    ///  reference a widget created in a `<ui>` tag which is outside
    ///  of the normal GtkBuilder UI definition hierarchy.  A reference to the
    ///  constructed object is returned and becomes owned by the caller.
    f_construct_child: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_name: [*:0]const u8) callconv(.c) *gobject.Object,
    /// Implement this if the buildable needs to parse
    ///  content below `<child>`. To handle an element, the implementation
    ///  must fill in the `parser` and `user_data` and return `TRUE`.
    ///  `GtkWidget` implements this to parse accessible attributes specified
    ///  in `<accessibility>` elements.
    ///  Note that `user_data` must be freed in `custom_tag_end` or `custom_finished`.
    f_custom_tag_start: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_parser: *gtk.BuildableParser, p_data: ?*anyopaque) callconv(.c) c_int,
    /// Called for the end tag of each custom element that is
    ///  handled by the buildable (see `custom_tag_start`).
    f_custom_tag_end: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_data: ?*anyopaque) callconv(.c) void,
    /// Called for each custom tag handled by the buildable
    ///  when the builder finishes parsing (see `custom_tag_start`)
    f_custom_finished: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_child: ?*gobject.Object, p_tagname: [*:0]const u8, p_data: ?*anyopaque) callconv(.c) void,
    /// 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.
    f_parser_finished: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder) callconv(.c) void,
    /// Returns an internal child of a buildable.
    ///  `GtkDialog` implements this to give access to its `vbox`, making
    ///  it possible to add children to the vbox in a UI definition.
    ///  Implement this if the buildable has internal children that may
    ///  need to be accessed from a UI definition.
    f_get_internal_child: ?*const fn (p_buildable: *gtk.Buildable, p_builder: *gtk.Builder, p_childname: [*:0]const u8) callconv(.c) *gobject.Object,

    pub fn as(p_instance: *BuildableIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides context for parsing GtkBuilder UI files.
///
/// `GtkBuildableParseContext` is an opaque struct.
pub const BuildableParseContext = opaque {
    /// Retrieves the name of the currently open element.
    ///
    /// If called from the start_element or end_element handlers this will
    /// give the element_name as passed to those functions. For the parent
    /// elements, see `gtk.BuildableParseContext.getElementStack`.
    extern fn gtk_buildable_parse_context_get_element(p_context: *BuildableParseContext) ?[*:0]const u8;
    pub const getElement = gtk_buildable_parse_context_get_element;

    /// Retrieves the element stack from the internal state of the parser.
    ///
    /// The returned `GPtrArray` is an array of strings where the last item is
    /// the currently open tag (as would be returned by
    /// `gtk.BuildableParseContext.getElement`) and the previous item is its
    /// immediate parent.
    ///
    /// This function is intended to be used in the start_element and
    /// end_element handlers where `gtk.BuildableParseContext.getElement`
    /// would merely return the name of the element that is being
    /// processed.
    extern fn gtk_buildable_parse_context_get_element_stack(p_context: *BuildableParseContext) *glib.PtrArray;
    pub const getElementStack = gtk_buildable_parse_context_get_element_stack;

    /// Retrieves the current line number and the number of the character on
    /// that line. Intended for use in error messages; there are no strict
    /// semantics for what constitutes the "current" line number other than
    /// "the best number we could come up with for error messages."
    extern fn gtk_buildable_parse_context_get_position(p_context: *BuildableParseContext, p_line_number: ?*c_int, p_char_number: ?*c_int) void;
    pub const getPosition = gtk_buildable_parse_context_get_position;

    /// Completes the process of a temporary sub-parser redirection.
    ///
    /// This function exists to collect the user_data allocated by a
    /// matching call to `gtk.BuildableParseContext.push`. It must be called
    /// in the end_element handler corresponding to the start_element
    /// handler during which `gtk.BuildableParseContext.push` was called.
    /// You must not call this function from the error callback -- the
    /// `user_data` is provided directly to the callback in that case.
    ///
    /// This function is not intended to be directly called by users
    /// interested in invoking subparsers. Instead, it is intended to
    /// be used by the subparsers themselves to implement a higher-level
    /// interface.
    extern fn gtk_buildable_parse_context_pop(p_context: *BuildableParseContext) ?*anyopaque;
    pub const pop = gtk_buildable_parse_context_pop;

    /// Temporarily redirects markup data to a sub-parser.
    ///
    /// This function may only be called from the start_element handler of
    /// a `GtkBuildableParser`. It must be matched with a corresponding call to
    /// `gtk.BuildableParseContext.pop` in the matching end_element handler
    /// (except in the case that the parser aborts due to an error).
    ///
    /// All tags, text and other data between the matching tags is
    /// redirected to the subparser given by `parser`. `user_data` is used
    /// as the user_data for that parser. `user_data` is also passed to the
    /// error callback in the event that an error occurs. This includes
    /// errors that occur in subparsers of the subparser.
    ///
    /// The end tag matching the start tag for which this call was made is
    /// handled by the previous parser (which is given its own user_data)
    /// which is why `gtk.BuildableParseContext.pop` is provided to allow "one
    /// last access" to the `user_data` provided to this function. In the
    /// case of error, the `user_data` provided here is passed directly to
    /// the error callback of the subparser and `gtk.BuildableParseContext.pop`
    /// should not be called. In either case, if `user_data` was allocated
    /// then it ought to be freed from both of these locations.
    ///
    /// This function is not intended to be directly called by users
    /// interested in invoking subparsers. Instead, it is intended to be
    /// used by the subparsers themselves to implement a higher-level
    /// interface.
    ///
    /// For an example of how to use this, see `glib.MarkupParseContext.push` which
    /// has the same kind of API.
    extern fn gtk_buildable_parse_context_push(p_context: *BuildableParseContext, p_parser: *const gtk.BuildableParser, p_user_data: ?*anyopaque) void;
    pub const push = gtk_buildable_parse_context_push;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A sub-parser for `GtkBuildable` implementations.
pub const BuildableParser = extern struct {
    /// function called for open elements
    f_start_element: ?*const fn (p_context: *gtk.BuildableParseContext, p_element_name: [*:0]const u8, p_attribute_names: *[*:0]const u8, p_attribute_values: *[*:0]const u8, p_user_data: ?*anyopaque, p_error: ?*?*glib.Error) callconv(.c) void,
    /// function called for close elements
    f_end_element: ?*const fn (p_context: *gtk.BuildableParseContext, p_element_name: [*:0]const u8, p_user_data: ?*anyopaque, p_error: ?*?*glib.Error) callconv(.c) void,
    /// function called for character data
    f_text: ?*const fn (p_context: *gtk.BuildableParseContext, p_text: [*:0]const u8, p_text_len: usize, p_user_data: ?*anyopaque, p_error: ?*?*glib.Error) callconv(.c) void,
    /// function called on error
    f_error: ?*const fn (p_context: *gtk.BuildableParseContext, p_error: *glib.Error, p_user_data: ?*anyopaque) callconv(.c) void,
    f_padding: [4]*anyopaque,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BuilderCScopeClass = extern struct {
    pub const Instance = gtk.BuilderCScope;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *BuilderCScopeClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BuilderClass = opaque {
    pub const Instance = gtk.Builder;

    pub fn as(p_instance: *BuilderClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const BuilderListItemFactoryClass = opaque {
    pub const Instance = gtk.BuilderListItemFactory;

    pub fn as(p_instance: *BuilderListItemFactoryClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The virtual function table to implement for `GtkBuilderScope` implementations.
/// Default implementations for each function do exist, but they usually just fail,
/// so it is suggested that implementations implement all of them.
pub const BuilderScopeInterface = extern struct {
    pub const Instance = gtk.BuilderScope;

    f_g_iface: gobject.TypeInterface,
    /// Try to lookup a `GType` via the its name. See
    ///   `gtk.Builder.getTypeFromName` for more details.
    ///   The C implementation will use `gobject.typeFromName` and if that fails try to guess the
    ///   correct function name for registering the type and then use `dlsym` to load it.
    ///   The default implementation just tries `gobject.typeFromName` and otherwise fails.
    f_get_type_from_name: ?*const fn (p_self: *gtk.BuilderScope, p_builder: *gtk.Builder, p_type_name: [*:0]const u8) callconv(.c) usize,
    /// Try to lookup a `GType` via the given function name, specified
    ///   explicitly in a GtkBuilder file, like via the "type-func" attribute in the `<object>` tag.
    ///   This function is very rarely used.
    ///   The C implementation will use `dlsym` and call the resulting function as a `GTypeFunc`.
    ///   The default implementation will fail and just return `G_TYPE_INVALID`.
    f_get_type_from_function: ?*const fn (p_self: *gtk.BuilderScope, p_builder: *gtk.Builder, p_function_name: [*:0]const u8) callconv(.c) usize,
    /// Create a closure with the given arguments. See `gtk.Builder.createClosure`
    ///   for more details on those.
    ///   The C implementation will try to use `dlsym` to locate the function name and then
    ///   `gobject.cclosureNew` to create a closure for the symbol.
    ///   The default implementation just fails and returns `NULL`.
    f_create_closure: ?*const fn (p_self: *gtk.BuilderScope, p_builder: *gtk.Builder, p_function_name: [*:0]const u8, p_flags: gtk.BuilderClosureFlags, p_object: *gobject.Object, p_error: ?*?*glib.Error) callconv(.c) ?*gobject.Closure,

    pub fn as(p_instance: *BuilderScopeInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ButtonClass = extern struct {
    pub const Instance = gtk.Button;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    /// Signal emitted when the button has been activated (pressed and released).
    f_clicked: ?*const fn (p_button: *gtk.Button) callconv(.c) void,
    /// Signal that causes the button to animate press then
    ///    release. Applications should never connect to this signal, but use
    ///    the `clicked` signal.
    f_activate: ?*const fn (p_button: *gtk.Button) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ButtonClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ButtonPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CallbackActionClass = opaque {
    pub const Instance = gtk.CallbackAction;

    pub fn as(p_instance: *CallbackActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellAreaClass = extern struct {
    pub const Instance = gtk.CellArea;

    f_parent_class: gobject.InitiallyUnownedClass,
    /// adds a `GtkCellRenderer` to the area.
    f_add: ?*const fn (p_area: *gtk.CellArea, p_renderer: *gtk.CellRenderer) callconv(.c) void,
    /// removes a `GtkCellRenderer` from the area.
    f_remove: ?*const fn (p_area: *gtk.CellArea, p_renderer: *gtk.CellRenderer) callconv(.c) void,
    /// calls the `GtkCellCallback` function on every `GtkCellRenderer` in
    ///   the area with the provided user data until the callback returns `TRUE`.
    f_foreach: ?*const fn (p_area: *gtk.CellArea, p_callback: gtk.CellCallback, p_callback_data: ?*anyopaque) callconv(.c) void,
    /// Calls the `GtkCellAllocCallback` function on every
    ///   `GtkCellRenderer` in the area with the allocated area for the cell
    ///   and the provided user data until the callback returns `TRUE`.
    f_foreach_alloc: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_background_area: *const gdk.Rectangle, p_callback: gtk.CellAllocCallback, p_callback_data: ?*anyopaque) callconv(.c) void,
    /// Handle an event in the area, this is generally used to activate
    ///   a cell at the event location for button events but can also be used
    ///   to generically pass events to `GtkWidget`s drawn onto the area.
    f_event: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_event: *gdk.Event, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) c_int,
    /// Actually snapshot the area’s cells to the specified rectangle,
    ///   `background_area` should be correctly distributed to the cells
    ///   corresponding background areas.
    f_snapshot: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_snapshot: *gtk.Snapshot, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_paint_focus: c_int) callconv(.c) void,
    /// Apply the cell attributes to the cells. This is
    ///   implemented as a signal and generally `GtkCellArea` subclasses don't
    ///   need to implement it since it is handled by the base class.
    f_apply_attributes: ?*const fn (p_area: *gtk.CellArea, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_is_expander: c_int, p_is_expanded: c_int) callconv(.c) void,
    /// Creates and returns a class specific `GtkCellAreaContext`
    ///   to store cell alignment and allocation details for a said `GtkCellArea`
    ///   class.
    f_create_context: ?*const fn (p_area: *gtk.CellArea) callconv(.c) *gtk.CellAreaContext,
    /// Creates a new `GtkCellAreaContext` in the same state as
    ///   the passed `context` with any cell alignment data and allocations intact.
    f_copy_context: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext) callconv(.c) *gtk.CellAreaContext,
    /// This allows an area to tell its layouting widget whether
    ///   it prefers to be allocated in `GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH` or
    ///   `GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT` mode.
    f_get_request_mode: ?*const fn (p_area: *gtk.CellArea) callconv(.c) gtk.SizeRequestMode,
    /// Calculates the minimum and natural width of the
    ///   areas cells with the current attributes applied while considering
    ///   the particular layouting details of the said `GtkCellArea`. While
    ///   requests are performed over a series of rows, alignments and overall
    ///   minimum and natural sizes should be stored in the corresponding
    ///   `GtkCellAreaContext`.
    f_get_preferred_width: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void,
    /// Calculates the minimum and natural height
    ///   for the area if the passed `context` would be allocated the given width.
    ///   When implementing this virtual method it is safe to assume that `context`
    ///   has already stored the aligned cell widths for every `GtkTreeModel` row
    ///   that `context` will be allocated for since this information was stored
    ///   at `GtkCellAreaClass.`get_preferred_width`` time. This virtual method
    ///   should also store any necessary alignments of cell heights for the
    ///   case that the context is allocated a height.
    f_get_preferred_height_for_width: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void,
    /// Calculates the minimum and natural height of the
    ///   areas cells with the current attributes applied. Essentially this is
    ///   the same as `GtkCellAreaClass.`get_preferred_width`` only for areas
    ///   that are being requested as `GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT`.
    f_get_preferred_height: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void,
    /// Calculates the minimum and natural width
    ///   for the area if the passed `context` would be allocated the given
    ///   height. The same as `GtkCellAreaClass.`get_preferred_height_for_width``
    ///   only for handling requests in the `GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT`
    ///   mode.
    f_get_preferred_width_for_height: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void,
    /// This should be implemented to handle changes in child
    ///   cell properties for a given `GtkCellRenderer` that were previously
    ///   installed on the `GtkCellAreaClass` with `gtk.CellAreaClass.installCellProperty`.
    f_set_cell_property: ?*const fn (p_area: *gtk.CellArea, p_renderer: *gtk.CellRenderer, p_property_id: c_uint, p_value: *const gobject.Value, p_pspec: *gobject.ParamSpec) callconv(.c) void,
    /// This should be implemented to report the values of
    ///   child cell properties for a given child `GtkCellRenderer`.
    f_get_cell_property: ?*const fn (p_area: *gtk.CellArea, p_renderer: *gtk.CellRenderer, p_property_id: c_uint, p_value: *gobject.Value, p_pspec: *gobject.ParamSpec) callconv(.c) void,
    /// This virtual method should be implemented to navigate focus from
    ///   cell to cell inside the `GtkCellArea`. The `GtkCellArea` should move
    ///   focus from cell to cell inside the area and return `FALSE` if focus
    ///   logically leaves the area with the following exceptions: When the
    ///   area contains no activatable cells, the entire area receives focus.
    ///   Focus should not be given to cells that are actually “focus siblings”
    ///   of other sibling cells (see `gtk.CellArea.getFocusFromSibling`).
    ///   Focus is set by calling `gtk.CellArea.setFocusCell`.
    f_focus: ?*const fn (p_area: *gtk.CellArea, p_direction: gtk.DirectionType) callconv(.c) c_int,
    /// Returns whether the `GtkCellArea` can respond to
    ///   `GtkCellAreaClass.`activate``, usually this does not need to be
    ///   implemented since the base class takes care of this however it can
    ///   be enhanced if the `GtkCellArea` subclass can handle activation in
    ///   other ways than activating its `GtkCellRenderers`.
    f_is_activatable: ?*const fn (p_area: *gtk.CellArea) callconv(.c) c_int,
    /// This is called when the layouting widget rendering the
    ///   `GtkCellArea` activates the focus cell (see `gtk.CellArea.getFocusCell`).
    f_activate: ?*const fn (p_area: *gtk.CellArea, p_context: *gtk.CellAreaContext, p_widget: *gtk.Widget, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState, p_edit_only: c_int) callconv(.c) c_int,
    f_padding: [8]*anyopaque,

    /// Finds a cell property of a cell area class by name.
    extern fn gtk_cell_area_class_find_cell_property(p_aclass: *CellAreaClass, p_property_name: [*:0]const u8) *gobject.ParamSpec;
    pub const findCellProperty = gtk_cell_area_class_find_cell_property;

    /// Installs a cell property on a cell area class.
    extern fn gtk_cell_area_class_install_cell_property(p_aclass: *CellAreaClass, p_property_id: c_uint, p_pspec: *gobject.ParamSpec) void;
    pub const installCellProperty = gtk_cell_area_class_install_cell_property;

    /// Returns all cell properties of a cell area class.
    extern fn gtk_cell_area_class_list_cell_properties(p_aclass: *CellAreaClass, p_n_properties: *c_uint) [*]*gobject.ParamSpec;
    pub const listCellProperties = gtk_cell_area_class_list_cell_properties;

    pub fn as(p_instance: *CellAreaClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellAreaContextClass = extern struct {
    pub const Instance = gtk.CellAreaContext;

    f_parent_class: gobject.ObjectClass,
    /// This tells the context that an allocation width or height
    ///   (or both) have been decided for a group of rows. The context should
    ///   store any allocations for internally aligned cells at this point so
    ///   that they dont need to be recalculated at `gtk_cell_area_render` time.
    f_allocate: ?*const fn (p_context: *gtk.CellAreaContext, p_width: c_int, p_height: c_int) callconv(.c) void,
    /// Clear any previously stored information about requested and
    ///   allocated sizes for the context.
    f_reset: ?*const fn (p_context: *gtk.CellAreaContext) callconv(.c) void,
    /// Returns the aligned height for the given
    ///   width that context must store while collecting sizes for it’s rows.
    f_get_preferred_height_for_width: ?*const fn (p_context: *gtk.CellAreaContext, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void,
    /// Returns the aligned width for the given
    ///   height that context must store while collecting sizes for it’s rows.
    f_get_preferred_width_for_height: ?*const fn (p_context: *gtk.CellAreaContext, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *CellAreaContextClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellAreaContextPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellEditableIface = extern struct {
    pub const Instance = gtk.CellEditable;

    f_g_iface: gobject.TypeInterface,
    /// Signal is a sign for the cell renderer to update its
    ///    value from the cell_editable.
    f_editing_done: ?*const fn (p_cell_editable: *gtk.CellEditable) callconv(.c) void,
    /// Signal is meant to indicate that the cell is
    ///    finished editing, and the widget may now be destroyed.
    f_remove_widget: ?*const fn (p_cell_editable: *gtk.CellEditable) callconv(.c) void,
    /// Begins editing on a cell_editable.
    f_start_editing: ?*const fn (p_cell_editable: *gtk.CellEditable, p_event: ?*gdk.Event) callconv(.c) void,

    pub fn as(p_instance: *CellEditableIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellLayoutIface = extern struct {
    pub const Instance = gtk.CellLayout;

    f_g_iface: gobject.TypeInterface,
    /// Packs the cell into the beginning of cell_layout.
    f_pack_start: ?*const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer, p_expand: c_int) callconv(.c) void,
    /// Adds the cell to the end of cell_layout.
    f_pack_end: ?*const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer, p_expand: c_int) callconv(.c) void,
    /// Unsets all the mappings on all renderers on cell_layout and
    ///    removes all renderers from cell_layout.
    f_clear: ?*const fn (p_cell_layout: *gtk.CellLayout) callconv(.c) void,
    /// Adds an attribute mapping to the list in
    ///    cell_layout.
    f_add_attribute: ?*const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer, p_attribute: [*:0]const u8, p_column: c_int) callconv(.c) void,
    /// Sets the `GtkCellLayout`DataFunc to use for
    ///    cell_layout.
    f_set_cell_data_func: ?*const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer, p_func: ?gtk.CellLayoutDataFunc, p_func_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void,
    /// Clears all existing attributes previously set
    ///    with `gtk.CellLayout.setAttributes`.
    f_clear_attributes: ?*const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer) callconv(.c) void,
    /// Re-inserts cell at position.
    f_reorder: ?*const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer, p_position: c_int) callconv(.c) void,
    /// Get the cell renderers which have been added to
    ///    cell_layout.
    f_get_cells: ?*const fn (p_cell_layout: *gtk.CellLayout) callconv(.c) *glib.List,
    /// Get the underlying `GtkCellArea` which might be
    ///    cell_layout if called on a `GtkCellArea` or might be NULL if no
    ///    `GtkCellArea` is used by cell_layout.
    f_get_area: ?*const fn (p_cell_layout: *gtk.CellLayout) callconv(.c) ?*gtk.CellArea,

    pub fn as(p_instance: *CellLayoutIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellRendererClass = extern struct {
    pub const Instance = gtk.CellRenderer;

    f_parent_class: gobject.InitiallyUnownedClass,
    /// Called to gets whether the cell renderer prefers
    ///    a height-for-width layout or a width-for-height layout.
    f_get_request_mode: ?*const fn (p_cell: *gtk.CellRenderer) callconv(.c) gtk.SizeRequestMode,
    /// Called to get a renderer’s natural width.
    f_get_preferred_width: ?*const fn (p_cell: *gtk.CellRenderer, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) callconv(.c) void,
    /// Called to get a renderer’s natural height for width.
    f_get_preferred_height_for_width: ?*const fn (p_cell: *gtk.CellRenderer, p_widget: *gtk.Widget, p_width: c_int, p_minimum_height: ?*c_int, p_natural_height: ?*c_int) callconv(.c) void,
    /// Called to get a renderer’s natural height.
    f_get_preferred_height: ?*const fn (p_cell: *gtk.CellRenderer, p_widget: *gtk.Widget, p_minimum_size: ?*c_int, p_natural_size: ?*c_int) callconv(.c) void,
    /// Called to get a renderer’s natural width for height.
    f_get_preferred_width_for_height: ?*const fn (p_cell: *gtk.CellRenderer, p_widget: *gtk.Widget, p_height: c_int, p_minimum_width: ?*c_int, p_natural_width: ?*c_int) callconv(.c) void,
    /// Called to get the aligned area used by `cell` inside `cell_area`.
    f_get_aligned_area: ?*const fn (p_cell: *gtk.CellRenderer, p_widget: *gtk.Widget, p_flags: gtk.CellRendererState, p_cell_area: *const gdk.Rectangle, p_aligned_area: *gdk.Rectangle) callconv(.c) void,
    /// Called to snapshot the content of the `GtkCellRenderer`.
    f_snapshot: ?*const fn (p_cell: *gtk.CellRenderer, p_snapshot: *gtk.Snapshot, p_widget: *gtk.Widget, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) void,
    /// Called to activate the content of the `GtkCellRenderer`.
    f_activate: ?*const fn (p_cell: *gtk.CellRenderer, p_event: *gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) c_int,
    /// Called to initiate editing the content of the `GtkCellRenderer`.
    f_start_editing: ?*const fn (p_cell: *gtk.CellRenderer, p_event: ?*gdk.Event, p_widget: *gtk.Widget, p_path: [*:0]const u8, p_background_area: *const gdk.Rectangle, p_cell_area: *const gdk.Rectangle, p_flags: gtk.CellRendererState) callconv(.c) ?*gtk.CellEditable,
    /// Signal gets emitted when the user cancels the process of editing a cell.
    f_editing_canceled: ?*const fn (p_cell: *gtk.CellRenderer) callconv(.c) void,
    /// Signal gets emitted when a cell starts to be edited.
    f_editing_started: ?*const fn (p_cell: *gtk.CellRenderer, p_editable: *gtk.CellEditable, p_path: [*:0]const u8) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *CellRendererClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellRendererClassPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellRendererPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CellRendererTextClass = extern struct {
    pub const Instance = gtk.CellRendererText;

    f_parent_class: gtk.CellRendererClass,
    f_edited: ?*const fn (p_cell_renderer_text: *gtk.CellRendererText, p_path: [*:0]const u8, p_new_text: [*:0]const u8) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *CellRendererTextClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CenterBoxClass = opaque {
    pub const Instance = gtk.CenterBox;

    pub fn as(p_instance: *CenterBoxClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CenterLayoutClass = extern struct {
    pub const Instance = gtk.CenterLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *CenterLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CheckButtonClass = extern struct {
    pub const Instance = gtk.CheckButton;

    f_parent_class: gtk.WidgetClass,
    f_toggled: ?*const fn (p_check_button: *gtk.CheckButton) callconv(.c) void,
    f_activate: ?*const fn (p_check_button: *gtk.CheckButton) callconv(.c) void,
    f_padding: [7]*anyopaque,

    pub fn as(p_instance: *CheckButtonClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColorChooserInterface = extern struct {
    pub const Instance = gtk.ColorChooser;

    f_base_interface: gobject.TypeInterface,
    f_get_rgba: ?*const fn (p_chooser: *gtk.ColorChooser, p_color: *gdk.RGBA) callconv(.c) void,
    f_set_rgba: ?*const fn (p_chooser: *gtk.ColorChooser, p_color: *const gdk.RGBA) callconv(.c) void,
    f_add_palette: ?*const fn (p_chooser: *gtk.ColorChooser, p_orientation: gtk.Orientation, p_colors_per_line: c_int, p_n_colors: c_int, p_colors: ?[*]gdk.RGBA) callconv(.c) void,
    f_color_activated: ?*const fn (p_chooser: *gtk.ColorChooser, p_color: *const gdk.RGBA) callconv(.c) void,
    f_padding: [12]*anyopaque,

    pub fn as(p_instance: *ColorChooserInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColorDialogButtonClass = extern struct {
    pub const Instance = gtk.ColorDialogButton;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *ColorDialogButtonClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColorDialogClass = extern struct {
    pub const Instance = gtk.ColorDialog;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *ColorDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColumnViewCellClass = opaque {
    pub const Instance = gtk.ColumnViewCell;

    pub fn as(p_instance: *ColumnViewCellClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColumnViewClass = opaque {
    pub const Instance = gtk.ColumnView;

    pub fn as(p_instance: *ColumnViewClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColumnViewColumnClass = opaque {
    pub const Instance = gtk.ColumnViewColumn;

    pub fn as(p_instance: *ColumnViewColumnClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColumnViewRowClass = opaque {
    pub const Instance = gtk.ColumnViewRow;

    pub fn as(p_instance: *ColumnViewRowClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ColumnViewSorterClass = extern struct {
    pub const Instance = gtk.ColumnViewSorter;

    f_parent_class: gtk.SorterClass,

    pub fn as(p_instance: *ColumnViewSorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ComboBoxClass = extern struct {
    pub const Instance = gtk.ComboBox;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    /// Signal is emitted when the active item is changed.
    f_changed: ?*const fn (p_combo_box: *gtk.ComboBox) callconv(.c) void,
    /// Signal which allows you to change how the text
    ///    displayed in a combo box’s entry is displayed.
    f_format_entry_text: ?*const fn (p_combo_box: *gtk.ComboBox, p_path: [*:0]const u8) callconv(.c) [*:0]u8,
    f_activate: ?*const fn (p_combo_box: *gtk.ComboBox) callconv(.c) void,
    f_padding: [7]*anyopaque,

    pub fn as(p_instance: *ComboBoxClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ConstraintClass = extern struct {
    pub const Instance = gtk.Constraint;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *ConstraintClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ConstraintGuideClass = extern struct {
    pub const Instance = gtk.ConstraintGuide;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *ConstraintGuideClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ConstraintLayoutChildClass = extern struct {
    pub const Instance = gtk.ConstraintLayoutChild;

    f_parent_class: gtk.LayoutChildClass,

    pub fn as(p_instance: *ConstraintLayoutChildClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ConstraintLayoutClass = extern struct {
    pub const Instance = gtk.ConstraintLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *ConstraintLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ConstraintTargetInterface = opaque {
    pub const Instance = gtk.ConstraintTarget;

    pub fn as(p_instance: *ConstraintTargetInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Points at a location inside a CSS stream.
pub const CssLocation = extern struct {
    f_bytes: usize,
    f_chars: usize,
    f_lines: usize,
    f_line_bytes: usize,
    f_line_chars: usize,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CssProviderClass = opaque {
    pub const Instance = gtk.CssProvider;

    pub fn as(p_instance: *CssProviderClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CssProviderPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Defines a part of a CSS document.
///
/// Because sections are nested into one another, you can use
/// `CssSection.getParent` to get the containing region.
pub const CssSection = opaque {
    /// Creates a new `GtkCssSection` referring to the section
    /// in the given `file` from the `start` location to the
    /// `end` location.
    extern fn gtk_css_section_new(p_file: ?*gio.File, p_start: *const gtk.CssLocation, p_end: *const gtk.CssLocation) *gtk.CssSection;
    pub const new = gtk_css_section_new;

    /// Creates a new `GtkCssSection` referring to the section
    /// in the given `file` or the given `bytes` from the `start` location to the
    /// `end` location.
    extern fn gtk_css_section_new_with_bytes(p_file: ?*gio.File, p_bytes: ?*glib.Bytes, p_start: *const gtk.CssLocation, p_end: *const gtk.CssLocation) *gtk.CssSection;
    pub const newWithBytes = gtk_css_section_new_with_bytes;

    /// Gets the bytes that `section` was parsed from.
    extern fn gtk_css_section_get_bytes(p_section: *const CssSection) ?*glib.Bytes;
    pub const getBytes = gtk_css_section_get_bytes;

    /// Returns the location in the CSS document where this section ends.
    extern fn gtk_css_section_get_end_location(p_section: *const CssSection) *const gtk.CssLocation;
    pub const getEndLocation = gtk_css_section_get_end_location;

    /// Gets the file that `section` was parsed from.
    ///
    /// If no such file exists, for example because the CSS was loaded via
    /// `gtk.CssProvider.loadFromData`, then `NULL` is returned.
    extern fn gtk_css_section_get_file(p_section: *const CssSection) ?*gio.File;
    pub const getFile = gtk_css_section_get_file;

    /// Gets the parent section for the given `section`.
    ///
    /// The parent section is the section that contains this `section`. A special
    /// case are sections of  type `GTK_CSS_SECTION_DOCUMENT`. Their parent will
    /// either be `NULL` if they are the original CSS document that was loaded by
    /// `gtk.CssProvider.loadFromFile` or a section of type
    /// `GTK_CSS_SECTION_IMPORT` if it was loaded with an ``import`` rule from
    /// a different file.
    extern fn gtk_css_section_get_parent(p_section: *const CssSection) ?*gtk.CssSection;
    pub const getParent = gtk_css_section_get_parent;

    /// Returns the location in the CSS document where this section starts.
    extern fn gtk_css_section_get_start_location(p_section: *const CssSection) *const gtk.CssLocation;
    pub const getStartLocation = gtk_css_section_get_start_location;

    /// Prints the `section` into `string` in a human-readable form.
    ///
    /// This is a form like `gtk.css:32:1-23` to denote line 32, characters
    /// 1 to 23 in the file `gtk.css`.
    extern fn gtk_css_section_print(p_section: *const CssSection, p_string: *glib.String) void;
    pub const print = gtk_css_section_print;

    /// Increments the reference count on `section`.
    extern fn gtk_css_section_ref(p_section: *CssSection) *gtk.CssSection;
    pub const ref = gtk_css_section_ref;

    /// Prints the section into a human-readable text form using
    /// `gtk.CssSection.print`.
    extern fn gtk_css_section_to_string(p_section: *const CssSection) [*:0]u8;
    pub const toString = gtk_css_section_to_string;

    /// Decrements the reference count on `section`, freeing the
    /// structure if the reference count reaches 0.
    extern fn gtk_css_section_unref(p_section: *CssSection) void;
    pub const unref = gtk_css_section_unref;

    extern fn gtk_css_section_get_type() usize;
    pub const getGObjectType = gtk_css_section_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A CSS style change.
pub const CssStyleChange = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CustomFilterClass = extern struct {
    pub const Instance = gtk.CustomFilter;

    f_parent_class: gtk.FilterClass,

    pub fn as(p_instance: *CustomFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CustomLayoutClass = extern struct {
    pub const Instance = gtk.CustomLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *CustomLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const CustomSorterClass = extern struct {
    pub const Instance = gtk.CustomSorter;

    f_parent_class: gtk.SorterClass,

    pub fn as(p_instance: *CustomSorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DialogClass = extern struct {
    pub const Instance = gtk.Dialog;

    /// The parent class.
    f_parent_class: gtk.WindowClass,
    /// Signal emitted when an action widget is activated.
    f_response: ?*const fn (p_dialog: *gtk.Dialog, p_response_id: c_int) callconv(.c) void,
    /// Signal emitted when the user uses a keybinding to close the dialog.
    f_close: ?*const fn (p_dialog: *gtk.Dialog) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *DialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DirectoryListClass = extern struct {
    pub const Instance = gtk.DirectoryList;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *DirectoryListClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DragIconClass = extern struct {
    pub const Instance = gtk.DragIcon;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *DragIconClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DragSourceClass = opaque {
    pub const Instance = gtk.DragSource;

    pub fn as(p_instance: *DragSourceClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DrawingAreaClass = extern struct {
    pub const Instance = gtk.DrawingArea;

    f_parent_class: gtk.WidgetClass,
    f_resize: ?*const fn (p_area: *gtk.DrawingArea, p_width: c_int, p_height: c_int) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *DrawingAreaClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DropControllerMotionClass = opaque {
    pub const Instance = gtk.DropControllerMotion;

    pub fn as(p_instance: *DropControllerMotionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DropDownClass = extern struct {
    pub const Instance = gtk.DropDown;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *DropDownClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DropTargetAsyncClass = opaque {
    pub const Instance = gtk.DropTargetAsync;

    pub fn as(p_instance: *DropTargetAsyncClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const DropTargetClass = opaque {
    pub const Instance = gtk.DropTarget;

    pub fn as(p_instance: *DropTargetClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EditableInterface = extern struct {
    pub const Instance = gtk.Editable;

    f_base_iface: gobject.TypeInterface,
    f_insert_text: ?*const fn (p_editable: *gtk.Editable, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) callconv(.c) void,
    f_delete_text: ?*const fn (p_editable: *gtk.Editable, p_start_pos: c_int, p_end_pos: c_int) callconv(.c) void,
    f_changed: ?*const fn (p_editable: *gtk.Editable) callconv(.c) void,
    f_get_text: ?*const fn (p_editable: *gtk.Editable) callconv(.c) [*:0]const u8,
    f_do_insert_text: ?*const fn (p_editable: *gtk.Editable, p_text: [*:0]const u8, p_length: c_int, p_position: *c_int) callconv(.c) void,
    f_do_delete_text: ?*const fn (p_editable: *gtk.Editable, p_start_pos: c_int, p_end_pos: c_int) callconv(.c) void,
    f_get_selection_bounds: ?*const fn (p_editable: *gtk.Editable, p_start_pos: ?*c_int, p_end_pos: ?*c_int) callconv(.c) c_int,
    f_set_selection_bounds: ?*const fn (p_editable: *gtk.Editable, p_start_pos: c_int, p_end_pos: c_int) callconv(.c) void,
    f_get_delegate: ?*const fn (p_editable: *gtk.Editable) callconv(.c) ?*gtk.Editable,

    pub fn as(p_instance: *EditableInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EditableLabelClass = extern struct {
    pub const Instance = gtk.EditableLabel;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *EditableLabelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EmojiChooserClass = opaque {
    pub const Instance = gtk.EmojiChooser;

    pub fn as(p_instance: *EmojiChooserClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EntryBufferClass = extern struct {
    pub const Instance = gtk.EntryBuffer;

    f_parent_class: gobject.ObjectClass,
    f_inserted_text: ?*const fn (p_buffer: *gtk.EntryBuffer, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) callconv(.c) void,
    f_deleted_text: ?*const fn (p_buffer: *gtk.EntryBuffer, p_position: c_uint, p_n_chars: c_uint) callconv(.c) void,
    f_get_text: ?*const fn (p_buffer: *gtk.EntryBuffer, p_n_bytes: *usize) callconv(.c) [*:0]const u8,
    f_get_length: ?*const fn (p_buffer: *gtk.EntryBuffer) callconv(.c) c_uint,
    f_insert_text: ?*const fn (p_buffer: *gtk.EntryBuffer, p_position: c_uint, p_chars: [*:0]const u8, p_n_chars: c_uint) callconv(.c) c_uint,
    f_delete_text: ?*const fn (p_buffer: *gtk.EntryBuffer, p_position: c_uint, p_n_chars: c_uint) callconv(.c) c_uint,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,
    f__gtk_reserved5: ?*const fn () callconv(.c) void,
    f__gtk_reserved6: ?*const fn () callconv(.c) void,
    f__gtk_reserved7: ?*const fn () callconv(.c) void,
    f__gtk_reserved8: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *EntryBufferClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Class structure for `GtkEntry`. All virtual functions have a default
/// implementation. Derived classes may set the virtual function pointers for the
/// signal handlers to `NULL`, but must keep `get_text_area_size` and
/// `get_frame_size` non-`NULL`; either use the default implementation, or provide
/// a custom one.
pub const EntryClass = extern struct {
    pub const Instance = gtk.Entry;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    /// Class handler for the `GtkEntry::activate` signal. The default
    ///   implementation activates the gtk.activate-default action.
    f_activate: ?*const fn (p_entry: *gtk.Entry) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *EntryClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EventControllerClass = opaque {
    pub const Instance = gtk.EventController;

    pub fn as(p_instance: *EventControllerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EventControllerFocusClass = opaque {
    pub const Instance = gtk.EventControllerFocus;

    pub fn as(p_instance: *EventControllerFocusClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EventControllerKeyClass = opaque {
    pub const Instance = gtk.EventControllerKey;

    pub fn as(p_instance: *EventControllerKeyClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EventControllerLegacyClass = opaque {
    pub const Instance = gtk.EventControllerLegacy;

    pub fn as(p_instance: *EventControllerLegacyClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EventControllerMotionClass = opaque {
    pub const Instance = gtk.EventControllerMotion;

    pub fn as(p_instance: *EventControllerMotionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EventControllerScrollClass = opaque {
    pub const Instance = gtk.EventControllerScroll;

    pub fn as(p_instance: *EventControllerScrollClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const EveryFilterClass = opaque {
    pub const Instance = gtk.EveryFilter;

    pub fn as(p_instance: *EveryFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An opaque structure representing a watched `GtkExpression`.
///
/// The contents of `GtkExpressionWatch` should only be accessed through the
/// provided API.
pub const ExpressionWatch = opaque {
    /// Evaluates the watched expression and on success stores the result
    /// in `value`.
    ///
    /// This is equivalent to calling `gtk.Expression.evaluate` with the
    /// expression and this pointer originally used to create `watch`.
    extern fn gtk_expression_watch_evaluate(p_watch: *ExpressionWatch, p_value: *gobject.Value) c_int;
    pub const evaluate = gtk_expression_watch_evaluate;

    /// Acquires a reference on the given `GtkExpressionWatch`.
    extern fn gtk_expression_watch_ref(p_watch: *ExpressionWatch) *gtk.ExpressionWatch;
    pub const ref = gtk_expression_watch_ref;

    /// Releases a reference on the given `GtkExpressionWatch`.
    ///
    /// If the reference was the last, the resources associated to `self` are
    /// freed.
    extern fn gtk_expression_watch_unref(p_watch: *ExpressionWatch) void;
    pub const unref = gtk_expression_watch_unref;

    /// Stops watching an expression.
    ///
    /// See `gtk.Expression.watch` for how the watch
    /// was established.
    extern fn gtk_expression_watch_unwatch(p_watch: *ExpressionWatch) void;
    pub const unwatch = gtk_expression_watch_unwatch;

    extern fn gtk_expression_watch_get_type() usize;
    pub const getGObjectType = gtk_expression_watch_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FileChooserNativeClass = extern struct {
    pub const Instance = gtk.FileChooserNative;

    f_parent_class: gtk.NativeDialogClass,

    pub fn as(p_instance: *FileChooserNativeClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FileDialogClass = extern struct {
    pub const Instance = gtk.FileDialog;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *FileDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FileLauncherClass = extern struct {
    pub const Instance = gtk.FileLauncher;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *FileLauncherClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FilterClass = extern struct {
    pub const Instance = gtk.Filter;

    f_parent_class: gobject.ObjectClass,
    f_match: ?*const fn (p_self: *gtk.Filter, p_item: ?*gobject.Object) callconv(.c) c_int,
    f_get_strictness: ?*const fn (p_self: *gtk.Filter) callconv(.c) gtk.FilterMatch,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,
    f__gtk_reserved5: ?*const fn () callconv(.c) void,
    f__gtk_reserved6: ?*const fn () callconv(.c) void,
    f__gtk_reserved7: ?*const fn () callconv(.c) void,
    f__gtk_reserved8: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *FilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FilterListModelClass = extern struct {
    pub const Instance = gtk.FilterListModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *FilterListModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FixedClass = extern struct {
    pub const Instance = gtk.Fixed;

    f_parent_class: gtk.WidgetClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *FixedClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FixedLayoutChildClass = extern struct {
    pub const Instance = gtk.FixedLayoutChild;

    f_parent_class: gtk.LayoutChildClass,

    pub fn as(p_instance: *FixedLayoutChildClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FixedLayoutClass = extern struct {
    pub const Instance = gtk.FixedLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *FixedLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FlattenListModelClass = extern struct {
    pub const Instance = gtk.FlattenListModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *FlattenListModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FlowBoxChildClass = extern struct {
    pub const Instance = gtk.FlowBoxChild;

    f_parent_class: gtk.WidgetClass,
    f_activate: ?*const fn (p_child: *gtk.FlowBoxChild) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *FlowBoxChildClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FontChooserIface = extern struct {
    pub const Instance = gtk.FontChooser;

    f_base_iface: gobject.TypeInterface,
    f_get_font_family: ?*const fn (p_fontchooser: *gtk.FontChooser) callconv(.c) ?*pango.FontFamily,
    f_get_font_face: ?*const fn (p_fontchooser: *gtk.FontChooser) callconv(.c) ?*pango.FontFace,
    f_get_font_size: ?*const fn (p_fontchooser: *gtk.FontChooser) callconv(.c) c_int,
    f_set_filter_func: ?*const fn (p_fontchooser: *gtk.FontChooser, p_filter: ?gtk.FontFilterFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void,
    f_font_activated: ?*const fn (p_chooser: *gtk.FontChooser, p_fontname: [*:0]const u8) callconv(.c) void,
    f_set_font_map: ?*const fn (p_fontchooser: *gtk.FontChooser, p_fontmap: ?*pango.FontMap) callconv(.c) void,
    f_get_font_map: ?*const fn (p_fontchooser: *gtk.FontChooser) callconv(.c) ?*pango.FontMap,
    f_padding: [10]*anyopaque,

    pub fn as(p_instance: *FontChooserIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FontDialogButtonClass = extern struct {
    pub const Instance = gtk.FontDialogButton;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *FontDialogButtonClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FontDialogClass = extern struct {
    pub const Instance = gtk.FontDialog;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *FontDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const FrameClass = extern struct {
    pub const Instance = gtk.Frame;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    f_compute_child_allocation: ?*const fn (p_frame: *gtk.Frame, p_allocation: *gtk.Allocation) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *FrameClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkGLAreaClass` structure contains only private data.
pub const GLAreaClass = extern struct {
    pub const Instance = gtk.GLArea;

    f_parent_class: gtk.WidgetClass,
    /// class closure for the `GtkGLArea::render` signal
    f_render: ?*const fn (p_area: *gtk.GLArea, p_context: *gdk.GLContext) callconv(.c) c_int,
    /// class closeure for the `GtkGLArea::resize` signal
    f_resize: ?*const fn (p_area: *gtk.GLArea, p_width: c_int, p_height: c_int) callconv(.c) void,
    /// class closure for the `GtkGLArea::create-context` signal
    f_create_context: ?*const fn (p_area: *gtk.GLArea) callconv(.c) *gdk.GLContext,
    f__padding: [8]*anyopaque,

    pub fn as(p_instance: *GLAreaClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureClass = opaque {
    pub const Instance = gtk.Gesture;

    pub fn as(p_instance: *GestureClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureClickClass = opaque {
    pub const Instance = gtk.GestureClick;

    pub fn as(p_instance: *GestureClickClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureDragClass = opaque {
    pub const Instance = gtk.GestureDrag;

    pub fn as(p_instance: *GestureDragClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureLongPressClass = opaque {
    pub const Instance = gtk.GestureLongPress;

    pub fn as(p_instance: *GestureLongPressClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GesturePanClass = opaque {
    pub const Instance = gtk.GesturePan;

    pub fn as(p_instance: *GesturePanClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureRotateClass = opaque {
    pub const Instance = gtk.GestureRotate;

    pub fn as(p_instance: *GestureRotateClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureSingleClass = opaque {
    pub const Instance = gtk.GestureSingle;

    pub fn as(p_instance: *GestureSingleClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureStylusClass = opaque {
    pub const Instance = gtk.GestureStylus;

    pub fn as(p_instance: *GestureStylusClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureSwipeClass = opaque {
    pub const Instance = gtk.GestureSwipe;

    pub fn as(p_instance: *GestureSwipeClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GestureZoomClass = opaque {
    pub const Instance = gtk.GestureZoom;

    pub fn as(p_instance: *GestureZoomClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GraphicsOffloadClass = extern struct {
    pub const Instance = gtk.GraphicsOffload;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *GraphicsOffloadClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GridClass = extern struct {
    pub const Instance = gtk.Grid;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *GridClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GridLayoutChildClass = extern struct {
    pub const Instance = gtk.GridLayoutChild;

    f_parent_class: gtk.LayoutChildClass,

    pub fn as(p_instance: *GridLayoutChildClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GridLayoutClass = extern struct {
    pub const Instance = gtk.GridLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *GridLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const GridViewClass = opaque {
    pub const Instance = gtk.GridView;

    pub fn as(p_instance: *GridViewClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const IMContextClass = extern struct {
    pub const Instance = gtk.IMContext;

    f_parent_class: gobject.ObjectClass,
    /// Default handler of the `gtk.IMContext.signals.preedit_start` signal.
    f_preedit_start: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    /// Default handler of the `gtk.IMContext.signals.preedit_end` signal.
    f_preedit_end: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    /// Default handler of the `gtk.IMContext.signals.preedit_changed`
    ///   signal.
    f_preedit_changed: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    /// Default handler of the `gtk.IMContext.signals.commit` signal.
    f_commit: ?*const fn (p_context: *gtk.IMContext, p_str: [*:0]const u8) callconv(.c) void,
    /// Default handler of the
    ///   `gtk.IMContext.signals.retrieve_surrounding` signal.
    f_retrieve_surrounding: ?*const fn (p_context: *gtk.IMContext) callconv(.c) c_int,
    /// Default handler of the
    ///   `gtk.IMContext.signals.delete_surrounding` signal.
    f_delete_surrounding: ?*const fn (p_context: *gtk.IMContext, p_offset: c_int, p_n_chars: c_int) callconv(.c) c_int,
    /// Called via `gtk.IMContext.setClientWidget` when
    ///   the input window where the entered text will appear changes. Override this
    ///   to keep track of the current input window, for instance for the purpose of
    ///   positioning a status display of your input method.
    f_set_client_widget: ?*const fn (p_context: *gtk.IMContext, p_widget: ?*gtk.Widget) callconv(.c) void,
    /// Called via `gtk.IMContext.getPreeditString`
    ///   to retrieve the text currently being preedited for display at the cursor
    ///   position. Any input method which composes complex characters or any
    ///   other compositions from multiple sequential key presses should override
    ///   this method to provide feedback.
    f_get_preedit_string: ?*const fn (p_context: *gtk.IMContext, p_str: *[*:0]u8, p_attrs: **pango.AttrList, p_cursor_pos: *c_int) callconv(.c) void,
    /// Called via `gtk.IMContext.filterKeypress` on every
    ///   key press or release event. Every non-trivial input method needs to
    ///   override this in order to implement the mapping from key events to text.
    ///   A return value of `TRUE` indicates to the caller that the event was
    ///   consumed by the input method. In that case, the `gtk.IMContext.signals.commit`
    ///   signal should be emitted upon completion of a key sequence to pass the
    ///   resulting text back to the input widget. Alternatively, `FALSE` may be
    ///   returned to indicate that the event wasn’t handled by the input method.
    ///   If a builtin mapping exists for the key, it is used to produce a
    ///   character.
    f_filter_keypress: ?*const fn (p_context: *gtk.IMContext, p_event: *gdk.Event) callconv(.c) c_int,
    /// Called via `gtk.IMContext.focusIn` when the input widget
    ///   has gained focus. May be overridden to keep track of the current focus.
    f_focus_in: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    /// Called via `gtk.IMContext.focusOut` when the input widget
    ///   has lost focus. May be overridden to keep track of the current focus.
    f_focus_out: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    /// Called via `gtk.IMContext.reset` to signal a change such as a
    ///   change in cursor position. An input method that implements preediting
    ///   should override this method to clear the preedit state on reset.
    f_reset: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    /// Called via `gtk.IMContext.setCursorLocation`
    ///   to inform the input method of the current cursor location relative to
    ///   the client window. May be overridden to implement the display of popup
    ///   windows at the cursor position.
    f_set_cursor_location: ?*const fn (p_context: *gtk.IMContext, p_area: *gdk.Rectangle) callconv(.c) void,
    /// Called via `gtk.IMContext.setUsePreedit` to control
    ///   the use of the preedit string. Override this to display feedback by some
    ///   other means if turned off.
    f_set_use_preedit: ?*const fn (p_context: *gtk.IMContext, p_use_preedit: c_int) callconv(.c) void,
    /// Called via `gtk.IMContext.setSurrounding` in
    ///   response to `gtk.IMContext.signals.retrieve_surrounding` signal to update
    ///   the input method’s idea of the context around the cursor. It is not necessary
    ///   to override this method even with input methods which implement
    ///   context-dependent behavior. The base implementation is sufficient for
    ///   `gtk.IMContext.getSurrounding` to work.
    f_set_surrounding: ?*const fn (p_context: *gtk.IMContext, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int) callconv(.c) void,
    /// Called via `gtk.IMContext.getSurrounding` to update
    ///   the context around the cursor location. It is not necessary to override this
    ///   method even with input methods which implement context-dependent behavior.
    ///   The base implementation emits `gtk.IMContext.signals.retrieve_surrounding`
    ///   and records the context received by the subsequent invocation of
    ///   `gtk.IMContext.virtual_methods.get_surrounding`.
    f_get_surrounding: ?*const fn (p_context: *gtk.IMContext, p_text: *[*:0]u8, p_cursor_index: *c_int) callconv(.c) c_int,
    /// Called via
    ///   `gtk.IMContext.setSurroundingWithSelection` in response to the
    ///   `gtk.IMContext.signals.retrieve_surrounding` signal to update the input
    ///   method’s idea of the context around the cursor. It is not necessary to
    ///   override this method even with input methods which implement
    ///   context-dependent behavior. The base implementation is sufficient for
    ///   `gtk.IMContext.getSurrounding` to work.
    f_set_surrounding_with_selection: ?*const fn (p_context: *gtk.IMContext, p_text: [*:0]const u8, p_len: c_int, p_cursor_index: c_int, p_anchor_index: c_int) callconv(.c) void,
    /// Called via
    ///   `gtk.IMContext.getSurroundingWithSelection` to update the
    ///   context around the cursor location. It is not necessary to override
    ///   this method even with input methods which implement context-dependent
    ///   behavior. The base implementation emits
    ///   `gtk.IMContext.signals.retrieve_surrounding` and records the context
    ///   received by the subsequent invocation of `gtk.IMContext.virtual_methods.get_surrounding`.
    f_get_surrounding_with_selection: ?*const fn (p_context: *gtk.IMContext, p_text: *[*:0]u8, p_cursor_index: *c_int, p_anchor_index: *c_int) callconv(.c) c_int,
    f_activate_osk: ?*const fn (p_context: *gtk.IMContext) callconv(.c) void,
    f_activate_osk_with_event: ?*const fn (p_context: *gtk.IMContext, p_event: *gdk.Event) callconv(.c) c_int,
    /// Default handler of the
    ///   `gtk.IMContext.signals.invalid_composition` signal. Since: 4.22
    f_invalid_composition: ?*const fn (p_context: *gtk.IMContext, p_str: [*:0]const u8) callconv(.c) c_int,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *IMContextClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const IMContextSimpleClass = extern struct {
    pub const Instance = gtk.IMContextSimple;

    f_parent_class: gtk.IMContextClass,

    pub fn as(p_instance: *IMContextSimpleClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const IMContextSimplePrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const IMMulticontextClass = extern struct {
    pub const Instance = gtk.IMMulticontext;

    f_parent_class: gtk.IMContextClass,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *IMMulticontextClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const IMMulticontextPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const IconPaintableClass = extern struct {
    pub const Instance = gtk.IconPaintable;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *IconPaintableClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const InscriptionClass = extern struct {
    pub const Instance = gtk.Inscription;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *InscriptionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const KeyvalTriggerClass = opaque {
    pub const Instance = gtk.KeyvalTrigger;

    pub fn as(p_instance: *KeyvalTriggerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const LayoutChildClass = extern struct {
    pub const Instance = gtk.LayoutChild;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *LayoutChildClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkLayoutManagerClass` structure contains only private data, and
/// should only be accessed through the provided API, or when subclassing
/// `GtkLayoutManager`.
pub const LayoutManagerClass = extern struct {
    pub const Instance = gtk.LayoutManager;

    f_parent_class: gobject.ObjectClass,
    /// a virtual function, used to return the preferred
    ///   request mode for the layout manager; for instance, "width for height"
    ///   or "height for width"; see `GtkSizeRequestMode`
    f_get_request_mode: ?*const fn (p_manager: *gtk.LayoutManager, p_widget: *gtk.Widget) callconv(.c) gtk.SizeRequestMode,
    /// a virtual function, used to measure the minimum and preferred
    ///   sizes of the widget using the layout manager for a given orientation
    f_measure: ?*const fn (p_manager: *gtk.LayoutManager, p_widget: *gtk.Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) callconv(.c) void,
    /// a virtual function, used to allocate the size of the widget
    ///   using the layout manager
    f_allocate: ?*const fn (p_manager: *gtk.LayoutManager, p_widget: *gtk.Widget, p_width: c_int, p_height: c_int, p_baseline: c_int) callconv(.c) void,
    /// the type of `GtkLayoutChild` used by this layout manager
    f_layout_child_type: usize,
    /// a virtual function, used to create a `GtkLayoutChild`
    ///   meta object for the layout properties
    f_create_layout_child: ?*const fn (p_manager: *gtk.LayoutManager, p_widget: *gtk.Widget, p_for_child: *gtk.Widget) callconv(.c) *gtk.LayoutChild,
    /// a virtual function, called when the widget using the layout
    ///   manager is attached to a `GtkRoot`
    f_root: ?*const fn (p_manager: *gtk.LayoutManager) callconv(.c) void,
    /// a virtual function, called when the widget using the layout
    ///   manager is detached from a `GtkRoot`
    f_unroot: ?*const fn (p_manager: *gtk.LayoutManager) callconv(.c) void,
    f__padding: [16]*anyopaque,

    pub fn as(p_instance: *LayoutManagerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListBaseClass = opaque {
    pub const Instance = gtk.ListBase;

    pub fn as(p_instance: *ListBaseClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListBoxRowClass = extern struct {
    pub const Instance = gtk.ListBoxRow;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    f_activate: ?*const fn (p_row: *gtk.ListBoxRow) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ListBoxRowClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListHeaderClass = opaque {
    pub const Instance = gtk.ListHeader;

    pub fn as(p_instance: *ListHeaderClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListItemClass = opaque {
    pub const Instance = gtk.ListItem;

    pub fn as(p_instance: *ListItemClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListItemFactoryClass = opaque {
    pub const Instance = gtk.ListItemFactory;

    pub fn as(p_instance: *ListItemFactoryClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListStoreClass = extern struct {
    pub const Instance = gtk.ListStore;

    f_parent_class: gobject.ObjectClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ListStoreClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListStorePrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ListViewClass = opaque {
    pub const Instance = gtk.ListView;

    pub fn as(p_instance: *ListViewClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MapListModelClass = extern struct {
    pub const Instance = gtk.MapListModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *MapListModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MediaControlsClass = extern struct {
    pub const Instance = gtk.MediaControls;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *MediaControlsClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MediaFileClass = extern struct {
    pub const Instance = gtk.MediaFile;

    f_parent_class: gtk.MediaStreamClass,
    f_open: ?*const fn (p_self: *gtk.MediaFile) callconv(.c) void,
    f_close: ?*const fn (p_self: *gtk.MediaFile) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *MediaFileClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MediaStreamClass = extern struct {
    pub const Instance = gtk.MediaStream;

    f_parent_class: gobject.ObjectClass,
    f_play: ?*const fn (p_self: *gtk.MediaStream) callconv(.c) c_int,
    f_pause: ?*const fn (p_self: *gtk.MediaStream) callconv(.c) void,
    f_seek: ?*const fn (p_self: *gtk.MediaStream, p_timestamp: i64) callconv(.c) void,
    f_update_audio: ?*const fn (p_self: *gtk.MediaStream, p_muted: c_int, p_volume: f64) callconv(.c) void,
    f_realize: ?*const fn (p_self: *gtk.MediaStream, p_surface: *gdk.Surface) callconv(.c) void,
    f_unrealize: ?*const fn (p_self: *gtk.MediaStream, p_surface: *gdk.Surface) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,
    f__gtk_reserved5: ?*const fn () callconv(.c) void,
    f__gtk_reserved6: ?*const fn () callconv(.c) void,
    f__gtk_reserved7: ?*const fn () callconv(.c) void,
    f__gtk_reserved8: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *MediaStreamClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MessageDialogClass = opaque {
    pub const Instance = gtk.MessageDialog;

    pub fn as(p_instance: *MessageDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MnemonicActionClass = opaque {
    pub const Instance = gtk.MnemonicAction;

    pub fn as(p_instance: *MnemonicActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MnemonicTriggerClass = opaque {
    pub const Instance = gtk.MnemonicTrigger;

    pub fn as(p_instance: *MnemonicTriggerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MountOperationClass = extern struct {
    pub const Instance = gtk.MountOperation;

    /// The parent class.
    f_parent_class: gio.MountOperationClass,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *MountOperationClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MountOperationPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MultiFilterClass = opaque {
    pub const Instance = gtk.MultiFilter;

    pub fn as(p_instance: *MultiFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MultiSelectionClass = extern struct {
    pub const Instance = gtk.MultiSelection;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *MultiSelectionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const MultiSorterClass = extern struct {
    pub const Instance = gtk.MultiSorter;

    f_parent_class: gtk.SorterClass,

    pub fn as(p_instance: *MultiSorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const NamedActionClass = opaque {
    pub const Instance = gtk.NamedAction;

    pub fn as(p_instance: *NamedActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Class structure for `GtkNativeDialog`.
pub const NativeDialogClass = extern struct {
    pub const Instance = gtk.NativeDialog;

    f_parent_class: gobject.ObjectClass,
    /// class handler for the `GtkNativeDialog::response` signal
    f_response: ?*const fn (p_self: *gtk.NativeDialog, p_response_id: c_int) callconv(.c) void,
    f_show: ?*const fn (p_self: *gtk.NativeDialog) callconv(.c) void,
    f_hide: ?*const fn (p_self: *gtk.NativeDialog) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *NativeDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const NativeInterface = opaque {
    pub const Instance = gtk.Native;

    pub fn as(p_instance: *NativeInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const NeverTriggerClass = opaque {
    pub const Instance = gtk.NeverTrigger;

    pub fn as(p_instance: *NeverTriggerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const NoSelectionClass = extern struct {
    pub const Instance = gtk.NoSelection;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *NoSelectionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const NothingActionClass = opaque {
    pub const Instance = gtk.NothingAction;

    pub fn as(p_instance: *NothingActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const NumericSorterClass = extern struct {
    pub const Instance = gtk.NumericSorter;

    f_parent_class: gtk.SorterClass,

    pub fn as(p_instance: *NumericSorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const OrientableIface = extern struct {
    pub const Instance = gtk.Orientable;

    f_base_iface: gobject.TypeInterface,

    pub fn as(p_instance: *OrientableIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const OverlayLayoutChildClass = extern struct {
    pub const Instance = gtk.OverlayLayoutChild;

    f_parent_class: gtk.LayoutChildClass,

    pub fn as(p_instance: *OverlayLayoutChildClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const OverlayLayoutClass = extern struct {
    pub const Instance = gtk.OverlayLayout;

    f_parent_class: gtk.LayoutManagerClass,

    pub fn as(p_instance: *OverlayLayoutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Struct defining a pad action entry.
pub const PadActionEntry = extern struct {
    /// the type of pad feature that will trigger this action entry.
    f_type: gtk.PadActionType,
    /// the 0-indexed button/ring/strip/dial number that will trigger this action
    ///   entry.
    f_index: c_int,
    /// the mode that will trigger this action entry, or -1 for all modes.
    f_mode: c_int,
    /// Human readable description of this action entry, this string should
    ///   be deemed user-visible.
    f_label: ?[*:0]const u8,
    /// action name that will be activated in the `GActionGroup`.
    f_action_name: ?[*:0]const u8,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PadControllerClass = opaque {
    pub const Instance = gtk.PadController;

    pub fn as(p_instance: *PadControllerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A range of pages to print.
///
/// See also `gtk.PrintSettings.setPageRanges`.
pub const PageRange = extern struct {
    /// start of page range.
    f_start: c_int,
    /// end of page range.
    f_end: c_int,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkPaperSize` handles paper sizes.
///
/// It uses the standard called
/// [PWG 5101.1-2002 PWG: Standard for Media Standardized Names](http://www.pwg.org/standards.html)
/// to name the paper sizes (and to get the data for the page sizes).
/// In addition to standard paper sizes, `GtkPaperSize` allows to
/// construct custom paper sizes with arbitrary dimensions.
///
/// The `GtkPaperSize` object stores not only the dimensions (width
/// and height) of a paper size and its name, it also provides
/// default print margins.
pub const PaperSize = opaque {
    /// Returns the name of the default paper size, which
    /// depends on the current locale.
    extern fn gtk_paper_size_get_default() [*:0]const u8;
    pub const getDefault = gtk_paper_size_get_default;

    /// Creates a list of known paper sizes.
    extern fn gtk_paper_size_get_paper_sizes(p_include_custom: c_int) *glib.List;
    pub const getPaperSizes = gtk_paper_size_get_paper_sizes;

    /// Creates a new `GtkPaperSize` object by parsing a
    /// [PWG 5101.1-2002](ftp://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn10-20020226-5101.1.pdf)
    /// paper name.
    ///
    /// If `name` is `NULL`, the default paper size is returned,
    /// see `gtk.PaperSize.getDefault`.
    extern fn gtk_paper_size_new(p_name: ?[*:0]const u8) *gtk.PaperSize;
    pub const new = gtk_paper_size_new;

    /// Creates a new `GtkPaperSize` object with the
    /// given parameters.
    extern fn gtk_paper_size_new_custom(p_name: [*:0]const u8, p_display_name: [*:0]const u8, p_width: f64, p_height: f64, p_unit: gtk.Unit) *gtk.PaperSize;
    pub const newCustom = gtk_paper_size_new_custom;

    /// Deserialize a paper size from a `GVariant`.
    ///
    /// The `GVariant must be in the format produced by
    /// `gtk.PaperSize.toGvariant`.
    extern fn gtk_paper_size_new_from_gvariant(p_variant: *glib.Variant) *gtk.PaperSize;
    pub const newFromGvariant = gtk_paper_size_new_from_gvariant;

    /// Creates a new `GtkPaperSize` object by using
    /// IPP information.
    ///
    /// If `ipp_name` is not a recognized paper name,
    /// `width` and `height` are used to
    /// construct a custom `GtkPaperSize` object.
    extern fn gtk_paper_size_new_from_ipp(p_ipp_name: [*:0]const u8, p_width: f64, p_height: f64) *gtk.PaperSize;
    pub const newFromIpp = gtk_paper_size_new_from_ipp;

    /// Reads a paper size from the group `group_name` in the key file
    /// `key_file`.
    extern fn gtk_paper_size_new_from_key_file(p_key_file: *glib.KeyFile, p_group_name: ?[*:0]const u8, p_error: ?*?*glib.Error) ?*gtk.PaperSize;
    pub const newFromKeyFile = gtk_paper_size_new_from_key_file;

    /// Creates a new `GtkPaperSize` object by using
    /// PPD information.
    ///
    /// If `ppd_name` is not a recognized PPD paper name,
    /// `ppd_display_name`, `width` and `height` are used to
    /// construct a custom `GtkPaperSize` object.
    extern fn gtk_paper_size_new_from_ppd(p_ppd_name: [*:0]const u8, p_ppd_display_name: [*:0]const u8, p_width: f64, p_height: f64) *gtk.PaperSize;
    pub const newFromPpd = gtk_paper_size_new_from_ppd;

    /// Copies an existing `GtkPaperSize`.
    extern fn gtk_paper_size_copy(p_other: *PaperSize) *gtk.PaperSize;
    pub const copy = gtk_paper_size_copy;

    /// Free the given `GtkPaperSize` object.
    extern fn gtk_paper_size_free(p_size: *PaperSize) void;
    pub const free = gtk_paper_size_free;

    /// Gets the default bottom margin for the `GtkPaperSize`.
    extern fn gtk_paper_size_get_default_bottom_margin(p_size: *PaperSize, p_unit: gtk.Unit) f64;
    pub const getDefaultBottomMargin = gtk_paper_size_get_default_bottom_margin;

    /// Gets the default left margin for the `GtkPaperSize`.
    extern fn gtk_paper_size_get_default_left_margin(p_size: *PaperSize, p_unit: gtk.Unit) f64;
    pub const getDefaultLeftMargin = gtk_paper_size_get_default_left_margin;

    /// Gets the default right margin for the `GtkPaperSize`.
    extern fn gtk_paper_size_get_default_right_margin(p_size: *PaperSize, p_unit: gtk.Unit) f64;
    pub const getDefaultRightMargin = gtk_paper_size_get_default_right_margin;

    /// Gets the default top margin for the `GtkPaperSize`.
    extern fn gtk_paper_size_get_default_top_margin(p_size: *PaperSize, p_unit: gtk.Unit) f64;
    pub const getDefaultTopMargin = gtk_paper_size_get_default_top_margin;

    /// Gets the human-readable name of the `GtkPaperSize`.
    extern fn gtk_paper_size_get_display_name(p_size: *PaperSize) [*:0]const u8;
    pub const getDisplayName = gtk_paper_size_get_display_name;

    /// Gets the paper height of the `GtkPaperSize`, in
    /// units of `unit`.
    extern fn gtk_paper_size_get_height(p_size: *PaperSize, p_unit: gtk.Unit) f64;
    pub const getHeight = gtk_paper_size_get_height;

    /// Gets the name of the `GtkPaperSize`.
    extern fn gtk_paper_size_get_name(p_size: *PaperSize) [*:0]const u8;
    pub const getName = gtk_paper_size_get_name;

    /// Gets the PPD name of the `GtkPaperSize`, which
    /// may be `NULL`.
    extern fn gtk_paper_size_get_ppd_name(p_size: *PaperSize) [*:0]const u8;
    pub const getPpdName = gtk_paper_size_get_ppd_name;

    /// Gets the paper width of the `GtkPaperSize`, in
    /// units of `unit`.
    extern fn gtk_paper_size_get_width(p_size: *PaperSize, p_unit: gtk.Unit) f64;
    pub const getWidth = gtk_paper_size_get_width;

    /// Returns `TRUE` if `size` is not a standard paper size.
    extern fn gtk_paper_size_is_custom(p_size: *PaperSize) c_int;
    pub const isCustom = gtk_paper_size_is_custom;

    /// Compares two `GtkPaperSize` objects.
    extern fn gtk_paper_size_is_equal(p_size1: *PaperSize, p_size2: *gtk.PaperSize) c_int;
    pub const isEqual = gtk_paper_size_is_equal;

    /// Returns `TRUE` if `size` is an IPP standard paper size.
    extern fn gtk_paper_size_is_ipp(p_size: *PaperSize) c_int;
    pub const isIpp = gtk_paper_size_is_ipp;

    /// Changes the dimensions of a `size` to `width` x `height`.
    extern fn gtk_paper_size_set_size(p_size: *PaperSize, p_width: f64, p_height: f64, p_unit: gtk.Unit) void;
    pub const setSize = gtk_paper_size_set_size;

    /// Serialize a paper size to an `a{sv}` variant.
    extern fn gtk_paper_size_to_gvariant(p_paper_size: *PaperSize) *glib.Variant;
    pub const toGvariant = gtk_paper_size_to_gvariant;

    /// This function adds the paper size from `size` to `key_file`.
    extern fn gtk_paper_size_to_key_file(p_size: *PaperSize, p_key_file: *glib.KeyFile, p_group_name: [*:0]const u8) void;
    pub const toKeyFile = gtk_paper_size_to_key_file;

    extern fn gtk_paper_size_get_type() usize;
    pub const getGObjectType = gtk_paper_size_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PasswordEntryBufferClass = extern struct {
    pub const Instance = gtk.PasswordEntryBuffer;

    f_parent_class: gtk.EntryBufferClass,

    pub fn as(p_instance: *PasswordEntryBufferClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PasswordEntryClass = opaque {
    pub const Instance = gtk.PasswordEntry;

    pub fn as(p_instance: *PasswordEntryClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PictureClass = extern struct {
    pub const Instance = gtk.Picture;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *PictureClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PopoverBinClass = extern struct {
    pub const Instance = gtk.PopoverBin;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *PopoverBinClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PopoverClass = extern struct {
    pub const Instance = gtk.Popover;

    f_parent_class: gtk.WidgetClass,
    f_closed: ?*const fn (p_popover: *gtk.Popover) callconv(.c) void,
    f_activate_default: ?*const fn (p_popover: *gtk.Popover) callconv(.c) void,
    f_reserved: [8]*anyopaque,

    pub fn as(p_instance: *PopoverClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A print backend.
pub const PrintBackend = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PrintDialogClass = extern struct {
    pub const Instance = gtk.PrintDialog;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *PrintDialogClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PrintOperationClass = extern struct {
    pub const Instance = gtk.PrintOperation;

    /// The parent class.
    f_parent_class: gobject.ObjectClass,
    /// Signal emitted when the print operation run has finished
    ///    doing everything required for printing.
    f_done: ?*const fn (p_operation: *gtk.PrintOperation, p_result: gtk.PrintOperationResult) callconv(.c) void,
    /// Signal emitted after the user has finished changing
    ///    print settings in the dialog, before the actual rendering starts.
    f_begin_print: ?*const fn (p_operation: *gtk.PrintOperation, p_context: *gtk.PrintContext) callconv(.c) void,
    /// Signal emitted after the “begin-print” signal, but
    ///    before the actual rendering starts.
    f_paginate: ?*const fn (p_operation: *gtk.PrintOperation, p_context: *gtk.PrintContext) callconv(.c) c_int,
    /// Emitted once for every page that is printed,
    ///    to give the application a chance to modify the page setup.
    f_request_page_setup: ?*const fn (p_operation: *gtk.PrintOperation, p_context: *gtk.PrintContext, p_page_nr: c_int, p_setup: *gtk.PageSetup) callconv(.c) void,
    /// Signal emitted for every page that is printed.
    f_draw_page: ?*const fn (p_operation: *gtk.PrintOperation, p_context: *gtk.PrintContext, p_page_nr: c_int) callconv(.c) void,
    /// Signal emitted after all pages have been rendered.
    f_end_print: ?*const fn (p_operation: *gtk.PrintOperation, p_context: *gtk.PrintContext) callconv(.c) void,
    /// Emitted at between the various phases of the print
    ///    operation.
    f_status_changed: ?*const fn (p_operation: *gtk.PrintOperation) callconv(.c) void,
    /// Signal emitted when displaying the print dialog.
    f_create_custom_widget: ?*const fn (p_operation: *gtk.PrintOperation) callconv(.c) *gtk.Widget,
    /// Signal emitted right before “begin-print” if
    ///    you added a custom widget in the “create-custom-widget” handler.
    f_custom_widget_apply: ?*const fn (p_operation: *gtk.PrintOperation, p_widget: *gtk.Widget) callconv(.c) void,
    /// Signal emitted when a preview is requested from the
    ///    native dialog.
    f_preview: ?*const fn (p_operation: *gtk.PrintOperation, p_preview: *gtk.PrintOperationPreview, p_context: *gtk.PrintContext, p_parent: *gtk.Window) callconv(.c) c_int,
    /// Emitted after change of selected printer.
    f_update_custom_widget: ?*const fn (p_operation: *gtk.PrintOperation, p_widget: *gtk.Widget, p_setup: *gtk.PageSetup, p_settings: *gtk.PrintSettings) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *PrintOperationClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PrintOperationPreviewIface = extern struct {
    pub const Instance = gtk.PrintOperationPreview;

    f_g_iface: gobject.TypeInterface,
    f_ready: ?*const fn (p_preview: *gtk.PrintOperationPreview, p_context: *gtk.PrintContext) callconv(.c) void,
    f_got_page_size: ?*const fn (p_preview: *gtk.PrintOperationPreview, p_context: *gtk.PrintContext, p_page_setup: *gtk.PageSetup) callconv(.c) void,
    f_render_page: ?*const fn (p_preview: *gtk.PrintOperationPreview, p_page_nr: c_int) callconv(.c) void,
    f_is_selected: ?*const fn (p_preview: *gtk.PrintOperationPreview, p_page_nr: c_int) callconv(.c) c_int,
    f_end_preview: ?*const fn (p_preview: *gtk.PrintOperationPreview) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,
    f__gtk_reserved5: ?*const fn () callconv(.c) void,
    f__gtk_reserved6: ?*const fn () callconv(.c) void,
    f__gtk_reserved7: ?*const fn () callconv(.c) void,
    f__gtk_reserved8: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *PrintOperationPreviewIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const PrintOperationPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An auxiliary object for printing that allows decoupling the setup from the printing.
///
/// A print setup is obtained by calling `gtk.PrintDialog.setup`,
/// and can later be passed to print functions such as `gtk.PrintDialog.print`.
///
/// Print setups can be reused for multiple print calls.
///
/// Applications may wish to store the page_setup and print_settings from the print setup
/// and copy them to the PrintDialog if they want to keep using them.
pub const PrintSetup = opaque {
    /// Returns the page setup of `setup`.
    ///
    /// It may be different from the `GtkPrintDialog`'s page setup
    /// if the user changed it during the setup process.
    extern fn gtk_print_setup_get_page_setup(p_setup: *PrintSetup) *gtk.PageSetup;
    pub const getPageSetup = gtk_print_setup_get_page_setup;

    /// Returns the print settings of `setup`.
    ///
    /// They may be different from the `GtkPrintDialog`'s settings
    /// if the user changed them during the setup process.
    extern fn gtk_print_setup_get_print_settings(p_setup: *PrintSetup) *gtk.PrintSettings;
    pub const getPrintSettings = gtk_print_setup_get_print_settings;

    /// Increase the reference count of `setup`.
    extern fn gtk_print_setup_ref(p_setup: *PrintSetup) *gtk.PrintSetup;
    pub const ref = gtk_print_setup_ref;

    /// Decrease the reference count of `setup`.
    ///
    /// If the reference count reaches zero,
    /// the object is freed.
    extern fn gtk_print_setup_unref(p_setup: *PrintSetup) void;
    pub const unref = gtk_print_setup_unref;

    extern fn gtk_print_setup_get_type() usize;
    pub const getGObjectType = gtk_print_setup_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const RangeClass = extern struct {
    pub const Instance = gtk.Range;

    f_parent_class: gtk.WidgetClass,
    f_value_changed: ?*const fn (p_range: *gtk.Range) callconv(.c) void,
    f_adjust_bounds: ?*const fn (p_range: *gtk.Range, p_new_value: f64) callconv(.c) void,
    f_move_slider: ?*const fn (p_range: *gtk.Range, p_scroll: gtk.ScrollType) callconv(.c) void,
    f_get_range_border: ?*const fn (p_range: *gtk.Range, p_border_: *gtk.Border) callconv(.c) void,
    f_change_value: ?*const fn (p_range: *gtk.Range, p_scroll: gtk.ScrollType, p_new_value: f64) callconv(.c) c_int,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *RangeClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Meta-data to be passed to `gtk.RecentManager.addFull` when
/// registering a recently used resource.
pub const RecentData = extern struct {
    /// a UTF-8 encoded string, containing the name of the recently
    ///   used resource to be displayed, or `NULL`;
    f_display_name: ?[*:0]u8,
    /// a UTF-8 encoded string, containing a short description of
    ///   the resource, or `NULL`;
    f_description: ?[*:0]u8,
    /// the MIME type of the resource;
    f_mime_type: ?[*:0]u8,
    /// the name of the application that is registering this recently
    ///   used resource;
    f_app_name: ?[*:0]u8,
    /// command line used to launch this resource; may contain the
    ///   “\%f” and “\%u” escape characters which will be expanded
    ///   to the resource file path and URI respectively when the command line
    ///   is retrieved;
    f_app_exec: ?[*:0]u8,
    /// a vector of strings containing
    ///   groups names;
    f_groups: ?[*][*:0]u8,
    /// whether this resource should be displayed only by the
    ///   applications that have registered it or not.
    f_is_private: c_int,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Contains the metadata associated with an item in the
/// recently used files list.
pub const RecentInfo = opaque {
    /// Creates a `GAppInfo` for the specified `GtkRecentInfo`
    ///
    /// In case of error, `error` will be set either with a
    /// `GTK_RECENT_MANAGER_ERROR` or a `G_IO_ERROR`
    extern fn gtk_recent_info_create_app_info(p_info: *RecentInfo, p_app_name: ?[*:0]const u8, p_error: ?*?*glib.Error) ?*gio.AppInfo;
    pub const createAppInfo = gtk_recent_info_create_app_info;

    /// Checks whether the resource pointed by `info` still exists.
    /// At the moment this check is done only on resources pointing
    /// to local files.
    extern fn gtk_recent_info_exists(p_info: *RecentInfo) c_int;
    pub const exists = gtk_recent_info_exists;

    /// Gets the time when the resource
    /// was added to the recently used resources list.
    extern fn gtk_recent_info_get_added(p_info: *RecentInfo) *glib.DateTime;
    pub const getAdded = gtk_recent_info_get_added;

    /// Gets the number of days elapsed since the last update
    /// of the resource pointed by `info`.
    extern fn gtk_recent_info_get_age(p_info: *RecentInfo) c_int;
    pub const getAge = gtk_recent_info_get_age;

    /// Gets the data regarding the application that has registered the resource
    /// pointed by `info`.
    ///
    /// If the command line contains any escape characters defined inside the
    /// storage specification, they will be expanded.
    extern fn gtk_recent_info_get_application_info(p_info: *RecentInfo, p_app_name: [*:0]const u8, p_app_exec: *[*:0]const u8, p_count: *c_uint, p_stamp: **glib.DateTime) c_int;
    pub const getApplicationInfo = gtk_recent_info_get_application_info;

    /// Retrieves the list of applications that have registered this resource.
    extern fn gtk_recent_info_get_applications(p_info: *RecentInfo, p_length: ?*usize) [*:null]?[*:0]u8;
    pub const getApplications = gtk_recent_info_get_applications;

    /// Gets the (short) description of the resource.
    extern fn gtk_recent_info_get_description(p_info: *RecentInfo) [*:0]const u8;
    pub const getDescription = gtk_recent_info_get_description;

    /// Gets the name of the resource.
    ///
    /// If none has been defined, the basename
    /// of the resource is obtained.
    extern fn gtk_recent_info_get_display_name(p_info: *RecentInfo) [*:0]const u8;
    pub const getDisplayName = gtk_recent_info_get_display_name;

    /// Retrieves the icon associated to the resource MIME type.
    extern fn gtk_recent_info_get_gicon(p_info: *RecentInfo) ?*gio.Icon;
    pub const getGicon = gtk_recent_info_get_gicon;

    /// Returns all groups registered for the recently used item `info`.
    ///
    /// The array of returned group names will be `NULL` terminated, so
    /// length might optionally be `NULL`.
    extern fn gtk_recent_info_get_groups(p_info: *RecentInfo, p_length: ?*usize) [*:null]?[*:0]u8;
    pub const getGroups = gtk_recent_info_get_groups;

    /// Gets the MIME type of the resource.
    extern fn gtk_recent_info_get_mime_type(p_info: *RecentInfo) [*:0]const u8;
    pub const getMimeType = gtk_recent_info_get_mime_type;

    /// Gets the time when the meta-data
    /// for the resource was last modified.
    extern fn gtk_recent_info_get_modified(p_info: *RecentInfo) *glib.DateTime;
    pub const getModified = gtk_recent_info_get_modified;

    /// Gets the value of the “private” flag.
    ///
    /// Resources in the recently used list that have this flag
    /// set to `TRUE` should only be displayed by the applications
    /// that have registered them.
    extern fn gtk_recent_info_get_private_hint(p_info: *RecentInfo) c_int;
    pub const getPrivateHint = gtk_recent_info_get_private_hint;

    /// Computes a valid UTF-8 string that can be used as the
    /// name of the item in a menu or list.
    ///
    /// For example, calling this function on an item that refers
    /// to “file:///foo/bar.txt” will yield “bar.txt”.
    extern fn gtk_recent_info_get_short_name(p_info: *RecentInfo) [*:0]u8;
    pub const getShortName = gtk_recent_info_get_short_name;

    /// Gets the URI of the resource.
    extern fn gtk_recent_info_get_uri(p_info: *RecentInfo) [*:0]const u8;
    pub const getUri = gtk_recent_info_get_uri;

    /// Gets a displayable version of the resource’s URI.
    ///
    /// If the resource is local, it returns a local path; if the
    /// resource is not local, it returns the UTF-8 encoded content
    /// of `gtk.RecentInfo.getUri`.
    extern fn gtk_recent_info_get_uri_display(p_info: *RecentInfo) ?[*:0]u8;
    pub const getUriDisplay = gtk_recent_info_get_uri_display;

    /// Gets the time when the meta-data
    /// for the resource was last visited.
    extern fn gtk_recent_info_get_visited(p_info: *RecentInfo) *glib.DateTime;
    pub const getVisited = gtk_recent_info_get_visited;

    /// Checks whether an application registered this resource using `app_name`.
    extern fn gtk_recent_info_has_application(p_info: *RecentInfo, p_app_name: [*:0]const u8) c_int;
    pub const hasApplication = gtk_recent_info_has_application;

    /// Checks whether `group_name` appears inside the groups
    /// registered for the recently used item `info`.
    extern fn gtk_recent_info_has_group(p_info: *RecentInfo, p_group_name: [*:0]const u8) c_int;
    pub const hasGroup = gtk_recent_info_has_group;

    /// Checks whether the resource is local or not by looking at the
    /// scheme of its URI.
    extern fn gtk_recent_info_is_local(p_info: *RecentInfo) c_int;
    pub const isLocal = gtk_recent_info_is_local;

    /// Gets the name of the last application that have registered the
    /// recently used resource represented by `info`.
    extern fn gtk_recent_info_last_application(p_info: *RecentInfo) [*:0]u8;
    pub const lastApplication = gtk_recent_info_last_application;

    /// Checks whether two `GtkRecentInfo` point to the same resource.
    extern fn gtk_recent_info_match(p_info_a: *RecentInfo, p_info_b: *gtk.RecentInfo) c_int;
    pub const match = gtk_recent_info_match;

    /// Increases the reference count of `recent_info` by one.
    extern fn gtk_recent_info_ref(p_info: *RecentInfo) *gtk.RecentInfo;
    pub const ref = gtk_recent_info_ref;

    /// Decreases the reference count of `info` by one.
    ///
    /// If the reference count reaches zero, `info` is
    /// deallocated, and the memory freed.
    extern fn gtk_recent_info_unref(p_info: *RecentInfo) void;
    pub const unref = gtk_recent_info_unref;

    extern fn gtk_recent_info_get_type() usize;
    pub const getGObjectType = gtk_recent_info_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// `GtkRecentManagerClass` contains only private data.
pub const RecentManagerClass = extern struct {
    pub const Instance = gtk.RecentManager;

    f_parent_class: gobject.ObjectClass,
    f_changed: ?*const fn (p_manager: *gtk.RecentManager) callconv(.c) void,
    f__gtk_recent1: ?*const fn () callconv(.c) void,
    f__gtk_recent2: ?*const fn () callconv(.c) void,
    f__gtk_recent3: ?*const fn () callconv(.c) void,
    f__gtk_recent4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *RecentManagerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const RecentManagerPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents a request of a screen object in a given orientation.
///
/// These are primarily used in container implementations when allocating
/// a natural size for children. See `distributeNaturalAllocation`.
pub const RequestedSize = extern struct {
    /// A client pointer
    f_data: ?*anyopaque,
    /// The minimum size needed for allocation in a given orientation
    f_minimum_size: c_int,
    /// The natural size for allocation in a given orientation
    f_natural_size: c_int,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents the desired size of a widget.
///
/// See [GtkWidget’s geometry management section](class.Widget.html`height`-for-width-geometry-management)
/// for more information.
pub const Requisition = extern struct {
    /// the widget’s desired width
    f_width: c_int,
    /// the widget’s desired height
    f_height: c_int,

    /// Allocates a new `GtkRequisition`.
    ///
    /// The struct is initialized to zero.
    extern fn gtk_requisition_new() *gtk.Requisition;
    pub const new = gtk_requisition_new;

    /// Copies a `GtkRequisition`.
    extern fn gtk_requisition_copy(p_requisition: *const Requisition) *gtk.Requisition;
    pub const copy = gtk_requisition_copy;

    /// Frees a `GtkRequisition`.
    extern fn gtk_requisition_free(p_requisition: *Requisition) void;
    pub const free = gtk_requisition_free;

    extern fn gtk_requisition_get_type() usize;
    pub const getGObjectType = gtk_requisition_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const RootInterface = opaque {
    pub const Instance = gtk.Root;

    pub fn as(p_instance: *RootInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ScaleButtonClass = extern struct {
    pub const Instance = gtk.ScaleButton;

    f_parent_class: gtk.WidgetClass,
    f_value_changed: ?*const fn (p_button: *gtk.ScaleButton, p_value: f64) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ScaleButtonClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ScaleClass = extern struct {
    pub const Instance = gtk.Scale;

    f_parent_class: gtk.RangeClass,
    f_get_layout_offsets: ?*const fn (p_scale: *gtk.Scale, p_x: ?*c_int, p_y: ?*c_int) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ScaleClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides detailed information on how a scroll operation should be performed.
///
/// Scrolling functions usually allow passing a `NULL` scroll info which will
/// cause the default values to be used and just scroll the element into view.
pub const ScrollInfo = opaque {
    /// Creates a new scroll info for scrolling an element into view.
    extern fn gtk_scroll_info_new() *gtk.ScrollInfo;
    pub const new = gtk_scroll_info_new;

    /// Checks if horizontal scrolling is enabled.
    extern fn gtk_scroll_info_get_enable_horizontal(p_self: *ScrollInfo) c_int;
    pub const getEnableHorizontal = gtk_scroll_info_get_enable_horizontal;

    /// Checks if vertical scrolling is enabled.
    extern fn gtk_scroll_info_get_enable_vertical(p_self: *ScrollInfo) c_int;
    pub const getEnableVertical = gtk_scroll_info_get_enable_vertical;

    /// Increases the reference count of a `GtkScrollInfo` by one.
    extern fn gtk_scroll_info_ref(p_self: *ScrollInfo) *gtk.ScrollInfo;
    pub const ref = gtk_scroll_info_ref;

    /// Turns horizontal scrolling on or off.
    extern fn gtk_scroll_info_set_enable_horizontal(p_self: *ScrollInfo, p_horizontal: c_int) void;
    pub const setEnableHorizontal = gtk_scroll_info_set_enable_horizontal;

    /// Turns vertical scrolling on or off.
    extern fn gtk_scroll_info_set_enable_vertical(p_self: *ScrollInfo, p_vertical: c_int) void;
    pub const setEnableVertical = gtk_scroll_info_set_enable_vertical;

    /// Decreases the reference count of a `GtkScrollInfo` by one.
    ///
    /// If the resulting reference count is zero, frees the self.
    extern fn gtk_scroll_info_unref(p_self: *ScrollInfo) void;
    pub const unref = gtk_scroll_info_unref;

    extern fn gtk_scroll_info_get_type() usize;
    pub const getGObjectType = gtk_scroll_info_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ScrollableInterface = extern struct {
    pub const Instance = gtk.Scrollable;

    f_base_iface: gobject.TypeInterface,
    f_get_border: ?*const fn (p_scrollable: *gtk.Scrollable, p_border: *gtk.Border) callconv(.c) c_int,

    pub fn as(p_instance: *ScrollableInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The list of virtual functions for the `GtkSectionModel` interface.
/// No function must be implemented, but unless `GtkSectionModel::`get_section``
/// is implemented, the whole model will just be a single section.
pub const SectionModelInterface = extern struct {
    pub const Instance = gtk.SectionModel;

    f_g_iface: gobject.TypeInterface,
    /// Return the section that covers the given position. If
    ///   the position is outside the number of items, returns a single range from
    ///   n_items to G_MAXUINT
    f_get_section: ?*const fn (p_self: *gtk.SectionModel, p_position: c_uint, p_out_start: *c_uint, p_out_end: *c_uint) callconv(.c) void,

    pub fn as(p_instance: *SectionModelInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SelectionFilterModelClass = extern struct {
    pub const Instance = gtk.SelectionFilterModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *SelectionFilterModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The list of virtual functions for the `GtkSelectionModel` interface.
/// No function must be implemented, but unless `GtkSelectionModel::`is_selected``
/// is implemented, it will not be possible to select items in the set.
///
/// The model does not need to implement any functions to support either
/// selecting or unselecting items. Of course, if the model does not do that,
/// it means that users cannot select or unselect items in a list widget
/// using the model.
///
/// All selection functions fall back to `GtkSelectionModel::`set_selection``
/// so it is sufficient to implement just that function for full selection
/// support.
pub const SelectionModelInterface = extern struct {
    pub const Instance = gtk.SelectionModel;

    f_g_iface: gobject.TypeInterface,
    /// Return if the item at the given position is selected.
    f_is_selected: ?*const fn (p_model: *gtk.SelectionModel, p_position: c_uint) callconv(.c) c_int,
    /// Return a bitset with all currently selected
    ///   items in the given range. By default, this function will call
    ///   `GtkSelectionModel::`is_selected`` on all items in the given range.
    f_get_selection_in_range: ?*const fn (p_model: *gtk.SelectionModel, p_position: c_uint, p_n_items: c_uint) callconv(.c) *gtk.Bitset,
    /// Select the item in the given position. If the operation
    ///   is known to fail, return `FALSE`.
    f_select_item: ?*const fn (p_model: *gtk.SelectionModel, p_position: c_uint, p_unselect_rest: c_int) callconv(.c) c_int,
    /// Unselect the item in the given position. If the
    ///   operation is known to fail, return `FALSE`.
    f_unselect_item: ?*const fn (p_model: *gtk.SelectionModel, p_position: c_uint) callconv(.c) c_int,
    /// Select all items in the given range. If the operation
    ///   is unsupported or known to fail for all items, return `FALSE`.
    f_select_range: ?*const fn (p_model: *gtk.SelectionModel, p_position: c_uint, p_n_items: c_uint, p_unselect_rest: c_int) callconv(.c) c_int,
    /// Unselect all items in the given range. If the
    ///   operation is unsupported or known to fail for all items, return
    ///   `FALSE`.
    f_unselect_range: ?*const fn (p_model: *gtk.SelectionModel, p_position: c_uint, p_n_items: c_uint) callconv(.c) c_int,
    /// Select all items in the model. If the operation is
    ///   unsupported or known to fail for all items, return `FALSE`.
    f_select_all: ?*const fn (p_model: *gtk.SelectionModel) callconv(.c) c_int,
    /// Unselect all items in the model. If the operation is
    ///   unsupported or known to fail for all items, return `FALSE`.
    f_unselect_all: ?*const fn (p_model: *gtk.SelectionModel) callconv(.c) c_int,
    /// Set selection state of all items in mask to selected.
    ///   See `gtk.SelectionModel.setSelection` for a detailed explanation
    ///   of this function.
    f_set_selection: ?*const fn (p_model: *gtk.SelectionModel, p_selected: *gtk.Bitset, p_mask: *gtk.Bitset) callconv(.c) c_int,

    pub fn as(p_instance: *SelectionModelInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutActionClass = opaque {
    pub const Instance = gtk.ShortcutAction;

    pub fn as(p_instance: *ShortcutActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutClass = extern struct {
    pub const Instance = gtk.Shortcut;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *ShortcutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutControllerClass = opaque {
    pub const Instance = gtk.ShortcutController;

    pub fn as(p_instance: *ShortcutControllerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutLabelClass = opaque {
    pub const Instance = gtk.ShortcutLabel;

    pub fn as(p_instance: *ShortcutLabelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The list of functions that can be implemented for the `GtkShortcutManager`
/// interface.
///
/// Note that no function is mandatory to implement, the default implementation
/// will work fine.
pub const ShortcutManagerInterface = extern struct {
    pub const Instance = gtk.ShortcutManager;

    f_g_iface: gobject.TypeInterface,
    /// Add a `GtkShortcutController` to be managed.
    f_add_controller: ?*const fn (p_self: *gtk.ShortcutManager, p_controller: *gtk.ShortcutController) callconv(.c) void,
    /// Remove a `GtkShortcutController` that had previously
    ///   been added
    f_remove_controller: ?*const fn (p_self: *gtk.ShortcutManager, p_controller: *gtk.ShortcutController) callconv(.c) void,

    pub fn as(p_instance: *ShortcutManagerInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutTriggerClass = opaque {
    pub const Instance = gtk.ShortcutTrigger;

    pub fn as(p_instance: *ShortcutTriggerClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutsGroupClass = opaque {
    pub const Instance = gtk.ShortcutsGroup;

    pub fn as(p_instance: *ShortcutsGroupClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutsSectionClass = opaque {
    pub const Instance = gtk.ShortcutsSection;

    pub fn as(p_instance: *ShortcutsSectionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ShortcutsShortcutClass = opaque {
    pub const Instance = gtk.ShortcutsShortcut;

    pub fn as(p_instance: *ShortcutsShortcutClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SignalActionClass = opaque {
    pub const Instance = gtk.SignalAction;

    pub fn as(p_instance: *SignalActionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SignalListItemFactoryClass = opaque {
    pub const Instance = gtk.SignalListItemFactory;

    pub fn as(p_instance: *SignalListItemFactoryClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SingleSelectionClass = extern struct {
    pub const Instance = gtk.SingleSelection;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *SingleSelectionClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SliceListModelClass = extern struct {
    pub const Instance = gtk.SliceListModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *SliceListModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SnapshotClass = opaque {
    pub const Instance = gtk.Snapshot;

    pub fn as(p_instance: *SnapshotClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SortListModelClass = extern struct {
    pub const Instance = gtk.SortListModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *SortListModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The virtual table for `GtkSorter`.
pub const SorterClass = extern struct {
    pub const Instance = gtk.Sorter;

    f_parent_class: gobject.ObjectClass,
    /// Compare two items. See `gtk.Sorter.compare` for details.
    f_compare: ?*const fn (p_self: *gtk.Sorter, p_item1: ?*gobject.Object, p_item2: ?*gobject.Object) callconv(.c) gtk.Ordering,
    /// Get the `GtkSorderOrder` that applies to the current sorter.
    ///   If unimplemented, it returns `GTK_SORTER_ORDER_PARTIAL`.
    f_get_order: ?*const fn (p_self: *gtk.Sorter) callconv(.c) gtk.SorterOrder,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,
    f__gtk_reserved5: ?*const fn () callconv(.c) void,
    f__gtk_reserved6: ?*const fn () callconv(.c) void,
    f__gtk_reserved7: ?*const fn () callconv(.c) void,
    f__gtk_reserved8: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *SorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const StringFilterClass = extern struct {
    pub const Instance = gtk.StringFilter;

    f_parent_class: gtk.FilterClass,

    pub fn as(p_instance: *StringFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const StringListClass = extern struct {
    pub const Instance = gtk.StringList;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *StringListClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const StringObjectClass = extern struct {
    pub const Instance = gtk.StringObject;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *StringObjectClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const StringSorterClass = extern struct {
    pub const Instance = gtk.StringSorter;

    f_parent_class: gtk.SorterClass,

    pub fn as(p_instance: *StringSorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const StyleContextClass = extern struct {
    pub const Instance = gtk.StyleContext;

    f_parent_class: gobject.ObjectClass,
    f_changed: ?*const fn (p_context: *gtk.StyleContext) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *StyleContextClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const SvgClass = extern struct {
    pub const Instance = gtk.Svg;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *SvgClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Provides information about a location in an SVG document.
///
/// The information should be considered approximate; it is
/// meant to provide feedback for errors in an editor.
pub const SvgLocation = extern struct {
    /// the byte index in document. If unknown, this will
    ///   be zero (which is also a valid value, but only if all
    ///   three values are zero)
    f_bytes: usize,
    /// the line index in the document, 0-based
    f_lines: usize,
    /// the char index in the line, 0-based
    f_line_chars: usize,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The list of virtual functions for the `GtkSymbolicPaintable` interface.
/// No function must be implemented, default implementations exist for each one.
pub const SymbolicPaintableInterface = extern struct {
    pub const Instance = gtk.SymbolicPaintable;

    f_g_iface: gobject.TypeInterface,
    /// Snapshot the paintable using the given colors.
    ///   See `GtkSymbolicPaintable::`snapshot_symbolic`` for details.
    ///   If this function is not implemented, `gdk.Paintable.virtual_methods.snapshot`
    ///   will be called.
    f_snapshot_symbolic: ?*const fn (p_paintable: *gtk.SymbolicPaintable, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize) callconv(.c) void,
    /// Like `snapshot_symbolic`, but additionally takes
    ///   a font weight argument. Since: 4.22
    f_snapshot_with_weight: ?*const fn (p_paintable: *gtk.SymbolicPaintable, p_snapshot: *gdk.Snapshot, p_width: f64, p_height: f64, p_colors: [*]const gdk.RGBA, p_n_colors: usize, p_weight: f64) callconv(.c) void,

    pub fn as(p_instance: *SymbolicPaintableInterface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The class structure for `GtkTextBuffer`.
pub const TextBufferClass = extern struct {
    pub const Instance = gtk.TextBuffer;

    /// The object class structure needs to be the first.
    f_parent_class: gobject.ObjectClass,
    /// The class handler for the `GtkTextBuffer::insert-text` signal.
    f_insert_text: ?*const fn (p_buffer: *gtk.TextBuffer, p_pos: *gtk.TextIter, p_new_text: [*:0]const u8, p_new_text_length: c_int) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::insert-paintable` signal.
    f_insert_paintable: ?*const fn (p_buffer: *gtk.TextBuffer, p_iter: *gtk.TextIter, p_paintable: *gdk.Paintable) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::insert-child-anchor` signal.
    f_insert_child_anchor: ?*const fn (p_buffer: *gtk.TextBuffer, p_iter: *gtk.TextIter, p_anchor: *gtk.TextChildAnchor) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::delete-range` signal.
    f_delete_range: ?*const fn (p_buffer: *gtk.TextBuffer, p_start: *gtk.TextIter, p_end: *gtk.TextIter) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::changed` signal.
    f_changed: ?*const fn (p_buffer: *gtk.TextBuffer) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::modified-changed` signal.
    f_modified_changed: ?*const fn (p_buffer: *gtk.TextBuffer) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::mark-set` signal.
    f_mark_set: ?*const fn (p_buffer: *gtk.TextBuffer, p_location: *const gtk.TextIter, p_mark: *gtk.TextMark) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::mark-deleted` signal.
    f_mark_deleted: ?*const fn (p_buffer: *gtk.TextBuffer, p_mark: *gtk.TextMark) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::apply-tag` signal.
    f_apply_tag: ?*const fn (p_buffer: *gtk.TextBuffer, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::remove-tag` signal.
    f_remove_tag: ?*const fn (p_buffer: *gtk.TextBuffer, p_tag: *gtk.TextTag, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::begin-user-action` signal.
    f_begin_user_action: ?*const fn (p_buffer: *gtk.TextBuffer) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::end-user-action` signal.
    f_end_user_action: ?*const fn (p_buffer: *gtk.TextBuffer) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::paste-done` signal.
    f_paste_done: ?*const fn (p_buffer: *gtk.TextBuffer, p_clipboard: *gdk.Clipboard) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::undo` signal
    f_undo: ?*const fn (p_buffer: *gtk.TextBuffer) callconv(.c) void,
    /// The class handler for the `GtkTextBuffer::redo` signal
    f_redo: ?*const fn (p_buffer: *gtk.TextBuffer) callconv(.c) void,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *TextBufferClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextBufferPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextChildAnchorClass = extern struct {
    pub const Instance = gtk.TextChildAnchor;

    f_parent_class: gobject.ObjectClass,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *TextChildAnchorClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Iterates over the contents of a `GtkTextBuffer`.
///
/// You may wish to begin by reading the
/// [text widget conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types
/// related to the text widget and how they work together.
pub const TextIter = extern struct {
    f_dummy1: ?*anyopaque,
    f_dummy2: ?*anyopaque,
    f_dummy3: c_int,
    f_dummy4: c_int,
    f_dummy5: c_int,
    f_dummy6: c_int,
    f_dummy7: c_int,
    f_dummy8: c_int,
    f_dummy9: ?*anyopaque,
    f_dummy10: ?*anyopaque,
    f_dummy11: c_int,
    f_dummy12: c_int,
    f_dummy13: c_int,
    f_dummy14: ?*anyopaque,

    /// Assigns the value of `other` to `iter`.
    ///
    /// This function is not useful in applications, because
    /// iterators can be assigned with `GtkTextIter i = j;`.
    ///
    /// The function is used by language bindings.
    extern fn gtk_text_iter_assign(p_iter: *TextIter, p_other: *const gtk.TextIter) void;
    pub const assign = gtk_text_iter_assign;

    /// Moves backward by one character offset.
    ///
    /// Returns `TRUE` if movement was possible; if `iter` was the first
    /// in the buffer (character offset 0), this function returns `FALSE`
    /// for convenience when writing loops.
    extern fn gtk_text_iter_backward_char(p_iter: *TextIter) c_int;
    pub const backwardChar = gtk_text_iter_backward_char;

    /// Moves `count` characters backward, if possible.
    ///
    /// If `count` would move past the start or end of the buffer, moves
    /// to the start or end of the buffer.
    ///
    /// The return value indicates whether the iterator moved
    /// onto a dereferenceable position; if the iterator didn’t move, or
    /// moved onto the end iterator, then `FALSE` is returned. If `count` is 0,
    /// the function does nothing and returns `FALSE`.
    extern fn gtk_text_iter_backward_chars(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardChars = gtk_text_iter_backward_chars;

    /// Like `gtk.TextIter.forwardCursorPosition`, but moves backward.
    extern fn gtk_text_iter_backward_cursor_position(p_iter: *TextIter) c_int;
    pub const backwardCursorPosition = gtk_text_iter_backward_cursor_position;

    /// Moves up to `count` cursor positions.
    ///
    /// See `gtk.TextIter.forwardCursorPosition` for details.
    extern fn gtk_text_iter_backward_cursor_positions(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardCursorPositions = gtk_text_iter_backward_cursor_positions;

    /// Same as `gtk.TextIter.forwardFindChar`,
    /// but goes backward from `iter`.
    extern fn gtk_text_iter_backward_find_char(p_iter: *TextIter, p_pred: gtk.TextCharPredicate, p_user_data: ?*anyopaque, p_limit: ?*const gtk.TextIter) c_int;
    pub const backwardFindChar = gtk_text_iter_backward_find_char;

    /// Moves `iter` to the start of the previous line.
    ///
    /// Returns `TRUE` if `iter` could be moved; i.e. if `iter` was at
    /// character offset 0, this function returns `FALSE`. Therefore,
    /// if `iter` was already on line 0, but not at the start of the line,
    /// `iter` is snapped to the start of the line and the function returns
    /// `TRUE`. (Note that this implies that
    /// in a loop calling this function, the line number may not change on
    /// every iteration, if your first iteration is on line 0.)
    extern fn gtk_text_iter_backward_line(p_iter: *TextIter) c_int;
    pub const backwardLine = gtk_text_iter_backward_line;

    /// Moves `count` lines backward, if possible.
    ///
    /// If `count` would move past the start or end of the buffer, moves to
    /// the start or end of the buffer.
    ///
    /// The return value indicates whether the iterator moved
    /// onto a dereferenceable position; if the iterator didn’t move, or
    /// moved onto the end iterator, then `FALSE` is returned. If `count` is 0,
    /// the function does nothing and returns `FALSE`. If `count` is negative,
    /// moves forward by 0 - `count` lines.
    extern fn gtk_text_iter_backward_lines(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardLines = gtk_text_iter_backward_lines;

    /// Same as `gtk.TextIter.forwardSearch`, but moves backward.
    ///
    /// `match_end` will never be set to a `GtkTextIter` located after `iter`,
    /// even if there is a possible `match_start` before or at `iter`.
    extern fn gtk_text_iter_backward_search(p_iter: *const TextIter, p_str: [*:0]const u8, p_flags: gtk.TextSearchFlags, p_match_start: ?*gtk.TextIter, p_match_end: ?*gtk.TextIter, p_limit: ?*const gtk.TextIter) c_int;
    pub const backwardSearch = gtk_text_iter_backward_search;

    /// Moves backward to the previous sentence start.
    ///
    /// If `iter` is already at the start of a sentence, moves backward
    /// to the next one.
    ///
    /// Sentence boundaries are determined by Pango and should
    /// be correct for nearly any language.
    extern fn gtk_text_iter_backward_sentence_start(p_iter: *TextIter) c_int;
    pub const backwardSentenceStart = gtk_text_iter_backward_sentence_start;

    /// Calls `gtk.TextIter.backwardSentenceStart` up to `count` times.
    ///
    /// If `count` is negative, moves forward instead of backward.
    extern fn gtk_text_iter_backward_sentence_starts(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardSentenceStarts = gtk_text_iter_backward_sentence_starts;

    /// Moves backward to the next toggle (on or off) of the
    /// `tag`, or to the next toggle of any tag if
    /// `tag` is `NULL`.
    ///
    /// If no matching tag toggles are found,
    /// returns `FALSE`, otherwise `TRUE`. Does not return toggles
    /// located at `iter`, only toggles before `iter`. Sets `iter`
    /// to the location of the toggle, or the start of the buffer
    /// if no toggle is found.
    extern fn gtk_text_iter_backward_to_tag_toggle(p_iter: *TextIter, p_tag: ?*gtk.TextTag) c_int;
    pub const backwardToTagToggle = gtk_text_iter_backward_to_tag_toggle;

    /// Moves `iter` backward to the previous visible cursor position.
    ///
    /// See `gtk.TextIter.backwardCursorPosition` for details.
    extern fn gtk_text_iter_backward_visible_cursor_position(p_iter: *TextIter) c_int;
    pub const backwardVisibleCursorPosition = gtk_text_iter_backward_visible_cursor_position;

    /// Moves up to `count` visible cursor positions.
    ///
    /// See `gtk.TextIter.backwardCursorPosition` for details.
    extern fn gtk_text_iter_backward_visible_cursor_positions(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardVisibleCursorPositions = gtk_text_iter_backward_visible_cursor_positions;

    /// Moves `iter` to the start of the previous visible line.
    ///
    /// Returns `TRUE` if
    /// `iter` could be moved; i.e. if `iter` was at character offset 0, this
    /// function returns `FALSE`. Therefore if `iter` was already on line 0,
    /// but not at the start of the line, `iter` is snapped to the start of
    /// the line and the function returns `TRUE`. (Note that this implies that
    /// in a loop calling this function, the line number may not change on
    /// every iteration, if your first iteration is on line 0.)
    extern fn gtk_text_iter_backward_visible_line(p_iter: *TextIter) c_int;
    pub const backwardVisibleLine = gtk_text_iter_backward_visible_line;

    /// Moves `count` visible lines backward, if possible.
    ///
    /// If `count` would move past the start or end of the buffer, moves to
    /// the start or end of the buffer.
    ///
    /// The return value indicates whether the iterator moved
    /// onto a dereferenceable position; if the iterator didn’t move, or
    /// moved onto the end iterator, then `FALSE` is returned. If `count` is 0,
    /// the function does nothing and returns `FALSE`. If `count` is negative,
    /// moves forward by 0 - `count` lines.
    extern fn gtk_text_iter_backward_visible_lines(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardVisibleLines = gtk_text_iter_backward_visible_lines;

    /// Moves backward to the previous visible word start.
    ///
    /// If `iter` is currently on a word start, moves backward to the
    /// next one after that.
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language.
    extern fn gtk_text_iter_backward_visible_word_start(p_iter: *TextIter) c_int;
    pub const backwardVisibleWordStart = gtk_text_iter_backward_visible_word_start;

    /// Calls `gtk.TextIter.backwardVisibleWordStart` up to `count` times.
    extern fn gtk_text_iter_backward_visible_word_starts(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardVisibleWordStarts = gtk_text_iter_backward_visible_word_starts;

    /// Moves backward to the previous word start.
    ///
    /// If `iter` is currently on a word start, moves backward to the
    /// next one after that.
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language
    extern fn gtk_text_iter_backward_word_start(p_iter: *TextIter) c_int;
    pub const backwardWordStart = gtk_text_iter_backward_word_start;

    /// Calls `gtk.TextIter.backwardWordStart` up to `count` times.
    extern fn gtk_text_iter_backward_word_starts(p_iter: *TextIter, p_count: c_int) c_int;
    pub const backwardWordStarts = gtk_text_iter_backward_word_starts;

    /// Considering the default editability of the buffer, and tags that
    /// affect editability, determines whether text inserted at `iter` would
    /// be editable.
    ///
    /// If text inserted at `iter` would be editable then the
    /// user should be allowed to insert text at `iter`.
    /// `gtk.TextBuffer.insertInteractive` uses this function
    /// to decide whether insertions are allowed at a given position.
    extern fn gtk_text_iter_can_insert(p_iter: *const TextIter, p_default_editability: c_int) c_int;
    pub const canInsert = gtk_text_iter_can_insert;

    /// A `qsort`-style function that returns negative if `lhs` is less than
    /// `rhs`, positive if `lhs` is greater than `rhs`, and 0 if they’re equal.
    ///
    /// Ordering is in character offset order, i.e. the first character
    /// in the buffer is less than the second character in the buffer.
    extern fn gtk_text_iter_compare(p_lhs: *const TextIter, p_rhs: *const gtk.TextIter) c_int;
    pub const compare = gtk_text_iter_compare;

    /// Creates a dynamically-allocated copy of an iterator.
    ///
    /// This function is not useful in applications, because
    /// iterators can be copied with a simple assignment
    /// (`GtkTextIter i = j;`).
    ///
    /// The function is used by language bindings.
    extern fn gtk_text_iter_copy(p_iter: *const TextIter) *gtk.TextIter;
    pub const copy = gtk_text_iter_copy;

    /// Returns whether the character at `iter` is within an editable region
    /// of text.
    ///
    /// Non-editable text is “locked” and can’t be changed by the
    /// user via `GtkTextView`. If no tags applied to this text affect
    /// editability, `default_setting` will be returned.
    ///
    /// You don’t want to use this function to decide whether text can be
    /// inserted at `iter`, because for insertion you don’t want to know
    /// whether the char at `iter` is inside an editable range, you want to
    /// know whether a new character inserted at `iter` would be inside an
    /// editable range. Use `gtk.TextIter.canInsert` to handle this
    /// case.
    extern fn gtk_text_iter_editable(p_iter: *const TextIter, p_default_setting: c_int) c_int;
    pub const editable = gtk_text_iter_editable;

    /// Returns `TRUE` if `iter` points to the start of the paragraph
    /// delimiter characters for a line.
    ///
    /// Delimiters will be either a newline, a carriage return, a carriage
    /// return followed by a newline, or a Unicode paragraph separator
    /// character.
    ///
    /// Note that an iterator pointing to the \n of a \r\n pair will not be
    /// counted as the end of a line, the line ends before the \r. The end
    /// iterator is considered to be at the end of a line, even though there
    /// are no paragraph delimiter chars there.
    extern fn gtk_text_iter_ends_line(p_iter: *const TextIter) c_int;
    pub const endsLine = gtk_text_iter_ends_line;

    /// Determines whether `iter` ends a sentence.
    ///
    /// Sentence boundaries are determined by Pango and should
    /// be correct for nearly any language.
    extern fn gtk_text_iter_ends_sentence(p_iter: *const TextIter) c_int;
    pub const endsSentence = gtk_text_iter_ends_sentence;

    /// Returns `TRUE` if `tag` is toggled off at exactly this point.
    ///
    /// If `tag` is `NULL`, returns `TRUE` if any tag is toggled off at this point.
    ///
    /// Note that if this function returns `TRUE`, it means that
    /// `iter` is at the end of the tagged range, but that the character
    /// at `iter` is outside the tagged range. In other words,
    /// unlike `gtk.TextIter.startsTag`, if this function
    /// returns `TRUE`, `gtk.TextIter.hasTag` will return
    /// `FALSE` for the same parameters.
    extern fn gtk_text_iter_ends_tag(p_iter: *const TextIter, p_tag: ?*gtk.TextTag) c_int;
    pub const endsTag = gtk_text_iter_ends_tag;

    /// Determines whether `iter` ends a natural-language word.
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language.
    extern fn gtk_text_iter_ends_word(p_iter: *const TextIter) c_int;
    pub const endsWord = gtk_text_iter_ends_word;

    /// Tests whether two iterators are equal, using the fastest possible
    /// mechanism.
    ///
    /// This function is very fast; you can expect it to perform
    /// better than e.g. getting the character offset for each
    /// iterator and comparing the offsets yourself. Also, it’s a
    /// bit faster than `gtk.TextIter.compare`.
    extern fn gtk_text_iter_equal(p_lhs: *const TextIter, p_rhs: *const gtk.TextIter) c_int;
    pub const equal = gtk_text_iter_equal;

    /// Moves `iter` forward by one character offset.
    ///
    /// Note that images embedded in the buffer occupy 1 character slot, so
    /// this function may actually move onto an image instead of a character,
    /// if you have images in your buffer. If `iter` is the end iterator or
    /// one character before it, `iter` will now point at the end iterator,
    /// and this function returns `FALSE` for convenience when writing loops.
    extern fn gtk_text_iter_forward_char(p_iter: *TextIter) c_int;
    pub const forwardChar = gtk_text_iter_forward_char;

    /// Moves `count` characters if possible.
    ///
    /// If `count` would move past the start or end of the buffer,
    /// moves to the start or end of the buffer.
    ///
    /// The return value indicates whether the new position of
    /// `iter` is different from its original position, and dereferenceable
    /// (the last iterator in the buffer is not dereferenceable). If `count`
    /// is 0, the function does nothing and returns `FALSE`.
    extern fn gtk_text_iter_forward_chars(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardChars = gtk_text_iter_forward_chars;

    /// Moves `iter` forward by a single cursor position.
    ///
    /// Cursor positions are (unsurprisingly) positions where the
    /// cursor can appear. Perhaps surprisingly, there may not be
    /// a cursor position between all characters. The most common
    /// example for European languages would be a carriage return/newline
    /// sequence.
    ///
    /// For some Unicode characters, the equivalent of say the letter “a”
    /// with an accent mark will be represented as two characters, first
    /// the letter then a "combining mark" that causes the accent to be
    /// rendered; so the cursor can’t go between those two characters.
    ///
    /// See also the `pango.LogAttr` struct and the `pango.@"break"`
    /// function.
    extern fn gtk_text_iter_forward_cursor_position(p_iter: *TextIter) c_int;
    pub const forwardCursorPosition = gtk_text_iter_forward_cursor_position;

    /// Moves up to `count` cursor positions.
    ///
    /// See `gtk.TextIter.forwardCursorPosition` for details.
    extern fn gtk_text_iter_forward_cursor_positions(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardCursorPositions = gtk_text_iter_forward_cursor_positions;

    /// Advances `iter`, calling `pred` on each character.
    ///
    /// If `pred` returns `TRUE`, returns `TRUE` and stops scanning.
    /// If `pred` never returns `TRUE`, `iter` is set to `limit` if
    /// `limit` is non-`NULL`, otherwise to the end iterator.
    extern fn gtk_text_iter_forward_find_char(p_iter: *TextIter, p_pred: gtk.TextCharPredicate, p_user_data: ?*anyopaque, p_limit: ?*const gtk.TextIter) c_int;
    pub const forwardFindChar = gtk_text_iter_forward_find_char;

    /// Moves `iter` to the start of the next line.
    ///
    /// If the iter is already on the last line of the buffer,
    /// moves the iter to the end of the current line. If after
    /// the operation, the iter is at the end of the buffer and not
    /// dereferenceable, returns `FALSE`. Otherwise, returns `TRUE`.
    extern fn gtk_text_iter_forward_line(p_iter: *TextIter) c_int;
    pub const forwardLine = gtk_text_iter_forward_line;

    /// Moves `count` lines forward, if possible.
    ///
    /// If `count` would move past the start or end of the buffer, moves to
    /// the start or end of the buffer.
    ///
    /// The return value indicates whether the iterator moved
    /// onto a dereferenceable position; if the iterator didn’t move, or
    /// moved onto the end iterator, then `FALSE` is returned. If `count` is 0,
    /// the function does nothing and returns `FALSE`. If `count` is negative,
    /// moves backward by 0 - `count` lines.
    extern fn gtk_text_iter_forward_lines(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardLines = gtk_text_iter_forward_lines;

    /// Searches forward for `str`.
    ///
    /// Any match is returned by setting `match_start` to the first character
    /// of the match and `match_end` to the first character after the match.
    /// The search will not continue past `limit`. Note that a search is a
    /// linear or O(n) operation, so you may wish to use `limit` to avoid
    /// locking up your UI on large buffers.
    ///
    /// `match_start` will never be set to a `GtkTextIter` located before `iter`,
    /// even if there is a possible `match_end` after or at `iter`.
    extern fn gtk_text_iter_forward_search(p_iter: *const TextIter, p_str: [*:0]const u8, p_flags: gtk.TextSearchFlags, p_match_start: ?*gtk.TextIter, p_match_end: ?*gtk.TextIter, p_limit: ?*const gtk.TextIter) c_int;
    pub const forwardSearch = gtk_text_iter_forward_search;

    /// Moves forward to the next sentence end.
    ///
    /// If `iter` is at the end of a sentence, moves to the next
    /// end of sentence.
    ///
    /// Sentence boundaries are determined by Pango and should
    /// be correct for nearly any language.
    extern fn gtk_text_iter_forward_sentence_end(p_iter: *TextIter) c_int;
    pub const forwardSentenceEnd = gtk_text_iter_forward_sentence_end;

    /// Calls `gtk.TextIter.forwardSentenceEnd` `count` times.
    ///
    /// If `count` is negative, moves backward instead of forward.
    extern fn gtk_text_iter_forward_sentence_ends(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardSentenceEnds = gtk_text_iter_forward_sentence_ends;

    /// Moves `iter` forward to the “end iterator”, which points
    /// one past the last valid character in the buffer.
    ///
    /// `gtk.TextIter.getChar` called on the end iterator
    /// returns 0, which is convenient for writing loops.
    extern fn gtk_text_iter_forward_to_end(p_iter: *TextIter) void;
    pub const forwardToEnd = gtk_text_iter_forward_to_end;

    /// Moves the iterator to point to the paragraph delimiter characters.
    ///
    /// The possible characters are either a newline, a carriage return,
    /// a carriage return/newline in sequence, or the Unicode paragraph
    /// separator character.
    ///
    /// If the iterator is already at the paragraph delimiter
    /// characters, moves to the paragraph delimiter characters for the
    /// next line. If `iter` is on the last line in the buffer, which does
    /// not end in paragraph delimiters, moves to the end iterator (end of
    /// the last line), and returns `FALSE`.
    extern fn gtk_text_iter_forward_to_line_end(p_iter: *TextIter) c_int;
    pub const forwardToLineEnd = gtk_text_iter_forward_to_line_end;

    /// Moves forward to the next toggle (on or off) of the
    /// `tag`, or to the next toggle of any tag if
    /// `tag` is `NULL`.
    ///
    /// If no matching tag toggles are found,
    /// returns `FALSE`, otherwise `TRUE`. Does not return toggles
    /// located at `iter`, only toggles after `iter`. Sets `iter` to
    /// the location of the toggle, or to the end of the buffer
    /// if no toggle is found.
    extern fn gtk_text_iter_forward_to_tag_toggle(p_iter: *TextIter, p_tag: ?*gtk.TextTag) c_int;
    pub const forwardToTagToggle = gtk_text_iter_forward_to_tag_toggle;

    /// Moves `iter` forward to the next visible cursor position.
    ///
    /// See `gtk.TextIter.forwardCursorPosition` for details.
    extern fn gtk_text_iter_forward_visible_cursor_position(p_iter: *TextIter) c_int;
    pub const forwardVisibleCursorPosition = gtk_text_iter_forward_visible_cursor_position;

    /// Moves up to `count` visible cursor positions.
    ///
    /// See `gtk.TextIter.forwardCursorPosition` for details.
    extern fn gtk_text_iter_forward_visible_cursor_positions(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardVisibleCursorPositions = gtk_text_iter_forward_visible_cursor_positions;

    /// Moves `iter` to the start of the next visible line.
    ///
    /// Returns `TRUE` if there
    /// was a next line to move to, and `FALSE` if `iter` was simply moved to
    /// the end of the buffer and is now not dereferenceable, or if `iter` was
    /// already at the end of the buffer.
    extern fn gtk_text_iter_forward_visible_line(p_iter: *TextIter) c_int;
    pub const forwardVisibleLine = gtk_text_iter_forward_visible_line;

    /// Moves `count` visible lines forward, if possible.
    ///
    /// If `count` would move past the start or end of the buffer, moves to
    /// the start or end of the buffer.
    ///
    /// The return value indicates whether the iterator moved
    /// onto a dereferenceable position; if the iterator didn’t move, or
    /// moved onto the end iterator, then `FALSE` is returned. If `count` is 0,
    /// the function does nothing and returns `FALSE`. If `count` is negative,
    /// moves backward by 0 - `count` lines.
    extern fn gtk_text_iter_forward_visible_lines(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardVisibleLines = gtk_text_iter_forward_visible_lines;

    /// Moves forward to the next visible word end.
    ///
    /// If `iter` is currently on a word end, moves forward to the
    /// next one after that.
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language
    extern fn gtk_text_iter_forward_visible_word_end(p_iter: *TextIter) c_int;
    pub const forwardVisibleWordEnd = gtk_text_iter_forward_visible_word_end;

    /// Calls `gtk.TextIter.forwardVisibleWordEnd` up to `count` times.
    extern fn gtk_text_iter_forward_visible_word_ends(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardVisibleWordEnds = gtk_text_iter_forward_visible_word_ends;

    /// Moves forward to the next word end.
    ///
    /// If `iter` is currently on a word end, moves forward to the
    /// next one after that.
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language.
    extern fn gtk_text_iter_forward_word_end(p_iter: *TextIter) c_int;
    pub const forwardWordEnd = gtk_text_iter_forward_word_end;

    /// Calls `gtk.TextIter.forwardWordEnd` up to `count` times.
    extern fn gtk_text_iter_forward_word_ends(p_iter: *TextIter, p_count: c_int) c_int;
    pub const forwardWordEnds = gtk_text_iter_forward_word_ends;

    /// Free an iterator allocated on the heap.
    ///
    /// This function is intended for use in language bindings,
    /// and is not especially useful for applications, because
    /// iterators can simply be allocated on the stack.
    extern fn gtk_text_iter_free(p_iter: *TextIter) void;
    pub const free = gtk_text_iter_free;

    /// Returns the `GtkTextBuffer` this iterator is associated with.
    extern fn gtk_text_iter_get_buffer(p_iter: *const TextIter) *gtk.TextBuffer;
    pub const getBuffer = gtk_text_iter_get_buffer;

    /// Returns the number of bytes in the line containing `iter`,
    /// including the paragraph delimiters.
    extern fn gtk_text_iter_get_bytes_in_line(p_iter: *const TextIter) c_int;
    pub const getBytesInLine = gtk_text_iter_get_bytes_in_line;

    /// The Unicode character at this iterator is returned.
    ///
    /// Equivalent to operator* on a C++ iterator. If the element at
    /// this iterator is a non-character element, such as an image
    /// embedded in the buffer, the Unicode “unknown” character 0xFFFC
    /// is returned. If invoked on the end iterator, zero is returned;
    /// zero is not a valid Unicode character.
    ///
    /// So you can write a loop which ends when this function returns 0.
    extern fn gtk_text_iter_get_char(p_iter: *const TextIter) u32;
    pub const getChar = gtk_text_iter_get_char;

    /// Returns the number of characters in the line containing `iter`,
    /// including the paragraph delimiters.
    extern fn gtk_text_iter_get_chars_in_line(p_iter: *const TextIter) c_int;
    pub const getCharsInLine = gtk_text_iter_get_chars_in_line;

    /// If the location at `iter` contains a child anchor, the
    /// anchor is returned.
    ///
    /// Otherwise, `NULL` is returned.
    extern fn gtk_text_iter_get_child_anchor(p_iter: *const TextIter) ?*gtk.TextChildAnchor;
    pub const getChildAnchor = gtk_text_iter_get_child_anchor;

    /// Returns the language in effect at `iter`.
    ///
    /// If no tags affecting language apply to `iter`, the return
    /// value is identical to that of `gtk.getDefaultLanguage`.
    extern fn gtk_text_iter_get_language(p_iter: *const TextIter) *pango.Language;
    pub const getLanguage = gtk_text_iter_get_language;

    /// Returns the line number containing the iterator.
    ///
    /// Lines in a `GtkTextBuffer` are numbered beginning
    /// with 0 for the first line in the buffer.
    extern fn gtk_text_iter_get_line(p_iter: *const TextIter) c_int;
    pub const getLine = gtk_text_iter_get_line;

    /// Returns the byte index of the iterator, counting
    /// from the start of a newline-terminated line.
    ///
    /// Remember that `GtkTextBuffer` encodes text in
    /// UTF-8, and that characters can require a variable
    /// number of bytes to represent.
    extern fn gtk_text_iter_get_line_index(p_iter: *const TextIter) c_int;
    pub const getLineIndex = gtk_text_iter_get_line_index;

    /// Returns the character offset of the iterator,
    /// counting from the start of a newline-terminated line.
    ///
    /// The first character on the line has offset 0.
    extern fn gtk_text_iter_get_line_offset(p_iter: *const TextIter) c_int;
    pub const getLineOffset = gtk_text_iter_get_line_offset;

    /// Returns a list of all `GtkTextMark` at this location.
    ///
    /// Because marks are not iterable (they don’t take up any "space"
    /// in the buffer, they are just marks in between iterable locations),
    /// multiple marks can exist in the same place.
    ///
    /// The returned list is not in any meaningful order.
    extern fn gtk_text_iter_get_marks(p_iter: *const TextIter) *glib.SList;
    pub const getMarks = gtk_text_iter_get_marks;

    /// Returns the character offset of an iterator.
    ///
    /// Each character in a `GtkTextBuffer` has an offset,
    /// starting with 0 for the first character in the buffer.
    /// Use `gtk.TextBuffer.getIterAtOffset` to convert
    /// an offset back into an iterator.
    extern fn gtk_text_iter_get_offset(p_iter: *const TextIter) c_int;
    pub const getOffset = gtk_text_iter_get_offset;

    /// If the element at `iter` is a paintable, the paintable is returned.
    ///
    /// Otherwise, `NULL` is returned.
    extern fn gtk_text_iter_get_paintable(p_iter: *const TextIter) ?*gdk.Paintable;
    pub const getPaintable = gtk_text_iter_get_paintable;

    /// Returns the text in the given range.
    ///
    /// A “slice” is an array of characters encoded in UTF-8 format,
    /// including the Unicode “unknown” character 0xFFFC for iterable
    /// non-character elements in the buffer, such as images.
    /// Because images are encoded in the slice, byte and
    /// character offsets in the returned array will correspond to byte
    /// offsets in the text buffer. Note that 0xFFFC can occur in normal
    /// text as well, so it is not a reliable indicator that a paintable or
    /// widget is in the buffer.
    extern fn gtk_text_iter_get_slice(p_start: *const TextIter, p_end: *const gtk.TextIter) [*:0]u8;
    pub const getSlice = gtk_text_iter_get_slice;

    /// Returns a list of tags that apply to `iter`, in ascending order of
    /// priority.
    ///
    /// The highest-priority tags are last.
    ///
    /// The `GtkTextTag`s in the list don’t have a reference added,
    /// but you have to free the list itself.
    extern fn gtk_text_iter_get_tags(p_iter: *const TextIter) *glib.SList;
    pub const getTags = gtk_text_iter_get_tags;

    /// Returns text in the given range.
    ///
    /// If the range
    /// contains non-text elements such as images, the character and byte
    /// offsets in the returned string will not correspond to character and
    /// byte offsets in the buffer. If you want offsets to correspond, see
    /// `gtk.TextIter.getSlice`.
    extern fn gtk_text_iter_get_text(p_start: *const TextIter, p_end: *const gtk.TextIter) [*:0]u8;
    pub const getText = gtk_text_iter_get_text;

    /// Returns a list of `GtkTextTag` that are toggled on or off at this
    /// point.
    ///
    /// If `toggled_on` is `TRUE`, the list contains tags that are
    /// toggled on. If a tag is toggled on at `iter`, then some non-empty
    /// range of characters following `iter` has that tag applied to it.  If
    /// a tag is toggled off, then some non-empty range following `iter`
    /// does not have the tag applied to it.
    extern fn gtk_text_iter_get_toggled_tags(p_iter: *const TextIter, p_toggled_on: c_int) *glib.SList;
    pub const getToggledTags = gtk_text_iter_get_toggled_tags;

    /// Returns the number of bytes from the start of the
    /// line to the given `iter`, not counting bytes that
    /// are invisible due to tags with the “invisible” flag
    /// toggled on.
    extern fn gtk_text_iter_get_visible_line_index(p_iter: *const TextIter) c_int;
    pub const getVisibleLineIndex = gtk_text_iter_get_visible_line_index;

    /// Returns the offset in characters from the start of the
    /// line to the given `iter`, not counting characters that
    /// are invisible due to tags with the “invisible” flag
    /// toggled on.
    extern fn gtk_text_iter_get_visible_line_offset(p_iter: *const TextIter) c_int;
    pub const getVisibleLineOffset = gtk_text_iter_get_visible_line_offset;

    /// Returns visible text in the given range.
    ///
    /// Like `gtk.TextIter.getSlice`, but invisible text
    /// is not included. Invisible text is usually invisible because
    /// a `GtkTextTag` with the “invisible” attribute turned on has
    /// been applied to it.
    extern fn gtk_text_iter_get_visible_slice(p_start: *const TextIter, p_end: *const gtk.TextIter) [*:0]u8;
    pub const getVisibleSlice = gtk_text_iter_get_visible_slice;

    /// Returns visible text in the given range.
    ///
    /// Like `gtk.TextIter.getText`, but invisible text
    /// is not included. Invisible text is usually invisible because
    /// a `GtkTextTag` with the “invisible” attribute turned on has
    /// been applied to it.
    extern fn gtk_text_iter_get_visible_text(p_start: *const TextIter, p_end: *const gtk.TextIter) [*:0]u8;
    pub const getVisibleText = gtk_text_iter_get_visible_text;

    /// Returns `TRUE` if `iter` points to a character that is part
    /// of a range tagged with `tag`.
    ///
    /// See also `gtk.TextIter.startsTag` and
    /// `gtk.TextIter.endsTag`.
    extern fn gtk_text_iter_has_tag(p_iter: *const TextIter, p_tag: *gtk.TextTag) c_int;
    pub const hasTag = gtk_text_iter_has_tag;

    /// Checks whether `iter` falls in the range [`start`, `end`).
    ///
    /// `start` and `end` must be in ascending order.
    extern fn gtk_text_iter_in_range(p_iter: *const TextIter, p_start: *const gtk.TextIter, p_end: *const gtk.TextIter) c_int;
    pub const inRange = gtk_text_iter_in_range;

    /// Determines whether `iter` is inside a sentence (as opposed to in
    /// between two sentences, e.g. after a period and before the first
    /// letter of the next sentence).
    ///
    /// Sentence boundaries are determined by Pango and should be correct
    /// for nearly any language.
    extern fn gtk_text_iter_inside_sentence(p_iter: *const TextIter) c_int;
    pub const insideSentence = gtk_text_iter_inside_sentence;

    /// Determines whether the character pointed by `iter` is part of a
    /// natural-language word (as opposed to say inside some whitespace).
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language.
    ///
    /// Note that if `gtk.TextIter.startsWord` returns `TRUE`,
    /// then this function returns `TRUE` too, since `iter` points to
    /// the first character of the word.
    extern fn gtk_text_iter_inside_word(p_iter: *const TextIter) c_int;
    pub const insideWord = gtk_text_iter_inside_word;

    /// Determine if `iter` is at a cursor position.
    ///
    /// See `gtk.TextIter.forwardCursorPosition` or
    /// `pango.LogAttr` or `pango.@"break"` for details
    /// on what a cursor position is.
    extern fn gtk_text_iter_is_cursor_position(p_iter: *const TextIter) c_int;
    pub const isCursorPosition = gtk_text_iter_is_cursor_position;

    /// Returns `TRUE` if `iter` is the end iterator.
    ///
    /// This means it is one past the last dereferenceable iterator
    /// in the buffer. `gtk.TextIter.isEnd` is the most efficient
    /// way to check whether an iterator is the end iterator.
    extern fn gtk_text_iter_is_end(p_iter: *const TextIter) c_int;
    pub const isEnd = gtk_text_iter_is_end;

    /// Returns `TRUE` if `iter` is the first iterator in the buffer.
    extern fn gtk_text_iter_is_start(p_iter: *const TextIter) c_int;
    pub const isStart = gtk_text_iter_is_start;

    /// Swaps the value of `first` and `second` if `second` comes before
    /// `first` in the buffer.
    ///
    /// That is, ensures that `first` and `second` are in sequence.
    /// Most text buffer functions that take a range call this
    /// automatically on your behalf, so there’s no real reason to
    /// call it yourself in those cases. There are some exceptions,
    /// such as `gtk.TextIter.inRange`, that expect a
    /// pre-sorted range.
    extern fn gtk_text_iter_order(p_first: *TextIter, p_second: *gtk.TextIter) void;
    pub const order = gtk_text_iter_order;

    /// Moves iterator `iter` to the start of the line `line_number`.
    ///
    /// If `line_number` is negative or larger than or equal to the number of lines
    /// in the buffer, moves `iter` to the start of the last line in the buffer.
    extern fn gtk_text_iter_set_line(p_iter: *TextIter, p_line_number: c_int) void;
    pub const setLine = gtk_text_iter_set_line;

    /// Same as `gtk.TextIter.setLineOffset`, but works with a
    /// byte index. The given byte index must be at
    /// the start of a character, it can’t be in the middle of a UTF-8
    /// encoded character.
    extern fn gtk_text_iter_set_line_index(p_iter: *TextIter, p_byte_on_line: c_int) void;
    pub const setLineIndex = gtk_text_iter_set_line_index;

    /// Moves `iter` within a line, to a new character (not byte) offset.
    ///
    /// The given character offset must be less than or equal to the number
    /// of characters in the line; if equal, `iter` moves to the start of the
    /// next line. See `gtk.TextIter.setLineIndex` if you have a byte
    /// index rather than a character offset.
    extern fn gtk_text_iter_set_line_offset(p_iter: *TextIter, p_char_on_line: c_int) void;
    pub const setLineOffset = gtk_text_iter_set_line_offset;

    /// Sets `iter` to point to `char_offset`.
    ///
    /// `char_offset` counts from the start
    /// of the entire text buffer, starting with 0.
    extern fn gtk_text_iter_set_offset(p_iter: *TextIter, p_char_offset: c_int) void;
    pub const setOffset = gtk_text_iter_set_offset;

    /// Like `gtk.TextIter.setLineIndex`, but the index is in visible
    /// bytes, i.e. text with a tag making it invisible is not counted
    /// in the index.
    extern fn gtk_text_iter_set_visible_line_index(p_iter: *TextIter, p_byte_on_line: c_int) void;
    pub const setVisibleLineIndex = gtk_text_iter_set_visible_line_index;

    /// Like `gtk.TextIter.setLineOffset`, but the offset is in visible
    /// characters, i.e. text with a tag making it invisible is not
    /// counted in the offset.
    extern fn gtk_text_iter_set_visible_line_offset(p_iter: *TextIter, p_char_on_line: c_int) void;
    pub const setVisibleLineOffset = gtk_text_iter_set_visible_line_offset;

    /// Returns `TRUE` if `iter` begins a paragraph.
    ///
    /// This is the case if `gtk.TextIter.getLineOffset`
    /// would return 0. However this function is potentially more
    /// efficient than `gtk.TextIter.getLineOffset`, because
    /// it doesn’t have to compute the offset, it just has to see
    /// whether it’s 0.
    extern fn gtk_text_iter_starts_line(p_iter: *const TextIter) c_int;
    pub const startsLine = gtk_text_iter_starts_line;

    /// Determines whether `iter` begins a sentence.
    ///
    /// Sentence boundaries are determined by Pango and
    /// should be correct for nearly any language.
    extern fn gtk_text_iter_starts_sentence(p_iter: *const TextIter) c_int;
    pub const startsSentence = gtk_text_iter_starts_sentence;

    /// Returns `TRUE` if `tag` is toggled on at exactly this point.
    ///
    /// If `tag` is `NULL`, returns `TRUE` if any tag is toggled on at this point.
    ///
    /// Note that if this function returns `TRUE`, it means that
    /// `iter` is at the beginning of the tagged range, and that the
    /// character at `iter` is inside the tagged range. In other
    /// words, unlike `gtk.TextIter.endsTag`, if
    /// this function returns `TRUE`, `gtk.TextIter.hasTag`
    /// will also return `TRUE` for the same parameters.
    extern fn gtk_text_iter_starts_tag(p_iter: *const TextIter, p_tag: ?*gtk.TextTag) c_int;
    pub const startsTag = gtk_text_iter_starts_tag;

    /// Determines whether `iter` begins a natural-language word.
    ///
    /// Word breaks are determined by Pango and should be correct
    /// for nearly any language.
    extern fn gtk_text_iter_starts_word(p_iter: *const TextIter) c_int;
    pub const startsWord = gtk_text_iter_starts_word;

    /// Gets whether a range with `tag` applied to it begins
    /// or ends at `iter`.
    ///
    /// This is equivalent to (`gtk.TextIter.startsTag` ||
    /// `gtk.TextIter.endsTag`)
    extern fn gtk_text_iter_toggles_tag(p_iter: *const TextIter, p_tag: ?*gtk.TextTag) c_int;
    pub const togglesTag = gtk_text_iter_toggles_tag;

    extern fn gtk_text_iter_get_type() usize;
    pub const getGObjectType = gtk_text_iter_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextMarkClass = extern struct {
    pub const Instance = gtk.TextMark;

    f_parent_class: gobject.ObjectClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *TextMarkClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextTagClass = extern struct {
    pub const Instance = gtk.TextTag;

    f_parent_class: gobject.ObjectClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *TextTagClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextTagPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextViewClass = extern struct {
    pub const Instance = gtk.TextView;

    /// The object class structure needs to be the first
    f_parent_class: gtk.WidgetClass,
    /// The class handler for the `GtkTextView::move-cursor`
    ///   keybinding signal.
    f_move_cursor: ?*const fn (p_text_view: *gtk.TextView, p_step: gtk.MovementStep, p_count: c_int, p_extend_selection: c_int) callconv(.c) void,
    /// The class handler for the `GtkTextView::set-anchor`
    ///   keybinding signal.
    f_set_anchor: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    /// The class handler for the `GtkTextView::insert-at-cursor`
    ///   keybinding signal.
    f_insert_at_cursor: ?*const fn (p_text_view: *gtk.TextView, p_str: [*:0]const u8) callconv(.c) void,
    /// The class handler for the `GtkTextView::delete-from-cursor`
    ///   keybinding signal.
    f_delete_from_cursor: ?*const fn (p_text_view: *gtk.TextView, p_type: gtk.DeleteType, p_count: c_int) callconv(.c) void,
    /// The class handler for the `GtkTextView::backspace`
    ///   keybinding signal.
    f_backspace: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    /// The class handler for the `GtkTextView::cut-clipboard`
    ///   keybinding signal
    f_cut_clipboard: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    /// The class handler for the `GtkTextView::copy-clipboard`
    ///   keybinding signal.
    f_copy_clipboard: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    /// The class handler for the `GtkTextView::paste-clipboard`
    ///   keybinding signal.
    f_paste_clipboard: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    /// The class handler for the `GtkTextView::toggle-overwrite`
    ///   keybinding signal.
    f_toggle_overwrite: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    /// The create_buffer vfunc is called to create a `GtkTextBuffer`
    ///   for the text view. The default implementation is to just call
    ///   `gtk.TextBuffer.new`.
    f_create_buffer: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) *gtk.TextBuffer,
    /// The snapshot_layer vfunc is called before and after the text
    ///   view is drawing its own text. Applications can override this vfunc
    ///   in a subclass to draw customized content underneath or above the
    ///   text. In the `GTK_TEXT_VIEW_LAYER_BELOW_TEXT` and `GTK_TEXT_VIEW_LAYER_ABOVE_TEXT`
    ///   layers the drawing is done in the buffer coordinate space.
    f_snapshot_layer: ?*const fn (p_text_view: *gtk.TextView, p_layer: gtk.TextViewLayer, p_snapshot: *gtk.Snapshot) callconv(.c) void,
    /// The class handler for the `GtkTextView::extend-selection` signal.
    f_extend_selection: ?*const fn (p_text_view: *gtk.TextView, p_granularity: gtk.TextExtendSelection, p_location: *const gtk.TextIter, p_start: *gtk.TextIter, p_end: *gtk.TextIter) callconv(.c) c_int,
    /// The class handler for the `GtkTextView::insert-emoji` signal.
    f_insert_emoji: ?*const fn (p_text_view: *gtk.TextView) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *TextViewClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TextViewPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const ToggleButtonClass = extern struct {
    pub const Instance = gtk.ToggleButton;

    f_parent_class: gtk.ButtonClass,
    f_toggled: ?*const fn (p_toggle_button: *gtk.ToggleButton) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *ToggleButtonClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeDragDestIface = extern struct {
    pub const Instance = gtk.TreeDragDest;

    f_g_iface: gobject.TypeInterface,
    /// Asks the `GtkTreeDragDest` to insert a row
    ///    before the path dest, deriving the contents of the row from
    ///    selection_data.
    f_drag_data_received: ?*const fn (p_drag_dest: *gtk.TreeDragDest, p_dest: *gtk.TreePath, p_value: *const gobject.Value) callconv(.c) c_int,
    /// Determines whether a drop is possible before
    ///    the given dest_path, at the same depth as dest_path.
    f_row_drop_possible: ?*const fn (p_drag_dest: *gtk.TreeDragDest, p_dest_path: *gtk.TreePath, p_value: *const gobject.Value) callconv(.c) c_int,

    pub fn as(p_instance: *TreeDragDestIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeDragSourceIface = extern struct {
    pub const Instance = gtk.TreeDragSource;

    f_g_iface: gobject.TypeInterface,
    /// Asks the `GtkTreeDragSource` whether a particular
    ///    row can be used as the source of a DND operation.
    f_row_draggable: ?*const fn (p_drag_source: *gtk.TreeDragSource, p_path: *gtk.TreePath) callconv(.c) c_int,
    /// Asks the `GtkTreeDragSource` to fill in
    ///    selection_data with a representation of the row at path.
    f_drag_data_get: ?*const fn (p_drag_source: *gtk.TreeDragSource, p_path: *gtk.TreePath) callconv(.c) ?*gdk.ContentProvider,
    /// Asks the `GtkTreeDragSource` to delete the row at
    ///    path, because it was moved somewhere else via drag-and-drop.
    f_drag_data_delete: ?*const fn (p_drag_source: *gtk.TreeDragSource, p_path: *gtk.TreePath) callconv(.c) c_int,

    pub fn as(p_instance: *TreeDragSourceIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeExpanderClass = extern struct {
    pub const Instance = gtk.TreeExpander;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *TreeExpanderClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The `GtkTreeIter` is the primary structure
/// for accessing a `GtkTreeModel`. Models are expected to put a unique
/// integer in the `stamp` member, and put
/// model-specific data in the three `user_data`
/// members.
pub const TreeIter = extern struct {
    /// a unique stamp to catch invalid iterators
    f_stamp: c_int,
    /// model-specific data
    f_user_data: ?*anyopaque,
    /// model-specific data
    f_user_data2: ?*anyopaque,
    /// model-specific data
    f_user_data3: ?*anyopaque,

    /// Creates a dynamically allocated tree iterator as a copy of `iter`.
    ///
    /// This function is not intended for use in applications,
    /// because you can just copy the structs by value
    /// (`GtkTreeIter new_iter = iter;`).
    /// You must free this iter with `gtk.TreeIter.free`.
    extern fn gtk_tree_iter_copy(p_iter: *TreeIter) *gtk.TreeIter;
    pub const copy = gtk_tree_iter_copy;

    /// Frees an iterator that has been allocated by `gtk.TreeIter.copy`.
    ///
    /// This function is mainly used for language bindings.
    extern fn gtk_tree_iter_free(p_iter: *TreeIter) void;
    pub const free = gtk_tree_iter_free;

    extern fn gtk_tree_iter_get_type() usize;
    pub const getGObjectType = gtk_tree_iter_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeListModelClass = extern struct {
    pub const Instance = gtk.TreeListModel;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *TreeListModelClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeListRowClass = extern struct {
    pub const Instance = gtk.TreeListRow;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *TreeListRowClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeListRowSorterClass = extern struct {
    pub const Instance = gtk.TreeListRowSorter;

    f_parent_class: gtk.SorterClass,

    pub fn as(p_instance: *TreeListRowSorterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeModelFilterClass = extern struct {
    pub const Instance = gtk.TreeModelFilter;

    f_parent_class: gobject.ObjectClass,
    f_visible: ?*const fn (p_self: *gtk.TreeModelFilter, p_child_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) c_int,
    f_modify: ?*const fn (p_self: *gtk.TreeModelFilter, p_child_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_value: *gobject.Value, p_column: c_int) callconv(.c) void,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *TreeModelFilterClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeModelFilterPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeModelIface = extern struct {
    pub const Instance = gtk.TreeModel;

    f_g_iface: gobject.TypeInterface,
    /// Signal emitted when a row in the model has changed.
    f_row_changed: ?*const fn (p_tree_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) callconv(.c) void,
    /// Signal emitted when a new row has been inserted in
    ///    the model.
    f_row_inserted: ?*const fn (p_tree_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) callconv(.c) void,
    /// Signal emitted when a row has gotten the
    ///    first child row or lost its last child row.
    f_row_has_child_toggled: ?*const fn (p_tree_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter) callconv(.c) void,
    /// Signal emitted when a row has been deleted.
    f_row_deleted: ?*const fn (p_tree_model: *gtk.TreeModel, p_path: *gtk.TreePath) callconv(.c) void,
    /// Signal emitted when the children of a node in the
    ///    GtkTreeModel have been reordered.
    f_rows_reordered: ?*const fn (p_tree_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_new_order: *c_int) callconv(.c) void,
    /// Get `GtkTreeModelFlags` supported by this interface.
    f_get_flags: ?*const fn (p_tree_model: *gtk.TreeModel) callconv(.c) gtk.TreeModelFlags,
    /// Get the number of columns supported by the model.
    f_get_n_columns: ?*const fn (p_tree_model: *gtk.TreeModel) callconv(.c) c_int,
    /// Get the type of the column.
    f_get_column_type: ?*const fn (p_tree_model: *gtk.TreeModel, p_index_: c_int) callconv(.c) usize,
    /// Sets iter to a valid iterator pointing to path.
    f_get_iter: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) c_int,
    /// Gets a newly-created `GtkTreePath` referenced by iter.
    f_get_path: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) *gtk.TreePath,
    /// Initializes and sets value to that at column.
    f_get_value: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_column: c_int, p_value: *gobject.Value) callconv(.c) void,
    /// Sets iter to point to the node following it at the
    ///    current level.
    f_iter_next: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) c_int,
    /// Sets iter to point to the previous node at the
    ///    current level.
    f_iter_previous: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) c_int,
    /// Sets iter to point to the first child of parent.
    f_iter_children: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter) callconv(.c) c_int,
    /// `TRUE` if iter has children, `FALSE` otherwise.
    f_iter_has_child: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) c_int,
    /// Gets the number of children that iter has.
    f_iter_n_children: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: ?*gtk.TreeIter) callconv(.c) c_int,
    /// Sets iter to be the child of parent, using the
    ///    given index.
    f_iter_nth_child: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_parent: ?*gtk.TreeIter, p_n: c_int) callconv(.c) c_int,
    /// Sets iter to be the parent of child.
    f_iter_parent: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_child: *gtk.TreeIter) callconv(.c) c_int,
    /// Lets the tree ref the node.
    f_ref_node: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) void,
    /// Lets the tree unref the node.
    f_unref_node: ?*const fn (p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter) callconv(.c) void,

    pub fn as(p_instance: *TreeModelIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeModelSortClass = extern struct {
    pub const Instance = gtk.TreeModelSort;

    f_parent_class: gobject.ObjectClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *TreeModelSortClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeModelSortPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An opaque structure representing a path to a row in a model.
pub const TreePath = opaque {
    /// Creates a new `GtkTreePath`
    /// This refers to a row.
    extern fn gtk_tree_path_new() *gtk.TreePath;
    pub const new = gtk_tree_path_new;

    /// Creates a new `GtkTreePath`.
    ///
    /// The string representation of this path is “0”.
    extern fn gtk_tree_path_new_first() *gtk.TreePath;
    pub const newFirst = gtk_tree_path_new_first;

    /// Creates a new path with `first_index` and `varargs` as indices.
    extern fn gtk_tree_path_new_from_indices(p_first_index: c_int, ...) *gtk.TreePath;
    pub const newFromIndices = gtk_tree_path_new_from_indices;

    /// Creates a new path with the given `indices` array of `length`.
    extern fn gtk_tree_path_new_from_indicesv(p_indices: [*]c_int, p_length: usize) *gtk.TreePath;
    pub const newFromIndicesv = gtk_tree_path_new_from_indicesv;

    /// Creates a new `GtkTreePath` initialized to `path`.
    ///
    /// `path` is expected to be a colon separated list of numbers.
    /// For example, the string “10:4:0” would create a path of depth
    /// 3 pointing to the 11th child of the root node, the 5th
    /// child of that 11th child, and the 1st child of that 5th child.
    /// If an invalid path string is passed in, `NULL` is returned.
    extern fn gtk_tree_path_new_from_string(p_path: [*:0]const u8) ?*gtk.TreePath;
    pub const newFromString = gtk_tree_path_new_from_string;

    /// Appends a new index to a path.
    ///
    /// As a result, the depth of the path is increased.
    extern fn gtk_tree_path_append_index(p_path: *TreePath, p_index_: c_int) void;
    pub const appendIndex = gtk_tree_path_append_index;

    /// Compares two paths.
    ///
    /// If `a` appears before `b` in a tree, then -1 is returned.
    /// If `b` appears before `a`, then 1 is returned.
    /// If the two nodes are equal, then 0 is returned.
    extern fn gtk_tree_path_compare(p_a: *const TreePath, p_b: *const gtk.TreePath) c_int;
    pub const compare = gtk_tree_path_compare;

    /// Creates a new `GtkTreePath` as a copy of `path`.
    extern fn gtk_tree_path_copy(p_path: *const TreePath) *gtk.TreePath;
    pub const copy = gtk_tree_path_copy;

    /// Moves `path` to point to the first child of the current path.
    extern fn gtk_tree_path_down(p_path: *TreePath) void;
    pub const down = gtk_tree_path_down;

    /// Frees `path`. If `path` is `NULL`, it simply returns.
    extern fn gtk_tree_path_free(p_path: ?*TreePath) void;
    pub const free = gtk_tree_path_free;

    /// Returns the current depth of `path`.
    extern fn gtk_tree_path_get_depth(p_path: *TreePath) c_int;
    pub const getDepth = gtk_tree_path_get_depth;

    /// Returns the current indices of `path`.
    ///
    /// This is an array of integers, each representing a node in a tree.
    /// This value should not be freed.
    ///
    /// The length of the array can be obtained with `gtk.TreePath.getDepth`.
    extern fn gtk_tree_path_get_indices(p_path: *TreePath) ?*c_int;
    pub const getIndices = gtk_tree_path_get_indices;

    /// Returns the current indices of `path`.
    ///
    /// This is an array of integers, each representing a node in a tree.
    /// It also returns the number of elements in the array.
    /// The array should not be freed.
    extern fn gtk_tree_path_get_indices_with_depth(p_path: *TreePath, p_depth: ?*c_int) ?[*]c_int;
    pub const getIndicesWithDepth = gtk_tree_path_get_indices_with_depth;

    /// Returns `TRUE` if `descendant` is a descendant of `path`.
    extern fn gtk_tree_path_is_ancestor(p_path: *TreePath, p_descendant: *gtk.TreePath) c_int;
    pub const isAncestor = gtk_tree_path_is_ancestor;

    /// Returns `TRUE` if `path` is a descendant of `ancestor`.
    extern fn gtk_tree_path_is_descendant(p_path: *TreePath, p_ancestor: *gtk.TreePath) c_int;
    pub const isDescendant = gtk_tree_path_is_descendant;

    /// Moves the `path` to point to the next node at the current depth.
    extern fn gtk_tree_path_next(p_path: *TreePath) void;
    pub const next = gtk_tree_path_next;

    /// Prepends a new index to a path.
    ///
    /// As a result, the depth of the path is increased.
    extern fn gtk_tree_path_prepend_index(p_path: *TreePath, p_index_: c_int) void;
    pub const prependIndex = gtk_tree_path_prepend_index;

    /// Moves the `path` to point to the previous node at the
    /// current depth, if it exists.
    extern fn gtk_tree_path_prev(p_path: *TreePath) c_int;
    pub const prev = gtk_tree_path_prev;

    /// Generates a string representation of the path.
    ///
    /// This string is a “:” separated list of numbers.
    /// For example, “4:10:0:3” would be an acceptable
    /// return value for this string. If the path has
    /// depth 0, `NULL` is returned.
    extern fn gtk_tree_path_to_string(p_path: *TreePath) ?[*:0]u8;
    pub const toString = gtk_tree_path_to_string;

    /// Moves the `path` to point to its parent node, if it has a parent.
    extern fn gtk_tree_path_up(p_path: *TreePath) c_int;
    pub const up = gtk_tree_path_up;

    extern fn gtk_tree_path_get_type() usize;
    pub const getGObjectType = gtk_tree_path_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// A GtkTreeRowReference tracks model changes so that it always refers to the
/// same row (a `GtkTreePath` refers to a position, not a fixed row). Create a
/// new GtkTreeRowReference with `gtk.TreeRowReference.new`.
pub const TreeRowReference = opaque {
    /// Lets a set of row reference created by
    /// `gtk.TreeRowReference.newProxy` know that the
    /// model emitted the ::row-deleted signal.
    extern fn gtk_tree_row_reference_deleted(p_proxy: *gobject.Object, p_path: *gtk.TreePath) void;
    pub const deleted = gtk_tree_row_reference_deleted;

    /// Lets a set of row reference created by
    /// `gtk.TreeRowReference.newProxy` know that the
    /// model emitted the ::row-inserted signal.
    extern fn gtk_tree_row_reference_inserted(p_proxy: *gobject.Object, p_path: *gtk.TreePath) void;
    pub const inserted = gtk_tree_row_reference_inserted;

    /// Lets a set of row reference created by
    /// `gtk.TreeRowReference.newProxy` know that the
    /// model emitted the ::rows-reordered signal.
    extern fn gtk_tree_row_reference_reordered(p_proxy: *gobject.Object, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_new_order: [*]c_int) void;
    pub const reordered = gtk_tree_row_reference_reordered;

    /// Creates a row reference based on `path`.
    ///
    /// This reference will keep pointing to the node pointed to
    /// by `path`, so long as it exists. Any changes that occur on `model` are
    /// propagated, and the path is updated appropriately. If
    /// `path` isn’t a valid path in `model`, then `NULL` is returned.
    extern fn gtk_tree_row_reference_new(p_model: *gtk.TreeModel, p_path: *gtk.TreePath) ?*gtk.TreeRowReference;
    pub const new = gtk_tree_row_reference_new;

    /// You do not need to use this function.
    ///
    /// Creates a row reference based on `path`.
    ///
    /// This reference will keep pointing to the node pointed to
    /// by `path`, so long as it exists. If `path` isn’t a valid
    /// path in `model`, then `NULL` is returned. However, unlike
    /// references created with `gtk.TreeRowReference.new`, it
    /// does not listen to the model for changes. The creator of
    /// the row reference must do this explicitly using
    /// `gtk.treeRowReferenceInserted`, `gtk.treeRowReferenceDeleted`,
    /// `gtk.treeRowReferenceReordered`.
    ///
    /// These functions must be called exactly once per proxy when the
    /// corresponding signal on the model is emitted. This single call
    /// updates all row references for that proxy. Since built-in GTK
    /// objects like `GtkTreeView` already use this mechanism internally,
    /// using them as the proxy object will produce unpredictable results.
    /// Further more, passing the same object as `model` and `proxy`
    /// doesn’t work for reasons of internal implementation.
    ///
    /// This type of row reference is primarily meant by structures that
    /// need to carefully monitor exactly when a row reference updates
    /// itself, and is not generally needed by most applications.
    extern fn gtk_tree_row_reference_new_proxy(p_proxy: *gobject.Object, p_model: *gtk.TreeModel, p_path: *gtk.TreePath) ?*gtk.TreeRowReference;
    pub const newProxy = gtk_tree_row_reference_new_proxy;

    /// Copies a `GtkTreeRowReference`.
    extern fn gtk_tree_row_reference_copy(p_reference: *TreeRowReference) *gtk.TreeRowReference;
    pub const copy = gtk_tree_row_reference_copy;

    /// Free’s `reference`. `reference` may be `NULL`
    extern fn gtk_tree_row_reference_free(p_reference: ?*TreeRowReference) void;
    pub const free = gtk_tree_row_reference_free;

    /// Returns the model that the row reference is monitoring.
    extern fn gtk_tree_row_reference_get_model(p_reference: *TreeRowReference) *gtk.TreeModel;
    pub const getModel = gtk_tree_row_reference_get_model;

    /// Returns a path that the row reference currently points to,
    /// or `NULL` if the path pointed to is no longer valid.
    extern fn gtk_tree_row_reference_get_path(p_reference: *TreeRowReference) ?*gtk.TreePath;
    pub const getPath = gtk_tree_row_reference_get_path;

    /// Returns `TRUE` if the `reference` is non-`NULL` and refers to
    /// a current valid path.
    extern fn gtk_tree_row_reference_valid(p_reference: ?*TreeRowReference) c_int;
    pub const valid = gtk_tree_row_reference_valid;

    extern fn gtk_tree_row_reference_get_type() usize;
    pub const getGObjectType = gtk_tree_row_reference_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeSortableIface = extern struct {
    pub const Instance = gtk.TreeSortable;

    f_g_iface: gobject.TypeInterface,
    /// Signal emitted when the sort column or sort
    ///    order of sortable is changed.
    f_sort_column_changed: ?*const fn (p_sortable: *gtk.TreeSortable) callconv(.c) void,
    /// Fills in sort_column_id and order with the
    ///    current sort column and the order.
    f_get_sort_column_id: ?*const fn (p_sortable: *gtk.TreeSortable, p_sort_column_id: *c_int, p_order: *gtk.SortType) callconv(.c) c_int,
    /// Sets the current sort column to be
    ///    sort_column_id.
    f_set_sort_column_id: ?*const fn (p_sortable: *gtk.TreeSortable, p_sort_column_id: c_int, p_order: gtk.SortType) callconv(.c) void,
    /// Sets the comparison function used when sorting to
    ///    be sort_func.
    f_set_sort_func: ?*const fn (p_sortable: *gtk.TreeSortable, p_sort_column_id: c_int, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void,
    /// Sets the default comparison function used
    ///    when sorting to be sort_func.
    f_set_default_sort_func: ?*const fn (p_sortable: *gtk.TreeSortable, p_sort_func: gtk.TreeIterCompareFunc, p_user_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify) callconv(.c) void,
    /// `TRUE` if the model has a default sort
    /// function.
    f_has_default_sort_func: ?*const fn (p_sortable: *gtk.TreeSortable) callconv(.c) c_int,

    pub fn as(p_instance: *TreeSortableIface, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeStoreClass = extern struct {
    pub const Instance = gtk.TreeStore;

    f_parent_class: gobject.ObjectClass,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *TreeStoreClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeStorePrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const TreeViewClass = extern struct {
    pub const Instance = gtk.TreeView;

    f_parent_class: gtk.WidgetClass,
    f_row_activated: ?*const fn (p_tree_view: *gtk.TreeView, p_path: *gtk.TreePath, p_column: ?*gtk.TreeViewColumn) callconv(.c) void,
    f_test_expand_row: ?*const fn (p_tree_view: *gtk.TreeView, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) c_int,
    f_test_collapse_row: ?*const fn (p_tree_view: *gtk.TreeView, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) c_int,
    f_row_expanded: ?*const fn (p_tree_view: *gtk.TreeView, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) void,
    f_row_collapsed: ?*const fn (p_tree_view: *gtk.TreeView, p_iter: *gtk.TreeIter, p_path: *gtk.TreePath) callconv(.c) void,
    f_columns_changed: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) void,
    f_cursor_changed: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) void,
    f_move_cursor: ?*const fn (p_tree_view: *gtk.TreeView, p_step: gtk.MovementStep, p_count: c_int, p_extend: c_int, p_modify: c_int) callconv(.c) c_int,
    f_select_all: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) c_int,
    f_unselect_all: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) c_int,
    f_select_cursor_row: ?*const fn (p_tree_view: *gtk.TreeView, p_start_editing: c_int) callconv(.c) c_int,
    f_toggle_cursor_row: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) c_int,
    f_expand_collapse_cursor_row: ?*const fn (p_tree_view: *gtk.TreeView, p_logical: c_int, p_expand: c_int, p_open_all: c_int) callconv(.c) c_int,
    f_select_cursor_parent: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) c_int,
    f_start_interactive_search: ?*const fn (p_tree_view: *gtk.TreeView) callconv(.c) c_int,
    f__reserved: [16]*anyopaque,

    pub fn as(p_instance: *TreeViewClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const UriLauncherClass = extern struct {
    pub const Instance = gtk.UriLauncher;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *UriLauncherClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const VideoClass = extern struct {
    pub const Instance = gtk.Video;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *VideoClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WidgetClass = extern struct {
    pub const Instance = gtk.Widget;

    /// The object class structure needs to be the first
    ///   element in the widget class structure in order for the class mechanism
    ///   to work correctly. This allows a GtkWidgetClass pointer to be cast to
    ///   a GObjectClass pointer.
    f_parent_class: gobject.InitiallyUnownedClass,
    /// Signal emitted when widget is shown
    f_show: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Signal emitted when widget is hidden.
    f_hide: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Signal emitted when widget is going to be mapped, that is
    ///   when the widget is visible (which is controlled with
    ///   `gtk.Widget.setVisible`) and all its parents up to the toplevel
    ///   widget are also visible.
    f_map: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Signal emitted when widget is going to be unmapped, which
    ///   means that either it or any of its parents up to the toplevel
    ///   widget have been set as hidden.
    f_unmap: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Signal emitted when widget is associated with a
    ///   `GdkSurface`, which means that `gtk.Widget.realize` has been called or
    ///   the widget has been mapped (that is, it is going to be drawn).
    f_realize: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Signal emitted when the GdkSurface associated with
    ///   widget is destroyed, which means that `gtk.Widget.unrealize` has
    ///   been called or the widget has been unmapped (that is, it is going
    ///   to be hidden).
    f_unrealize: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Called when the widget gets added to a `GtkRoot` widget. Must
    ///   chain up
    f_root: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Called when the widget is about to be removed from its
    ///   `GtkRoot` widget. Must chain up
    f_unroot: ?*const fn (p_widget: *gtk.Widget) callconv(.c) void,
    /// Called to set the allocation, if the widget does
    ///   not have a layout manager.
    f_size_allocate: ?*const fn (p_widget: *gtk.Widget, p_width: c_int, p_height: c_int, p_baseline: c_int) callconv(.c) void,
    /// Signal emitted when the widget state changes,
    ///   see `gtk.Widget.getStateFlags`.
    f_state_flags_changed: ?*const fn (p_widget: *gtk.Widget, p_previous_state_flags: gtk.StateFlags) callconv(.c) void,
    /// Signal emitted when the text direction of a
    ///   widget changes.
    f_direction_changed: ?*const fn (p_widget: *gtk.Widget, p_previous_direction: gtk.TextDirection) callconv(.c) void,
    /// Called to get the request mode, if the widget
    ///   does not have a layout manager.
    ///   This allows a widget to tell its parent container whether
    ///   it prefers to be allocated in `GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH` or
    ///   `GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT` mode.
    ///   `GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH` means the widget prefers to have
    ///   `GtkWidgetClass.`measure`` called first to get the default width (passing
    ///   a for_size of -1), then again to get the height for said default width.
    ///   `GTK_SIZE_REQUEST_CONSTANT_SIZE` disables any height-for-width or
    ///   width-for-height geometry management for said widget and is the
    ///   default return.
    ///   It’s important to note that any widget
    ///   which trades height-for-width or width-for-height must respond properly
    ///   to a for_size value >= -1 passed to `GtkWidgetClass.measure`, for both
    ///   possible orientations.
    f_get_request_mode: ?*const fn (p_widget: *gtk.Widget) callconv(.c) gtk.SizeRequestMode,
    /// Called to obtain the minimum and natural size of the widget,
    ///   if the widget does not have a layout manager.
    ///   Depending on the orientation parameter, the passed for_size can be
    ///   interpreted as width or height. A widget will never be allocated less
    ///   than its minimum size.
    f_measure: ?*const fn (p_widget: *gtk.Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: ?*c_int, p_natural: ?*c_int, p_minimum_baseline: ?*c_int, p_natural_baseline: ?*c_int) callconv(.c) void,
    /// Activates the `widget` if `group_cycling` is
    ///   `FALSE`, and just grabs the focus if `group_cycling` is `TRUE`.
    f_mnemonic_activate: ?*const fn (p_widget: *gtk.Widget, p_group_cycling: c_int) callconv(.c) c_int,
    /// Causes `widget` to have the keyboard focus for the
    ///   `GtkWindow` it’s inside.
    f_grab_focus: ?*const fn (p_widget: *gtk.Widget) callconv(.c) c_int,
    /// Vfunc for `gtk.Widget.childFocus`
    f_focus: ?*const fn (p_widget: *gtk.Widget, p_direction: gtk.DirectionType) callconv(.c) c_int,
    /// Sets the focused child of a widget. Must chain up
    f_set_focus_child: ?*const fn (p_widget: *gtk.Widget, p_child: ?*gtk.Widget) callconv(.c) void,
    /// Signal emitted when a change of focus is requested
    f_move_focus: ?*const fn (p_widget: *gtk.Widget, p_direction: gtk.DirectionType) callconv(.c) void,
    /// Signal emitted if keyboard navigation fails.
    f_keynav_failed: ?*const fn (p_widget: *gtk.Widget, p_direction: gtk.DirectionType) callconv(.c) c_int,
    /// 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.
    f_query_tooltip: ?*const fn (p_widget: *gtk.Widget, p_x: c_int, p_y: c_int, p_keyboard_tooltip: c_int, p_tooltip: *gtk.Tooltip) callconv(.c) c_int,
    /// Computes whether a container should give this
    ///   widget extra space when possible.
    f_compute_expand: ?*const fn (p_widget: *gtk.Widget, p_hexpand_p: *c_int, p_vexpand_p: *c_int) callconv(.c) void,
    /// 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.
    f_css_changed: ?*const fn (p_widget: *gtk.Widget, p_change: *gtk.CssStyleChange) callconv(.c) void,
    /// Emitted when a system setting was changed. Must chain up.
    f_system_setting_changed: ?*const fn (p_widget: *gtk.Widget, p_settings: gtk.SystemSetting) callconv(.c) void,
    /// Vfunc called when a new snapshot of the widget has to be taken.
    f_snapshot: ?*const fn (p_widget: *gtk.Widget, p_snapshot: *gtk.Snapshot) callconv(.c) void,
    /// Vfunc for `gtk.Widget.contains`.
    f_contains: ?*const fn (p_widget: *gtk.Widget, p_x: f64, p_y: f64) callconv(.c) c_int,
    f_priv: ?*gtk.WidgetClassPrivate,
    f_padding: [8]*anyopaque,

    /// Creates a new shortcut for `widget_class` that calls the given `callback`
    /// with arguments according to `format_string`.
    ///
    /// The arguments and format string must be provided in the same way as
    /// with `glib.Variant.new`.
    ///
    /// This function is a convenience wrapper around
    /// `gtk.WidgetClass.addShortcut` and must be called during class
    /// initialization. It does not provide for user data, if you need that,
    /// you will have to use `gtk.WidgetClass.addShortcut` with a custom
    /// shortcut.
    extern fn gtk_widget_class_add_binding(p_widget_class: *WidgetClass, p_keyval: c_uint, p_mods: gdk.ModifierType, p_callback: gtk.ShortcutFunc, p_format_string: ?[*:0]const u8, ...) void;
    pub const addBinding = gtk_widget_class_add_binding;

    /// Creates a new shortcut for `widget_class` that activates the given
    /// `action_name` with arguments read according to `format_string`.
    ///
    /// The arguments and format string must be provided in the same way as
    /// with `glib.Variant.new`.
    ///
    /// This function is a convenience wrapper around
    /// `gtk.WidgetClass.addShortcut` and must be called during class
    /// initialization.
    extern fn gtk_widget_class_add_binding_action(p_widget_class: *WidgetClass, p_keyval: c_uint, p_mods: gdk.ModifierType, p_action_name: [*:0]const u8, p_format_string: ?[*:0]const u8, ...) void;
    pub const addBindingAction = gtk_widget_class_add_binding_action;

    /// Creates a new shortcut for `widget_class` that emits the given action
    /// `signal` with arguments read according to `format_string`.
    ///
    /// The arguments and format string must be provided in the same way as
    /// with `glib.Variant.new`.
    ///
    /// This function is a convenience wrapper around
    /// `gtk.WidgetClass.addShortcut` and must be called during class
    /// initialization.
    extern fn gtk_widget_class_add_binding_signal(p_widget_class: *WidgetClass, p_keyval: c_uint, p_mods: gdk.ModifierType, p_signal: [*:0]const u8, p_format_string: ?[*:0]const u8, ...) void;
    pub const addBindingSignal = gtk_widget_class_add_binding_signal;

    /// Installs a shortcut in `widget_class`.
    ///
    /// Every instance created for `widget_class` or its subclasses will
    /// inherit this shortcut and trigger it.
    ///
    /// Shortcuts added this way will be triggered in the `gtk.@"PropagationPhase.bubble"`
    /// phase, which means they may also trigger if child widgets have focus.
    ///
    /// This function must only be used in class initialization functions
    /// otherwise it is not guaranteed that the shortcut will be installed.
    extern fn gtk_widget_class_add_shortcut(p_widget_class: *WidgetClass, p_shortcut: *gtk.Shortcut) void;
    pub const addShortcut = gtk_widget_class_add_shortcut;

    /// Associates a name to be used in GtkBuilder XML with a symbol.
    ///
    /// This function is not supported after `gtk.WidgetClass.setTemplateScope`
    /// has been used on `widget_class`.
    ///
    /// See `gtk.BuilderCScope.addCallbackSymbol`.
    ///
    /// Note that this must be called from a composite widget classes
    /// class initializer after calling `gtk.WidgetClass.setTemplate`.
    extern fn gtk_widget_class_bind_template_callback_full(p_widget_class: *WidgetClass, p_callback_name: [*:0]const u8, p_callback_symbol: gobject.Callback) void;
    pub const bindTemplateCallbackFull = gtk_widget_class_bind_template_callback_full;

    /// Assigns an object declared in the class template XML to be set to
    /// a location on a freshly built instance’s private data, or
    /// alternatively accessible via `gtk.Widget.getTemplateChild`.
    ///
    /// The struct can point either into the public instance, then you should
    /// use `G_STRUCT_OFFSET(WidgetType, member)` for `struct_offset`, or in the
    /// private struct, then you should use `G_PRIVATE_OFFSET(WidgetType, member)`.
    ///
    /// An explicit strong reference will be held automatically for the duration
    /// of your instance’s life cycle, it will be released automatically when
    /// `GObjectClass.`dispose`` runs on your instance and if a nonzero `struct_offset`
    /// is specified, then the automatic location in your instance public or private
    /// data will be set to `NULL`. You can however access an automated child pointer
    /// the first time your classes `GObjectClass.`dispose`` runs, or alternatively
    /// in `gtk.Widget.signals.destroy`.
    ///
    /// If `internal_child` is specified, `gtk.Buildable.virtual_methods.get_internal_child`
    /// will be automatically implemented by the widget class so there is no
    /// need to implement it manually.
    ///
    /// The wrapper macros `gtk.widgetClassBindTemplateChild`,
    /// `gtk.widgetClassBindTemplateChildInternal`,
    /// `gtk.widgetClassBindTemplateChildPrivate` and
    /// `gtk.widgetClassBindTemplateChildInternalPrivate`
    /// might be more convenient to use.
    ///
    /// Note that this must be called from a composite widget classes class
    /// initializer after calling `gtk.WidgetClass.setTemplate`.
    extern fn gtk_widget_class_bind_template_child_full(p_widget_class: *WidgetClass, p_name: [*:0]const u8, p_internal_child: c_int, p_struct_offset: isize) void;
    pub const bindTemplateChildFull = gtk_widget_class_bind_template_child_full;

    /// Retrieves the accessible role used by the given widget class.
    ///
    /// Different accessible roles have different states, and are rendered
    /// differently by assistive technologies.
    ///
    /// See also: `gtk.Accessible.getAccessibleRole`.
    extern fn gtk_widget_class_get_accessible_role(p_widget_class: *WidgetClass) gtk.AccessibleRole;
    pub const getAccessibleRole = gtk_widget_class_get_accessible_role;

    /// Retrieves the signal id for the activation signal.
    ///
    /// The activation signal is set using
    /// `gtk.WidgetClass.setActivateSignal`.
    extern fn gtk_widget_class_get_activate_signal(p_widget_class: *WidgetClass) c_uint;
    pub const getActivateSignal = gtk_widget_class_get_activate_signal;

    /// Gets the name used by this class for matching in CSS code.
    ///
    /// See `gtk.WidgetClass.setCssName` for details.
    extern fn gtk_widget_class_get_css_name(p_widget_class: *WidgetClass) [*:0]const u8;
    pub const getCssName = gtk_widget_class_get_css_name;

    /// Retrieves the type of the `gtk.LayoutManager`
    /// used by widgets of class `widget_class`.
    ///
    /// See also: `gtk.WidgetClass.setLayoutManagerType`.
    extern fn gtk_widget_class_get_layout_manager_type(p_widget_class: *WidgetClass) usize;
    pub const getLayoutManagerType = gtk_widget_class_get_layout_manager_type;

    /// Adds an action for all instances of a widget class.
    ///
    /// This function should be called at class initialization time.
    ///
    /// Actions installed by this function are stateless. The only state
    /// they have is whether they are enabled or not (which can be changed
    /// with `gtk.Widget.actionSetEnabled`).
    extern fn gtk_widget_class_install_action(p_widget_class: *WidgetClass, p_action_name: [*:0]const u8, p_parameter_type: ?[*:0]const u8, p_activate: gtk.WidgetActionActivateFunc) void;
    pub const installAction = gtk_widget_class_install_action;

    /// Installs an action called `action_name` on `widget_class` and
    /// binds its state to the value of the `property_name` property.
    ///
    /// This function will perform a few sanity checks on the property selected
    /// via `property_name`. Namely, the property must exist, must be readable,
    /// writable and must not be construct-only. There are also restrictions
    /// on the type of the given property, it must be boolean, int, unsigned int,
    /// double or string. If any of these conditions are not met, a critical
    /// warning will be printed and no action will be added.
    ///
    /// The state type of the action matches the property type.
    ///
    /// If the property is boolean, the action will have no parameter and
    /// toggle the property value. Otherwise, the action will have a parameter
    /// of the same type as the property.
    extern fn gtk_widget_class_install_property_action(p_widget_class: *WidgetClass, p_action_name: [*:0]const u8, p_property_name: [*:0]const u8) void;
    pub const installPropertyAction = gtk_widget_class_install_property_action;

    /// Returns details about an action that has been
    /// installed for `widget_class`.
    ///
    /// See `gtk.WidgetClass.installAction` for details on
    /// how to install actions.
    ///
    /// Note that this function will also return actions defined
    /// by parent classes. You can identify those by looking
    /// at `owner`.
    extern fn gtk_widget_class_query_action(p_widget_class: *WidgetClass, p_index_: c_uint, p_owner: *usize, p_action_name: *[*:0]const u8, p_parameter_type: ?**const glib.VariantType, p_property_name: ?*[*:0]const u8) c_int;
    pub const queryAction = gtk_widget_class_query_action;

    /// Sets the accessible role used by the given widget class.
    ///
    /// Different accessible roles have different states, and are
    /// rendered differently by assistive technologies.
    extern fn gtk_widget_class_set_accessible_role(p_widget_class: *WidgetClass, p_accessible_role: gtk.AccessibleRole) void;
    pub const setAccessibleRole = gtk_widget_class_set_accessible_role;

    /// Sets the activation signal for a widget class.
    ///
    /// The signal will be emitted when calling `gtk.Widget.activate`.
    ///
    /// The `signal_id` must have been registered with [function.GObject.signal_new]
    /// or `gobject.signalNewv` before calling this function.
    extern fn gtk_widget_class_set_activate_signal(p_widget_class: *WidgetClass, p_signal_id: c_uint) void;
    pub const setActivateSignal = gtk_widget_class_set_activate_signal;

    /// Sets the activation signal for a widget class.
    ///
    /// The signal id will by looked up by `signal_name`.
    ///
    /// The signal will be emitted when calling `gtk.Widget.activate`.
    ///
    /// The `signal_name` must have been registered with [function.GObject.signal_new]
    /// or `gobject.signalNewv` before calling this function.
    extern fn gtk_widget_class_set_activate_signal_from_name(p_widget_class: *WidgetClass, p_signal_name: [*:0]const u8) void;
    pub const setActivateSignalFromName = gtk_widget_class_set_activate_signal_from_name;

    /// Sets the name to be used for CSS matching of widgets.
    ///
    /// If this function is not called for a given class, the name
    /// set on the parent class is used. By default, `GtkWidget`
    /// uses the name "widget".
    extern fn gtk_widget_class_set_css_name(p_widget_class: *WidgetClass, p_name: [*:0]const u8) void;
    pub const setCssName = gtk_widget_class_set_css_name;

    /// Sets the type to be used for creating layout managers for
    /// widgets of `widget_class`.
    ///
    /// The given `type` must be a subtype of `gtk.LayoutManager`.
    ///
    /// This function should only be called from class init functions
    /// of widgets.
    extern fn gtk_widget_class_set_layout_manager_type(p_widget_class: *WidgetClass, p_type: usize) void;
    pub const setLayoutManagerType = gtk_widget_class_set_layout_manager_type;

    /// This should be called at class initialization time to specify
    /// the `GtkBuilder` XML to be used to extend a widget.
    ///
    /// For convenience, `gtk.WidgetClass.setTemplateFromResource`
    /// is also provided.
    ///
    /// Note that any class that installs templates must call
    /// `gtk.Widget.initTemplate` in the widget’s instance initializer.
    extern fn gtk_widget_class_set_template(p_widget_class: *WidgetClass, p_template_bytes: *glib.Bytes) void;
    pub const setTemplate = gtk_widget_class_set_template;

    /// A convenience function that calls `gtk.WidgetClass.setTemplate`
    /// with the contents of a resource.
    ///
    /// Note that any class that installs templates must call
    /// `gtk.Widget.initTemplate` in the widget’s instance
    /// initializer.
    extern fn gtk_widget_class_set_template_from_resource(p_widget_class: *WidgetClass, p_resource_name: [*:0]const u8) void;
    pub const setTemplateFromResource = gtk_widget_class_set_template_from_resource;

    /// Overrides the default scope to be used when parsing the class template.
    ///
    /// This function is intended for language bindings.
    ///
    /// Note that this must be called from a composite widget classes class
    /// initializer after calling `gtk.WidgetClass.setTemplate`.
    extern fn gtk_widget_class_set_template_scope(p_widget_class: *WidgetClass, p_scope: *gtk.BuilderScope) void;
    pub const setTemplateScope = gtk_widget_class_set_template_scope;

    pub fn as(p_instance: *WidgetClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WidgetClassPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WidgetPaintableClass = extern struct {
    pub const Instance = gtk.WidgetPaintable;

    f_parent_class: gobject.ObjectClass,

    pub fn as(p_instance: *WidgetPaintableClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WidgetPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WindowClass = extern struct {
    pub const Instance = gtk.Window;

    /// The parent class.
    f_parent_class: gtk.WidgetClass,
    /// Activates the current focused widget within the window.
    f_activate_focus: ?*const fn (p_window: *gtk.Window) callconv(.c) void,
    /// Activates the default widget for the window.
    f_activate_default: ?*const fn (p_window: *gtk.Window) callconv(.c) void,
    /// Signal gets emitted when the set of accelerators or
    ///   mnemonics that are associated with window changes.
    f_keys_changed: ?*const fn (p_window: *gtk.Window) callconv(.c) void,
    /// Class handler for the `GtkWindow::enable-debugging`
    ///   keybinding signal.
    f_enable_debugging: ?*const fn (p_window: *gtk.Window, p_toggle: c_int) callconv(.c) c_int,
    f_close_request: ?*const fn (p_window: *gtk.Window) callconv(.c) c_int,
    f_padding: [8]*anyopaque,

    pub fn as(p_instance: *WindowClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WindowControlsClass = extern struct {
    pub const Instance = gtk.WindowControls;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *WindowControlsClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WindowGroupClass = extern struct {
    pub const Instance = gtk.WindowGroup;

    f_parent_class: gobject.ObjectClass,
    f__gtk_reserved1: ?*const fn () callconv(.c) void,
    f__gtk_reserved2: ?*const fn () callconv(.c) void,
    f__gtk_reserved3: ?*const fn () callconv(.c) void,
    f__gtk_reserved4: ?*const fn () callconv(.c) void,

    pub fn as(p_instance: *WindowGroupClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WindowGroupPrivate = opaque {
    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

pub const WindowHandleClass = extern struct {
    pub const Instance = gtk.WindowHandle;

    f_parent_class: gtk.WidgetClass,

    pub fn as(p_instance: *WindowHandleClass, comptime P_T: type) *P_T {
        return gobject.ext.as(P_T, p_instance);
    }

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The priority of an accessibility announcement.
pub const AccessibleAnnouncementPriority = enum(c_int) {
    low = 0,
    medium = 1,
    high = 2,
    _,

    extern fn gtk_accessible_announcement_priority_get_type() usize;
    pub const getGObjectType = gtk_accessible_announcement_priority_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible values for the `GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE`
/// accessible property.
pub const AccessibleAutocomplete = enum(c_int) {
    none = 0,
    @"inline" = 1,
    list = 2,
    both = 3,
    _,

    extern fn gtk_accessible_autocomplete_get_type() usize;
    pub const getGObjectType = gtk_accessible_autocomplete_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible values for the `GTK_ACCESSIBLE_STATE_INVALID`
/// accessible state.
///
/// Note that the `GTK_ACCESSIBLE_INVALID_FALSE` and
/// `GTK_ACCESSIBLE_INVALID_TRUE` have the same values
/// as `FALSE` and `TRUE`.
pub const AccessibleInvalidState = enum(c_int) {
    false = 0,
    true = 1,
    grammar = 2,
    spelling = 3,
    _,

    extern fn gtk_accessible_invalid_state_get_type() usize;
    pub const getGObjectType = gtk_accessible_invalid_state_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The various platform states which can be queried
/// using `gtk.Accessible.getPlatformState`.
pub const AccessiblePlatformState = enum(c_int) {
    focusable = 0,
    focused = 1,
    active = 2,
    _,

    extern fn gtk_accessible_platform_state_get_type() usize;
    pub const getGObjectType = gtk_accessible_platform_state_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible accessible properties of a `Accessible`.
pub const AccessibleProperty = enum(c_int) {
    autocomplete = 0,
    description = 1,
    has_popup = 2,
    key_shortcuts = 3,
    label = 4,
    level = 5,
    modal = 6,
    multi_line = 7,
    multi_selectable = 8,
    orientation = 9,
    placeholder = 10,
    read_only = 11,
    required = 12,
    role_description = 13,
    sort = 14,
    value_max = 15,
    value_min = 16,
    value_now = 17,
    value_text = 18,
    help_text = 19,
    _,

    /// Initializes `value` with the appropriate type for the `property`.
    ///
    /// This function is mostly meant for language bindings, in conjunction
    /// with `gtk.Accessible.updatePropertyValue`.
    extern fn gtk_accessible_property_init_value(p_property: gtk.AccessibleProperty, p_value: *gobject.Value) void;
    pub const initValue = gtk_accessible_property_init_value;

    extern fn gtk_accessible_property_get_type() usize;
    pub const getGObjectType = gtk_accessible_property_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible accessible relations of a `Accessible`.
///
/// Accessible relations can be references to other widgets,
/// integers or strings.
pub const AccessibleRelation = enum(c_int) {
    active_descendant = 0,
    col_count = 1,
    col_index = 2,
    col_index_text = 3,
    col_span = 4,
    controls = 5,
    described_by = 6,
    details = 7,
    error_message = 8,
    flow_to = 9,
    labelled_by = 10,
    owns = 11,
    pos_in_set = 12,
    row_count = 13,
    row_index = 14,
    row_index_text = 15,
    row_span = 16,
    set_size = 17,
    label_for = 18,
    description_for = 19,
    controlled_by = 20,
    details_for = 21,
    error_message_for = 22,
    flow_from = 23,
    _,

    /// Initializes `value` with the appropriate type for the `relation`.
    ///
    /// This function is mostly meant for language bindings, in conjunction
    /// with `gtk.Accessible.updateRelationValue`.
    extern fn gtk_accessible_relation_init_value(p_relation: gtk.AccessibleRelation, p_value: *gobject.Value) void;
    pub const initValue = gtk_accessible_relation_init_value;

    extern fn gtk_accessible_relation_get_type() usize;
    pub const getGObjectType = gtk_accessible_relation_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The accessible role for a `Accessible` implementation.
///
/// Abstract roles are only used as part of the ontology; application
/// developers must not use abstract roles in their code.
pub const AccessibleRole = enum(c_int) {
    alert = 0,
    alert_dialog = 1,
    banner = 2,
    button = 3,
    caption = 4,
    cell = 5,
    checkbox = 6,
    column_header = 7,
    combo_box = 8,
    command = 9,
    composite = 10,
    dialog = 11,
    document = 12,
    feed = 13,
    form = 14,
    generic = 15,
    grid = 16,
    grid_cell = 17,
    group = 18,
    heading = 19,
    img = 20,
    input = 21,
    label = 22,
    landmark = 23,
    legend = 24,
    link = 25,
    list = 26,
    list_box = 27,
    list_item = 28,
    log = 29,
    main = 30,
    marquee = 31,
    math = 32,
    meter = 33,
    menu = 34,
    menu_bar = 35,
    menu_item = 36,
    menu_item_checkbox = 37,
    menu_item_radio = 38,
    navigation = 39,
    none = 40,
    note = 41,
    option = 42,
    presentation = 43,
    progress_bar = 44,
    radio = 45,
    radio_group = 46,
    range = 47,
    region = 48,
    row = 49,
    row_group = 50,
    row_header = 51,
    scrollbar = 52,
    search = 53,
    search_box = 54,
    section = 55,
    section_head = 56,
    select = 57,
    separator = 58,
    slider = 59,
    spin_button = 60,
    status = 61,
    structure = 62,
    @"switch" = 63,
    tab = 64,
    table = 65,
    tab_list = 66,
    tab_panel = 67,
    text_box = 68,
    time = 69,
    timer = 70,
    toolbar = 71,
    tooltip = 72,
    tree = 73,
    tree_grid = 74,
    tree_item = 75,
    widget = 76,
    window = 77,
    toggle_button = 78,
    application = 79,
    paragraph = 80,
    block_quote = 81,
    article = 82,
    comment = 83,
    terminal = 84,
    _,

    extern fn gtk_accessible_role_get_type() usize;
    pub const getGObjectType = gtk_accessible_role_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible values for the `GTK_ACCESSIBLE_PROPERTY_SORT`
/// accessible property.
pub const AccessibleSort = enum(c_int) {
    none = 0,
    ascending = 1,
    descending = 2,
    other = 3,
    _,

    extern fn gtk_accessible_sort_get_type() usize;
    pub const getGObjectType = gtk_accessible_sort_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible accessible states of a `Accessible`.
pub const AccessibleState = enum(c_int) {
    busy = 0,
    checked = 1,
    disabled = 2,
    expanded = 3,
    hidden = 4,
    invalid = 5,
    pressed = 6,
    selected = 7,
    visited = 8,
    _,

    /// Initializes `value` with the appropriate type for the `state`.
    ///
    /// This function is mostly meant for language bindings, in conjunction
    /// with `gtk_accessible_update_relation_state`.
    extern fn gtk_accessible_state_init_value(p_state: gtk.AccessibleState, p_value: *gobject.Value) void;
    pub const initValue = gtk_accessible_state_init_value;

    extern fn gtk_accessible_state_get_type() usize;
    pub const getGObjectType = gtk_accessible_state_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The type of contents change operation.
pub const AccessibleTextContentChange = enum(c_int) {
    insert = 0,
    remove = 1,
    _,

    extern fn gtk_accessible_text_content_change_get_type() usize;
    pub const getGObjectType = gtk_accessible_text_content_change_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The granularity for queries about the text contents of a `gtk.AccessibleText`
/// implementation.
pub const AccessibleTextGranularity = enum(c_int) {
    character = 0,
    word = 1,
    sentence = 2,
    line = 3,
    paragraph = 4,
    _,

    extern fn gtk_accessible_text_granularity_get_type() usize;
    pub const getGObjectType = gtk_accessible_text_granularity_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The possible values for the `GTK_ACCESSIBLE_STATE_PRESSED`
/// accessible state.
///
/// Note that the `GTK_ACCESSIBLE_TRISTATE_FALSE` and
/// `GTK_ACCESSIBLE_TRISTATE_TRUE` have the same values
/// as `FALSE` and `TRUE`.
pub const AccessibleTristate = enum(c_int) {
    false = 0,
    true = 1,
    mixed = 2,
    _,

    extern fn gtk_accessible_tristate_get_type() usize;
    pub const getGObjectType = gtk_accessible_tristate_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Controls how a widget deals with extra space in a single dimension.
///
/// Alignment only matters if the widget receives a “too large” allocation,
/// for example if you packed the widget with the `gtk.Widget.properties.hexpand`
/// property inside a `Box`, then the widget might get extra space.
/// If you have for example a 16x16 icon inside a 32x32 space, the icon
/// could be scaled and stretched, it could be centered, or it could be
/// positioned to one side of the space.
///
/// Note that in horizontal context `GTK_ALIGN_START` and `GTK_ALIGN_END`
/// are interpreted relative to text direction.
///
/// Baseline support is optional for containers and widgets, and is only available
/// for vertical alignment. `GTK_ALIGN_BASELINE_CENTER` and `GTK_ALIGN_BASELINE_FILL`
/// are treated similar to `GTK_ALIGN_CENTER` and `GTK_ALIGN_FILL`, except that it
/// positions the widget to line up the baselines, where that is supported.
pub const Align = enum(c_int) {
    fill = 0,
    start = 1,
    end = 2,
    center = 3,
    baseline_fill = 4,
    baseline_center = 5,
    _,

    pub const baseline = Align.baseline_fill;
    extern fn gtk_align_get_type() usize;
    pub const getGObjectType = gtk_align_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Indicates the direction in which an arrow should point.
pub const ArrowType = enum(c_int) {
    up = 0,
    down = 1,
    left = 2,
    right = 3,
    none = 4,
    _,

    extern fn gtk_arrow_type_get_type() usize;
    pub const getGObjectType = gtk_arrow_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines the role of a page inside a `GtkAssistant`.
///
/// The role is used to handle buttons sensitivity and visibility.
///
/// Note that an assistant needs to end its page flow with a page of type
/// `GTK_ASSISTANT_PAGE_CONFIRM`, `GTK_ASSISTANT_PAGE_SUMMARY` or
/// `GTK_ASSISTANT_PAGE_PROGRESS` to be correct.
///
/// The Cancel button will only be shown if the page isn’t “committed”.
/// See `gtk.Assistant.commit` for details.
pub const AssistantPageType = enum(c_int) {
    content = 0,
    intro = 1,
    confirm = 2,
    summary = 3,
    progress = 4,
    custom = 5,
    _,

    extern fn gtk_assistant_page_type_get_type() usize;
    pub const getGObjectType = gtk_assistant_page_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Baseline position in a row of widgets.
///
/// Whenever a container has some form of natural row it may align
/// children in that row along a common typographical baseline. If
/// the amount of vertical space in the row is taller than the total
/// requested height of the baseline-aligned children then it can use a
/// `GtkBaselinePosition` to select where to put the baseline inside the
/// extra available space.
pub const BaselinePosition = enum(c_int) {
    top = 0,
    center = 1,
    bottom = 2,
    _,

    extern fn gtk_baseline_position_get_type() usize;
    pub const getGObjectType = gtk_baseline_position_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes how the border of a UI element should be rendered.
pub const BorderStyle = enum(c_int) {
    none = 0,
    hidden = 1,
    solid = 2,
    inset = 3,
    outset = 4,
    dotted = 5,
    dashed = 6,
    double = 7,
    groove = 8,
    ridge = 9,
    _,

    extern fn gtk_border_style_get_type() usize;
    pub const getGObjectType = gtk_border_style_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Error codes that identify various errors that can occur while using
/// `GtkBuilder`.
pub const BuilderError = enum(c_int) {
    invalid_type_function = 0,
    unhandled_tag = 1,
    missing_attribute = 2,
    invalid_attribute = 3,
    invalid_tag = 4,
    missing_property_value = 5,
    invalid_value = 6,
    version_mismatch = 7,
    duplicate_id = 8,
    object_type_refused = 9,
    template_mismatch = 10,
    invalid_property = 11,
    invalid_signal = 12,
    invalid_id = 13,
    invalid_function = 14,
    _,

    /// Registers an error quark for `gtk.Builder` errors.
    extern fn gtk_builder_error_quark() glib.Quark;
    pub const quark = gtk_builder_error_quark;

    extern fn gtk_builder_error_get_type() usize;
    pub const getGObjectType = gtk_builder_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Prebuilt sets of buttons for `GtkDialog`.
///
/// If none of these choices are appropriate, simply use
/// `GTK_BUTTONS_NONE` and call `gtk.Dialog.addButtons`.
///
/// > Please note that `GTK_BUTTONS_OK`, `GTK_BUTTONS_YES_NO`
/// > and `GTK_BUTTONS_OK_CANCEL` are discouraged by the
/// > [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/).
pub const ButtonsType = enum(c_int) {
    none = 0,
    ok = 1,
    close = 2,
    cancel = 3,
    yes_no = 4,
    ok_cancel = 5,
    _,

    extern fn gtk_buttons_type_get_type() usize;
    pub const getGObjectType = gtk_buttons_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The available modes for `gtk.CellRendererAccel.properties.accel_mode`.
pub const CellRendererAccelMode = enum(c_int) {
    gtk = 0,
    other = 1,
    _,

    extern fn gtk_cell_renderer_accel_mode_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_accel_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Identifies how the user can interact with a particular cell.
pub const CellRendererMode = enum(c_int) {
    inert = 0,
    activatable = 1,
    editable = 2,
    _,

    extern fn gtk_cell_renderer_mode_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes how a `gtk.StringSorter` turns strings into sort keys to
/// compare them.
///
/// Note that the result of sorting will in general depend on the current locale
/// unless the mode is `GTK_COLLATION_NONE`.
pub const Collation = enum(c_int) {
    none = 0,
    unicode = 1,
    filename = 2,
    _,

    extern fn gtk_collation_get_type() usize;
    pub const getGObjectType = gtk_collation_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The widget attributes that can be used when creating a `Constraint`.
pub const ConstraintAttribute = enum(c_int) {
    none = 0,
    left = 1,
    right = 2,
    top = 3,
    bottom = 4,
    start = 5,
    end = 6,
    width = 7,
    height = 8,
    center_x = 9,
    center_y = 10,
    baseline = 11,
    _,

    extern fn gtk_constraint_attribute_get_type() usize;
    pub const getGObjectType = gtk_constraint_attribute_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The relation between two terms of a constraint.
pub const ConstraintRelation = enum(c_int) {
    le = -1,
    eq = 0,
    ge = 1,
    _,

    extern fn gtk_constraint_relation_get_type() usize;
    pub const getGObjectType = gtk_constraint_relation_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The strength of a constraint, expressed as a symbolic constant.
///
/// The strength of a `Constraint` can be expressed with any positive
/// integer; the values of this enumeration can be used for readability.
pub const ConstraintStrength = enum(c_int) {
    required = 1001001000,
    strong = 1000000000,
    medium = 1000,
    weak = 1,
    _,

    extern fn gtk_constraint_strength_get_type() usize;
    pub const getGObjectType = gtk_constraint_strength_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Domain for VFL parsing errors.
pub const ConstraintVflParserError = enum(c_int) {
    invalid_symbol = 0,
    invalid_attribute = 1,
    invalid_view = 2,
    invalid_metric = 3,
    invalid_priority = 4,
    invalid_relation = 5,
    _,

    /// Registers an error quark for VFL error parsing.
    extern fn gtk_constraint_vfl_parser_error_quark() glib.Quark;
    pub const quark = gtk_constraint_vfl_parser_error_quark;

    extern fn gtk_constraint_vfl_parser_error_get_type() usize;
    pub const getGObjectType = gtk_constraint_vfl_parser_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Controls how a content should be made to fit inside an allocation.
pub const ContentFit = enum(c_int) {
    fill = 0,
    contain = 1,
    cover = 2,
    scale_down = 3,
    _,

    extern fn gtk_content_fit_get_type() usize;
    pub const getGObjectType = gtk_content_fit_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies which corner a child widget should be placed in when packed into
/// a `GtkScrolledWindow.`
///
/// This is effectively the opposite of where the scroll bars are placed.
pub const CornerType = enum(c_int) {
    top_left = 0,
    bottom_left = 1,
    top_right = 2,
    bottom_right = 3,
    _,

    extern fn gtk_corner_type_get_type() usize;
    pub const getGObjectType = gtk_corner_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Errors that can occur while parsing CSS.
///
/// These errors are unexpected and will cause parts of the given CSS
/// to be ignored.
pub const CssParserError = enum(c_int) {
    failed = 0,
    syntax = 1,
    import = 2,
    name = 3,
    unknown_value = 4,
    _,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Warnings that can occur while parsing CSS.
///
/// Unlike `GtkCssParserError`s, warnings do not cause the parser to
/// skip any input, but they indicate issues that should be fixed.
pub const CssParserWarning = enum(c_int) {
    deprecated = 0,
    syntax = 1,
    unimplemented = 2,
    _,

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Passed to various keybinding signals for deleting text.
pub const DeleteType = enum(c_int) {
    chars = 0,
    word_ends = 1,
    words = 2,
    display_lines = 3,
    display_line_ends = 4,
    paragraph_ends = 5,
    paragraphs = 6,
    whitespace = 7,
    _,

    extern fn gtk_delete_type_get_type() usize;
    pub const getGObjectType = gtk_delete_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Error codes in the `GTK_DIALOG_ERROR` domain that can be returned
/// by async dialog functions.
pub const DialogError = enum(c_int) {
    failed = 0,
    cancelled = 1,
    dismissed = 2,
    _,

    /// Registers an error quark for an operation that requires a dialog if
    /// necessary.
    extern fn gtk_dialog_error_quark() glib.Quark;
    pub const quark = gtk_dialog_error_quark;

    extern fn gtk_dialog_error_get_type() usize;
    pub const getGObjectType = gtk_dialog_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Focus movement types.
pub const DirectionType = enum(c_int) {
    tab_forward = 0,
    tab_backward = 1,
    up = 2,
    down = 3,
    left = 4,
    right = 5,
    _,

    extern fn gtk_direction_type_get_type() usize;
    pub const getGObjectType = gtk_direction_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The identifiers for `gtk.Editable` properties.
///
/// See `gtk.Editable.installProperties` for details on how to
/// implement the `GtkEditable` interface.
pub const EditableProperties = enum(c_int) {
    prop_text = 0,
    prop_cursor_position = 1,
    prop_selection_bound = 2,
    prop_editable = 3,
    prop_width_chars = 4,
    prop_max_width_chars = 5,
    prop_xalign = 6,
    prop_enable_undo = 7,
    num_properties = 8,
    _,

    extern fn gtk_editable_properties_get_type() usize;
    pub const getGObjectType = gtk_editable_properties_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies the side of the entry at which an icon is placed.
pub const EntryIconPosition = enum(c_int) {
    primary = 0,
    secondary = 1,
    _,

    extern fn gtk_entry_icon_position_get_type() usize;
    pub const getGObjectType = gtk_entry_icon_position_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the state of a `gdk.EventSequence` in a `Gesture`.
pub const EventSequenceState = enum(c_int) {
    none = 0,
    claimed = 1,
    denied = 2,
    _,

    extern fn gtk_event_sequence_state_get_type() usize;
    pub const getGObjectType = gtk_event_sequence_state_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes whether a `GtkFileChooser` is being used to open existing files
/// or to save to a possibly new file.
pub const FileChooserAction = enum(c_int) {
    open = 0,
    save = 1,
    select_folder = 2,
    _,

    extern fn gtk_file_chooser_action_get_type() usize;
    pub const getGObjectType = gtk_file_chooser_action_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// These identify the various errors that can occur while calling
/// `GtkFileChooser` functions.
pub const FileChooserError = enum(c_int) {
    nonexistent = 0,
    bad_filename = 1,
    already_exists = 2,
    incomplete_hostname = 3,
    _,

    /// Registers an error quark for `GtkFileChooser` errors.
    extern fn gtk_file_chooser_error_quark() glib.Quark;
    pub const quark = gtk_file_chooser_error_quark;

    extern fn gtk_file_chooser_error_get_type() usize;
    pub const getGObjectType = gtk_file_chooser_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes changes in a filter in more detail and allows objects
/// using the filter to optimize refiltering items.
///
/// If you are writing an implementation and are not sure which
/// value to pass, `GTK_FILTER_CHANGE_DIFFERENT` is always a correct
/// choice.
///
/// New values may be added in the future.
pub const FilterChange = enum(c_int) {
    different = 0,
    less_strict = 1,
    more_strict = 2,
    different_rewatch = 3,
    less_strict_rewatch = 4,
    more_strict_rewatch = 5,
    _,

    extern fn gtk_filter_change_get_type() usize;
    pub const getGObjectType = gtk_filter_change_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the known strictness of a filter.
///
/// Note that for filters where the strictness is not known,
/// `GTK_FILTER_MATCH_SOME` is always an acceptable value,
/// even if a filter does match all or no items.
pub const FilterMatch = enum(c_int) {
    some = 0,
    none = 1,
    all = 2,
    _,

    extern fn gtk_filter_match_get_type() usize;
    pub const getGObjectType = gtk_filter_match_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The level of granularity for the font selection.
///
/// Depending on this value, the `PangoFontDescription` that
/// is returned by `gtk.FontDialogButton.getFontDesc`
/// will have more or less fields set.
pub const FontLevel = enum(c_int) {
    family = 0,
    face = 1,
    font = 2,
    features = 3,
    _,

    extern fn gtk_font_level_get_type() usize;
    pub const getGObjectType = gtk_font_level_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Values for the `gtk.Settings.properties.gtk_font_rendering` setting
/// that influence how GTK renders fonts.
pub const FontRendering = enum(c_int) {
    automatic = 0,
    manual = 1,
    _,

    extern fn gtk_font_rendering_get_type() usize;
    pub const getGObjectType = gtk_font_rendering_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents the state of graphics offloading.
pub const GraphicsOffloadEnabled = enum(c_int) {
    enabled = 0,
    disabled = 1,
    _,

    extern fn gtk_graphics_offload_enabled_get_type() usize;
    pub const getGObjectType = gtk_graphics_offload_enabled_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Built-in icon sizes.
///
/// Icon sizes default to being inherited. Where they cannot be
/// inherited, text size is the default.
///
/// All widgets which use `GtkIconSize` set the normal-icons or
/// large-icons style classes correspondingly, and let themes
/// determine the actual size to be used with the
/// `-gtk-icon-size` CSS property.
pub const IconSize = enum(c_int) {
    inherit = 0,
    normal = 1,
    large = 2,
    _,

    extern fn gtk_icon_size_get_type() usize;
    pub const getGObjectType = gtk_icon_size_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Error codes for `GtkIconTheme` operations.
pub const IconThemeError = enum(c_int) {
    not_found = 0,
    failed = 1,
    _,

    /// Registers an error quark for `gtk.IconTheme` errors.
    extern fn gtk_icon_theme_error_quark() glib.Quark;
    pub const quark = gtk_icon_theme_error_quark;

    extern fn gtk_icon_theme_error_get_type() usize;
    pub const getGObjectType = gtk_icon_theme_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An enum for determining where a dropped item goes.
pub const IconViewDropPosition = enum(c_int) {
    no_drop = 0,
    drop_into = 1,
    drop_left = 2,
    drop_right = 3,
    drop_above = 4,
    drop_below = 5,
    _,

    extern fn gtk_icon_view_drop_position_get_type() usize;
    pub const getGObjectType = gtk_icon_view_drop_position_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the image data representation used by a `gtk.Image`.
///
/// If you want to get the image from the widget, you can only get the
/// currently-stored representation; for instance, if the `gtk.Image.getStorageType`
/// returns `GTK_IMAGE_PAINTABLE`, then you can call `gtk.Image.getPaintable`.
///
/// For empty images, you can request any storage type (call any of the "get"
/// functions), but they will all return `NULL` values.
pub const ImageType = enum(c_int) {
    empty = 0,
    icon_name = 1,
    gicon = 2,
    paintable = 3,
    _,

    extern fn gtk_image_type_get_type() usize;
    pub const getGObjectType = gtk_image_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes primary purpose of the input widget.
///
/// This information is useful for on-screen keyboards and similar input
/// methods to decide which keys should be presented to the user.
///
/// Note that the purpose is not meant to impose a totally strict rule
/// about allowed characters, and does not replace input validation.
/// It is fine for an on-screen keyboard to let the user override the
/// character set restriction that is expressed by the purpose. The
/// application is expected to validate the entry contents, even if
/// it specified a purpose.
///
/// The difference between `GTK_INPUT_PURPOSE_DIGITS` and
/// `GTK_INPUT_PURPOSE_NUMBER` is that the former accepts only digits
/// while the latter also some punctuation (like commas or points, plus,
/// minus) and “e” or “E” as in 3.14E+000.
///
/// This enumeration may be extended in the future; input methods should
/// interpret unknown values as “free form”.
pub const InputPurpose = enum(c_int) {
    free_form = 0,
    alpha = 1,
    digits = 2,
    number = 3,
    phone = 4,
    url = 5,
    email = 6,
    name = 7,
    password = 8,
    pin = 9,
    terminal = 10,
    _,

    extern fn gtk_input_purpose_get_type() usize;
    pub const getGObjectType = gtk_input_purpose_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The different methods to handle text in `gtk.Inscription` when it doesn't
/// fit the available space.
pub const InscriptionOverflow = enum(c_int) {
    clip = 0,
    ellipsize_start = 1,
    ellipsize_middle = 2,
    ellipsize_end = 3,
    _,

    extern fn gtk_inscription_overflow_get_type() usize;
    pub const getGObjectType = gtk_inscription_overflow_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Values for the `gtk.Settings.properties.gtk_interface_color_scheme`
/// and `gtk.CssProvider.properties.prefers_color_scheme` properties
/// that indicates what color scheme is used.
///
/// This information can be used inside CSS via media queries.
///
/// More values may be added to this enumeration. Unknown values
/// should be treated the same as `GTK_INTERFACE_COLOR_SCHEME_DEFAULT`.
pub const InterfaceColorScheme = enum(c_int) {
    unsupported = 0,
    default = 1,
    dark = 2,
    light = 3,
    _,

    extern fn gtk_interface_color_scheme_get_type() usize;
    pub const getGObjectType = gtk_interface_color_scheme_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Values for the `gtk.Settings.properties.gtk_interface_contrast`
/// and `gtk.CssProvider.properties.prefers_contrast` properties
/// that indicates the preferred level of contrast.
///
/// This information can be used inside CSS via media queries.
///
/// More values may be added to this enumeration. Unknown values
/// should be treated the same as `GTK_INTERFACE_CONTRAST_NO_PREFERENCE`.
pub const InterfaceContrast = enum(c_int) {
    unsupported = 0,
    no_preference = 1,
    more = 2,
    less = 3,
    _,

    extern fn gtk_interface_contrast_get_type() usize;
    pub const getGObjectType = gtk_interface_contrast_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used for justifying the text inside a `Label` widget.
pub const Justification = enum(c_int) {
    left = 0,
    right = 1,
    center = 2,
    fill = 3,
    _,

    extern fn gtk_justification_get_type() usize;
    pub const getGObjectType = gtk_justification_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes how `LevelBar` contents should be rendered.
///
/// Note that this enumeration could be extended with additional modes
/// in the future.
pub const LevelBarMode = enum(c_int) {
    continuous = 0,
    discrete = 1,
    _,

    extern fn gtk_level_bar_mode_get_type() usize;
    pub const getGObjectType = gtk_level_bar_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The type of license for an application.
///
/// This enumeration can be expanded at later date.
pub const License = enum(c_int) {
    unknown = 0,
    custom = 1,
    gpl_2_0 = 2,
    gpl_3_0 = 3,
    lgpl_2_1 = 4,
    lgpl_3_0 = 5,
    bsd = 6,
    mit_x11 = 7,
    artistic = 8,
    gpl_2_0_only = 9,
    gpl_3_0_only = 10,
    lgpl_2_1_only = 11,
    lgpl_3_0_only = 12,
    agpl_3_0 = 13,
    agpl_3_0_only = 14,
    bsd_3 = 15,
    apache_2_0 = 16,
    mpl_2_0 = 17,
    @"0bsd" = 18,
    _,

    extern fn gtk_license_get_type() usize;
    pub const getGObjectType = gtk_license_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to configure the focus behavior in the `GTK_DIR_TAB_FORWARD`
/// and `GTK_DIR_TAB_BACKWARD` direction, like the <kbd>Tab</kbd> key
/// in a `gtk.ListView`.
pub const ListTabBehavior = enum(c_int) {
    all = 0,
    item = 1,
    cell = 2,
    _,

    extern fn gtk_list_tab_behavior_get_type() usize;
    pub const getGObjectType = gtk_list_tab_behavior_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The type of message being displayed in a `MessageDialog`.
pub const MessageType = enum(c_int) {
    info = 0,
    warning = 1,
    question = 2,
    @"error" = 3,
    other = 4,
    _,

    extern fn gtk_message_type_get_type() usize;
    pub const getGObjectType = gtk_message_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Passed as argument to various keybinding signals for moving the
/// cursor position.
pub const MovementStep = enum(c_int) {
    logical_positions = 0,
    visual_positions = 1,
    words = 2,
    display_lines = 3,
    display_line_ends = 4,
    paragraphs = 5,
    paragraph_ends = 6,
    pages = 7,
    buffer_ends = 8,
    horizontal_pages = 9,
    _,

    extern fn gtk_movement_step_get_type() usize;
    pub const getGObjectType = gtk_movement_step_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Options for selecting a different wrap mode for natural size
/// requests.
///
/// See for example the `gtk.Label.properties.natural_wrap_mode` property.
pub const NaturalWrapMode = enum(c_int) {
    inherit = 0,
    none = 1,
    word = 2,
    _,

    extern fn gtk_natural_wrap_mode_get_type() usize;
    pub const getGObjectType = gtk_natural_wrap_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The parameter used in the action signals of `GtkNotebook`.
pub const NotebookTab = enum(c_int) {
    first = 0,
    last = 1,
    _,

    extern fn gtk_notebook_tab_get_type() usize;
    pub const getGObjectType = gtk_notebook_tab_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to determine the layout of pages on a sheet when printing
/// multiple pages per sheet.
pub const NumberUpLayout = enum(c_int) {
    lrtb = 0,
    lrbt = 1,
    rltb = 2,
    rlbt = 3,
    tblr = 4,
    tbrl = 5,
    btlr = 6,
    btrl = 7,
    _,

    extern fn gtk_number_up_layout_get_type() usize;
    pub const getGObjectType = gtk_number_up_layout_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the way two values can be compared.
///
/// These values can be used with a `glib.CompareFunc`. However,
/// a `GCompareFunc` is allowed to return any integer values.
/// For converting such a value to a `GtkOrdering` value, use
/// `gtk.Ordering.fromCmpfunc`.
pub const Ordering = enum(c_int) {
    smaller = -1,
    equal = 0,
    larger = 1,
    _,

    extern fn gtk_ordering_get_type() usize;
    pub const getGObjectType = gtk_ordering_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents the orientation of widgets and other objects.
///
/// Typical examples are `Box` or `GesturePan`.
pub const Orientation = enum(c_int) {
    horizontal = 0,
    vertical = 1,
    _,

    extern fn gtk_orientation_get_type() usize;
    pub const getGObjectType = gtk_orientation_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Defines how content overflowing a given area should be handled.
///
/// This is used in `gtk.Widget.setOverflow`. The
/// `gtk.Widget.properties.overflow` property is modeled after the
/// CSS overflow property, but implements it only partially.
pub const Overflow = enum(c_int) {
    visible = 0,
    hidden = 1,
    _,

    extern fn gtk_overflow_get_type() usize;
    pub const getGObjectType = gtk_overflow_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Represents the packing location of a children in its parent.
///
/// See `WindowControls` for example.
pub const PackType = enum(c_int) {
    start = 0,
    end = 1,
    _,

    extern fn gtk_pack_type_get_type() usize;
    pub const getGObjectType = gtk_pack_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The type of a pad action.
pub const PadActionType = enum(c_int) {
    button = 0,
    ring = 1,
    strip = 2,
    dial = 3,
    _,

    extern fn gtk_pad_action_type_get_type() usize;
    pub const getGObjectType = gtk_pad_action_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// See also `gtk.PrintSettings.setOrientation`.
pub const PageOrientation = enum(c_int) {
    portrait = 0,
    landscape = 1,
    reverse_portrait = 2,
    reverse_landscape = 3,
    _,

    extern fn gtk_page_orientation_get_type() usize;
    pub const getGObjectType = gtk_page_orientation_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// See also `gtk.PrintJob.setPageSet`.
pub const PageSet = enum(c_int) {
    all = 0,
    even = 1,
    odd = 2,
    _,

    extern fn gtk_page_set_get_type() usize;
    pub const getGObjectType = gtk_page_set_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the panning direction of a `GesturePan`.
pub const PanDirection = enum(c_int) {
    left = 0,
    right = 1,
    up = 2,
    down = 3,
    _,

    extern fn gtk_pan_direction_get_type() usize;
    pub const getGObjectType = gtk_pan_direction_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines how the size should be computed to achieve the one of the
/// visibility mode for the scrollbars.
pub const PolicyType = enum(c_int) {
    always = 0,
    automatic = 1,
    never = 2,
    external = 3,
    _,

    extern fn gtk_policy_type_get_type() usize;
    pub const getGObjectType = gtk_policy_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes which edge of a widget a certain feature is positioned at.
///
/// For examples, see the tabs of a `Notebook`, or the label
/// of a `Scale`.
pub const PositionType = enum(c_int) {
    left = 0,
    right = 1,
    top = 2,
    bottom = 3,
    _,

    extern fn gtk_position_type_get_type() usize;
    pub const getGObjectType = gtk_position_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// See also `gtk.PrintSettings.setDuplex`.
pub const PrintDuplex = enum(c_int) {
    simplex = 0,
    horizontal = 1,
    vertical = 2,
    _,

    extern fn gtk_print_duplex_get_type() usize;
    pub const getGObjectType = gtk_print_duplex_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Error codes that identify various errors that can occur while
/// using the GTK printing support.
pub const PrintError = enum(c_int) {
    general = 0,
    internal_error = 1,
    nomem = 2,
    invalid_file = 3,
    _,

    /// Registers an error quark for `GtkPrintOperation` if necessary.
    extern fn gtk_print_error_quark() glib.Quark;
    pub const quark = gtk_print_error_quark;

    extern fn gtk_print_error_get_type() usize;
    pub const getGObjectType = gtk_print_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines what action the print operation should perform.
///
/// A parameter of this typs is passed to `gtk.PrintOperation.run`.
pub const PrintOperationAction = enum(c_int) {
    print_dialog = 0,
    print = 1,
    preview = 2,
    @"export" = 3,
    _,

    extern fn gtk_print_operation_action_get_type() usize;
    pub const getGObjectType = gtk_print_operation_action_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The result of a print operation.
///
/// A value of this type is returned by `gtk.PrintOperation.run`.
pub const PrintOperationResult = enum(c_int) {
    @"error" = 0,
    apply = 1,
    cancel = 2,
    in_progress = 3,
    _,

    extern fn gtk_print_operation_result_get_type() usize;
    pub const getGObjectType = gtk_print_operation_result_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// See also `gtk.PrintJob.setPages`
pub const PrintPages = enum(c_int) {
    all = 0,
    current = 1,
    ranges = 2,
    selection = 3,
    _,

    extern fn gtk_print_pages_get_type() usize;
    pub const getGObjectType = gtk_print_pages_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// See also `gtk.PrintSettings.setQuality`.
pub const PrintQuality = enum(c_int) {
    low = 0,
    normal = 1,
    high = 2,
    draft = 3,
    _,

    extern fn gtk_print_quality_get_type() usize;
    pub const getGObjectType = gtk_print_quality_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The status gives a rough indication of the completion of a running
/// print operation.
pub const PrintStatus = enum(c_int) {
    initial = 0,
    preparing = 1,
    generating_data = 2,
    sending_data = 3,
    pending = 4,
    pending_issue = 5,
    printing = 6,
    finished = 7,
    finished_aborted = 8,
    _,

    extern fn gtk_print_status_get_type() usize;
    pub const getGObjectType = gtk_print_status_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes limits of a `EventController` for handling events
/// targeting other widgets.
pub const PropagationLimit = enum(c_int) {
    none = 0,
    same_native = 1,
    _,

    extern fn gtk_propagation_limit_get_type() usize;
    pub const getGObjectType = gtk_propagation_limit_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the stage at which events are fed into a `EventController`.
pub const PropagationPhase = enum(c_int) {
    none = 0,
    capture = 1,
    bubble = 2,
    target = 3,
    _,

    extern fn gtk_propagation_phase_get_type() usize;
    pub const getGObjectType = gtk_propagation_phase_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Error codes for `GtkRecentManager` operations
pub const RecentManagerError = enum(c_int) {
    not_found = 0,
    invalid_uri = 1,
    invalid_encoding = 2,
    not_registered = 3,
    read = 4,
    write = 5,
    unknown = 6,
    _,

    /// Registers an error quark for `RecentManager` errors.
    extern fn gtk_recent_manager_error_quark() glib.Quark;
    pub const quark = gtk_recent_manager_error_quark;

    extern fn gtk_recent_manager_error_get_type() usize;
    pub const getGObjectType = gtk_recent_manager_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Values for the `gtk.Settings.properties.gtk_interface_reduced_motion`
/// and `gtk.CssProvider.properties.prefers_reduced_motion` properties
/// that indicates the preferred level of motion animations.
///
/// This information can be used inside CSS via media queries.
pub const ReducedMotion = enum(c_int) {
    no_preference = 0,
    reduce = 1,
    _,

    extern fn gtk_reduced_motion_get_type() usize;
    pub const getGObjectType = gtk_reduced_motion_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Predefined values for use as response ids in `gtk.Dialog.addButton`.
///
/// All predefined values are negative; GTK leaves values of 0 or greater for
/// application-defined response ids.
pub const ResponseType = enum(c_int) {
    none = -1,
    reject = -2,
    accept = -3,
    delete_event = -4,
    ok = -5,
    cancel = -6,
    close = -7,
    yes = -8,
    no = -9,
    apply = -10,
    help = -11,
    _,

    extern fn gtk_response_type_get_type() usize;
    pub const getGObjectType = gtk_response_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// These enumeration values describe the possible transitions
/// when the child of a `GtkRevealer` widget is shown or hidden.
pub const RevealerTransitionType = enum(c_int) {
    none = 0,
    crossfade = 1,
    slide_right = 2,
    slide_left = 3,
    slide_up = 4,
    slide_down = 5,
    swing_right = 6,
    swing_left = 7,
    swing_up = 8,
    swing_down = 9,
    fade_slide_right = 10,
    fade_slide_left = 11,
    fade_slide_up = 12,
    fade_slide_down = 13,
    _,

    extern fn gtk_revealer_transition_type_get_type() usize;
    pub const getGObjectType = gtk_revealer_transition_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Passed as argument to various keybinding signals.
pub const ScrollStep = enum(c_int) {
    steps = 0,
    pages = 1,
    ends = 2,
    horizontal_steps = 3,
    horizontal_pages = 4,
    horizontal_ends = 5,
    _,

    extern fn gtk_scroll_step_get_type() usize;
    pub const getGObjectType = gtk_scroll_step_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Scrolling types.
pub const ScrollType = enum(c_int) {
    none = 0,
    jump = 1,
    step_backward = 2,
    step_forward = 3,
    page_backward = 4,
    page_forward = 5,
    step_up = 6,
    step_down = 7,
    page_up = 8,
    page_down = 9,
    step_left = 10,
    step_right = 11,
    page_left = 12,
    page_right = 13,
    start = 14,
    end = 15,
    _,

    extern fn gtk_scroll_type_get_type() usize;
    pub const getGObjectType = gtk_scroll_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Defines the policy to be used in a scrollable widget when updating
/// the scrolled window adjustments in a given orientation.
pub const ScrollablePolicy = enum(c_int) {
    minimum = 0,
    natural = 1,
    _,

    extern fn gtk_scrollable_policy_get_type() usize;
    pub const getGObjectType = gtk_scrollable_policy_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to control what selections users are allowed to make.
pub const SelectionMode = enum(c_int) {
    none = 0,
    single = 1,
    browse = 2,
    multiple = 3,
    _,

    extern fn gtk_selection_mode_get_type() usize;
    pub const getGObjectType = gtk_selection_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines how GTK handles the sensitivity of various controls,
/// such as combo box buttons.
pub const SensitivityType = enum(c_int) {
    auto = 0,
    on = 1,
    off = 2,
    _,

    extern fn gtk_sensitivity_type_get_type() usize;
    pub const getGObjectType = gtk_sensitivity_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes where `Shortcut`s added to a
/// `ShortcutController` get handled.
pub const ShortcutScope = enum(c_int) {
    local = 0,
    managed = 1,
    global = 2,
    _,

    extern fn gtk_shortcut_scope_get_type() usize;
    pub const getGObjectType = gtk_shortcut_scope_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// GtkShortcutType specifies the kind of shortcut that is being described.
///
/// More values may be added to this enumeration over time.
pub const ShortcutType = enum(c_int) {
    accelerator = 0,
    gesture_pinch = 1,
    gesture_stretch = 2,
    gesture_rotate_clockwise = 3,
    gesture_rotate_counterclockwise = 4,
    gesture_two_finger_swipe_left = 5,
    gesture_two_finger_swipe_right = 6,
    gesture = 7,
    gesture_swipe_left = 8,
    gesture_swipe_right = 9,
    _,

    extern fn gtk_shortcut_type_get_type() usize;
    pub const getGObjectType = gtk_shortcut_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The mode of the size group determines the directions in which the size
/// group affects the requested sizes of its component widgets.
pub const SizeGroupMode = enum(c_int) {
    none = 0,
    horizontal = 1,
    vertical = 2,
    both = 3,
    _,

    extern fn gtk_size_group_mode_get_type() usize;
    pub const getGObjectType = gtk_size_group_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies a preference for height-for-width or
/// width-for-height geometry management.
pub const SizeRequestMode = enum(c_int) {
    height_for_width = 0,
    width_for_height = 1,
    constant_size = 2,
    _,

    extern fn gtk_size_request_mode_get_type() usize;
    pub const getGObjectType = gtk_size_request_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines the direction of a sort.
pub const SortType = enum(c_int) {
    ascending = 0,
    descending = 1,
    _,

    extern fn gtk_sort_type_get_type() usize;
    pub const getGObjectType = gtk_sort_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes changes in a sorter in more detail and allows users
/// to optimize resorting.
pub const SorterChange = enum(c_int) {
    different = 0,
    inverted = 1,
    less_strict = 2,
    more_strict = 3,
    _,

    extern fn gtk_sorter_change_get_type() usize;
    pub const getGObjectType = gtk_sorter_change_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the type of order that a `GtkSorter` may produce.
pub const SorterOrder = enum(c_int) {
    partial = 0,
    none = 1,
    total = 2,
    _,

    extern fn gtk_sorter_order_get_type() usize;
    pub const getGObjectType = gtk_sorter_order_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines whether the spin button displays values outside the adjustment
/// bounds.
///
/// See `gtk.SpinButton.setUpdatePolicy`.
pub const SpinButtonUpdatePolicy = enum(c_int) {
    always = 0,
    if_valid = 1,
    _,

    extern fn gtk_spin_button_update_policy_get_type() usize;
    pub const getGObjectType = gtk_spin_button_update_policy_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The values of the GtkSpinType enumeration are used to specify the
/// change to make in `gtk.SpinButton.spin`.
pub const SpinType = enum(c_int) {
    step_forward = 0,
    step_backward = 1,
    page_forward = 2,
    page_backward = 3,
    home = 4,
    end = 5,
    user_defined = 6,
    _,

    extern fn gtk_spin_type_get_type() usize;
    pub const getGObjectType = gtk_spin_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Possible transitions between pages in a `GtkStack` widget.
///
/// New values may be added to this enumeration over time.
pub const StackTransitionType = enum(c_int) {
    none = 0,
    crossfade = 1,
    slide_right = 2,
    slide_left = 3,
    slide_up = 4,
    slide_down = 5,
    slide_left_right = 6,
    slide_up_down = 7,
    over_up = 8,
    over_down = 9,
    over_left = 10,
    over_right = 11,
    under_up = 12,
    under_down = 13,
    under_left = 14,
    under_right = 15,
    over_up_down = 16,
    over_down_up = 17,
    over_left_right = 18,
    over_right_left = 19,
    rotate_left = 20,
    rotate_right = 21,
    rotate_left_right = 22,
    _,

    extern fn gtk_stack_transition_type_get_type() usize;
    pub const getGObjectType = gtk_stack_transition_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies how search strings are matched inside text.
pub const StringFilterMatchMode = enum(c_int) {
    exact = 0,
    substring = 1,
    prefix = 2,
    _,

    extern fn gtk_string_filter_match_mode_get_type() usize;
    pub const getGObjectType = gtk_string_filter_match_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Error codes in the `GTK_SVG_ERROR` domain for errors
/// that happen during parsing or rendering of SVG.
pub const SvgError = enum(c_int) {
    invalid_syntax = 0,
    invalid_element = 1,
    invalid_attribute = 2,
    missing_attribute = 3,
    invalid_reference = 4,
    failed_update = 5,
    failed_rendering = 6,
    ignored_element = 7,
    limits_exceeded = 8,
    not_implemented = 9,
    _,

    /// Returns context information about what XML attribute
    /// the parsing error occurred in.
    extern fn gtk_svg_error_get_attribute(p_error: *const glib.Error) ?[*:0]const u8;
    pub const getAttribute = gtk_svg_error_get_attribute;

    /// Returns context information about what XML element
    /// the parsing error occurred in.
    extern fn gtk_svg_error_get_element(p_error: *const glib.Error) ?[*:0]const u8;
    pub const getElement = gtk_svg_error_get_element;

    /// Returns context information about the end position
    /// in the document where the parsing error occurred.
    extern fn gtk_svg_error_get_end(p_error: *const glib.Error) ?*const gtk.SvgLocation;
    pub const getEnd = gtk_svg_error_get_end;

    /// Returns context information about the start position
    /// in the document where the parsing error occurred.
    extern fn gtk_svg_error_get_start(p_error: *const glib.Error) ?*const gtk.SvgLocation;
    pub const getStart = gtk_svg_error_get_start;

    extern fn gtk_svg_error_quark() glib.Quark;
    pub const quark = gtk_svg_error_quark;

    extern fn gtk_svg_error_get_type() usize;
    pub const getGObjectType = gtk_svg_error_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The indexes of colors passed to symbolic color rendering, such as
/// `gtk.SymbolicPaintable.virtual_methods.snapshot_symbolic`.
///
/// More values may be added over time.
pub const SymbolicColor = enum(c_int) {
    foreground = 0,
    @"error" = 1,
    warning = 2,
    success = 3,
    accent = 4,
    _,

    extern fn gtk_symbolic_color_get_type() usize;
    pub const getGObjectType = gtk_symbolic_color_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Values that can be passed to the `gtk.Widget.virtual_methods.system_setting_changed`
/// vfunc.
///
/// The values indicate which system setting has changed.
/// Widgets may need to drop caches, or react otherwise.
///
/// Most of the values correspond to `Settings` properties.
///
/// More values may be added over time.
pub const SystemSetting = enum(c_int) {
    dpi = 0,
    font_name = 1,
    font_config = 2,
    display = 3,
    icon_theme = 4,
    _,

    extern fn gtk_system_setting_get_type() usize;
    pub const getGObjectType = gtk_system_setting_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Reading directions for text.
pub const TextDirection = enum(c_int) {
    none = 0,
    ltr = 1,
    rtl = 2,
    _,

    extern fn gtk_text_direction_get_type() usize;
    pub const getGObjectType = gtk_text_direction_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Granularity types that extend the text selection. Use the
/// `GtkTextView::extend-selection` signal to customize the selection.
pub const TextExtendSelection = enum(c_int) {
    word = 0,
    line = 1,
    _,

    extern fn gtk_text_extend_selection_get_type() usize;
    pub const getGObjectType = gtk_text_extend_selection_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to reference the layers of `GtkTextView` for the purpose of customized
/// drawing with the ::snapshot_layer vfunc.
pub const TextViewLayer = enum(c_int) {
    below_text = 0,
    above_text = 1,
    _,

    extern fn gtk_text_view_layer_get_type() usize;
    pub const getGObjectType = gtk_text_view_layer_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to reference the parts of `GtkTextView`.
pub const TextWindowType = enum(c_int) {
    widget = 1,
    text = 2,
    left = 3,
    right = 4,
    top = 5,
    bottom = 6,
    _,

    extern fn gtk_text_window_type_get_type() usize;
    pub const getGObjectType = gtk_text_window_type_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The sizing method the column uses to determine its width.  Please note
/// that `GTK_TREE_VIEW_COLUMN_AUTOSIZE` are inefficient for large views, and
/// can make columns appear choppy.
pub const TreeViewColumnSizing = enum(c_int) {
    grow_only = 0,
    autosize = 1,
    fixed = 2,
    _,

    extern fn gtk_tree_view_column_sizing_get_type() usize;
    pub const getGObjectType = gtk_tree_view_column_sizing_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// An enum for determining where a dropped row goes.
pub const TreeViewDropPosition = enum(c_int) {
    before = 0,
    after = 1,
    into_or_before = 2,
    into_or_after = 3,
    _,

    extern fn gtk_tree_view_drop_position_get_type() usize;
    pub const getGObjectType = gtk_tree_view_drop_position_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to indicate which grid lines to draw in a tree view.
pub const TreeViewGridLines = enum(c_int) {
    none = 0,
    horizontal = 1,
    vertical = 2,
    both = 3,
    _,

    extern fn gtk_tree_view_grid_lines_get_type() usize;
    pub const getGObjectType = gtk_tree_view_grid_lines_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// See also `gtk.PrintSettings.setPaperWidth`.
pub const Unit = enum(c_int) {
    none = 0,
    points = 1,
    inch = 2,
    mm = 3,
    _,

    extern fn gtk_unit_get_type() usize;
    pub const getGObjectType = gtk_unit_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Determines which point or edge of a window is meant to remain fixed
/// when a window changes size.
pub const WindowGravity = enum(c_int) {
    top_left = 0,
    top = 1,
    top_right = 2,
    left = 3,
    center = 4,
    right = 5,
    bottom_left = 6,
    bottom = 7,
    bottom_right = 8,
    top_start = 9,
    top_end = 10,
    start = 11,
    end = 12,
    bottom_start = 13,
    bottom_end = 14,
    _,

    extern fn gtk_window_gravity_get_type() usize;
    pub const getGObjectType = gtk_window_gravity_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes a type of line wrapping.
pub const WrapMode = enum(c_int) {
    none = 0,
    char = 1,
    word = 2,
    word_char = 3,
    _,

    extern fn gtk_wrap_mode_get_type() usize;
    pub const getGObjectType = gtk_wrap_mode_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Types of user actions that may be blocked by `GtkApplication`.
///
/// See `gtk.Application.inhibit`.
pub const ApplicationInhibitFlags = packed struct(c_uint) {
    logout: bool = false,
    @"switch": bool = false,
    @"suspend": bool = false,
    idle: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_logout: ApplicationInhibitFlags = @bitCast(@as(c_uint, 1));
    pub const flags_switch: ApplicationInhibitFlags = @bitCast(@as(c_uint, 2));
    pub const flags_suspend: ApplicationInhibitFlags = @bitCast(@as(c_uint, 4));
    pub const flags_idle: ApplicationInhibitFlags = @bitCast(@as(c_uint, 8));
    extern fn gtk_application_inhibit_flags_get_type() usize;
    pub const getGObjectType = gtk_application_inhibit_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// The list of flags that can be passed to `gtk.Builder.createClosure`.
///
/// New values may be added in the future for new features, so external
/// implementations of `gtk.BuilderScope` should test the flags
/// for unknown values and raise a `GTK_BUILDER_ERROR_INVALID_ATTRIBUTE` error
/// when they encounter one.
pub const BuilderClosureFlags = packed struct(c_uint) {
    swapped: bool = false,
    _padding1: bool = false,
    _padding2: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_swapped: BuilderClosureFlags = @bitCast(@as(c_uint, 1));
    extern fn gtk_builder_closure_flags_get_type() usize;
    pub const getGObjectType = gtk_builder_closure_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Tells how a cell is to be rendered.
pub const CellRendererState = packed struct(c_uint) {
    selected: bool = false,
    prelit: bool = false,
    insensitive: bool = false,
    sorted: bool = false,
    focused: bool = false,
    expandable: bool = false,
    expanded: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_selected: CellRendererState = @bitCast(@as(c_uint, 1));
    pub const flags_prelit: CellRendererState = @bitCast(@as(c_uint, 2));
    pub const flags_insensitive: CellRendererState = @bitCast(@as(c_uint, 4));
    pub const flags_sorted: CellRendererState = @bitCast(@as(c_uint, 8));
    pub const flags_focused: CellRendererState = @bitCast(@as(c_uint, 16));
    pub const flags_expandable: CellRendererState = @bitCast(@as(c_uint, 32));
    pub const flags_expanded: CellRendererState = @bitCast(@as(c_uint, 64));
    extern fn gtk_cell_renderer_state_get_type() usize;
    pub const getGObjectType = gtk_cell_renderer_state_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags to use with `gtk.setDebugFlags`.
///
/// Settings these flags causes GTK to print out different
/// types of debugging information. Some of these flags are
/// only available when GTK has been configured with `-Ddebug=true`.
pub const DebugFlags = packed struct(c_uint) {
    text: bool = false,
    tree: bool = false,
    keybindings: bool = false,
    modules: bool = false,
    geometry: bool = false,
    icontheme: bool = false,
    printing: bool = false,
    builder_trace: bool = false,
    size_request: bool = false,
    no_css_cache: bool = false,
    interactive: bool = false,
    touchscreen: bool = false,
    actions: bool = false,
    layout: bool = false,
    snapshot: bool = false,
    constraints: bool = false,
    builder_objects: bool = false,
    a11y: bool = false,
    iconfallback: bool = false,
    invert_text_dir: bool = false,
    css: bool = false,
    builder: bool = false,
    session: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_text: DebugFlags = @bitCast(@as(c_uint, 1));
    pub const flags_tree: DebugFlags = @bitCast(@as(c_uint, 2));
    pub const flags_keybindings: DebugFlags = @bitCast(@as(c_uint, 4));
    pub const flags_modules: DebugFlags = @bitCast(@as(c_uint, 8));
    pub const flags_geometry: DebugFlags = @bitCast(@as(c_uint, 16));
    pub const flags_icontheme: DebugFlags = @bitCast(@as(c_uint, 32));
    pub const flags_printing: DebugFlags = @bitCast(@as(c_uint, 64));
    pub const flags_builder_trace: DebugFlags = @bitCast(@as(c_uint, 128));
    pub const flags_size_request: DebugFlags = @bitCast(@as(c_uint, 256));
    pub const flags_no_css_cache: DebugFlags = @bitCast(@as(c_uint, 512));
    pub const flags_interactive: DebugFlags = @bitCast(@as(c_uint, 1024));
    pub const flags_touchscreen: DebugFlags = @bitCast(@as(c_uint, 2048));
    pub const flags_actions: DebugFlags = @bitCast(@as(c_uint, 4096));
    pub const flags_layout: DebugFlags = @bitCast(@as(c_uint, 8192));
    pub const flags_snapshot: DebugFlags = @bitCast(@as(c_uint, 16384));
    pub const flags_constraints: DebugFlags = @bitCast(@as(c_uint, 32768));
    pub const flags_builder_objects: DebugFlags = @bitCast(@as(c_uint, 65536));
    pub const flags_a11y: DebugFlags = @bitCast(@as(c_uint, 131072));
    pub const flags_iconfallback: DebugFlags = @bitCast(@as(c_uint, 262144));
    pub const flags_invert_text_dir: DebugFlags = @bitCast(@as(c_uint, 524288));
    pub const flags_css: DebugFlags = @bitCast(@as(c_uint, 1048576));
    pub const flags_builder: DebugFlags = @bitCast(@as(c_uint, 2097152));
    pub const flags_session: DebugFlags = @bitCast(@as(c_uint, 4194304));
    extern fn gtk_debug_flags_get_type() usize;
    pub const getGObjectType = gtk_debug_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags used to influence dialog construction.
pub const DialogFlags = packed struct(c_uint) {
    modal: bool = false,
    destroy_with_parent: bool = false,
    use_header_bar: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_modal: DialogFlags = @bitCast(@as(c_uint, 1));
    pub const flags_destroy_with_parent: DialogFlags = @bitCast(@as(c_uint, 2));
    pub const flags_use_header_bar: DialogFlags = @bitCast(@as(c_uint, 4));
    extern fn gtk_dialog_flags_get_type() usize;
    pub const getGObjectType = gtk_dialog_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes the behavior of a `GtkEventControllerScroll`.
pub const EventControllerScrollFlags = packed struct(c_uint) {
    vertical: bool = false,
    horizontal: bool = false,
    discrete: bool = false,
    kinetic: bool = false,
    physical_direction: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_none: EventControllerScrollFlags = @bitCast(@as(c_uint, 0));
    pub const flags_vertical: EventControllerScrollFlags = @bitCast(@as(c_uint, 1));
    pub const flags_horizontal: EventControllerScrollFlags = @bitCast(@as(c_uint, 2));
    pub const flags_discrete: EventControllerScrollFlags = @bitCast(@as(c_uint, 4));
    pub const flags_kinetic: EventControllerScrollFlags = @bitCast(@as(c_uint, 8));
    pub const flags_physical_direction: EventControllerScrollFlags = @bitCast(@as(c_uint, 16));
    pub const flags_both_axes: EventControllerScrollFlags = @bitCast(@as(c_uint, 3));
    extern fn gtk_event_controller_scroll_flags_get_type() usize;
    pub const getGObjectType = gtk_event_controller_scroll_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies the granularity of font selection
/// that is desired in a `GtkFontChooser`.
///
/// This enumeration may be extended in the future; applications should
/// ignore unknown values.
pub const FontChooserLevel = packed struct(c_uint) {
    style: bool = false,
    size: bool = false,
    variations: bool = false,
    features: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_family: FontChooserLevel = @bitCast(@as(c_uint, 0));
    pub const flags_style: FontChooserLevel = @bitCast(@as(c_uint, 1));
    pub const flags_size: FontChooserLevel = @bitCast(@as(c_uint, 2));
    pub const flags_variations: FontChooserLevel = @bitCast(@as(c_uint, 4));
    pub const flags_features: FontChooserLevel = @bitCast(@as(c_uint, 8));
    extern fn gtk_font_chooser_level_get_type() usize;
    pub const getGObjectType = gtk_font_chooser_level_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Used to specify options for `gtk.IconTheme.lookupIcon`.
pub const IconLookupFlags = packed struct(c_uint) {
    force_regular: bool = false,
    force_symbolic: bool = false,
    preload: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_none: IconLookupFlags = @bitCast(@as(c_uint, 0));
    pub const flags_force_regular: IconLookupFlags = @bitCast(@as(c_uint, 1));
    pub const flags_force_symbolic: IconLookupFlags = @bitCast(@as(c_uint, 2));
    pub const flags_preload: IconLookupFlags = @bitCast(@as(c_uint, 4));
    extern fn gtk_icon_lookup_flags_get_type() usize;
    pub const getGObjectType = gtk_icon_lookup_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes hints that might be taken into account by input methods
/// or applications.
///
/// Note that input methods may already tailor their behaviour according
/// to the `InputPurpose` of the entry.
///
/// Some common sense is expected when using these flags - mixing
/// `GTK_INPUT_HINT_LOWERCASE` with any of the uppercase hints makes no sense.
///
/// This enumeration may be extended in the future; input methods should
/// ignore unknown values.
pub const InputHints = packed struct(c_uint) {
    spellcheck: bool = false,
    no_spellcheck: bool = false,
    word_completion: bool = false,
    lowercase: bool = false,
    uppercase_chars: bool = false,
    uppercase_words: bool = false,
    uppercase_sentences: bool = false,
    inhibit_osk: bool = false,
    vertical_writing: bool = false,
    emoji: bool = false,
    no_emoji: bool = false,
    private: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_none: InputHints = @bitCast(@as(c_uint, 0));
    pub const flags_spellcheck: InputHints = @bitCast(@as(c_uint, 1));
    pub const flags_no_spellcheck: InputHints = @bitCast(@as(c_uint, 2));
    pub const flags_word_completion: InputHints = @bitCast(@as(c_uint, 4));
    pub const flags_lowercase: InputHints = @bitCast(@as(c_uint, 8));
    pub const flags_uppercase_chars: InputHints = @bitCast(@as(c_uint, 16));
    pub const flags_uppercase_words: InputHints = @bitCast(@as(c_uint, 32));
    pub const flags_uppercase_sentences: InputHints = @bitCast(@as(c_uint, 64));
    pub const flags_inhibit_osk: InputHints = @bitCast(@as(c_uint, 128));
    pub const flags_vertical_writing: InputHints = @bitCast(@as(c_uint, 256));
    pub const flags_emoji: InputHints = @bitCast(@as(c_uint, 512));
    pub const flags_no_emoji: InputHints = @bitCast(@as(c_uint, 1024));
    pub const flags_private: InputHints = @bitCast(@as(c_uint, 2048));
    extern fn gtk_input_hints_get_type() usize;
    pub const getGObjectType = gtk_input_hints_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// List of actions to perform when scrolling to items in
/// a list widget.
pub const ListScrollFlags = packed struct(c_uint) {
    focus: bool = false,
    select: bool = false,
    _padding2: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_none: ListScrollFlags = @bitCast(@as(c_uint, 0));
    pub const flags_focus: ListScrollFlags = @bitCast(@as(c_uint, 1));
    pub const flags_select: ListScrollFlags = @bitCast(@as(c_uint, 2));
    extern fn gtk_list_scroll_flags_get_type() usize;
    pub const getGObjectType = gtk_list_scroll_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags that influence the behavior of `Widget.pick`.
pub const PickFlags = packed struct(c_uint) {
    insensitive: bool = false,
    non_targetable: bool = false,
    _padding2: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_default: PickFlags = @bitCast(@as(c_uint, 0));
    pub const flags_insensitive: PickFlags = @bitCast(@as(c_uint, 1));
    pub const flags_non_targetable: PickFlags = @bitCast(@as(c_uint, 2));
    extern fn gtk_pick_flags_get_type() usize;
    pub const getGObjectType = gtk_pick_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags that affect how `gtk.PopoverMenu` widgets built from
/// a `gio.MenuModel` are created and displayed.
pub const PopoverMenuFlags = packed struct(c_uint) {
    nested: bool = false,
    _padding1: bool = false,
    _padding2: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_sliding: PopoverMenuFlags = @bitCast(@as(c_uint, 0));
    pub const flags_nested: PopoverMenuFlags = @bitCast(@as(c_uint, 1));
    extern fn gtk_popover_menu_flags_get_type() usize;
    pub const getGObjectType = gtk_popover_menu_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Specifies which features the print dialog should offer.
///
/// If neither `GTK_PRINT_CAPABILITY_GENERATE_PDF` nor
/// `GTK_PRINT_CAPABILITY_GENERATE_PS` is specified, GTK assumes that all
/// formats are supported.
pub const PrintCapabilities = packed struct(c_uint) {
    page_set: bool = false,
    copies: bool = false,
    collate: bool = false,
    reverse: bool = false,
    scale: bool = false,
    generate_pdf: bool = false,
    generate_ps: bool = false,
    preview: bool = false,
    number_up: bool = false,
    number_up_layout: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_page_set: PrintCapabilities = @bitCast(@as(c_uint, 1));
    pub const flags_copies: PrintCapabilities = @bitCast(@as(c_uint, 2));
    pub const flags_collate: PrintCapabilities = @bitCast(@as(c_uint, 4));
    pub const flags_reverse: PrintCapabilities = @bitCast(@as(c_uint, 8));
    pub const flags_scale: PrintCapabilities = @bitCast(@as(c_uint, 16));
    pub const flags_generate_pdf: PrintCapabilities = @bitCast(@as(c_uint, 32));
    pub const flags_generate_ps: PrintCapabilities = @bitCast(@as(c_uint, 64));
    pub const flags_preview: PrintCapabilities = @bitCast(@as(c_uint, 128));
    pub const flags_number_up: PrintCapabilities = @bitCast(@as(c_uint, 256));
    pub const flags_number_up_layout: PrintCapabilities = @bitCast(@as(c_uint, 512));
    extern fn gtk_print_capabilities_get_type() usize;
    pub const getGObjectType = gtk_print_capabilities_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags that can be passed to action activation.
///
/// More flags may be added in the future.
pub const ShortcutActionFlags = packed struct(c_uint) {
    exclusive: bool = false,
    _padding1: bool = false,
    _padding2: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_exclusive: ShortcutActionFlags = @bitCast(@as(c_uint, 1));
    extern fn gtk_shortcut_action_flags_get_type() usize;
    pub const getGObjectType = gtk_shortcut_action_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Describes a widget state.
///
/// Widget states are used to match the widget against CSS pseudo-classes.
/// Note that GTK extends the regular CSS classes and sometimes uses
/// different names.
pub const StateFlags = packed struct(c_uint) {
    active: bool = false,
    prelight: bool = false,
    selected: bool = false,
    insensitive: bool = false,
    inconsistent: bool = false,
    focused: bool = false,
    backdrop: bool = false,
    dir_ltr: bool = false,
    dir_rtl: bool = false,
    link: bool = false,
    visited: bool = false,
    checked: bool = false,
    drop_active: bool = false,
    focus_visible: bool = false,
    focus_within: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_normal: StateFlags = @bitCast(@as(c_uint, 0));
    pub const flags_active: StateFlags = @bitCast(@as(c_uint, 1));
    pub const flags_prelight: StateFlags = @bitCast(@as(c_uint, 2));
    pub const flags_selected: StateFlags = @bitCast(@as(c_uint, 4));
    pub const flags_insensitive: StateFlags = @bitCast(@as(c_uint, 8));
    pub const flags_inconsistent: StateFlags = @bitCast(@as(c_uint, 16));
    pub const flags_focused: StateFlags = @bitCast(@as(c_uint, 32));
    pub const flags_backdrop: StateFlags = @bitCast(@as(c_uint, 64));
    pub const flags_dir_ltr: StateFlags = @bitCast(@as(c_uint, 128));
    pub const flags_dir_rtl: StateFlags = @bitCast(@as(c_uint, 256));
    pub const flags_link: StateFlags = @bitCast(@as(c_uint, 512));
    pub const flags_visited: StateFlags = @bitCast(@as(c_uint, 1024));
    pub const flags_checked: StateFlags = @bitCast(@as(c_uint, 2048));
    pub const flags_drop_active: StateFlags = @bitCast(@as(c_uint, 4096));
    pub const flags_focus_visible: StateFlags = @bitCast(@as(c_uint, 8192));
    pub const flags_focus_within: StateFlags = @bitCast(@as(c_uint, 16384));
    extern fn gtk_state_flags_get_type() usize;
    pub const getGObjectType = gtk_state_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags that modify the behavior of `gtk.StyleContext.toString`.
///
/// New values may be added to this enumeration.
pub const StyleContextPrintFlags = packed struct(c_uint) {
    recurse: bool = false,
    show_style: bool = false,
    show_change: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_none: StyleContextPrintFlags = @bitCast(@as(c_uint, 0));
    pub const flags_recurse: StyleContextPrintFlags = @bitCast(@as(c_uint, 1));
    pub const flags_show_style: StyleContextPrintFlags = @bitCast(@as(c_uint, 2));
    pub const flags_show_change: StyleContextPrintFlags = @bitCast(@as(c_uint, 4));
    extern fn gtk_style_context_print_flags_get_type() usize;
    pub const getGObjectType = gtk_style_context_print_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Features of the SVG renderer that can be enabled or disabled.
///
/// By default, all features except `GTK_SVG_TRADITIONAL_SYMBOLIC`
/// are enabled.
///
/// New values may be added in the future.
pub const SvgFeatures = packed struct(c_uint) {
    animations: bool = false,
    system_resources: bool = false,
    external_resources: bool = false,
    extensions: bool = false,
    traditional_symbolic: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_animations: SvgFeatures = @bitCast(@as(c_uint, 1));
    pub const flags_system_resources: SvgFeatures = @bitCast(@as(c_uint, 2));
    pub const flags_external_resources: SvgFeatures = @bitCast(@as(c_uint, 4));
    pub const flags_extensions: SvgFeatures = @bitCast(@as(c_uint, 8));
    pub const flags_traditional_symbolic: SvgFeatures = @bitCast(@as(c_uint, 16));
    extern fn gtk_svg_features_get_type() usize;
    pub const getGObjectType = gtk_svg_features_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Values for `gtk.TextBufferCommitNotify` to denote the
/// point of the notification.
pub const TextBufferNotifyFlags = packed struct(c_uint) {
    before_insert: bool = false,
    after_insert: bool = false,
    before_delete: bool = false,
    after_delete: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_before_insert: TextBufferNotifyFlags = @bitCast(@as(c_uint, 1));
    pub const flags_after_insert: TextBufferNotifyFlags = @bitCast(@as(c_uint, 2));
    pub const flags_before_delete: TextBufferNotifyFlags = @bitCast(@as(c_uint, 4));
    pub const flags_after_delete: TextBufferNotifyFlags = @bitCast(@as(c_uint, 8));
    extern fn gtk_text_buffer_notify_flags_get_type() usize;
    pub const getGObjectType = gtk_text_buffer_notify_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Flags affecting how a search is done.
///
/// If neither `GTK_TEXT_SEARCH_VISIBLE_ONLY` nor `GTK_TEXT_SEARCH_TEXT_ONLY`
/// are enabled, the match must be exact; the special 0xFFFC character will
/// match embedded paintables or child widgets.
pub const TextSearchFlags = packed struct(c_uint) {
    visible_only: bool = false,
    text_only: bool = false,
    case_insensitive: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_visible_only: TextSearchFlags = @bitCast(@as(c_uint, 1));
    pub const flags_text_only: TextSearchFlags = @bitCast(@as(c_uint, 2));
    pub const flags_case_insensitive: TextSearchFlags = @bitCast(@as(c_uint, 4));
    extern fn gtk_text_search_flags_get_type() usize;
    pub const getGObjectType = gtk_text_search_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// These flags indicate various properties of a `GtkTreeModel`.
///
/// They are returned by `gtk.TreeModel.getFlags`, and must be
/// static for the lifetime of the object. A more complete description
/// of `GTK_TREE_MODEL_ITERS_PERSIST` can be found in the overview of
/// this section.
pub const TreeModelFlags = packed struct(c_uint) {
    iters_persist: bool = false,
    list_only: bool = false,
    _padding2: bool = false,
    _padding3: bool = false,
    _padding4: bool = false,
    _padding5: bool = false,
    _padding6: bool = false,
    _padding7: bool = false,
    _padding8: bool = false,
    _padding9: bool = false,
    _padding10: bool = false,
    _padding11: bool = false,
    _padding12: bool = false,
    _padding13: bool = false,
    _padding14: bool = false,
    _padding15: bool = false,
    _padding16: bool = false,
    _padding17: bool = false,
    _padding18: bool = false,
    _padding19: bool = false,
    _padding20: bool = false,
    _padding21: bool = false,
    _padding22: bool = false,
    _padding23: bool = false,
    _padding24: bool = false,
    _padding25: bool = false,
    _padding26: bool = false,
    _padding27: bool = false,
    _padding28: bool = false,
    _padding29: bool = false,
    _padding30: bool = false,
    _padding31: bool = false,

    pub const flags_iters_persist: TreeModelFlags = @bitCast(@as(c_uint, 1));
    pub const flags_list_only: TreeModelFlags = @bitCast(@as(c_uint, 2));
    extern fn gtk_tree_model_flags_get_type() usize;
    pub const getGObjectType = gtk_tree_model_flags_get_type;

    test {
        @setEvalBranchQuota(100_000);
        std.testing.refAllDecls(@This());
    }
};

/// Generates an accessible description of an accelerator.
///
/// This function is similar to `gtk.acceleratorGetLabel` but it is meant
/// for accessibility layers labels rather than user-facing labels. The output
/// of this function is fit for `gtk.@"AccessibleProperty.KEY_SHORTCUTS"`.
///
/// For more information, see the [WAI-ARIA](https://www.w3.org/TR/wai-aria/`aria`-keyshortcuts)
/// reference.
extern fn gtk_accelerator_get_accessible_label(p_accelerator_key: c_uint, p_accelerator_mods: gdk.ModifierType) [*:0]u8;
pub const acceleratorGetAccessibleLabel = gtk_accelerator_get_accessible_label;

/// Gets the modifier mask.
///
/// The modifier mask determines which modifiers are considered significant
/// for keyboard accelerators. This includes all keyboard modifiers except
/// for `GDK_LOCK_MASK`.
extern fn gtk_accelerator_get_default_mod_mask() gdk.ModifierType;
pub const acceleratorGetDefaultModMask = gtk_accelerator_get_default_mod_mask;

/// Converts an accelerator keyval and modifier mask into a string
/// which can be used to represent the accelerator to the user.
extern fn gtk_accelerator_get_label(p_accelerator_key: c_uint, p_accelerator_mods: gdk.ModifierType) [*:0]u8;
pub const acceleratorGetLabel = gtk_accelerator_get_label;

/// Converts an accelerator keyval and modifier mask
/// into a string that can be displayed to the user.
///
/// The string may be translated.
///
/// This function is similar to `gtk.acceleratorGetLabel`,
/// but handling keycodes. This is only useful for system-level
/// components, applications should use `gtk.acceleratorGetLabel`
/// instead.
extern fn gtk_accelerator_get_label_with_keycode(p_display: ?*gdk.Display, p_accelerator_key: c_uint, p_keycode: c_uint, p_accelerator_mods: gdk.ModifierType) [*:0]u8;
pub const acceleratorGetLabelWithKeycode = gtk_accelerator_get_label_with_keycode;

/// Converts an accelerator keyval and modifier mask into a string
/// that can be parsed by `gtk.acceleratorParse`.
///
/// For example, if you pass in `GDK_KEY_q` and `GDK_CONTROL_MASK`,
/// this function returns `<Control>q`.
///
/// If you need to display accelerators in the user interface,
/// see `gtk.acceleratorGetLabel`.
extern fn gtk_accelerator_name(p_accelerator_key: c_uint, p_accelerator_mods: gdk.ModifierType) [*:0]u8;
pub const acceleratorName = gtk_accelerator_name;

/// Converts an accelerator keyval and modifier mask
/// into a string that can be parsed by `gtk.acceleratorParseWithKeycode`.
///
/// This is similar to `gtk.acceleratorName` but handling keycodes.
/// This is only useful for system-level components, applications
/// should use `gtk.acceleratorName` instead.
extern fn gtk_accelerator_name_with_keycode(p_display: ?*gdk.Display, p_accelerator_key: c_uint, p_keycode: c_uint, p_accelerator_mods: gdk.ModifierType) [*:0]u8;
pub const acceleratorNameWithKeycode = gtk_accelerator_name_with_keycode;

/// Parses a string representing an accelerator.
///
/// The format looks like “`<Control>a`” or “`<Shift><Alt>F1`”.
///
/// The parser is fairly liberal and allows lower or upper case, and also
/// abbreviations such as “`<Ctl>`” and “`<Ctrl>`”.
///
/// Key names are parsed using `gdk.keyvalFromName`. For character keys
/// the name is not the symbol, but the lowercase name, e.g. one would use
/// “`<Ctrl>minus`” instead of “`<Ctrl>-`”.
///
/// Modifiers are enclosed in angular brackets `<>`, and match the
/// `gdk.ModifierType` mask:
///
/// - `<Shift>` for `GDK_SHIFT_MASK`
/// - `<Ctrl>` for `GDK_CONTROL_MASK`
/// - `<Alt>` for `GDK_ALT_MASK`
/// - `<Meta>` for `GDK_META_MASK`
/// - `<Super>` for `GDK_SUPER_MASK`
/// - `<Hyper>` for `GDK_HYPER_MASK`
///
/// If the parse operation fails, `accelerator_key` and `accelerator_mods` will
/// be set to 0 (zero).
extern fn gtk_accelerator_parse(p_accelerator: [*:0]const u8, p_accelerator_key: ?*c_uint, p_accelerator_mods: ?*gdk.ModifierType) c_int;
pub const acceleratorParse = gtk_accelerator_parse;

/// Parses a string representing an accelerator.
///
/// This is similar to `gtk.acceleratorParse` but handles keycodes as
/// well. This is only useful for system-level components, applications should
/// use `gtk.acceleratorParse` instead.
///
/// If `accelerator_codes` is given and the result stored in it is non-`NULL`,
/// the result must be freed with `glib.free`.
///
/// If a keycode is present in the accelerator and no `accelerator_codes`
/// is given, the parse will fail.
///
/// If the parse fails, `accelerator_key`, `accelerator_mods` and
/// `accelerator_codes` will be set to 0 (zero).
extern fn gtk_accelerator_parse_with_keycode(p_accelerator: [*:0]const u8, p_display: ?*gdk.Display, p_accelerator_key: ?*c_uint, p_accelerator_codes: ?*[*]c_uint, p_accelerator_mods: ?*gdk.ModifierType) c_int;
pub const acceleratorParseWithKeycode = gtk_accelerator_parse_with_keycode;

/// Determines whether a given keyval and modifier mask constitute
/// a valid keyboard accelerator.
///
/// For example, the `GDK_KEY_a` keyval plus `GDK_CONTROL_MASK` mask is valid,
/// and matches the “Ctrl+a” accelerator. But, you can't, for instance, use
/// the `GDK_KEY_Control_L` keyval as an accelerator.
extern fn gtk_accelerator_valid(p_keyval: c_uint, p_modifiers: gdk.ModifierType) c_int;
pub const acceleratorValid = gtk_accelerator_valid;

/// Checks that the GTK library in use is compatible with the
/// given version.
///
/// Generally you would pass in the constants `GTK_MAJOR_VERSION`,
/// `GTK_MINOR_VERSION`, `GTK_MICRO_VERSION` as the three arguments
/// to this function; that produces a check that the library in
/// use is compatible with the version of GTK the application or
/// module was compiled against.
///
/// Compatibility is defined by two things: first the version
/// of the running library is newer than the version
/// `required_major`.required_minor.`required_micro`. Second
/// the running library must be binary compatible with the
/// version `required_major`.required_minor.`required_micro`
/// (same major version.)
///
/// This function is primarily for GTK modules; the module
/// can call this function to check that it wasn’t loaded
/// into an incompatible version of GTK. However, such a
/// check isn’t completely reliable, since the module may be
/// linked against an old version of GTK and calling the
/// old version of `gtk.checkVersion`, but still get loaded
/// into an application using a newer version of GTK.
extern fn gtk_check_version(p_required_major: c_uint, p_required_minor: c_uint, p_required_micro: c_uint) ?[*:0]const u8;
pub const checkVersion = gtk_check_version;

/// Registers an error quark for CSS parsing errors.
extern fn gtk_css_parser_error_quark() glib.Quark;
pub const cssParserErrorQuark = gtk_css_parser_error_quark;

/// Registers an error quark for CSS parsing warnings.
extern fn gtk_css_parser_warning_quark() glib.Quark;
pub const cssParserWarningQuark = gtk_css_parser_warning_quark;

/// Prevents GTK from using the specified portals.
///
/// This should only be used in portal implementations, apps must not call it.
extern fn gtk_disable_portal_interfaces(p_portal_interfaces: [*][*:0]const u8) void;
pub const disablePortalInterfaces = gtk_disable_portal_interfaces;

/// Prevents GTK from using portals.
///
/// This is equivalent to setting `GDK_DEBUG=no-portals` in the environment.
///
/// This should only be used in portal implementations, apps must not call it.
extern fn gtk_disable_portals() void;
pub const disablePortals = gtk_disable_portals;

/// Prevents `gtk.init` and `gtk.initCheck` from calling ``setlocale``.
///
/// You would want to use this function if you wanted to set the locale for
/// your program to something other than the user’s locale, or if you wanted
/// to set different values for different locale categories.
///
/// Most programs should not need to call this function.
extern fn gtk_disable_setlocale() void;
pub const disableSetlocale = gtk_disable_setlocale;

/// Distributes `extra_space` to child `sizes` by bringing smaller
/// children up to natural size first.
///
/// The remaining space will be added to the `minimum_size` member of the
/// `GtkRequestedSize` struct. If all sizes reach their natural size then
/// the remaining space is returned.
extern fn gtk_distribute_natural_allocation(p_extra_space: c_int, p_n_requested_sizes: c_uint, p_sizes: [*]gtk.RequestedSize) c_int;
pub const distributeNaturalAllocation = gtk_distribute_natural_allocation;

/// Calls a function for all printers that are known to GTK.
///
/// If `func` returns true, the enumeration is stopped.
extern fn gtk_enumerate_printers(p_func: gtk.PrinterFunc, p_data: ?*anyopaque, p_destroy: ?glib.DestroyNotify, p_wait: c_int) void;
pub const enumeratePrinters = gtk_enumerate_printers;

/// Returns the binary age as passed to `libtool`.
///
/// If `libtool` means nothing to you, don't worry about it.
extern fn gtk_get_binary_age() c_uint;
pub const getBinaryAge = gtk_get_binary_age;

/// Returns the GTK debug flags that are currently active.
///
/// This function is intended for GTK modules that want
/// to adjust their debug output based on GTK debug flags.
extern fn gtk_get_debug_flags() gtk.DebugFlags;
pub const getDebugFlags = gtk_get_debug_flags;

/// Returns the `PangoLanguage` for the default language
/// currently in effect.
///
/// Note that this can change over the life of an
/// application.
///
/// The default language is derived from the current
/// locale. It determines, for example, whether GTK uses
/// the right-to-left or left-to-right text direction.
///
/// This function is equivalent to `pango.Language.getDefault`.
/// See that function for details.
extern fn gtk_get_default_language() *pango.Language;
pub const getDefaultLanguage = gtk_get_default_language;

/// Returns the interface age as passed to `libtool`.
///
/// If `libtool` means nothing to you, don't worry about it.
extern fn gtk_get_interface_age() c_uint;
pub const getInterfaceAge = gtk_get_interface_age;

/// Gets the direction of the current locale.
///
/// This is the expected reading direction for text and UI.
///
/// This function depends on the current locale being set with
/// ``setlocale`` and will default to setting the `GTK_TEXT_DIR_LTR`
/// direction otherwise. `GTK_TEXT_DIR_NONE` will never be returned.
///
/// GTK sets the default text direction according to the locale during
/// `gtk.init`, and you should normally use `gtk.Widget.getDirection`
/// or `gtk.Widget.getDefaultDirection` to obtain the current direction.
///
/// This function is only needed rare cases when the locale is
/// changed after GTK has already been initialized. In this case,
/// you can use it to update the default text direction as follows:
///
/// ```c
/// `include` <locale.h>
///
/// static void
/// update_locale (const char *new_locale)
/// {
///   setlocale (LC_ALL, new_locale);
///   gtk_widget_set_default_direction (gtk_get_locale_direction ());
/// }
/// ```
extern fn gtk_get_locale_direction() gtk.TextDirection;
pub const getLocaleDirection = gtk_get_locale_direction;

/// Returns the major version number of the GTK library.
///
/// For example, in GTK version 3.1.5 this is 3.
///
/// This function is in the library, so it represents the GTK library
/// your code is running against. Contrast with the `GTK_MAJOR_VERSION`
/// macro, which represents the major version of the GTK headers you
/// have included when compiling your code.
extern fn gtk_get_major_version() c_uint;
pub const getMajorVersion = gtk_get_major_version;

/// Returns the micro version number of the GTK library.
///
/// For example, in GTK version 3.1.5 this is 5.
///
/// This function is in the library, so it represents the GTK library
/// your code is are running against. Contrast with the
/// `GTK_MICRO_VERSION` macro, which represents the micro version of the
/// GTK headers you have included when compiling your code.
extern fn gtk_get_micro_version() c_uint;
pub const getMicroVersion = gtk_get_micro_version;

/// Returns the minor version number of the GTK library.
///
/// For example, in GTK version 3.1.5 this is 1.
///
/// This function is in the library, so it represents the GTK library
/// your code is are running against. Contrast with the
/// `GTK_MINOR_VERSION` macro, which represents the minor version of the
/// GTK headers you have included when compiling your code.
extern fn gtk_get_minor_version() c_uint;
pub const getMinorVersion = gtk_get_minor_version;

/// Converts a color from HSV space to RGB.
///
/// Input values must be in the [0.0, 1.0] range;
/// output values will be in the same range.
extern fn gtk_hsv_to_rgb(p_h: f32, p_s: f32, p_v: f32, p_r: *f32, p_g: *f32, p_b: *f32) void;
pub const hsvToRgb = gtk_hsv_to_rgb;

/// Initializes GTK.
///
/// This function must be called before using any other GTK functions
/// in your GUI applications.
///
/// It will initialize everything needed to operate the toolkit. In particular,
/// it will open the default display (see `gdk.Display.getDefault`).
///
/// If you are using `gtk.Application`, you usually don't have to call this
/// function; the `gio.Application.virtual_methods.startup` handler does it for you. Though,
/// if you are using `GApplication` methods that will be invoked before `startup`,
/// such as `local_command_line`, you may need to initialize GTK explicitly.
///
/// This function will terminate your program if it was unable to initialize
/// the windowing system for some reason. If you want your program to fall back
/// to a textual interface, call `gtk.initCheck` instead.
///
/// GTK calls `signal (SIGPIPE, SIG_IGN)` during initialization, to ignore
/// SIGPIPE signals, since these are almost never wanted in graphical
/// applications. If you do need to handle SIGPIPE for some reason, reset
/// the handler after `gtk.init`, but notice that other libraries (e.g.
/// libdbus or gvfs) might do similar things.
extern fn gtk_init() void;
pub const init = gtk_init;

/// Initializes GTK.
///
/// This function does the same work as `gtk.init` with only a
/// single change: It does not terminate the program if the windowing
/// system can’t be initialized. Instead it returns false on failure.
///
/// This way the application can fall back to some other means of
/// communication with the user - for example a curses or command line
/// interface.
extern fn gtk_init_check() c_int;
pub const initCheck = gtk_init_check;

/// Returns whether GTK has been initialized.
///
/// See `gtk.init`.
extern fn gtk_is_initialized() c_int;
pub const isInitialized = gtk_is_initialized;

/// Creates a new `GParamSpec` instance for a property holding a `GtkExpression`.
///
/// See ``gobject.ParamSpec.internal`` for details on the property strings.
extern fn gtk_param_spec_expression(p_name: [*:0]const u8, p_nick: [*:0]const u8, p_blurb: [*:0]const u8, p_flags: gobject.ParamFlags) *gobject.ParamSpec;
pub const paramSpecExpression = gtk_param_spec_expression;

/// Runs a page setup dialog, letting the user modify the values from `page_setup`.
///
/// If the user cancels the dialog, the returned `GtkPageSetup` is identical
/// to the passed in `page_setup`, otherwise it contains the modifications
/// done in the dialog.
///
/// Note that this function may use a recursive mainloop to show the page
/// setup dialog. See `gtk.printRunPageSetupDialogAsync` if this is
/// a problem.
extern fn gtk_print_run_page_setup_dialog(p_parent: ?*gtk.Window, p_page_setup: ?*gtk.PageSetup, p_settings: *gtk.PrintSettings) *gtk.PageSetup;
pub const printRunPageSetupDialog = gtk_print_run_page_setup_dialog;

/// Runs a page setup dialog, letting the user modify the values from `page_setup`.
///
/// In contrast to `gtk.printRunPageSetupDialog`, this function  returns
/// after showing the page setup dialog on platforms that support this, and calls
/// `done_cb` from a signal handler for the ::response signal of the dialog.
extern fn gtk_print_run_page_setup_dialog_async(p_parent: ?*gtk.Window, p_page_setup: ?*gtk.PageSetup, p_settings: *gtk.PrintSettings, p_done_cb: gtk.PageSetupDoneFunc, p_data: ?*anyopaque) void;
pub const printRunPageSetupDialogAsync = gtk_print_run_page_setup_dialog_async;

/// Renders an activity indicator (such as in `GtkSpinner`).
/// The state `GTK_STATE_FLAG_CHECKED` determines whether there is
/// activity going on.
extern fn gtk_render_activity(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderActivity = gtk_render_activity;

/// Renders an arrow pointing to `angle`.
///
/// Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:
///
/// ![](arrows.png)
extern fn gtk_render_arrow(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_angle: f64, p_x: f64, p_y: f64, p_size: f64) void;
pub const renderArrow = gtk_render_arrow;

/// Renders the background of an element.
///
/// Typical background rendering, showing the effect of
/// `background-image`, `border-width` and `border-radius`:
///
/// ![](background.png)
extern fn gtk_render_background(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderBackground = gtk_render_background;

/// Renders a checkmark (as in a `GtkCheckButton`).
///
/// The `GTK_STATE_FLAG_CHECKED` state determines whether the check is
/// on or off, and `GTK_STATE_FLAG_INCONSISTENT` determines whether it
/// should be marked as undefined.
///
/// Typical checkmark rendering:
///
/// ![](checks.png)
extern fn gtk_render_check(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderCheck = gtk_render_check;

/// Renders an expander (as used in `GtkTreeView` and `GtkExpander`) in the area
/// defined by `x`, `y`, `width`, `height`. The state `GTK_STATE_FLAG_CHECKED`
/// determines whether the expander is collapsed or expanded.
///
/// Typical expander rendering:
///
/// ![](expanders.png)
extern fn gtk_render_expander(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderExpander = gtk_render_expander;

/// Renders a focus indicator on the rectangle determined by `x`, `y`, `width`, `height`.
///
/// Typical focus rendering:
///
/// ![](focus.png)
extern fn gtk_render_focus(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderFocus = gtk_render_focus;

/// Renders a frame around the rectangle defined by `x`, `y`, `width`, `height`.
///
/// Examples of frame rendering, showing the effect of `border-image`,
/// `border-color`, `border-width`, `border-radius` and junctions:
///
/// ![](frames.png)
extern fn gtk_render_frame(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderFrame = gtk_render_frame;

/// Renders a handle (as in `GtkPaned` and `GtkWindow`’s resize grip),
/// in the rectangle determined by `x`, `y`, `width`, `height`.
///
/// Handles rendered for the paned and grip classes:
///
/// ![](handles.png)
extern fn gtk_render_handle(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderHandle = gtk_render_handle;

/// Renders the icon in `texture` at the specified `x` and `y` coordinates.
///
/// This function will render the icon in `texture` at exactly its size,
/// regardless of scaling factors, which may not be appropriate when
/// drawing on displays with high pixel densities.
extern fn gtk_render_icon(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_texture: *gdk.Texture, p_x: f64, p_y: f64) void;
pub const renderIcon = gtk_render_icon;

/// Renders `layout` on the coordinates `x`, `y`
extern fn gtk_render_layout(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_layout: *pango.Layout) void;
pub const renderLayout = gtk_render_layout;

/// Renders a line from (x0, y0) to (x1, y1).
extern fn gtk_render_line(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x0: f64, p_y0: f64, p_x1: f64, p_y1: f64) void;
pub const renderLine = gtk_render_line;

/// Renders an option mark (as in a radio button), the `GTK_STATE_FLAG_CHECKED`
/// state will determine whether the option is on or off, and
/// `GTK_STATE_FLAG_INCONSISTENT` whether it should be marked as undefined.
///
/// Typical option mark rendering:
///
/// ![](options.png)
extern fn gtk_render_option(p_context: *gtk.StyleContext, p_cr: *cairo.Context, p_x: f64, p_y: f64, p_width: f64, p_height: f64) void;
pub const renderOption = gtk_render_option;

/// Converts a color from RGB space to HSV.
///
/// Input values must be in the [0.0, 1.0] range;
/// output values will be in the same range.
extern fn gtk_rgb_to_hsv(p_r: f32, p_g: f32, p_b: f32, p_h: *f32, p_s: *f32, p_v: *f32) void;
pub const rgbToHsv = gtk_rgb_to_hsv;

/// Sets the GTK debug flags.
extern fn gtk_set_debug_flags(p_flags: gtk.DebugFlags) void;
pub const setDebugFlags = gtk_set_debug_flags;

/// A convenience function for showing an application’s about dialog.
///
/// The constructed dialog is associated with the parent window and
/// reused for future invocations of this function.
extern fn gtk_show_about_dialog(p_parent: ?*gtk.Window, p_first_property_name: [*:0]const u8, ...) void;
pub const showAboutDialog = gtk_show_about_dialog;

/// This function launches the default application for showing
/// a given uri, or shows an error dialog if that fails.
extern fn gtk_show_uri(p_parent: ?*gtk.Window, p_uri: [*:0]const u8, p_timestamp: u32) void;
pub const showUri = gtk_show_uri;

/// This function launches the default application for showing
/// a given uri.
///
/// The `callback` will be called when the launch is completed.
///
/// This is the recommended call to be used as it passes information
/// necessary for sandbox helpers to parent their dialogs properly.
extern fn gtk_show_uri_full(p_parent: ?*gtk.Window, p_uri: [*:0]const u8, p_timestamp: u32, p_cancellable: ?*gio.Cancellable, p_callback: ?gio.AsyncReadyCallback, p_user_data: ?*anyopaque) void;
pub const showUriFull = gtk_show_uri_full;

/// Finishes the `gtk.showUri` call and returns the result
/// of the operation.
extern fn gtk_show_uri_full_finish(p_parent: *gtk.Window, p_result: *gio.AsyncResult, p_error: ?*?*glib.Error) c_int;
pub const showUriFullFinish = gtk_show_uri_full_finish;

/// Prints an assertion message for `gtk_test_accessible_assert_role`.
extern fn gtk_test_accessible_assertion_message_role(p_domain: [*:0]const u8, p_file: [*:0]const u8, p_line: c_int, p_func: [*:0]const u8, p_expr: [*:0]const u8, p_accessible: *gtk.Accessible, p_expected_role: gtk.AccessibleRole, p_actual_role: gtk.AccessibleRole) void;
pub const testAccessibleAssertionMessageRole = gtk_test_accessible_assertion_message_role;

/// Checks whether the accessible `property` of `accessible` is set to
/// a specific value.
extern fn gtk_test_accessible_check_property(p_accessible: *gtk.Accessible, p_property: gtk.AccessibleProperty, ...) [*:0]u8;
pub const testAccessibleCheckProperty = gtk_test_accessible_check_property;

/// Checks whether the accessible `relation` of `accessible` is set to
/// a specific value.
extern fn gtk_test_accessible_check_relation(p_accessible: *gtk.Accessible, p_relation: gtk.AccessibleRelation, ...) [*:0]u8;
pub const testAccessibleCheckRelation = gtk_test_accessible_check_relation;

/// Checks whether the accessible `state` of `accessible` is set to
/// a specific value.
extern fn gtk_test_accessible_check_state(p_accessible: *gtk.Accessible, p_state: gtk.AccessibleState, ...) [*:0]u8;
pub const testAccessibleCheckState = gtk_test_accessible_check_state;

/// Checks whether the `GtkAccessible` has `property` set.
extern fn gtk_test_accessible_has_property(p_accessible: *gtk.Accessible, p_property: gtk.AccessibleProperty) c_int;
pub const testAccessibleHasProperty = gtk_test_accessible_has_property;

/// Checks whether the `GtkAccessible` has `relation` set.
extern fn gtk_test_accessible_has_relation(p_accessible: *gtk.Accessible, p_relation: gtk.AccessibleRelation) c_int;
pub const testAccessibleHasRelation = gtk_test_accessible_has_relation;

/// Checks whether the `GtkAccessible:accessible-role` of the accessible
/// is `role`.
extern fn gtk_test_accessible_has_role(p_accessible: *gtk.Accessible, p_role: gtk.AccessibleRole) c_int;
pub const testAccessibleHasRole = gtk_test_accessible_has_role;

/// Checks whether the `GtkAccessible` has `state` set.
extern fn gtk_test_accessible_has_state(p_accessible: *gtk.Accessible, p_state: gtk.AccessibleState) c_int;
pub const testAccessibleHasState = gtk_test_accessible_has_state;

/// This function is used to initialize a GTK test program.
///
/// It will in turn call `glib.testInit` and `gtk.init` to properly
/// initialize the testing framework and graphical toolkit. It’ll
/// also set the program’s locale to “C”. This is done to make test
/// program environments as deterministic as possible.
///
/// Like `gtk.init` and `glib.testInit`, any known arguments will be
/// processed and stripped from `argc` and `argv`.
extern fn gtk_test_init(p_argcp: *c_int, p_argvp: *[*][*:0]u8, ...) void;
pub const testInit = gtk_test_init;

/// Return the type ids that have been registered after
/// calling `gtk.testRegisterAllTypes`.
extern fn gtk_test_list_all_types(p_n_types: *c_uint) [*:0]const usize;
pub const testListAllTypes = gtk_test_list_all_types;

/// Force registration of all core GTK object types.
///
/// This allows to refer to any of those object types via
/// `gobject.typeFromName` after calling this function.
extern fn gtk_test_register_all_types() void;
pub const testRegisterAllTypes = gtk_test_register_all_types;

/// Enters the main loop and waits for `widget` to be “drawn”.
///
/// In this context that means it waits for the frame clock of
/// `widget` to have run a full styling, layout and drawing cycle.
///
/// This function is intended to be used for syncing with actions that
/// depend on `widget` relayouting or on interaction with the display
/// server.
extern fn gtk_test_widget_wait_for_draw(p_widget: *gtk.Widget) void;
pub const testWidgetWaitForDraw = gtk_test_widget_wait_for_draw;

/// Creates a content provider for dragging `path` from `tree_model`.
extern fn gtk_tree_create_row_drag_content(p_tree_model: *gtk.TreeModel, p_path: *gtk.TreePath) *gdk.ContentProvider;
pub const treeCreateRowDragContent = gtk_tree_create_row_drag_content;

/// Obtains a `tree_model` and `path` from value of target type
/// `GTK_TYPE_TREE_ROW_DATA`.
///
/// The returned path must be freed with `gtk.TreePath.free`.
extern fn gtk_tree_get_row_drag_data(p_value: *const gobject.Value, p_tree_model: ?**gtk.TreeModel, p_path: ?**gtk.TreePath) c_int;
pub const treeGetRowDragData = gtk_tree_get_row_drag_data;

/// Retrieves the `GtkExpression` stored inside the given `value`, and acquires
/// a reference to it.
extern fn gtk_value_dup_expression(p_value: *const gobject.Value) ?*gtk.Expression;
pub const valueDupExpression = gtk_value_dup_expression;

/// Retrieves the `GtkExpression` stored inside the given `value`.
extern fn gtk_value_get_expression(p_value: *const gobject.Value) ?*gtk.Expression;
pub const valueGetExpression = gtk_value_get_expression;

/// Stores the given `GtkExpression` inside `value`.
///
/// The `GValue` will acquire a reference to the `expression`.
extern fn gtk_value_set_expression(p_value: *gobject.Value, p_expression: *gtk.Expression) void;
pub const valueSetExpression = gtk_value_set_expression;

/// Stores the given `GtkExpression` inside `value`.
///
/// This function transfers the ownership of the `expression` to the `GValue`.
extern fn gtk_value_take_expression(p_value: *gobject.Value, p_expression: ?*gtk.Expression) void;
pub const valueTakeExpression = gtk_value_take_expression;

/// Type of callback used to calculate the next page in a `GtkAssistant`.
///
/// It’s called both for computing the next page when the user presses the
/// “forward” button and for handling the behavior of the “last” button.
///
/// See `gtk.Assistant.setForwardPageFunc`.
pub const AssistantPageFunc = *const fn (p_current_page: c_int, p_data: ?*anyopaque) callconv(.c) c_int;

/// The type of the callback functions used for iterating over the
/// cell renderers and their allocated areas inside a `GtkCellArea`,
/// see `gtk.CellArea.foreachAlloc`.
pub const CellAllocCallback = *const fn (p_renderer: *gtk.CellRenderer, p_cell_area: *const gdk.Rectangle, p_cell_background: *const gdk.Rectangle, p_data: ?*anyopaque) callconv(.c) c_int;

/// The type of the callback functions used for iterating over
/// the cell renderers of a `GtkCellArea`, see `gtk.CellArea.foreach`.
pub const CellCallback = *const fn (p_renderer: *gtk.CellRenderer, p_data: ?*anyopaque) callconv(.c) c_int;

/// A function which should set the value of `cell_layout`’s cell renderer(s)
/// as appropriate.
pub const CellLayoutDataFunc = *const fn (p_cell_layout: *gtk.CellLayout, p_cell: *gtk.CellRenderer, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_data: ?*anyopaque) callconv(.c) void;

/// A function to be used by `GtkCustomLayout` to allocate a widget.
pub const CustomAllocateFunc = *const fn (p_widget: *gtk.Widget, p_width: c_int, p_height: c_int, p_baseline: c_int) callconv(.c) void;

/// User function that is called to determine if the `item` should be matched.
///
/// If the filter matches the item, this function must return true.
/// If the item should be filtered out, false must be returned.
pub const CustomFilterFunc = *const fn (p_item: *gobject.Object, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// A function to be used by `GtkCustomLayout` to measure a widget.
pub const CustomMeasureFunc = *const fn (p_widget: *gtk.Widget, p_orientation: gtk.Orientation, p_for_size: c_int, p_minimum: *c_int, p_natural: *c_int, p_minimum_baseline: *c_int, p_natural_baseline: *c_int) callconv(.c) void;

/// Queries a widget for its preferred size request mode.
pub const CustomRequestModeFunc = *const fn (p_widget: *gtk.Widget) callconv(.c) gtk.SizeRequestMode;

/// Whenever `drawing_area` needs to redraw, this function will be called.
///
/// This function should exclusively redraw the contents of the drawing area
/// and must not call any widget functions that cause changes.
pub const DrawingAreaDrawFunc = *const fn (p_drawing_area: *gtk.DrawingArea, p_cr: *cairo.Context, p_width: c_int, p_height: c_int, p_user_data: ?*anyopaque) callconv(.c) void;

/// A function which decides whether the row indicated by `iter` matches
/// a given `key`, and should be displayed as a possible completion for `key`.
///
/// Note that `key` is normalized and case-folded (see `glib.utf8Normalize`
/// and `glib.utf8Casefold`). If this is not appropriate, match functions
/// have access to the unmodified key via
/// `gtk_editable_get_text (GTK_EDITABLE (gtk_entry_completion_get_entry ()))`.
pub const EntryCompletionMatchFunc = *const fn (p_completion: *gtk.EntryCompletion, p_key: [*:0]const u8, p_iter: *gtk.TreeIter, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// Callback called by `gtk.Expression.watch` when the
/// expression value changes.
pub const ExpressionNotify = *const fn (p_user_data: ?*anyopaque) callconv(.c) void;

/// Called for flow boxes that are bound to a `GListModel`.
///
/// This function is called for each item that gets added to the model.
pub const FlowBoxCreateWidgetFunc = *const fn (p_item: *gobject.Object, p_user_data: ?*anyopaque) callconv(.c) *gtk.Widget;

/// A function that will be called whenever a child changes
/// or is added.
///
/// It lets you control if the child should be visible or not.
pub const FlowBoxFilterFunc = *const fn (p_child: *gtk.FlowBoxChild, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// A function used by `gtk.FlowBox.selectedForeach`.
///
/// It will be called on every selected child of the `box`.
pub const FlowBoxForeachFunc = *const fn (p_box: *gtk.FlowBox, p_child: *gtk.FlowBoxChild, p_user_data: ?*anyopaque) callconv(.c) void;

/// A function to compare two children to determine which
/// should come first.
pub const FlowBoxSortFunc = *const fn (p_child1: *gtk.FlowBoxChild, p_child2: *gtk.FlowBoxChild, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// The type of function that is used for deciding what fonts get
/// shown in a `GtkFontChooser`.
///
/// See `gtk.FontChooser.setFilterFunc`.
pub const FontFilterFunc = *const fn (p_family: *const pango.FontFamily, p_face: *const pango.FontFace, p_data: ?*anyopaque) callconv(.c) c_int;

/// A function used by `gtk.IconView.selectedForeach` to map all
/// selected rows.
///
/// It will be called on every selected row in the view.
pub const IconViewForeachFunc = *const fn (p_icon_view: *gtk.IconView, p_path: *gtk.TreePath, p_data: ?*anyopaque) callconv(.c) void;

/// Called for list boxes that are bound to a `GListModel` with
/// `gtk.ListBox.bindModel` for each item that gets added to the model.
///
/// If the widget returned is not a `gtk.ListBoxRow` widget, then the widget
/// will be inserted as the child of an intermediate `gtk.ListBoxRow`.
pub const ListBoxCreateWidgetFunc = *const fn (p_item: *gobject.Object, p_user_data: ?*anyopaque) callconv(.c) *gtk.Widget;

/// Will be called whenever the row changes or is added and lets you control
/// if the row should be visible or not.
pub const ListBoxFilterFunc = *const fn (p_row: *gtk.ListBoxRow, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// A function used by `gtk.ListBox.selectedForeach`.
///
/// It will be called on every selected child of the `box`.
pub const ListBoxForeachFunc = *const fn (p_box: *gtk.ListBox, p_row: *gtk.ListBoxRow, p_user_data: ?*anyopaque) callconv(.c) void;

/// Compare two rows to determine which should be first.
pub const ListBoxSortFunc = *const fn (p_row1: *gtk.ListBoxRow, p_row2: *gtk.ListBoxRow, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// Whenever `row` changes or which row is before `row` changes this
/// is called, which lets you update the header on `row`.
///
/// You may remove or set a new one via `gtk.ListBoxRow.setHeader`
/// or just change the state of the current header widget.
pub const ListBoxUpdateHeaderFunc = *const fn (p_row: *gtk.ListBoxRow, p_before: ?*gtk.ListBoxRow, p_user_data: ?*anyopaque) callconv(.c) void;

/// User function that is called to map an `item` of the original model to
/// an item expected by the map model.
///
/// The returned items must conform to the item type of the model they are
/// used with.
pub const MapListModelMapFunc = *const fn (p_item: *gobject.Object, p_user_data: ?*anyopaque) callconv(.c) *gobject.Object;

/// User-provided callback function to create a popup for a
/// `GtkMenuButton` on demand.
///
/// This function is called when the popup of `menu_button` is shown,
/// but none has been provided via `gtk.MenuButton.setPopover`
/// or `gtk.MenuButton.setMenuModel`.
pub const MenuButtonCreatePopupFunc = *const fn (p_menu_button: *gtk.MenuButton, p_user_data: ?*anyopaque) callconv(.c) void;

/// The type of function that is passed to
/// `gtk.printRunPageSetupDialogAsync`.
///
/// This function will be called when the page setup dialog
/// is dismissed, and also serves as destroy notify for `data`.
pub const PageSetupDoneFunc = *const fn (p_page_setup: *gtk.PageSetup, p_data: ?*anyopaque) callconv(.c) void;

/// The type of callback that is passed to `gtk.PrintJob.send`.
///
/// It is called when the print job has been completely sent.
pub const PrintJobCompleteFunc = *const fn (p_print_job: *gtk.PrintJob, p_user_data: ?*anyopaque, p_error: *const glib.Error) callconv(.c) void;

/// Function called by `gtk.PrintSettings.foreach` on every key/value pair
/// inside a `gtk.PrintSettings`.
pub const PrintSettingsFunc = *const fn (p_key: [*:0]const u8, p_value: [*:0]const u8, p_user_data: ?*anyopaque) callconv(.c) void;

/// The type of function passed to `gtk.enumeratePrinters`.
///
/// Note that you need to ref `printer`, if you want to keep
/// a reference to it after the function has returned.
pub const PrinterFunc = *const fn (p_printer: *gtk.Printer, p_data: ?*anyopaque) callconv(.c) c_int;

/// Function that formats the value of a scale.
///
/// See `gtk.Scale.setFormatValueFunc`.
pub const ScaleFormatValueFunc = *const fn (p_scale: *gtk.Scale, p_value: f64, p_user_data: ?*anyopaque) callconv(.c) [*:0]u8;

/// Type for shortcuts based on user callbacks.
pub const ShortcutFunc = *const fn (p_widget: *gtk.Widget, p_args: ?*glib.Variant, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// A notification callback used by `gtk.TextBuffer.addCommitNotify`.
///
/// You may not modify the `gtk.TextBuffer` from a
/// `gtk.TextBufferCommitNotify` callback and that is enforced
/// by the `gtk.TextBuffer` API.
///
/// `gtk.TextBufferCommitNotify` may be used to be notified about
/// changes to the underlying buffer right before-or-after the changes are
/// committed to the underlying B-Tree. This is useful if you want to observe
/// changes to the buffer without other signal handlers potentially modifying
/// state on the way to the default signal handler.
///
/// When `flags` is `GTK_TEXT_BUFFER_NOTIFY_BEFORE_INSERT`, `position` is set to
/// the offset in characters from the start of the buffer where the insertion
/// will occur. `length` is set to the number of characters to be inserted.  You
/// may not yet retrieve the text until it has been inserted. You may access the
/// text from `GTK_TEXT_BUFFER_NOTIFY_AFTER_INSERT` using
/// `gtk.TextBuffer.getSlice`.
///
/// When `flags` is `GTK_TEXT_BUFFER_NOTIFY_AFTER_INSERT`, `position` is set to
/// offset in characters where the insertion occurred and `length` is set
/// to the number of characters inserted.
///
/// When `flags` is `GTK_TEXT_BUFFER_NOTIFY_BEFORE_DELETE`, `position` is set to
/// offset in characters where the deletion will occur and `length` is set
/// to the number of characters that will be removed. You may still retrieve
/// the text from this handler using `position` and `length`.
///
/// When `flags` is `GTK_TEXT_BUFFER_NOTIFY_AFTER_DELETE`, `length` is set to
/// zero to denote that the delete-range has already been committed to the
/// underlying B-Tree. You may no longer retrieve the text that has been
/// deleted from the `gtk.TextBuffer`.
pub const TextBufferCommitNotify = *const fn (p_buffer: *gtk.TextBuffer, p_flags: gtk.TextBufferNotifyFlags, p_position: c_uint, p_length: c_uint, p_user_data: ?*anyopaque) callconv(.c) void;

/// The predicate function used by `gtk.TextIter.forwardFindChar` and
/// `gtk.TextIter.backwardFindChar`.
pub const TextCharPredicate = *const fn (p_ch: u32, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// A function used with `gtk.TextTagTable.foreach`,
/// to iterate over every `GtkTextTag` inside a `GtkTextTagTable`.
pub const TextTagTableForeach = *const fn (p_tag: *gtk.TextTag, p_data: ?*anyopaque) callconv(.c) void;

/// Callback type for adding a function to update animations.
///
/// See `gtk.Widget.addTickCallback`.
pub const TickCallback = *const fn (p_widget: *gtk.Widget, p_frame_clock: *gdk.FrameClock, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// A function to set the properties of a cell instead of just using the
/// straight mapping between the cell and the model.
///
/// This function is useful for customizing the cell renderer. For example,
/// a function might get an* integer from the `tree_model`, and render it to
/// the “text” attribute of “cell” by converting it to its written equivalent.
///
/// See also: `gtk.TreeViewColumn.setCellDataFunc`
pub const TreeCellDataFunc = *const fn (p_tree_column: *gtk.TreeViewColumn, p_cell: *gtk.CellRenderer, p_tree_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_data: ?*anyopaque) callconv(.c) void;

/// A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive
/// integer if `a` sorts before `b`, `a` sorts with `b`, or `a` sorts after `b`
/// respectively.
///
/// If two iters compare as equal, their order in the sorted model
/// is undefined. In order to ensure that the `GtkTreeSortable` behaves as
/// expected, the GtkTreeIterCompareFunc must define a partial order on
/// the model, i.e. it must be reflexive, antisymmetric and transitive.
///
/// For example, if `model` is a product catalogue, then a compare function
/// for the “price” column could be one which returns
/// `price_of(`a`) - price_of(`b`)`.
pub const TreeIterCompareFunc = *const fn (p_model: *gtk.TreeModel, p_a: *gtk.TreeIter, p_b: *gtk.TreeIter, p_user_data: ?*anyopaque) callconv(.c) c_int;

/// Prototype of the function called to create new child models when
/// `gtk.TreeListRow.setExpanded` is called.
///
/// This function can return `NULL` to indicate that `item` is guaranteed to be
/// a leaf node and will never have children. If it does not have children but
/// may get children later, it should return an empty model that is filled once
/// children arrive.
pub const TreeListModelCreateModelFunc = *const fn (p_item: *gobject.Object, p_user_data: ?*anyopaque) callconv(.c) ?*gio.ListModel;

/// A function which calculates display values from raw values in the model.
/// It must fill `value` with the display value for the column `column` in the
/// row indicated by `iter`.
///
/// Since this function is called for each data access, it’s not a
/// particularly efficient operation.
pub const TreeModelFilterModifyFunc = *const fn (p_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_value: *gobject.Value, p_column: c_int, p_data: ?*anyopaque) callconv(.c) void;

/// A function which decides whether the row indicated by `iter` is visible.
pub const TreeModelFilterVisibleFunc = *const fn (p_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_data: ?*anyopaque) callconv(.c) c_int;

/// Type of the callback passed to `gtk.TreeModel.foreach` to
/// iterate over the rows in a tree model.
pub const TreeModelForeachFunc = *const fn (p_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_data: ?*anyopaque) callconv(.c) c_int;

/// A function used by `gtk.TreeSelection.selectedForeach` to map all
/// selected rows.  It will be called on every selected row in the view.
pub const TreeSelectionForeachFunc = *const fn (p_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_iter: *gtk.TreeIter, p_data: ?*anyopaque) callconv(.c) void;

/// A function used by `gtk.TreeSelection.setSelectFunction` to filter
/// whether or not a row may be selected. It is called whenever a row's
/// state might change.
///
/// A return value of `TRUE` indicates to `selection` that it is okay to
/// change the selection.
pub const TreeSelectionFunc = *const fn (p_selection: *gtk.TreeSelection, p_model: *gtk.TreeModel, p_path: *gtk.TreePath, p_path_currently_selected: c_int, p_data: ?*anyopaque) callconv(.c) c_int;

/// Function type for determining whether `column` can be dropped in a
/// particular spot (as determined by `prev_column` and `next_column`).  In
/// left to right locales, `prev_column` is on the left of the potential drop
/// spot, and `next_column` is on the right.  In right to left mode, this is
/// reversed.  This function should return `TRUE` if the spot is a valid drop
/// spot.  Please note that returning `TRUE` does not actually indicate that
/// the column drop was made, but is meant only to indicate a possible drop
/// spot to the user.
pub const TreeViewColumnDropFunc = *const fn (p_tree_view: *gtk.TreeView, p_column: *gtk.TreeViewColumn, p_prev_column: *gtk.TreeViewColumn, p_next_column: *gtk.TreeViewColumn, p_data: ?*anyopaque) callconv(.c) c_int;

/// Function used for `gtk.TreeView.mapExpandedRows`.
pub const TreeViewMappingFunc = *const fn (p_tree_view: *gtk.TreeView, p_path: *gtk.TreePath, p_user_data: ?*anyopaque) callconv(.c) void;

/// Function type for determining whether the row pointed to by `iter` should
/// be rendered as a separator. A common way to implement this is to have a
/// boolean column in the model, whose values the `GtkTreeViewRowSeparatorFunc`
/// returns.
pub const TreeViewRowSeparatorFunc = *const fn (p_model: *gtk.TreeModel, p_iter: *gtk.TreeIter, p_data: ?*anyopaque) callconv(.c) c_int;

/// A function used for checking whether a row in `model` matches
/// a search key string entered by the user. Note the return value
/// is reversed from what you would normally expect, though it
/// has some similarity to `strcmp` returning 0 for equal strings.
pub const TreeViewSearchEqualFunc = *const fn (p_model: *gtk.TreeModel, p_column: c_int, p_key: [*:0]const u8, p_iter: *gtk.TreeIter, p_search_data: ?*anyopaque) callconv(.c) c_int;

/// The type of the callback functions used for activating
/// actions installed with `gtk.WidgetClass.installAction`.
///
/// The `parameter` must match the `parameter_type` of the action.
pub const WidgetActionActivateFunc = *const fn (p_widget: *gtk.Widget, p_action_name: [*:0]const u8, p_parameter: ?*glib.Variant) callconv(.c) void;

/// An attribute for the background color, expressed as an RGB value
/// encoded in a string using the format: `{r8},{g8},{b8}`.
pub const ACCESSIBLE_ATTRIBUTE_BACKGROUND = "bg-color";
/// An attribute for the font family name.
pub const ACCESSIBLE_ATTRIBUTE_FAMILY = "family-name";
/// An attribute for the foreground color, expressed as an RGB value
/// encoded in a string using the format: `{r8},{g8},{b8}`.
pub const ACCESSIBLE_ATTRIBUTE_FOREGROUND = "fg-color";
/// An attribute for the overline style.
///
/// Possible values are:
///
/// - `gtk.ACCESSIBLE_ATTRIBUTE_OVERLINE_NONE`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_OVERLINE_SINGLE`
pub const ACCESSIBLE_ATTRIBUTE_OVERLINE = "overline";
/// The "none" overline value for `gtk.ACCESSIBLE_ATTRIBUTE_OVERLINE`.
pub const ACCESSIBLE_ATTRIBUTE_OVERLINE_NONE = "none";
/// The "single" overline value for `gtk.ACCESSIBLE_ATTRIBUTE_OVERLINE`.
pub const ACCESSIBLE_ATTRIBUTE_OVERLINE_SINGLE = "single";
/// An attribute for the font size, expressed in points.
pub const ACCESSIBLE_ATTRIBUTE_SIZE = "size";
/// An attribute for the font stretch type.
///
/// Possible values are:
///
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_CONDENSED`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_CONDENSED`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH_CONDENSED`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_CONDENSED`
pub const ACCESSIBLE_ATTRIBUTE_STRETCH = "stretch";
/// The "condensed" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_CONDENSED = "condensed";
/// The "expanded" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_EXPANDED = "expanded";
/// The "extra condensed" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_CONDENSED = "extra_condensed";
/// The "extra expanded" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_EXPANDED = "extra_expanded";
/// The "normal" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_NORMAL = "normal";
/// The "semi condensed" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_CONDENSED = "semi_condensed";
/// The "semi expanded" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_EXPANDED = "semi_expanded";
/// The "ultra condensed" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_CONDENSED = "ultra_condensed";
/// The "ultra expanded" stretch value for `gtk.ACCESSIBLE_ATTRIBUTE_STRETCH`.
pub const ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_EXPANDED = "ultra_expanded";
/// An attribute for strikethrough text.
///
/// Possible values are `true` or `false`.
pub const ACCESSIBLE_ATTRIBUTE_STRIKETHROUGH = "strikethrough";
/// An attribute for the font style.
///
/// Possible values are:
///
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STYLE_NORMAL`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STYLE_OBLIQUE`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_STYLE_ITALIC`
pub const ACCESSIBLE_ATTRIBUTE_STYLE = "style";
/// The "italic" style value for `gtk.ACCESSIBLE_ATTRIBUTE_STYLE`.
pub const ACCESSIBLE_ATTRIBUTE_STYLE_ITALIC = "italic";
/// The "normal" style value for `gtk.ACCESSIBLE_ATTRIBUTE_STYLE`.
pub const ACCESSIBLE_ATTRIBUTE_STYLE_NORMAL = "normal";
/// The "oblique" style value for `gtk.ACCESSIBLE_ATTRIBUTE_STYLE`.
pub const ACCESSIBLE_ATTRIBUTE_STYLE_OBLIQUE = "oblique";
/// An attribute for the underline style.
///
/// Possible values are:
///
/// - `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE_NONE`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE_SINGLE`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE_DOUBLE`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE_ERROR`
pub const ACCESSIBLE_ATTRIBUTE_UNDERLINE = "underline";
/// The "double" underline value for `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE`.
pub const ACCESSIBLE_ATTRIBUTE_UNDERLINE_DOUBLE = "double";
/// The "error" underline value for `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE`.
pub const ACCESSIBLE_ATTRIBUTE_UNDERLINE_ERROR = "error";
/// The "none" underline value for `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE`.
pub const ACCESSIBLE_ATTRIBUTE_UNDERLINE_NONE = "none";
/// The "single" underline value for `gtk.ACCESSIBLE_ATTRIBUTE_UNDERLINE`.
pub const ACCESSIBLE_ATTRIBUTE_UNDERLINE_SINGLE = "single";
/// An attribute for the font variant.
///
/// Possible values are:
///
/// - `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT_SMALL_CAPS`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_SMALL_CAPS`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT_PETITE_CAPS`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_PETITE_CAPS`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT_UNICASE`
/// - `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT_TITLE_CAPS`
pub const ACCESSIBLE_ATTRIBUTE_VARIANT = "variant";
/// The "all petite caps" variant value for `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT`.
pub const ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_PETITE_CAPS = "all-petite-caps";
/// The "all small caps" variant value for `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT`.
pub const ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_SMALL_CAPS = "all-small-caps";
/// The "petite caps" variant value for `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT`.
pub const ACCESSIBLE_ATTRIBUTE_VARIANT_PETITE_CAPS = "petite-caps";
/// The "small caps" variant value for `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT`.
pub const ACCESSIBLE_ATTRIBUTE_VARIANT_SMALL_CAPS = "small-caps";
/// The "title caps" variant value for `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT`.
pub const ACCESSIBLE_ATTRIBUTE_VARIANT_TITLE_CAPS = "title-caps";
/// The "unicase" variant value for `gtk.ACCESSIBLE_ATTRIBUTE_VARIANT`.
pub const ACCESSIBLE_ATTRIBUTE_VARIANT_UNICASE = "unicase";
/// An attribute for the font weight.
pub const ACCESSIBLE_ATTRIBUTE_WEIGHT = "weight";
/// An undefined value. The accessible attribute is either unset, or its
/// value is undefined.
pub const ACCESSIBLE_VALUE_UNDEFINED = -1;
/// Like `getBinaryAge`, but from the headers used at
/// application compile time, rather than from the library linked
/// against at application run time.
pub const BINARY_AGE = 2204;
/// The default name of the extension point.
pub const IM_MODULE_EXTENSION_POINT_NAME = "gtk-im-module";
/// Constant to return from a signal handler for the ::input
/// signal in case of conversion failure.
///
/// See `gtk.SpinButton.signals.input`.
pub const INPUT_ERROR = -1;
/// Like `getInterfaceAge`, but from the headers used at
/// application compile time, rather than from the library linked
/// against at application run time.
pub const INTERFACE_AGE = 4;
/// The value used to refer to a guaranteed invalid position
/// in a `GListModel`.
///
/// This value may be returned from some functions, others may
/// accept it as input. Its interpretation may differ for different
/// functions.
///
/// Refer to each function's documentation for if this value is
/// allowed and what it does.
pub const INVALID_LIST_POSITION = 4294967295;
/// The name used for the stock full offset included by `GtkLevelBar`.
pub const LEVEL_BAR_OFFSET_FULL = "full";
/// The name used for the stock high offset included by `GtkLevelBar`.
pub const LEVEL_BAR_OFFSET_HIGH = "high";
/// The name used for the stock low offset included by `GtkLevelBar`.
pub const LEVEL_BAR_OFFSET_LOW = "low";
/// Like `getMajorVersion`, but from the headers used at
/// application compile time, rather than from the library linked
/// against at application run time.
pub const MAJOR_VERSION = 4;
/// Evaluates to the maximum length of a compose sequence.
///
/// This macro is longer used by GTK.
pub const MAX_COMPOSE_LEN = 7;
/// The default extension point name for media file.
pub const MEDIA_FILE_EXTENSION_POINT_NAME = "gtk-media-file";
/// Like `getMicroVersion`, but from the headers used at
/// application compile time, rather than from the library linked
/// against at application run time.
pub const MICRO_VERSION = 4;
/// Like `getMinorVersion`, but from the headers used at
/// application compile time, rather than from the library linked
/// against at application run time.
pub const MINOR_VERSION = 22;
/// Name for the A3 paper size.
pub const PAPER_NAME_A3 = "iso_a3";
/// Name for the A4 paper size.
pub const PAPER_NAME_A4 = "iso_a4";
/// Name for the A5 paper size.
pub const PAPER_NAME_A5 = "iso_a5";
/// Name for the B5 paper size.
pub const PAPER_NAME_B5 = "iso_b5";
/// Name for the Executive paper size.
pub const PAPER_NAME_EXECUTIVE = "na_executive";
/// Name for the Legal paper size.
pub const PAPER_NAME_LEGAL = "na_legal";
/// Name for the Letter paper size.
pub const PAPER_NAME_LETTER = "na_letter";
/// The key used by the “Print to file” printer to store whether to collate the
/// printed pages.
pub const PRINT_SETTINGS_COLLATE = "collate";
/// The key used by the “Print to file” printer to store the default source.
pub const PRINT_SETTINGS_DEFAULT_SOURCE = "default-source";
/// The key used by the “Print to file” printer to store the dither used.
pub const PRINT_SETTINGS_DITHER = "dither";
/// The key used by the “Print to file” printer to store whether to print the
/// output in duplex.
pub const PRINT_SETTINGS_DUPLEX = "duplex";
/// The key used by the “Print to file” printer to store the finishings.
pub const PRINT_SETTINGS_FINISHINGS = "finishings";
/// The key used by the “Print to file” printer to store the media type.
///
/// The set of media types is defined in PWG 5101.1-2002 PWG.
pub const PRINT_SETTINGS_MEDIA_TYPE = "media-type";
/// The key used by the “Print to file” printer to store the number of pages per
/// sheet.
pub const PRINT_SETTINGS_NUMBER_UP = "number-up";
/// The key used by the “Print to file” printer to store the number of pages per
/// sheet in number-up mode.
pub const PRINT_SETTINGS_NUMBER_UP_LAYOUT = "number-up-layout";
/// The key used by the “Print to file” printer to store the number of copies.
pub const PRINT_SETTINGS_N_COPIES = "n-copies";
/// The key used by the “Print to file” printer to store the orientation.
pub const PRINT_SETTINGS_ORIENTATION = "orientation";
/// The key used by the “Print to file” printer to store the file
/// name of the output without the path to the directory and the
/// file extension.
pub const PRINT_SETTINGS_OUTPUT_BASENAME = "output-basename";
/// The key used by the “Print to file” printer to store the output bin.
pub const PRINT_SETTINGS_OUTPUT_BIN = "output-bin";
/// The key used by the “Print to file” printer to store the
/// directory to which the output should be written.
pub const PRINT_SETTINGS_OUTPUT_DIR = "output-dir";
/// The key used by the “Print to file” printer to store the format
/// of the output. The supported values are “PS” and “PDF”.
pub const PRINT_SETTINGS_OUTPUT_FILE_FORMAT = "output-file-format";
/// The key used by the “Print to file” printer to store the URI
/// to which the output should be written. GTK itself supports
/// only “file://” URIs.
pub const PRINT_SETTINGS_OUTPUT_URI = "output-uri";
/// The key used by the “Print to file” printer to store the array of page ranges
/// to print.
pub const PRINT_SETTINGS_PAGE_RANGES = "page-ranges";
/// The key used by the “Print to file” printer to store the set of pages to print.
pub const PRINT_SETTINGS_PAGE_SET = "page-set";
/// The key used by the “Print to file” printer to store the page format.
pub const PRINT_SETTINGS_PAPER_FORMAT = "paper-format";
/// The key used by the “Print to file” printer to store the page height.
pub const PRINT_SETTINGS_PAPER_HEIGHT = "paper-height";
/// The key used by the “Print to file” printer to store the paper width.
pub const PRINT_SETTINGS_PAPER_WIDTH = "paper-width";
/// The key used by the “Print to file” printer to store the printer name.
pub const PRINT_SETTINGS_PRINTER = "printer";
/// The key used by the “Print to file” printer to store the resolution in lines
/// per inch.
pub const PRINT_SETTINGS_PRINTER_LPI = "printer-lpi";
/// The key used by the “Print to file” printer to store which pages to print.
pub const PRINT_SETTINGS_PRINT_PAGES = "print-pages";
/// The key used by the “Print to file” printer to store the printing quality.
pub const PRINT_SETTINGS_QUALITY = "quality";
/// The key used by the “Print to file” printer to store the resolution in DPI.
pub const PRINT_SETTINGS_RESOLUTION = "resolution";
/// The key used by the “Print to file” printer to store the horizontal
/// resolution in DPI.
pub const PRINT_SETTINGS_RESOLUTION_X = "resolution-x";
/// The key used by the “Print to file” printer to store the vertical resolution
/// in DPI.
pub const PRINT_SETTINGS_RESOLUTION_Y = "resolution-y";
/// The key used by the “Print to file” printer to store whether to reverse the
/// order of the printed pages.
pub const PRINT_SETTINGS_REVERSE = "reverse";
/// The key used by the “Print to file” printer to store the scale.
pub const PRINT_SETTINGS_SCALE = "scale";
/// The key used by the “Print to file” printer to store whether to print with
/// colors.
pub const PRINT_SETTINGS_USE_COLOR = "use-color";
/// The key used by the “Print to file” printer to store 32-bit Windows extra
/// driver.
pub const PRINT_SETTINGS_WIN32_DRIVER_EXTRA = "win32-driver-extra";
/// The key used by the “Print to file” printer to store the 32-bit Windows
/// driver version.
pub const PRINT_SETTINGS_WIN32_DRIVER_VERSION = "win32-driver-version";
/// Use this priority for functionality related to size allocation.
///
/// It is used internally by GTK+ to compute the sizes of widgets.
/// This priority is higher than `GDK_PRIORITY_REDRAW` to avoid
/// resizing a widget which was just redrawn.
pub const PRIORITY_RESIZE = 110;
/// A priority that can be used when adding a `GtkStyleProvider`
/// for application-specific style information.
pub const STYLE_PROVIDER_PRIORITY_APPLICATION = 600;
/// The priority used for default style information
/// that is used in the absence of themes.
///
/// Note that this is not very useful for providing default
/// styling for custom style classes - themes are likely to
/// override styling provided at this priority with
/// catch-all `* {...}` rules.
pub const STYLE_PROVIDER_PRIORITY_FALLBACK = 1;
/// The priority used for style information provided
/// via `GtkSettings`.
///
/// This priority is higher than `GTK_STYLE_PROVIDER_PRIORITY_THEME`
/// to let settings override themes.
pub const STYLE_PROVIDER_PRIORITY_SETTINGS = 400;
/// The priority used for style information provided
/// by themes.
pub const STYLE_PROVIDER_PRIORITY_THEME = 200;
/// The priority used for the style information from
/// `$XDG_CONFIG_HOME/gtk-4.0/gtk.css`.
///
/// You should not use priorities higher than this, to
/// give the user the last word.
pub const STYLE_PROVIDER_PRIORITY_USER = 800;
/// The `GtkSvgFeatures` that are enabled by default.
pub const SVG_DEFAULT_FEATURES = 15;
/// The priority at which the text view validates onscreen lines
/// in an idle job in the background.
pub const TEXT_VIEW_PRIORITY_VALIDATE = 125;
/// Uses the default sort function in a `gtk.TreeSortable`.
///
/// See also: `gtk.TreeSortable.setSortColumnId`
pub const TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1;
/// Disables sorting in a `gtk.TreeSortable`.
///
/// See also: `gtk.TreeSortable.setSortColumnId`
pub const TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID = -2;

test {
    @setEvalBranchQuota(100_000);
    std.testing.refAllDecls(@This());
    std.testing.refAllDecls(ext);
}
