LinkButton


Object Hierarchy:

Gtk.LinkButton Gtk.LinkButton Gtk.LinkButton Gtk.Button Gtk.Button Gtk.Button->Gtk.LinkButton Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Button GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.LinkButton Gtk.Accessible->Gtk.Button Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.LinkButton Gtk.Buildable->Gtk.Button Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.LinkButton Gtk.ConstraintTarget->Gtk.Button Gtk.ConstraintTarget->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.LinkButton Gtk.Actionable->Gtk.Button

Description:

[ CCode ( type_id = "gtk_link_button_get_type ()" ) ]
public sealed class LinkButton : Button, Accessible, Actionable, Buildable, ConstraintTarget

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 [ctor@Gtk.LinkButton.new] or [ctor@Gtk.LinkButton.new_with_label]. 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 [method@Gtk.LinkButton.set_uri].

By default, `GtkLinkButton` calls [method@Gtk.FileLauncher.launch] when the button is clicked. This behaviour can be overridden by connecting to the [signal@Gtk.LinkButton:GtkLinkButton: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 [enum@Gtk.AccessibleRole.link] role.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Widget