Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A GtkLinkButton is a 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 linkButtonNew
or
linkButtonNewWithLabel
. 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
linkButtonSetUri
, and retrieved using linkButtonGetUri
.
By default, GtkLinkButton calls showUriOnWindow
when the button is
clicked. This behaviour can be overridden by connecting to the
LinkButton
::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 Button
, it gets the .link style class.
Synopsis
- newtype LinkButton = LinkButton (ManagedPtr LinkButton)
- class GObject o => IsLinkButton o
- toLinkButton :: (MonadIO m, IsLinkButton o) => o -> m LinkButton
- noLinkButton :: Maybe LinkButton
- linkButtonGetUri :: (HasCallStack, MonadIO m, IsLinkButton a) => a -> m Text
- linkButtonGetVisited :: (HasCallStack, MonadIO m, IsLinkButton a) => a -> m Bool
- linkButtonNew :: (HasCallStack, MonadIO m) => Text -> m LinkButton
- linkButtonNewWithLabel :: (HasCallStack, MonadIO m) => Text -> Maybe Text -> m LinkButton
- linkButtonSetUri :: (HasCallStack, MonadIO m, IsLinkButton a) => a -> Text -> m ()
- linkButtonSetVisited :: (HasCallStack, MonadIO m, IsLinkButton a) => a -> Bool -> m ()
- constructLinkButtonUri :: IsLinkButton o => Text -> IO (GValueConstruct o)
- getLinkButtonUri :: (MonadIO m, IsLinkButton o) => o -> m Text
- setLinkButtonUri :: (MonadIO m, IsLinkButton o) => o -> Text -> m ()
- constructLinkButtonVisited :: IsLinkButton o => Bool -> IO (GValueConstruct o)
- getLinkButtonVisited :: (MonadIO m, IsLinkButton o) => o -> m Bool
- setLinkButtonVisited :: (MonadIO m, IsLinkButton o) => o -> Bool -> m ()
- type C_LinkButtonActivateLinkCallback = Ptr () -> Ptr () -> IO CInt
- type LinkButtonActivateLinkCallback = IO Bool
- afterLinkButtonActivateLink :: (IsLinkButton a, MonadIO m) => a -> LinkButtonActivateLinkCallback -> m SignalHandlerId
- genClosure_LinkButtonActivateLink :: LinkButtonActivateLinkCallback -> IO Closure
- mk_LinkButtonActivateLinkCallback :: C_LinkButtonActivateLinkCallback -> IO (FunPtr C_LinkButtonActivateLinkCallback)
- noLinkButtonActivateLinkCallback :: Maybe LinkButtonActivateLinkCallback
- onLinkButtonActivateLink :: (IsLinkButton a, MonadIO m) => a -> LinkButtonActivateLinkCallback -> m SignalHandlerId
- wrap_LinkButtonActivateLinkCallback :: LinkButtonActivateLinkCallback -> C_LinkButtonActivateLinkCallback
Exported types
newtype LinkButton Source #
Memory-managed wrapper type.
Instances
GObject LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton gobjectType :: LinkButton -> IO GType # | |
IsImplementorIface LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsObject LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsActionable LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsActivatable LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsBuildable LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsBin LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsButton LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsContainer LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsWidget LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsLinkButton LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton |
class GObject o => IsLinkButton o Source #
Type class for types which can be safely cast to LinkButton
, for instance with toLinkButton
.
Instances
(GObject a, (UnknownAncestorError LinkButton a :: Constraint)) => IsLinkButton a Source # | |
Defined in GI.Gtk.Objects.LinkButton | |
IsLinkButton LinkButton Source # | |
Defined in GI.Gtk.Objects.LinkButton |
toLinkButton :: (MonadIO m, IsLinkButton o) => o -> m LinkButton Source #
Cast to LinkButton
, for types for which this is known to be safe. For general casts, use castTo
.
noLinkButton :: Maybe LinkButton Source #
A convenience alias for Nothing
:: Maybe
LinkButton
.
Methods
getUri
:: (HasCallStack, MonadIO m, IsLinkButton a) | |
=> a |
|
-> m Text | Returns: a valid URI. The returned string is owned by the link button and should not be modified or freed. |
Retrieves the URI set using linkButtonSetUri
.
Since: 2.10
getVisited
:: (HasCallStack, MonadIO m, IsLinkButton a) | |
=> a |
|
-> m Bool |
Retrieves the “visited” state of the URI where the LinkButton
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 linkButtonSetVisited
.
Since: 2.14
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m LinkButton | Returns: a new link button widget. |
Creates a new LinkButton
with the URI as its text.
Since: 2.10
newWithLabel
linkButtonNewWithLabel Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Maybe Text |
|
-> m LinkButton | Returns: a new link button widget. |
Creates a new LinkButton
containing a label.
Since: 2.10
setUri
:: (HasCallStack, MonadIO m, IsLinkButton a) | |
=> a |
|
-> Text |
|
-> m () |
Sets uri
as the URI where the LinkButton
points. As a side-effect
this unsets the “visited” state of the button.
Since: 2.10
setVisited
:: (HasCallStack, MonadIO m, IsLinkButton a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets the “visited” state of the URI where the LinkButton
points. See linkButtonGetVisited
for more details.
Since: 2.14
Properties
uri
The URI bound to this button.
Since: 2.10
constructLinkButtonUri :: IsLinkButton o => Text -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “uri
” property. This is rarely needed directly, but it is used by new
.
getLinkButtonUri :: (MonadIO m, IsLinkButton o) => o -> m Text Source #
Get the value of the “uri
” property.
When overloading is enabled, this is equivalent to
get
linkButton #uri
setLinkButtonUri :: (MonadIO m, IsLinkButton o) => o -> Text -> m () Source #
Set the value of the “uri
” property.
When overloading is enabled, this is equivalent to
set
linkButton [ #uri:=
value ]
visited
The 'visited' state of this button. A visited link is drawn in a different color.
Since: 2.14
constructLinkButtonVisited :: IsLinkButton o => Bool -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “visited
” property. This is rarely needed directly, but it is used by new
.
getLinkButtonVisited :: (MonadIO m, IsLinkButton o) => o -> m Bool Source #
Get the value of the “visited
” property.
When overloading is enabled, this is equivalent to
get
linkButton #visited
setLinkButtonVisited :: (MonadIO m, IsLinkButton o) => o -> Bool -> m () Source #
Set the value of the “visited
” property.
When overloading is enabled, this is equivalent to
set
linkButton [ #visited:=
value ]
Signals
activateLink
type C_LinkButtonActivateLinkCallback = Ptr () -> Ptr () -> IO CInt Source #
Type for the callback on the (unwrapped) C side.
type LinkButtonActivateLinkCallback = IO Bool Source #
The ::activate-link signal is emitted each time the LinkButton
has been clicked.
The default handler will call showUriOnWindow
with the URI stored inside
the LinkButton
: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.
afterLinkButtonActivateLink :: (IsLinkButton a, MonadIO m) => a -> LinkButtonActivateLinkCallback -> m SignalHandlerId Source #
Connect a signal handler for the “activate-link
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
linkButton #activateLink callback
genClosure_LinkButtonActivateLink :: LinkButtonActivateLinkCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_LinkButtonActivateLinkCallback :: C_LinkButtonActivateLinkCallback -> IO (FunPtr C_LinkButtonActivateLinkCallback) Source #
Generate a function pointer callable from C code, from a C_LinkButtonActivateLinkCallback
.
noLinkButtonActivateLinkCallback :: Maybe LinkButtonActivateLinkCallback Source #
A convenience synonym for
.Nothing
:: Maybe
LinkButtonActivateLinkCallback
onLinkButtonActivateLink :: (IsLinkButton a, MonadIO m) => a -> LinkButtonActivateLinkCallback -> m SignalHandlerId Source #
Connect a signal handler for the “activate-link
” signal, to be run before the default handler.
When overloading is enabled, this is equivalent to
on
linkButton #activateLink callback