Gtk.Link_Button

Entities

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

A GtkLinkButton is a Gtk.Button.Gtk_Button with a hyperlink, similar to the one used by web browsers, which triggers an action when clicked. It is useful to show quick links to resources.

A link button is created by calling either Gtk.Link_Button.Gtk_New or Gtk.Link_Button.Gtk_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 Gtk.Link_Button.Set_Uri, and retrieved using Gtk.Link_Button.Get_Uri.

By default, GtkLinkButton calls gtk_show_uri_on_window when the button is clicked. This behaviour can be overridden by connecting to the Gtk.Link_Button.Gtk_Link_Button::activate-link signal and returning True from the signal handler.

# CSS nodes

GtkLinkButton has a single CSS node with name button. To differentiate it from a plain Gtk.Button.Gtk_Button, it gets the .link style class.

<group>Buttons and Toggles</group>

"+"

function "+"
  (Widget : access Gtk_Link_Button_Record'Class)
return Gtk.Actionable.Gtk_Actionable
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Link_Button_Record'Class)
return Gtk.Activatable.Gtk_Activatable
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Link_Button_Record'Class)
return Gtk.Buildable.Gtk_Buildable
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Actionable.Gtk_Actionable)
return Gtk_Link_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Activatable.Gtk_Activatable)
return Gtk_Link_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Link_Button
Parameters
Interf
Return Value

Cb_GObject_Boolean

