LinkButton

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.LinkButton.new_ or gtk.link_button.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.link_button.LinkButton.setUri, and retrieved using gtk.link_button.LinkButton.getUri.

By default, GtkLinkButton calls gtk.global.showUriOnWindow when the button is clicked. This behaviour can be overridden by connecting to the #GtkLinkButton::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 #GtkButton, it gets the .link style class.

Constructors

this
this(void* ptr, Flag!"Take" take)
this
this(string uri)

Creates a new #GtkLinkButton with the URI as its text.

Members

Functions

connectActivateLink
gulong connectActivateLink(T callback, Flag!"After" after)

Connect to ActivateLink signal.

getUri
string getUri()

Retrieves the URI set using gtk.link_button.LinkButton.setUri.

getVisited
bool getVisited()

Retrieves the “visited” state of the URI where the #GtkLinkButton points. The button becomes visited when it is clicked. If the URI is changed on the button, the “visited” state is unset again.

self
LinkButton self()

Returns this, for use in with statements.

setUri
void setUri(string uri)

Sets uri as the URI where the #GtkLinkButton points. As a side-effect this unsets the “visited” state of the button.

setVisited
void setVisited(bool visited)

Sets the “visited” state of the URI where the #GtkLinkButton points. See gtk.link_button.LinkButton.getVisited for more details.

Properties

_gType
GType _gType [@property getter]
uri
string uri [@property getter]

Get uri property.

uri
string uri [@property setter]

Set uri property.

visited
bool visited [@property getter]

Get visited property.

visited
bool visited [@property setter]

Set visited property.

Static functions

_getGType
GType _getGType()
builder
LinkButtonGidBuilder builder()

Get builder for gtk.link_button.LinkButton

newWithLabel
gtk.link_button.LinkButton newWithLabel(string uri, string label)

Creates a new #GtkLinkButton containing a label.

Inherited Members

From Button

_getGType
GType _getGType()
_gType
GType _gType [@property getter]
self
Button self()

Returns this, for use in with statements.

builder
ButtonGidBuilder builder()

Get builder for gtk.button.Button

alwaysShowImage
bool alwaysShowImage [@property getter]

Get alwaysShowImage property.

alwaysShowImage
bool alwaysShowImage [@property setter]

Set alwaysShowImage property.

image
gtk.widget.Widget image [@property getter]

Get image property.

image
gtk.widget.Widget image [@property setter]

Set image property.

imagePosition
gtk.types.PositionType imagePosition [@property getter]

Get imagePosition property.

imagePosition
gtk.types.PositionType imagePosition [@property setter]

Set imagePosition property.

label
string label [@property getter]
label
string label [@property setter]
relief
gtk.types.ReliefStyle relief [@property getter]
relief
gtk.types.ReliefStyle relief [@property setter]
useStock
bool useStock [@property getter]
useStock
bool useStock [@property setter]
useUnderline
bool useUnderline [@property getter]
useUnderline
bool useUnderline [@property setter]
xalign
float xalign [@property getter]

Get xalign property.

xalign
float xalign [@property setter]

Set xalign property.

yalign
float yalign [@property getter]

Get yalign property.

yalign
float yalign [@property setter]

Set yalign property.

newFromIconName
gtk.button.Button newFromIconName(string iconName, gtk.types.IconSize size)

Creates a new button containing an icon from the current icon theme.

newFromStock
gtk.button.Button newFromStock(string stockId)

Creates a new #GtkButton containing the image and text from a [stock item]gtkstock. Some stock ids have preprocessor macros like #GTK_STOCK_OK and #GTK_STOCK_APPLY.

newWithLabel
gtk.button.Button newWithLabel(string label)

Creates a #GtkButton widget with a #GtkLabel child containing the given text.

