GtkLinkButton

GtkLinkButton — Create buttons bound to a URL

Synopsis


#include <gtk/gtk.h>


                    GtkLinkButton;
GtkWidget*          gtk_link_button_new                 (const gchar *uri);
GtkWidget*          gtk_link_button_new_with_label      (const gchar *uri,
                                                         const gchar *label);
const gchar*        gtk_link_button_get_uri             (GtkLinkButton *link_button);
void                gtk_link_button_set_uri             (GtkLinkButton *link_button,
                                                         const gchar *uri);
void                (*GtkLinkButtonUriFunc)             (GtkLinkButton *button,
                                                         const gchar *link,
                                                         gpointer user_data);
GtkLinkButtonUriFunc gtk_link_button_set_uri_hook       (GtkLinkButtonUriFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);


Object Hierarchy


  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkButton
                                       +----GtkLinkButton

Implemented Interfaces

GtkLinkButton implements AtkImplementorIface.

Properties


  "uri"                      gchararray            : Read / Write

Description

A GtkLinkButton is a GtkButton 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_new() or gtk_link_button_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().

GtkLinkButton offers a global hook, which is called when the used clicks on it: see gtk_link_button_set_uri_hook().

GtkLinkButton was added in GTK+ 2.10.

Details

GtkLinkButton

typedef struct _GtkLinkButton GtkLinkButton;

The GtkLinkButton struct contains private data only, and should be manipulated using the functions below.


gtk_link_button_new ()

GtkWidget*          gtk_link_button_new                 (const gchar *uri);

Creates a new GtkLinkButton with the URI as its text.

uri : a valid URI
Returns : a new link button widget.

Since 2.10


gtk_link_button_new_with_label ()

GtkWidget*          gtk_link_button_new_with_label      (const gchar *uri,
                                                         const gchar *label);

Creates a new GtkLinkButton containing a label.

uri : a valid URI
label : the text of the button
Returns : a new link button widget.

Since 2.10


gtk_link_button_get_uri ()

const gchar*        gtk_link_button_get_uri             (GtkLinkButton *link_button);

Retrieves the URI set using gtk_link_button_set_uri().

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

Since 2.10


gtk_link_button_set_uri ()

void                gtk_link_button_set_uri             (GtkLinkButton *link_button,
                                                         const gchar *uri);

Sets uri as the URI where the GtkLinkButton points.

link_button : a GtkLinkButton
uri : a valid URI

Since 2.10


GtkLinkButtonUriFunc ()

void                (*GtkLinkButtonUriFunc)             (GtkLinkButton *button,
                                                         const gchar *link,
                                                         gpointer user_data);

The type of a function which is called when the GtkLinkButton is clicked.

button : the GtkLinkButton which was clicked
link : the URI to which the clicked GtkLinkButton points
user_data :

gtk_link_button_set_uri_hook ()

GtkLinkButtonUriFunc gtk_link_button_set_uri_hook       (GtkLinkButtonUriFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);

Sets func as the function that should be invoked every time a user clicks a GtkLinkButton. This function is called before every callback registered for the "clicked" signal.

func : a function called each time a GtkLinkButton is clicked, or NULL
data : user data to be passed to func, or NULL
destroy : a GDestroyNotify that gets called when data is no longer needed, or NULL
Returns : the previously set hook function.

Since 2.10

Property Details

The "uri" property

  "uri"                      gchararray            : Read / Write

The URI bound to this button.

Default value: "http://www.gtk.org"

Since 2.10

See Also

GtkButton