type Cb_GObject_Boolean is not null access function
  (Self : access Glib.Object.GObject_Record'Class)
return Boolean;
Parameters
Self
Return Value

Cb_Gtk_Link_Button_Boolean

type Cb_Gtk_Link_Button_Boolean is not null access function
  (Self : access Gtk_Link_Button_Record'Class) return Boolean;
Parameters
Self
Return Value

Do_Set_Related_Action

procedure Do_Set_Related_Action
   (Self   : not null access Gtk_Link_Button_Record;
    Action : not null access Gtk.Action.Gtk_Action_Record'Class)
Parameters
Self
Action

Get_Action_Name

function Get_Action_Name
   (Self : not null access Gtk_Link_Button_Record) return UTF8_String
Parameters
Self
Return Value

Get_Action_Target_Value

function Get_Action_Target_Value
   (Self : not null access Gtk_Link_Button_Record)
    return Glib.Variant.Gvariant
Parameters
Self
Return Value

Get_Related_Action

function Get_Related_Action
   (Self : not null access Gtk_Link_Button_Record)
    return Gtk.Action.Gtk_Action
Parameters
Self
Return Value

Get_Type

function Get_Type return Glib.GType
Return Value

Get_Uri

function Get_Uri
   (Widget : not null access Gtk_Link_Button_Record) return UTF8_String

Retrieves the URI set using Gtk.Link_Button.Set_Uri. Since: gtk+ 2.10

Parameters
Widget
Return Value

a valid URI. The returned string is owned by the link button and should not be modified or freed.

Get_Use_Action_Appearance

function Get_Use_Action_Appearance
   (Self : not null access Gtk_Link_Button_Record) return Boolean
Parameters
Self
Return Value

Get_Visited

function Get_Visited
   (Widget : not null access Gtk_Link_Button_Record) return Boolean

Retrieves the "visited" state of the URI where the Gtk.Link_Button.Gtk_Link_Button points. 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.Link_Button.Set_Visited. Since: gtk+ 2.14

Parameters
Widget
Return Value

True if the link has been visited, False otherwise

Gtk_Link_Button

type Gtk_Link_Button is access all Gtk_Link_Button_Record'Class;

Gtk_Link_Button_New

function Gtk_Link_Button_New (URI : UTF8_String) return Gtk_Link_Button

Creates a new Gtk.Link_Button.Gtk_Link_Button with the URI as its text. Since: gtk+ 2.10

Parameters
URI

a valid URI

Return Value

Gtk_Link_Button_New_With_Label

function Gtk_Link_Button_New_With_Label
   (URI   : UTF8_String;
    Label : UTF8_String := "") return Gtk_Link_Button

Creates a new Gtk.Link_Button.Gtk_Link_Button containing a label. Since: gtk+ 2.10

Parameters
URI

a valid URI

Label

the text of the button

Return Value

Gtk_Link_Button_Record

type Gtk_Link_Button_Record is new Gtk_Button_Record with null record;

Gtk_New

procedure Gtk_New (Widget : out Gtk_Link_Button; URI : UTF8_String)

Creates a new Gtk.Link_Button.Gtk_Link_Button with the URI as its text. Since: gtk+ 2.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Widget
URI

a valid URI

Gtk_New_With_Label

procedure Gtk_New_With_Label
   (Widget : out Gtk_Link_Button;
    URI    : UTF8_String;
    Label  : UTF8_String := "")

Creates a new Gtk.Link_Button.Gtk_Link_Button containing a label. Since: gtk+ 2.10 Initialize_With_Label does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Widget
URI

a valid URI

Label

the text of the button

Implements_Gtk_Actionable

package Implements_Gtk_Actionable is new Glib.Types.Implements
  (Gtk.Actionable.Gtk_Actionable, Gtk_Link_Button_Record, Gtk_Link_Button);

Implements_Gtk_Activatable

package Implements_Gtk_Activatable is new Glib.Types.Implements
  (Gtk.Activatable.Gtk_Activatable, Gtk_Link_Button_Record, Gtk_Link_Button);

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_Link_Button_Record, Gtk_Link_Button);

Initialize

procedure Initialize
   (Widget : not null access Gtk_Link_Button_Record'Class;
    URI    : UTF8_String)

Creates a new Gtk.Link_Button.Gtk_Link_Button with the URI as its text. Since: gtk+ 2.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Widget
URI

a valid URI

Initialize_With_Label

procedure Initialize_With_Label
   (Widget : not null access Gtk_Link_Button_Record'Class;
    URI    : UTF8_String;
    Label  : UTF8_String := "")

Creates a new Gtk.Link_Button.Gtk_Link_Button containing a label. Since: gtk+ 2.10 Initialize_With_Label does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Widget
URI

a valid URI

Label

the text of the button

On_Activate_Link

procedure On_Activate_Link
   (Self  : not null access Gtk_Link_Button_Record;
    Call  : Cb_GObject_Boolean;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

The ::activate-link signal is emitted each time the Gtk.Link_Button.Gtk_Link_Button has been clicked.

The default handler will call gtk_show_uri_on_window with the URI stored inside the Gtk.Link_Button.Gtk_Link_Button: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.

Parameters
Self
Call
Slot
After

On_Activate_Link

procedure On_Activate_Link
   (Self  : not null access Gtk_Link_Button_Record;
    Call  : Cb_Gtk_Link_Button_Boolean;
    After : Boolean := False)

The ::activate-link signal is emitted each time the Gtk.Link_Button.Gtk_Link_Button has been clicked.

The default handler will call gtk_show_uri_on_window with the URI stored inside the Gtk.Link_Button.Gtk_Link_Button: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.

Parameters
Self
Call
After

Set_Action_Name

procedure Set_Action_Name
   (Self        : not null access Gtk_Link_Button_Record;
    Action_Name : UTF8_String := "")
Parameters
Self
Action_Name

Set_Action_Target_Value

procedure Set_Action_Target_Value
   (Self         : not null access Gtk_Link_Button_Record;
    Target_Value : Glib.Variant.Gvariant)
Parameters
Self
Target_Value

Set_Detailed_Action_Name

procedure Set_Detailed_Action_Name
   (Self                 : not null access Gtk_Link_Button_Record;
    Detailed_Action_Name : UTF8_String)
Parameters
Self
Detailed_Action_Name

Set_Related_Action

procedure Set_Related_Action
   (Self   : not null access Gtk_Link_Button_Record;
    Action : not null access Gtk.Action.Gtk_Action_Record'Class)
Parameters
Self
Action

Set_Uri

procedure Set_Uri
   (Widget : not null access Gtk_Link_Button_Record;
    URI    : UTF8_String)

Sets Uri as the URI where the Gtk.Link_Button.Gtk_Link_Button points. As a side-effect this unsets the "visited" state of the button. Since: gtk+ 2.10

Parameters
Widget
URI

a valid URI

Set_Use_Action_Appearance

procedure Set_Use_Action_Appearance
   (Self           : not null access Gtk_Link_Button_Record;
    Use_Appearance : Boolean)
Parameters
Self
Use_Appearance

Set_Visited

procedure Set_Visited
   (Widget  : not null access Gtk_Link_Button_Record;
    Visited : Boolean)

Sets the "visited" state of the URI where the Gtk.Link_Button.Gtk_Link_Button points. See Gtk.Link_Button.Get_Visited for more details. Since: gtk+ 2.14

Parameters
Widget
Visited

the new "visited" state

Signal_Activate_Link

Signal_Activate_Link : constant Glib.Signal_Name := "activate-link";

The ::activate-link signal is emitted each time the Gtk.Link_Button.Gtk_Link_Button has been clicked.

The default handler will call gtk_show_uri_on_window with the URI stored inside the Gtk.Link_Button.Gtk_Link_Button: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.

Sync_Action_Properties

procedure Sync_Action_Properties
   (Self   : not null access Gtk_Link_Button_Record;
    Action : access Gtk.Action.Gtk_Action_Record'Class)
Parameters
Self
Action

URI_Property

URI_Property : constant Glib.Properties.Property_String;

The URI bound to this button.

Visited_Property

Visited_Property : constant Glib.Properties.Property_Boolean;

The 'visited' state of this button. A visited link is drawn in a different color.