newWithMnemonic
gtk.button.Button newWithMnemonic(string 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 Alt and that key activates the button.

clicked
void clicked()

Emits a #GtkButton::clicked signal to the given #GtkButton.

enter
void enter()

Emits a #GtkButton::enter signal to the given #GtkButton.

getAlignment
void getAlignment(float xalign, float yalign)

Gets the alignment of the child in the button.

getAlwaysShowImage
bool getAlwaysShowImage()

Returns whether the button will ignore the #GtkSettings:gtk-button-images setting and always show the image, if available.

getEventWindow
gdk.window.Window getEventWindow()

Returns the button’s event window if it is realized, null otherwise. This function should be rarely needed.

getFocusOnClick
bool getFocusOnClick()

Returns whether the button grabs focus when it is clicked with the mouse. See gtk.button.Button.setFocusOnClick.

getImage
gtk.widget.Widget getImage()

Gets the widget that is currenty set as the image of button. This may have been explicitly set by gtk.button.Button.setImage or constructed by gtk.button.Button.newFromStock.

getImagePosition
gtk.types.PositionType getImagePosition()

Gets the position of the image relative to the text inside the button.

getLabel
string getLabel()

Fetches the text from the label of the button, as set by gtk.button.Button.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.Button.new_ to use as a container.

getRelief
gtk.types.ReliefStyle getRelief()

Returns the current relief style of the given #GtkButton.

getUseStock
bool getUseStock()

Returns whether the button label is a stock item.

getUseUnderline
bool getUseUnderline()

Returns whether an embedded underline in the button label indicates a mnemonic. See gtk_button_set_use_underline ().

leave
void leave()

Emits a #GtkButton::leave signal to the given #GtkButton.

pressed
void pressed()

Emits a #GtkButton::pressed signal to the given #GtkButton.

released
void released()

Emits a #GtkButton::released signal to the given #GtkButton.

setAlignment
void setAlignment(float xalign, float yalign)

Sets the alignment of the child. This property has no effect unless the child is a #GtkMisc or a #GtkAlignment.

setAlwaysShowImage
void setAlwaysShowImage(bool alwaysShow)

If true, the button will ignore the #GtkSettings:gtk-button-images setting and always show the image, if available.

setFocusOnClick
void setFocusOnClick(bool focusOnClick)

Sets whether the button will 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.

setImage
void setImage(gtk.widget.Widget image)

Set the image of button to the given widget. The image will be displayed if the label text is null or if #GtkButton:always-show-image is true. You don’t have to call gtk.widget.Widget.show on image yourself.

setImagePosition
void setImagePosition(gtk.types.PositionType position)

Sets the position of the image relative to the text inside the button.

setLabel
void setLabel(string label)

Sets the text of the label of the button to str. This text is also used to select the stock item if gtk.button.Button.setUseStock is used.

setRelief
void setRelief(gtk.types.ReliefStyle relief)

Sets the relief style of the edges of the given #GtkButton widget. Two styles exist, gtk.types.ReliefStyle.Normal and gtk.types.ReliefStyle.None. The default style is, as one can guess, gtk.types.ReliefStyle.Normal. The deprecated value gtk.types.ReliefStyle.Half behaves the same as gtk.types.ReliefStyle.Normal.

setUseStock
void setUseStock(bool useStock)

If true, the label set on the button is used as a stock id to select the stock item for the button.

setUseUnderline
void setUseUnderline(bool useUnderline)

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

connectActivate
gulong connectActivate(T callback, Flag!"After" after)

Connect to Activate signal.

connectClicked
gulong connectClicked(T callback, Flag!"After" after)

Connect to Clicked signal.

connectEnter
gulong connectEnter(T callback, Flag!"After" after)

Connect to Enter signal.

connectLeave
gulong connectLeave(T callback, Flag!"After" after)

Connect to Leave signal.

connectPressed
gulong connectPressed(T callback, Flag!"After" after)

Connect to Pressed signal.

connectReleased
gulong connectReleased(T callback, Flag!"After" after)

Connect to Released signal.