Gjsify LogoGjsify Logo

Hierarchy

  • WidgetClass

Index

Constructors

Properties

parent_class: InitiallyUnownedClass

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.

field
name: string

Methods

  • 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_PHASE_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.

    Parameters

    Returns void

  • bind_template_callback_full(widget_class: Function | GType<unknown> | Gtk.Widget, callback_name: string, callback_symbol: GObject.Callback): void
  • Declares a callback_symbol to handle callback_name from the template XML defined for widget_type.

    This function is not supported after [methodGtk.WidgetClass.set_template_scope] has been used on widget_class. See [methodGtk.BuilderCScope.add_callback_symbol].

    Note that this must be called from a composite widget classes class initializer after calling [methodGtk.WidgetClass.set_template].

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • callback_name: string

      The name of the callback as expected in the template XML

    • callback_symbol: GObject.Callback

      The callback symbol

    Returns void

  • bind_template_child_full(widget_class: Function | GType<unknown> | Gtk.Widget, name: string, internal_child: boolean, struct_offset: number): void
  • Automatically assign 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 [methodGtk.Widget.get_template_child].

    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 struct_offset that is != 0 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 [signalGtk.Widget::destroy].

    If internal_child is specified, [vfuncGtk.Buildable.get_internal_child] will be automatically implemented by the GtkWidget class so there is no need to implement it manually.

    The wrapper macros [funcGtk.widget_class_bind_template_child], [funcGtk.widget_class_bind_template_child_internal], [funcGtk.widget_class_bind_template_child_private] and [funcGtk.widget_class_bind_template_child_internal_private] might be more convenient to use.

    Note that this must be called from a composite widget classes class initializer after calling [methodGtk.WidgetClass.set_template].

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • name: string

      The “id” of the child defined in the template XML

    • internal_child: boolean

      Whether the child should be accessible as an “internal-child” when this class is used in GtkBuilder XML

    • struct_offset: number

      The structure offset into the composite widget’s instance public or private structure where the automated child pointer should be set, or 0 to not assign the pointer.

    Returns void

  • compute_expand(widget: Gtk.Widget, hexpand_p: boolean, vexpand_p: boolean): void
  • contains(widget: Gtk.Widget, x: number, y: number): boolean
  • Retrieves the accessible role used by the given GtkWidget class.

    Different accessible roles have different states, and are rendered differently by assistive technologies.

    See also: [methodGtk.Accessible.get_accessible_role].

    Parameters

    Returns AccessibleRole

  • get_activate_signal(widget_class: Function | GType<unknown> | Gtk.Widget): number
  • Retrieves the signal id for the activation signal.

    the activation signal is set using [methodGtk.WidgetClass.set_activate_signal].

    Parameters

    Returns number

  • get_css_name(widget_class: Function | GType<unknown> | Gtk.Widget): string
  • Gets the name used by this class for matching in CSS code.

    See [methodGtk.WidgetClass.set_css_name] for details.

    Parameters

    Returns string

  • Retrieves the type of the [classGtk.LayoutManager] used by widgets of class widget_class.

    See also: [methodGtk.WidgetClass.set_layout_manager_type].

    Parameters

    Returns GType<unknown>

  • This should be called at class initialization time to specify actions to be added for all instances of this class.

    Actions installed by this function are stateless. The only state they have is whether they are enabled or not.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • action_name: string

      a prefixed action name, such as "clipboard.paste"

    • parameter_type: string

      the parameter type

    • activate: WidgetActionActivateFunc

      callback to use when the action is activated

    Returns void

  • install_property_action(widget_class: Function | GType<unknown> | Gtk.Widget, action_name: string, property_name: string): void
  • 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 santity 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.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • action_name: string

      name of the action

    • property_name: string

      name of the property in instances of widget_class or any parent class.

    Returns void

  • mnemonic_activate(widget: Gtk.Widget, group_cycling: boolean): boolean
  • Returns details about the index_-th action that has been installed for widget_class during class initialization.

    See [methodGtk.WidgetClass.install_action] 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.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • index_: number

      position of the action to query

    Returns [boolean, GType<unknown>, string, VariantType, string]

  • query_tooltip(widget: Gtk.Widget, x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean
  • Sets the accessible role used by the given GtkWidget class.

    Different accessible roles have different states, and are rendered differently by assistive technologies.

    Parameters

    Returns void

  • set_activate_signal(widget_class: Function | GType<unknown> | Gtk.Widget, signal_id: number): void
  • Sets the GtkWidgetClass.activate_signal field with the given signal_id.

    The signal will be emitted when calling [methodGtk.Widget.activate].

    The signal_id must have been registered with g_signal_new() or g_signal_newv() before calling this function.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • signal_id: number

      the id for the activate signal

    Returns void

  • set_activate_signal_from_name(widget_class: Function | GType<unknown> | Gtk.Widget, signal_name: string): void
  • Sets the GtkWidgetClass.activate_signal field with the signal id for the given signal_name.

    The signal will be emitted when calling [methodGtk.Widget.activate].

    The signal_name of widget_type must have been registered with g_signal_new() or g_signal_newv() before calling this function.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • signal_name: string

      the name of the activate signal of widget_type

    Returns void

  • set_css_name(widget_class: Function | GType<unknown> | Gtk.Widget, name: string): void
  • 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".

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • name: string

      name to use

    Returns void

  • set_layout_manager_type(widget_class: Function | GType<unknown> | Gtk.Widget, type: GType<unknown>): void
  • Sets the type to be used for creating layout managers for widgets of widget_class.

    The given type must be a subtype of [classGtk.LayoutManager].

    This function should only be called from class init functions of widgets.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • type: GType<unknown>

      The object type that implements the GtkLayoutManager for widget_class

    Returns void

  • set_template(widget_class: Function | GType<unknown> | Gtk.Widget, template_bytes: Bytes): void
  • This should be called at class initialization time to specify the GtkBuilder XML to be used to extend a widget.

    For convenience, [methodGtk.WidgetClass.set_template_from_resource] is also provided.

    Note that any class that installs templates must call [methodGtk.Widget.init_template] in the widget’s instance initializer.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • template_bytes: Bytes

      A GBytes holding the GtkBuilder XML

    Returns void

  • set_template_from_resource(widget_class: Function | GType<unknown> | Gtk.Widget, resource_name: string): void
  • A convenience function that calls [methodGtk.WidgetClass.set_template] with the contents of a GResource.

    Note that any class that installs templates must call [methodGtk.Widget.init_template] in the widget’s instance initializer.

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • resource_name: string

      The name of the resource to load the template from

    Returns void

  • For use in language bindings, this will override the default GtkBuilderScope to be used when parsing GtkBuilder XML from this class’s template data.

    Note that this must be called from a composite widget classes class initializer after calling [methodGtkWidgetClass.set_template].

    Parameters

    • widget_class: Function | GType<unknown> | Gtk.Widget
    • scope: BuilderScope

      The GtkBuilderScope to use when loading the class template

    Returns void

  • size_allocate(widget: Gtk.Widget, width: number, height: number, baseline: number): void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method