Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
- Exported types
- Methods
- Overloaded methods
- getAngle
- getAttributes
- getCurrentUri
- getEllipsize
- getJustify
- getLabel
- getLayout
- getLayoutOffsets
- getLineWrap
- getLineWrapMode
- getLines
- getMaxWidthChars
- getMnemonicKeyval
- getMnemonicWidget
- getSelectable
- getSelectionBounds
- getSingleLineMode
- getText
- getTrackVisitedLinks
- getUseMarkup
- getUseUnderline
- getWidthChars
- getXalign
- getYalign
- new
- newWithMnemonic
- selectRegion
- setAngle
- setAttributes
- setEllipsize
- setJustify
- setLabel
- setLineWrap
- setLineWrapMode
- setLines
- setMarkup
- setMarkupWithMnemonic
- setMaxWidthChars
- setMnemonicWidget
- setPattern
- setSelectable
- setSingleLineMode
- setText
- setTextWithMnemonic
- setTrackVisitedLinks
- setUseMarkup
- setUseUnderline
- setWidthChars
- setXalign
- setYalign
- Properties
- Signals
The Label
widget displays a small amount of text. As the name
implies, most labels are used to label another widget such as a
Button
, a MenuItem
, or a ComboBox
.
CSS nodes
plain code
label ├── [selection] ├── [link] ┊ ╰── [link]
GtkLabel has a single CSS node with the name label. A wide variety
of style classes may be applied to labels, such as .title, .subtitle,
.dim-label, etc. In the ShortcutsWindow
, labels are used wth the
.keycap style class.
If the label has a selection, it gets a subnode with name selection.
If the label has links, there is one subnode per link. These subnodes carry the link or visited state depending on whether they have been visited.
GtkLabel as GtkBuildable
The GtkLabel implementation of the GtkBuildable interface supports a
custom <attributes> element, which supports any number of <attribute>
elements. The <attribute> element has attributes named “name“, “value“,
“start“ and “end“ and allows you to specify Attribute
values for
this label.
An example of a UI definition fragment specifying Pango attributes: > >class="GtkLabel" > attributes > name="weight" value="PANGO_WEIGHT_BOLD"/ > name="background" value="red" start="5" end="10"/ > /attributes >/object
The start and end attributes specify the range of characters to which the Pango attribute applies. If start and end are not specified, the attribute is applied to the whole text. Note that specifying ranges does not make much sense with translatable attributes. Use markup embedded in the translatable content instead.
Mnemonics
Labels may contain “mnemonics”. Mnemonics are
underlined characters in the label, used for keyboard navigation.
Mnemonics are created by providing a string with an underscore before
the mnemonic character, such as "_File"
, to the
functions labelNewWithMnemonic
or
labelSetTextWithMnemonic
.
Mnemonics automatically activate any activatable widget the label is
inside, such as a Button
; if the label is not inside the
mnemonic’s target widget, you have to tell the label about the target
using labelSetMnemonicWidget
. Here’s a simple example where
the label is inside a button:
C code
// Pressing Alt+H will activate this button GtkWidget *button = gtk_button_new (); GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello"); gtk_container_add (GTK_CONTAINER (button), label);
There’s a convenience function to create buttons with a mnemonic label already inside:
C code
// Pressing Alt+H will activate this button GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
To create a mnemonic for a widget alongside the label, such as a
Entry
, you have to point the label at the entry with
labelSetMnemonicWidget
:
C code
// Pressing Alt+H will focus the entry GtkWidget *entry = gtk_entry_new (); GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
Markup (styled text)
To make it easy to format text in a label (changing colors, fonts, etc.), label text can be provided in a simple [markup format][PangoMarkupFormat].
Here’s how to create a label with a small font:
C code
GtkWidget *label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
(See [complete documentation][PangoMarkupFormat] of available tags in the Pango manual.)
The markup passed to labelSetMarkup
must be valid; for example,
literal <, > and & characters must be escaped as <, >, and &.
If you pass text obtained from the user, file, or a network to
labelSetMarkup
, you’ll want to escape it with
markupEscapeText
or g_markup_printf_escaped()
.
Markup strings are just a convenient way to set the AttrList
on
a label; labelSetAttributes
may be a simpler way to set
attributes in some cases. Be careful though; AttrList
tends to
cause internationalization problems, unless you’re applying attributes
to the entire string (i.e. unless you set the range of each attribute
to [0, G_MAXINT
)). The reason is that specifying the start_index and
end_index for a Attribute
requires knowledge of the exact string
being displayed, so translations will cause problems.
Selectable labels
Labels can be made selectable with labelSetSelectable
.
Selectable labels allow the user to copy the label contents to
the clipboard. Only labels that contain useful-to-copy information
— such as error messages — should be made selectable.
A label can contain any number of paragraphs, but will have performance problems if it contains more than a small number. Paragraphs are separated by newlines or other paragraph separators understood by Pango.
Labels can automatically wrap text if you call
labelSetLineWrap
.
labelSetJustify
sets how the lines in a label align
with one another. If you want to set how the label as a whole
aligns in its available space, see the Widget
:halign
and
Widget
:valign
properties.
The Label
:width-chars
and Label
:max-width-chars
properties
can be used to control the size allocation of ellipsized or wrapped
labels. For ellipsizing labels, if either is specified (and less
than the actual text size), it is used as the minimum width, and the actual
text size is used as the natural width of the label. For wrapping labels,
width-chars is used as the minimum width, if specified, and max-width-chars
is used as the natural width. Even if max-width-chars specified, wrapping
labels will be rewrapped to use all of the available width.
Note that the interpretation of Label
:width-chars
and
Label
:max-width-chars
has changed a bit with the introduction of
[width-for-height geometry management.][geometry-management]
Links
Since 2.18, GTK+ supports markup for clickable hyperlinks in addition
to regular Pango markup. The markup for links is borrowed from HTML,
using the <a>
with “href“ and “title“ attributes. GTK+ renders links
similar to the way they appear in web browsers, with colored, underlined
text. The “title“ attribute is displayed as a tooltip on the link.
An example looks like this:
C code
const gchar *text = "Go to the" "<a href=\"http://www.gtk.org title=\"<i>Our</i> website\">" "GTK+ website</a> for more..."; GtkWidget *label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), text);
It is possible to implement custom handling for links and their tooltips with
the activateLink signal and the labelGetCurrentUri
function.
Synopsis
- newtype Label = Label (ManagedPtr Label)
- class (GObject o, IsDescendantOf Label o) => IsLabel o
- toLabel :: (MonadIO m, IsLabel o) => o -> m Label
- labelGetAngle :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Double
- labelGetAttributes :: (HasCallStack, MonadIO m, IsLabel a) => a -> m (Maybe AttrList)
- labelGetCurrentUri :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Text
- labelGetEllipsize :: (HasCallStack, MonadIO m, IsLabel a) => a -> m EllipsizeMode
- labelGetJustify :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Justification
- labelGetLabel :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Text
- labelGetLayout :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Layout
- labelGetLayoutOffsets :: (HasCallStack, MonadIO m, IsLabel a) => a -> m (Int32, Int32)
- labelGetLineWrap :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Bool
- labelGetLineWrapMode :: (HasCallStack, MonadIO m, IsLabel a) => a -> m WrapMode
- labelGetLines :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Int32
- labelGetMaxWidthChars :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Int32
- labelGetMnemonicKeyval :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Word32
- labelGetMnemonicWidget :: (HasCallStack, MonadIO m, IsLabel a) => a -> m (Maybe Widget)
- labelGetSelectable :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Bool
- labelGetSelectionBounds :: (HasCallStack, MonadIO m, IsLabel a) => a -> m (Bool, Int32, Int32)
- labelGetSingleLineMode :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Bool
- labelGetText :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Text
- labelGetTrackVisitedLinks :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Bool
- labelGetUseMarkup :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Bool
- labelGetUseUnderline :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Bool
- labelGetWidthChars :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Int32
- labelGetXalign :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Float
- labelGetYalign :: (HasCallStack, MonadIO m, IsLabel a) => a -> m Float
- labelNew :: (HasCallStack, MonadIO m) => Maybe Text -> m Label
- labelNewWithMnemonic :: (HasCallStack, MonadIO m) => Maybe Text -> m Label
- labelSelectRegion :: (HasCallStack, MonadIO m, IsLabel a) => a -> Int32 -> Int32 -> m ()
- labelSetAngle :: (HasCallStack, MonadIO m, IsLabel a) => a -> Double -> m ()
- labelSetAttributes :: (HasCallStack, MonadIO m, IsLabel a) => a -> Maybe AttrList -> m ()
- labelSetEllipsize :: (HasCallStack, MonadIO m, IsLabel a) => a -> EllipsizeMode -> m ()
- labelSetJustify :: (HasCallStack, MonadIO m, IsLabel a) => a -> Justification -> m ()
- labelSetLabel :: (HasCallStack, MonadIO m, IsLabel a) => a -> Text -> m ()
- labelSetLineWrap :: (HasCallStack, MonadIO m, IsLabel a) => a -> Bool -> m ()
- labelSetLineWrapMode :: (HasCallStack, MonadIO m, IsLabel a) => a -> WrapMode -> m ()
- labelSetLines :: (HasCallStack, MonadIO m, IsLabel a) => a -> Int32 -> m ()
- labelSetMarkup :: (HasCallStack, MonadIO m, IsLabel a) => a -> Text -> m ()
- labelSetMarkupWithMnemonic :: (HasCallStack, MonadIO m, IsLabel a) => a -> Text -> m ()
- labelSetMaxWidthChars :: (HasCallStack, MonadIO m, IsLabel a) => a -> Int32 -> m ()
- labelSetMnemonicWidget :: (HasCallStack, MonadIO m, IsLabel a, IsWidget b) => a -> Maybe b -> m ()
- labelSetPattern :: (HasCallStack, MonadIO m, IsLabel a) => a -> Text -> m ()
- labelSetSelectable :: (HasCallStack, MonadIO m, IsLabel a) => a -> Bool -> m ()
- labelSetSingleLineMode :: (HasCallStack, MonadIO m, IsLabel a) => a -> Bool -> m ()
- labelSetText :: (HasCallStack, MonadIO m, IsLabel a) => a -> Text -> m ()
- labelSetTextWithMnemonic :: (HasCallStack, MonadIO m, IsLabel a) => a -> Text -> m ()
- labelSetTrackVisitedLinks :: (HasCallStack, MonadIO m, IsLabel a) => a -> Bool -> m ()
- labelSetUseMarkup :: (HasCallStack, MonadIO m, IsLabel a) => a -> Bool -> m ()
- labelSetUseUnderline :: (HasCallStack, MonadIO m, IsLabel a) => a -> Bool -> m ()
- labelSetWidthChars :: (HasCallStack, MonadIO m, IsLabel a) => a -> Int32 -> m ()
- labelSetXalign :: (HasCallStack, MonadIO m, IsLabel a) => a -> Float -> m ()
- labelSetYalign :: (HasCallStack, MonadIO m, IsLabel a) => a -> Float -> m ()
- constructLabelAngle :: (IsLabel o, MonadIO m) => Double -> m (GValueConstruct o)
- getLabelAngle :: (MonadIO m, IsLabel o) => o -> m Double
- setLabelAngle :: (MonadIO m, IsLabel o) => o -> Double -> m ()
- clearLabelAttributes :: (MonadIO m, IsLabel o) => o -> m ()
- constructLabelAttributes :: (IsLabel o, MonadIO m) => AttrList -> m (GValueConstruct o)
- getLabelAttributes :: (MonadIO m, IsLabel o) => o -> m (Maybe AttrList)
- setLabelAttributes :: (MonadIO m, IsLabel o) => o -> AttrList -> m ()
- getLabelCursorPosition :: (MonadIO m, IsLabel o) => o -> m Int32
- constructLabelEllipsize :: (IsLabel o, MonadIO m) => EllipsizeMode -> m (GValueConstruct o)
- getLabelEllipsize :: (MonadIO m, IsLabel o) => o -> m EllipsizeMode
- setLabelEllipsize :: (MonadIO m, IsLabel o) => o -> EllipsizeMode -> m ()
- constructLabelJustify :: (IsLabel o, MonadIO m) => Justification -> m (GValueConstruct o)
- getLabelJustify :: (MonadIO m, IsLabel o) => o -> m Justification
- setLabelJustify :: (MonadIO m, IsLabel o) => o -> Justification -> m ()
- constructLabelLabel :: (IsLabel o, MonadIO m) => Text -> m (GValueConstruct o)
- getLabelLabel :: (MonadIO m, IsLabel o) => o -> m Text
- setLabelLabel :: (MonadIO m, IsLabel o) => o -> Text -> m ()
- constructLabelLines :: (IsLabel o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getLabelLines :: (MonadIO m, IsLabel o) => o -> m Int32
- setLabelLines :: (MonadIO m, IsLabel o) => o -> Int32 -> m ()
- constructLabelMaxWidthChars :: (IsLabel o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getLabelMaxWidthChars :: (MonadIO m, IsLabel o) => o -> m Int32
- setLabelMaxWidthChars :: (MonadIO m, IsLabel o) => o -> Int32 -> m ()
- getLabelMnemonicKeyval :: (MonadIO m, IsLabel o) => o -> m Word32
- clearLabelMnemonicWidget :: (MonadIO m, IsLabel o) => o -> m ()
- constructLabelMnemonicWidget :: (IsLabel o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getLabelMnemonicWidget :: (MonadIO m, IsLabel o) => o -> m (Maybe Widget)
- setLabelMnemonicWidget :: (MonadIO m, IsLabel o, IsWidget a) => o -> a -> m ()
- constructLabelPattern :: (IsLabel o, MonadIO m) => Text -> m (GValueConstruct o)
- setLabelPattern :: (MonadIO m, IsLabel o) => o -> Text -> m ()
- constructLabelSelectable :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getLabelSelectable :: (MonadIO m, IsLabel o) => o -> m Bool
- setLabelSelectable :: (MonadIO m, IsLabel o) => o -> Bool -> m ()
- getLabelSelectionBound :: (MonadIO m, IsLabel o) => o -> m Int32
- constructLabelSingleLineMode :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getLabelSingleLineMode :: (MonadIO m, IsLabel o) => o -> m Bool
- setLabelSingleLineMode :: (MonadIO m, IsLabel o) => o -> Bool -> m ()
- constructLabelTrackVisitedLinks :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getLabelTrackVisitedLinks :: (MonadIO m, IsLabel o) => o -> m Bool
- setLabelTrackVisitedLinks :: (MonadIO m, IsLabel o) => o -> Bool -> m ()
- constructLabelUseMarkup :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getLabelUseMarkup :: (MonadIO m, IsLabel o) => o -> m Bool
- setLabelUseMarkup :: (MonadIO m, IsLabel o) => o -> Bool -> m ()
- constructLabelUseUnderline :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getLabelUseUnderline :: (MonadIO m, IsLabel o) => o -> m Bool
- setLabelUseUnderline :: (MonadIO m, IsLabel o) => o -> Bool -> m ()
- constructLabelWidthChars :: (IsLabel o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getLabelWidthChars :: (MonadIO m, IsLabel o) => o -> m Int32
- setLabelWidthChars :: (MonadIO m, IsLabel o) => o -> Int32 -> m ()
- constructLabelWrap :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getLabelWrap :: (MonadIO m, IsLabel o) => o -> m Bool
- setLabelWrap :: (MonadIO m, IsLabel o) => o -> Bool -> m ()
- constructLabelWrapMode :: (IsLabel o, MonadIO m) => WrapMode -> m (GValueConstruct o)
- getLabelWrapMode :: (MonadIO m, IsLabel o) => o -> m WrapMode
- setLabelWrapMode :: (MonadIO m, IsLabel o) => o -> WrapMode -> m ()
- constructLabelXalign :: (IsLabel o, MonadIO m) => Float -> m (GValueConstruct o)
- getLabelXalign :: (MonadIO m, IsLabel o) => o -> m Float
- setLabelXalign :: (MonadIO m, IsLabel o) => o -> Float -> m ()
- constructLabelYalign :: (IsLabel o, MonadIO m) => Float -> m (GValueConstruct o)
- getLabelYalign :: (MonadIO m, IsLabel o) => o -> m Float
- setLabelYalign :: (MonadIO m, IsLabel o) => o -> Float -> m ()
- type C_LabelActivateCurrentLinkCallback = Ptr () -> Ptr () -> IO ()
- type LabelActivateCurrentLinkCallback = IO ()
- afterLabelActivateCurrentLink :: (IsLabel a, MonadIO m) => a -> LabelActivateCurrentLinkCallback -> m SignalHandlerId
- genClosure_LabelActivateCurrentLink :: MonadIO m => LabelActivateCurrentLinkCallback -> m (GClosure C_LabelActivateCurrentLinkCallback)
- mk_LabelActivateCurrentLinkCallback :: C_LabelActivateCurrentLinkCallback -> IO (FunPtr C_LabelActivateCurrentLinkCallback)
- noLabelActivateCurrentLinkCallback :: Maybe LabelActivateCurrentLinkCallback
- onLabelActivateCurrentLink :: (IsLabel a, MonadIO m) => a -> LabelActivateCurrentLinkCallback -> m SignalHandlerId
- wrap_LabelActivateCurrentLinkCallback :: LabelActivateCurrentLinkCallback -> C_LabelActivateCurrentLinkCallback
- type C_LabelActivateLinkCallback = Ptr () -> CString -> Ptr () -> IO CInt
- type LabelActivateLinkCallback = Text -> IO Bool
- afterLabelActivateLink :: (IsLabel a, MonadIO m) => a -> LabelActivateLinkCallback -> m SignalHandlerId
- genClosure_LabelActivateLink :: MonadIO m => LabelActivateLinkCallback -> m (GClosure C_LabelActivateLinkCallback)
- mk_LabelActivateLinkCallback :: C_LabelActivateLinkCallback -> IO (FunPtr C_LabelActivateLinkCallback)
- noLabelActivateLinkCallback :: Maybe LabelActivateLinkCallback
- onLabelActivateLink :: (IsLabel a, MonadIO m) => a -> LabelActivateLinkCallback -> m SignalHandlerId
- wrap_LabelActivateLinkCallback :: LabelActivateLinkCallback -> C_LabelActivateLinkCallback
- type C_LabelCopyClipboardCallback = Ptr () -> Ptr () -> IO ()
- type LabelCopyClipboardCallback = IO ()
- afterLabelCopyClipboard :: (IsLabel a, MonadIO m) => a -> LabelCopyClipboardCallback -> m SignalHandlerId
- genClosure_LabelCopyClipboard :: MonadIO m => LabelCopyClipboardCallback -> m (GClosure C_LabelCopyClipboardCallback)
- mk_LabelCopyClipboardCallback :: C_LabelCopyClipboardCallback -> IO (FunPtr C_LabelCopyClipboardCallback)
- noLabelCopyClipboardCallback :: Maybe LabelCopyClipboardCallback
- onLabelCopyClipboard :: (IsLabel a, MonadIO m) => a -> LabelCopyClipboardCallback -> m SignalHandlerId
- wrap_LabelCopyClipboardCallback :: LabelCopyClipboardCallback -> C_LabelCopyClipboardCallback
- type C_LabelMoveCursorCallback = Ptr () -> CUInt -> Int32 -> CInt -> Ptr () -> IO ()
- type LabelMoveCursorCallback = MovementStep -> Int32 -> Bool -> IO ()
- afterLabelMoveCursor :: (IsLabel a, MonadIO m) => a -> LabelMoveCursorCallback -> m SignalHandlerId
- genClosure_LabelMoveCursor :: MonadIO m => LabelMoveCursorCallback -> m (GClosure C_LabelMoveCursorCallback)
- mk_LabelMoveCursorCallback :: C_LabelMoveCursorCallback -> IO (FunPtr C_LabelMoveCursorCallback)
- noLabelMoveCursorCallback :: Maybe LabelMoveCursorCallback
- onLabelMoveCursor :: (IsLabel a, MonadIO m) => a -> LabelMoveCursorCallback -> m SignalHandlerId
- wrap_LabelMoveCursorCallback :: LabelMoveCursorCallback -> C_LabelMoveCursorCallback
- type C_LabelPopulatePopupCallback = Ptr () -> Ptr Menu -> Ptr () -> IO ()
- type LabelPopulatePopupCallback = Menu -> IO ()
- afterLabelPopulatePopup :: (IsLabel a, MonadIO m) => a -> LabelPopulatePopupCallback -> m SignalHandlerId
- genClosure_LabelPopulatePopup :: MonadIO m => LabelPopulatePopupCallback -> m (GClosure C_LabelPopulatePopupCallback)
- mk_LabelPopulatePopupCallback :: C_LabelPopulatePopupCallback -> IO (FunPtr C_LabelPopulatePopupCallback)
- noLabelPopulatePopupCallback :: Maybe LabelPopulatePopupCallback
- onLabelPopulatePopup :: (IsLabel a, MonadIO m) => a -> LabelPopulatePopupCallback -> m SignalHandlerId
- wrap_LabelPopulatePopupCallback :: LabelPopulatePopupCallback -> C_LabelPopulatePopupCallback
Exported types
Memory-managed wrapper type.
Instances
Eq Label Source # | |
IsGValue Label Source # | Convert |
ManagedPtrNewtype Label Source # | |
Defined in GI.Gtk.Objects.Label toManagedPtr :: Label -> ManagedPtr Label # | |
TypedObject Label Source # | |
Defined in GI.Gtk.Objects.Label | |
GObject Label Source # | |
Defined in GI.Gtk.Objects.Label | |
HasParentTypes Label Source # | |
Defined in GI.Gtk.Objects.Label | |
type ParentTypes Label Source # | |
Defined in GI.Gtk.Objects.Label |
class (GObject o, IsDescendantOf Label o) => IsLabel o Source #
Instances
(GObject o, IsDescendantOf Label o) => IsLabel o Source # | |
Defined in GI.Gtk.Objects.Label |
Methods
Overloaded methods
getAngle
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Double | Returns: the angle of rotation for the label |
Gets the angle of rotation for the label. See
labelSetAngle
.
Since: 2.6
getAttributes
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m (Maybe AttrList) | Returns: the attribute list, or |
Gets the attribute list that was set on the label using
labelSetAttributes
, if any. This function does
not reflect attributes that come from the labels markup
(see labelSetMarkup
). If you want to get the
effective attributes for the label, use
pango_layout_get_attribute (gtk_label_get_layout (label)).
getCurrentUri
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Text | Returns: the currently active URI. The string is owned by GTK+ and must not be freed or modified. |
Returns the URI for the currently active link in the label. The active link is the one under the mouse pointer or, in a selectable label, the link in which the text cursor is currently positioned.
This function is intended for use in a activateLink handler or for use in a queryTooltip handler.
Since: 2.18
getEllipsize
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m EllipsizeMode | Returns: |
Returns the ellipsizing position of the label. See labelSetEllipsize
.
Since: 2.6
getJustify
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Justification | Returns: |
Returns the justification of the label. See labelSetJustify
.
getLabel
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Text | Returns: the text of the label widget. This string is owned by the widget and must not be modified or freed. |
Fetches the text from a label widget including any embedded
underlines indicating mnemonics and Pango markup. (See
labelGetText
).
getLayout
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Layout | Returns: the |
Gets the Layout
used to display the label.
The layout is useful to e.g. convert text positions to
pixel positions, in combination with labelGetLayoutOffsets
.
The returned layout is owned by the label
so need not be
freed by the caller. The label
is free to recreate its layout at
any time, so it should be considered read-only.
getLayoutOffsets
labelGetLayoutOffsets Source #
Obtains the coordinates where the label will draw the Layout
representing the text in the label; useful to convert mouse events
into coordinates inside the Layout
, e.g. to take some action
if some part of the label is clicked. Of course you will need to
create a EventBox
to receive the events, and pack the label
inside it, since labels are windowless (they return False
from
widgetGetHasWindow
). Remember
when using the Layout
functions you need to convert to
and from pixels using PANGO_PIXELS()
or SCALE
.
getLineWrap
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether lines in the label are automatically wrapped.
See labelSetLineWrap
.
getLineWrapMode
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m WrapMode | Returns: |
Returns line wrap mode used by the label. See labelSetLineWrapMode
.
Since: 2.10
getLines
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Int32 | Returns: The number of lines |
Gets the number of lines to which an ellipsized, wrapping
label should be limited. See labelSetLines
.
Since: 3.10
getMaxWidthChars
labelGetMaxWidthChars Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Int32 | Returns: the maximum width of the label in characters. |
Retrieves the desired maximum width of label
, in characters. See
labelSetWidthChars
.
Since: 2.6
getMnemonicKeyval
labelGetMnemonicKeyval Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Word32 | Returns: GDK keyval usable for accelerators, or |
If the label has been set so that it has an mnemonic key this function
returns the keyval used for the mnemonic accelerator. If there is no
mnemonic set up it returns KEY_VoidSymbol
.
getMnemonicWidget
labelGetMnemonicWidget Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the target of the label’s mnemonic,
or |
Retrieves the target of the mnemonic (keyboard shortcut) of this
label. See labelSetMnemonicWidget
.
getSelectable
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Bool | Returns: |
Gets the value set by labelSetSelectable
.
getSelectionBounds
labelGetSelectionBounds Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m (Bool, Int32, Int32) | Returns: |
Gets the selected range of characters in the label, returning True
if there’s a selection.
getSingleLineMode
labelGetSingleLineMode Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the label is in single line mode.
Since: 2.6
getText
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Text | Returns: the text in the label widget. This is the internal string used by the label, and must not be modified. |
Fetches the text from a label widget, as displayed on the
screen. This does not include any embedded underlines
indicating mnemonics or Pango markup. (See labelGetLabel
)
getTrackVisitedLinks
labelGetTrackVisitedLinks Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the label is currently keeping track of clicked links.
Since: 2.18
getUseMarkup
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the label’s text is interpreted as marked up with the [Pango text markup language][PangoMarkupFormat]. See gtk_label_set_use_markup ().
getUseUnderline
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether an embedded underline in the label indicates a
mnemonic. See labelSetUseUnderline
.
getWidthChars
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Int32 | Returns: the width of the label in characters. |
Retrieves the desired width of label
, in characters. See
labelSetWidthChars
.
Since: 2.6
getXalign
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Float | Returns: the xalign property |
Gets the Label
:xalign
property for label
.
Since: 3.16
getYalign
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> m Float | Returns: the yalign property |
Gets the Label
:yalign
property for label
.
Since: 3.16
new
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m Label | Returns: the new |
Creates a new label with the given text inside it. You can
pass Nothing
to get an empty label widget.
newWithMnemonic
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m Label | Returns: the new |
Creates a new Label
, containing the text in str
.
If characters in str
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. The mnemonic key can be used
to activate another widget, chosen automatically, or explicitly using
labelSetMnemonicWidget
.
If labelSetMnemonicWidget
is not called, then the first
activatable ancestor of the Label
will be chosen as the mnemonic
widget. For instance, if the label is inside a button or menu item,
the button or menu item will automatically become the mnemonic widget
and be activated by the mnemonic.
selectRegion
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Selects a range of characters in the label, if the label is selectable.
See labelSetSelectable
. If the label is not selectable,
this function has no effect. If startOffset
or
endOffset
are -1, then the end of the label will be substituted.
setAngle
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the angle of rotation for the label. An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom. The angle setting for the label is ignored if the label is selectable, wrapped, or ellipsized.
Since: 2.6
setAttributes
Sets a AttrList
; the attributes in the list are applied to the
label text.
The attributes set with this function will be applied
and merged with any other attributes previously effected by way
of the Label
:use-underline
or Label
:use-markup
properties.
While it is not recommended to mix markup strings with manually set
attributes, if you must; know that the attributes will be applied
to the label after the markup string is parsed.
setEllipsize
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> EllipsizeMode |
|
-> m () |
Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string.
Since: 2.6
setJustify
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Justification |
|
-> m () |
Sets the alignment of the lines in the text of the label relative to
each other. JustificationLeft
is the default value when the widget is
first created with labelNew
. If you instead want to set the
alignment of the label as a whole, use widgetSetHalign
instead.
labelSetJustify
has no effect on labels containing only a
single line.
setLabel
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Text |
|
-> m () |
setLineWrap
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
Toggles line wrapping within the Label
widget. True
makes it break
lines if text exceeds the widget’s size. False
lets the text get cut off
by the edge of the widget if it exceeds the widget size.
Note that setting line wrapping to True
does not make the label
wrap at its parent container’s width, because GTK+ widgets
conceptually can’t make their requisition depend on the parent
container’s size. For a label that wraps at a specific position,
set the label’s width using widgetSetSizeRequest
.
setLineWrapMode
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> WrapMode |
|
-> m () |
If line wrapping is on (see labelSetLineWrap
) this controls how
the line wrapping is done. The default is WrapModeWord
which means
wrap on word boundaries.
Since: 2.10
setLines
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the number of lines to which an ellipsized, wrapping label should be limited. This has no effect if the label is not wrapping or ellipsized. Set this to -1 if you don’t want to limit the number of lines.
Since: 3.10
setMarkup
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Text |
|
-> m () |
Parses str
which is marked up with the
[Pango text markup language][PangoMarkupFormat], setting the
label’s text and attribute list based on the parse results.
If the str
is external data, you may need to escape it with
markupEscapeText
or g_markup_printf_escaped()
:
C code
GtkWidget *label = gtk_label_new (NULL); const char *str = "some text"; const char *format = "<span style=\"italic\">\%s</span>"; char *markup; markup = g_markup_printf_escaped (format, str); gtk_label_set_markup (GTK_LABEL (label), markup); g_free (markup);
This function will set the Label
:use-markup
property to True
as
a side effect.
If you set the label contents using the Label
:label
property you
should also ensure that you set the Label
:use-markup
property
accordingly.
See also: labelSetText
setMarkupWithMnemonic
labelSetMarkupWithMnemonic Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Text |
|
-> m () |
Parses str
which is marked up with the
[Pango text markup language][PangoMarkupFormat],
setting the label’s text and attribute list based on the parse results.
If characters in str
are preceded by an underscore, they are underlined
indicating that they represent a keyboard accelerator called a mnemonic.
The mnemonic key can be used to activate another widget, chosen
automatically, or explicitly using labelSetMnemonicWidget
.
setMaxWidthChars
labelSetMaxWidthChars Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the desired maximum width in characters of label
to nChars
.
Since: 2.6
setMnemonicWidget
labelSetMnemonicWidget Source #
If the label has been set so that it has an mnemonic key (using
i.e. labelSetMarkupWithMnemonic
,
labelSetTextWithMnemonic
, labelNewWithMnemonic
or the “use_underline” property) the label can be associated with a
widget that is the target of the mnemonic. When the label is inside
a widget (like a Button
or a Notebook
tab) it is
automatically associated with the correct widget, but sometimes
(i.e. when the target is a Entry
next to the label) you need to
set it explicitly using this function.
The target widget will be accelerated by emitting the GtkWidget[mnemonicActivate](#g:signal:mnemonicActivate) signal on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.
setPattern
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Text |
|
-> m () |
The pattern of underlines you want under the existing text within the
Label
widget. For example if the current text of the label says
“FooBarBaz” passing a pattern of “_ _” will underline
“Foo” and “Baz” but not “Bar”.
setSelectable
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
Selectable labels allow the user to select text from the label, for copy-and-paste.
setSingleLineMode
labelSetSingleLineMode Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the label is in single line mode.
Since: 2.6
setText
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the text within the Label
widget. It overwrites any text that
was there before.
This function will clear any previously set mnemonic accelerators, and
set the Label
:use-underline
property to False
as a side effect.
This function will set the Label
:use-markup
property to False
as a side effect.
See also: labelSetMarkup
setTextWithMnemonic
labelSetTextWithMnemonic Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the label’s text from the string str
.
If characters in str
are preceded by an underscore, they are underlined
indicating that they represent a keyboard accelerator called a mnemonic.
The mnemonic key can be used to activate another widget, chosen
automatically, or explicitly using labelSetMnemonicWidget
.
setTrackVisitedLinks
labelSetTrackVisitedLinks Source #
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the label should keep track of clicked links (and use a different color for them).
Since: 2.18
setUseMarkup
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the text of the label contains markup in
[Pango’s text markup language][PangoMarkupFormat].
See labelSetMarkup
.
setUseUnderline
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
If true, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
setWidthChars
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the desired width in characters of label
to nChars
.
Since: 2.6
setXalign
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Float |
|
-> m () |
Sets the Label
:xalign
property for label
.
Since: 3.16
setYalign
:: (HasCallStack, MonadIO m, IsLabel a) | |
=> a |
|
-> Float |
|
-> m () |
Sets the Label
:yalign
property for label
.
Since: 3.16
Properties
angle
The angle that the baseline of the label makes with the horizontal, in degrees, measured counterclockwise. An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom. Ignored if the label is selectable.
Since: 2.6
constructLabelAngle :: (IsLabel o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “angle
” property. This is rarely needed directly, but it is used by new
.
getLabelAngle :: (MonadIO m, IsLabel o) => o -> m Double Source #
Get the value of the “angle
” property.
When overloading is enabled, this is equivalent to
get
label #angle
setLabelAngle :: (MonadIO m, IsLabel o) => o -> Double -> m () Source #
Set the value of the “angle
” property.
When overloading is enabled, this is equivalent to
set
label [ #angle:=
value ]
attributes
No description available in the introspection data.
clearLabelAttributes :: (MonadIO m, IsLabel o) => o -> m () Source #
Set the value of the “attributes
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#attributes
constructLabelAttributes :: (IsLabel o, MonadIO m) => AttrList -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “attributes
” property. This is rarely needed directly, but it is used by new
.
getLabelAttributes :: (MonadIO m, IsLabel o) => o -> m (Maybe AttrList) Source #
Get the value of the “attributes
” property.
When overloading is enabled, this is equivalent to
get
label #attributes
setLabelAttributes :: (MonadIO m, IsLabel o) => o -> AttrList -> m () Source #
Set the value of the “attributes
” property.
When overloading is enabled, this is equivalent to
set
label [ #attributes:=
value ]
cursorPosition
No description available in the introspection data.
getLabelCursorPosition :: (MonadIO m, IsLabel o) => o -> m Int32 Source #
Get the value of the “cursor-position
” property.
When overloading is enabled, this is equivalent to
get
label #cursorPosition
ellipsize
The preferred place to ellipsize the string, if the label does
not have enough room to display the entire string, specified as a
EllipsizeMode
.
Note that setting this property to a value other than
EllipsizeModeNone
has the side-effect that the label requests
only enough space to display the ellipsis "...". In particular, this
means that ellipsizing labels do not work well in notebook tabs, unless
the Notebook
tab-expand child property is set to True
. Other ways
to set a label's width are widgetSetSizeRequest
and
labelSetWidthChars
.
Since: 2.6
constructLabelEllipsize :: (IsLabel o, MonadIO m) => EllipsizeMode -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ellipsize
” property. This is rarely needed directly, but it is used by new
.
getLabelEllipsize :: (MonadIO m, IsLabel o) => o -> m EllipsizeMode Source #
Get the value of the “ellipsize
” property.
When overloading is enabled, this is equivalent to
get
label #ellipsize
setLabelEllipsize :: (MonadIO m, IsLabel o) => o -> EllipsizeMode -> m () Source #
Set the value of the “ellipsize
” property.
When overloading is enabled, this is equivalent to
set
label [ #ellipsize:=
value ]
justify
No description available in the introspection data.
constructLabelJustify :: (IsLabel o, MonadIO m) => Justification -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “justify
” property. This is rarely needed directly, but it is used by new
.
getLabelJustify :: (MonadIO m, IsLabel o) => o -> m Justification Source #
Get the value of the “justify
” property.
When overloading is enabled, this is equivalent to
get
label #justify
setLabelJustify :: (MonadIO m, IsLabel o) => o -> Justification -> m () Source #
Set the value of the “justify
” property.
When overloading is enabled, this is equivalent to
set
label [ #justify:=
value ]
label
The contents of the label.
If the string contains [Pango XML markup][PangoMarkupFormat], you will
have to set the Label
:use-markup
property to True
in order for the
label to display the markup attributes. See also labelSetMarkup
for a convenience function that sets both this property and the
Label
:use-markup
property at the same time.
If the string contains underlines acting as mnemonics, you will have to
set the Label
:use-underline
property to True
in order for the label
to display them.
constructLabelLabel :: (IsLabel o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label
” property. This is rarely needed directly, but it is used by new
.
getLabelLabel :: (MonadIO m, IsLabel o) => o -> m Text Source #
Get the value of the “label
” property.
When overloading is enabled, this is equivalent to
get
label #label
setLabelLabel :: (MonadIO m, IsLabel o) => o -> Text -> m () Source #
Set the value of the “label
” property.
When overloading is enabled, this is equivalent to
set
label [ #label:=
value ]
lines
The number of lines to which an ellipsized, wrapping label should be limited. This property has no effect if the label is not wrapping or ellipsized. Set this property to -1 if you don't want to limit the number of lines.
Since: 3.10
constructLabelLines :: (IsLabel o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “lines
” property. This is rarely needed directly, but it is used by new
.
getLabelLines :: (MonadIO m, IsLabel o) => o -> m Int32 Source #
Get the value of the “lines
” property.
When overloading is enabled, this is equivalent to
get
label #lines
setLabelLines :: (MonadIO m, IsLabel o) => o -> Int32 -> m () Source #
Set the value of the “lines
” property.
When overloading is enabled, this is equivalent to
set
label [ #lines:=
value ]
maxWidthChars
The desired maximum width of the label, in characters. If this property is set to -1, the width will be calculated automatically.
See the section on [text layout][label-text-layout]
for details of how Label
:width-chars
and Label
:max-width-chars
determine the width of ellipsized and wrapped labels.
Since: 2.6
constructLabelMaxWidthChars :: (IsLabel o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-width-chars
” property. This is rarely needed directly, but it is used by new
.
getLabelMaxWidthChars :: (MonadIO m, IsLabel o) => o -> m Int32 Source #
Get the value of the “max-width-chars
” property.
When overloading is enabled, this is equivalent to
get
label #maxWidthChars
setLabelMaxWidthChars :: (MonadIO m, IsLabel o) => o -> Int32 -> m () Source #
Set the value of the “max-width-chars
” property.
When overloading is enabled, this is equivalent to
set
label [ #maxWidthChars:=
value ]
mnemonicKeyval
No description available in the introspection data.
getLabelMnemonicKeyval :: (MonadIO m, IsLabel o) => o -> m Word32 Source #
Get the value of the “mnemonic-keyval
” property.
When overloading is enabled, this is equivalent to
get
label #mnemonicKeyval
mnemonicWidget
No description available in the introspection data.
clearLabelMnemonicWidget :: (MonadIO m, IsLabel o) => o -> m () Source #
Set the value of the “mnemonic-widget
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#mnemonicWidget
constructLabelMnemonicWidget :: (IsLabel o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “mnemonic-widget
” property. This is rarely needed directly, but it is used by new
.
getLabelMnemonicWidget :: (MonadIO m, IsLabel o) => o -> m (Maybe Widget) Source #
Get the value of the “mnemonic-widget
” property.
When overloading is enabled, this is equivalent to
get
label #mnemonicWidget
setLabelMnemonicWidget :: (MonadIO m, IsLabel o, IsWidget a) => o -> a -> m () Source #
Set the value of the “mnemonic-widget
” property.
When overloading is enabled, this is equivalent to
set
label [ #mnemonicWidget:=
value ]
pattern
No description available in the introspection data.
constructLabelPattern :: (IsLabel o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “pattern
” property. This is rarely needed directly, but it is used by new
.
setLabelPattern :: (MonadIO m, IsLabel o) => o -> Text -> m () Source #
Set the value of the “pattern
” property.
When overloading is enabled, this is equivalent to
set
label [ #pattern:=
value ]
selectable
No description available in the introspection data.
constructLabelSelectable :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “selectable
” property. This is rarely needed directly, but it is used by new
.
getLabelSelectable :: (MonadIO m, IsLabel o) => o -> m Bool Source #
Get the value of the “selectable
” property.
When overloading is enabled, this is equivalent to
get
label #selectable
setLabelSelectable :: (MonadIO m, IsLabel o) => o -> Bool -> m () Source #
Set the value of the “selectable
” property.
When overloading is enabled, this is equivalent to
set
label [ #selectable:=
value ]
selectionBound
No description available in the introspection data.
getLabelSelectionBound :: (MonadIO m, IsLabel o) => o -> m Int32 Source #
Get the value of the “selection-bound
” property.
When overloading is enabled, this is equivalent to
get
label #selectionBound
singleLineMode
Whether the label is in single line mode. In single line mode, the height of the label does not depend on the actual text, it is always set to ascent + descent of the font. This can be an advantage in situations where resizing the label because of text changes would be distracting, e.g. in a statusbar.
Since: 2.6
constructLabelSingleLineMode :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “single-line-mode
” property. This is rarely needed directly, but it is used by new
.
getLabelSingleLineMode :: (MonadIO m, IsLabel o) => o -> m Bool Source #
Get the value of the “single-line-mode
” property.
When overloading is enabled, this is equivalent to
get
label #singleLineMode
setLabelSingleLineMode :: (MonadIO m, IsLabel o) => o -> Bool -> m () Source #
Set the value of the “single-line-mode
” property.
When overloading is enabled, this is equivalent to
set
label [ #singleLineMode:=
value ]
trackVisitedLinks
Set this property to True
to make the label track which links
have been visited. It will then apply the GTK_STATE_FLAG_VISITED
when rendering this link, in addition to GTK_STATE_FLAG_LINK
.
Since: 2.18
constructLabelTrackVisitedLinks :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “track-visited-links
” property. This is rarely needed directly, but it is used by new
.
getLabelTrackVisitedLinks :: (MonadIO m, IsLabel o) => o -> m Bool Source #
Get the value of the “track-visited-links
” property.
When overloading is enabled, this is equivalent to
get
label #trackVisitedLinks
setLabelTrackVisitedLinks :: (MonadIO m, IsLabel o) => o -> Bool -> m () Source #
Set the value of the “track-visited-links
” property.
When overloading is enabled, this is equivalent to
set
label [ #trackVisitedLinks:=
value ]
useMarkup
No description available in the introspection data.
constructLabelUseMarkup :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-markup
” property. This is rarely needed directly, but it is used by new
.
getLabelUseMarkup :: (MonadIO m, IsLabel o) => o -> m Bool Source #
Get the value of the “use-markup
” property.
When overloading is enabled, this is equivalent to
get
label #useMarkup
setLabelUseMarkup :: (MonadIO m, IsLabel o) => o -> Bool -> m () Source #
Set the value of the “use-markup
” property.
When overloading is enabled, this is equivalent to
set
label [ #useMarkup:=
value ]
useUnderline
No description available in the introspection data.
constructLabelUseUnderline :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-underline
” property. This is rarely needed directly, but it is used by new
.
getLabelUseUnderline :: (MonadIO m, IsLabel o) => o -> m Bool Source #
Get the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
get
label #useUnderline
setLabelUseUnderline :: (MonadIO m, IsLabel o) => o -> Bool -> m () Source #
Set the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
set
label [ #useUnderline:=
value ]
widthChars
The desired width of the label, in characters. If this property is set to -1, the width will be calculated automatically.
See the section on [text layout][label-text-layout]
for details of how Label
:width-chars
and Label
:max-width-chars
determine the width of ellipsized and wrapped labels.
Since: 2.6
constructLabelWidthChars :: (IsLabel o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “width-chars
” property. This is rarely needed directly, but it is used by new
.
getLabelWidthChars :: (MonadIO m, IsLabel o) => o -> m Int32 Source #
Get the value of the “width-chars
” property.
When overloading is enabled, this is equivalent to
get
label #widthChars
setLabelWidthChars :: (MonadIO m, IsLabel o) => o -> Int32 -> m () Source #
Set the value of the “width-chars
” property.
When overloading is enabled, this is equivalent to
set
label [ #widthChars:=
value ]
wrap
No description available in the introspection data.
constructLabelWrap :: (IsLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “wrap
” property. This is rarely needed directly, but it is used by new
.
getLabelWrap :: (MonadIO m, IsLabel o) => o -> m Bool Source #
Get the value of the “wrap
” property.
When overloading is enabled, this is equivalent to
get
label #wrap
setLabelWrap :: (MonadIO m, IsLabel o) => o -> Bool -> m () Source #
Set the value of the “wrap
” property.
When overloading is enabled, this is equivalent to
set
label [ #wrap:=
value ]
wrapMode
If line wrapping is on (see the Label
:wrap
property) this controls
how the line wrapping is done. The default is WrapModeWord
, which
means wrap on word boundaries.
Since: 2.10
constructLabelWrapMode :: (IsLabel o, MonadIO m) => WrapMode -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “wrap-mode
” property. This is rarely needed directly, but it is used by new
.
getLabelWrapMode :: (MonadIO m, IsLabel o) => o -> m WrapMode Source #
Get the value of the “wrap-mode
” property.
When overloading is enabled, this is equivalent to
get
label #wrapMode
setLabelWrapMode :: (MonadIO m, IsLabel o) => o -> WrapMode -> m () Source #
Set the value of the “wrap-mode
” property.
When overloading is enabled, this is equivalent to
set
label [ #wrapMode:=
value ]
xalign
The xalign property determines the horizontal aligment of the label text
inside the labels size allocation. Compare this to Widget
:halign
,
which determines how the labels size allocation is positioned in the
space available for the label.
Since: 3.16
constructLabelXalign :: (IsLabel o, MonadIO m) => Float -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “xalign
” property. This is rarely needed directly, but it is used by new
.
getLabelXalign :: (MonadIO m, IsLabel o) => o -> m Float Source #
Get the value of the “xalign
” property.
When overloading is enabled, this is equivalent to
get
label #xalign
setLabelXalign :: (MonadIO m, IsLabel o) => o -> Float -> m () Source #
Set the value of the “xalign
” property.
When overloading is enabled, this is equivalent to
set
label [ #xalign:=
value ]
yalign
The yalign property determines the vertical aligment of the label text
inside the labels size allocation. Compare this to Widget
:valign
,
which determines how the labels size allocation is positioned in the
space available for the label.
Since: 3.16
constructLabelYalign :: (IsLabel o, MonadIO m) => Float -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “yalign
” property. This is rarely needed directly, but it is used by new
.
getLabelYalign :: (MonadIO m, IsLabel o) => o -> m Float Source #
Get the value of the “yalign
” property.
When overloading is enabled, this is equivalent to
get
label #yalign
setLabelYalign :: (MonadIO m, IsLabel o) => o -> Float -> m () Source #
Set the value of the “yalign
” property.
When overloading is enabled, this is equivalent to
set
label [ #yalign:=
value ]
Signals
activateCurrentLink
type C_LabelActivateCurrentLinkCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type LabelActivateCurrentLinkCallback = IO () Source #
A [keybinding signal][GtkBindingSignal] which gets emitted when the user activates a link in the label.
Applications may also emit the signal with g_signal_emit_by_name()
if they need to control activation of URIs programmatically.
The default bindings for this signal are all forms of the Enter key.
Since: 2.18
afterLabelActivateCurrentLink :: (IsLabel a, MonadIO m) => a -> LabelActivateCurrentLinkCallback -> m SignalHandlerId Source #
Connect a signal handler for the activateCurrentLink signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
label #activateCurrentLink callback
genClosure_LabelActivateCurrentLink :: MonadIO m => LabelActivateCurrentLinkCallback -> m (GClosure C_LabelActivateCurrentLinkCallback) Source #
Wrap the callback into a GClosure
.
mk_LabelActivateCurrentLinkCallback :: C_LabelActivateCurrentLinkCallback -> IO (FunPtr C_LabelActivateCurrentLinkCallback) Source #
Generate a function pointer callable from C code, from a C_LabelActivateCurrentLinkCallback
.
noLabelActivateCurrentLinkCallback :: Maybe LabelActivateCurrentLinkCallback Source #
A convenience synonym for
.Nothing
:: Maybe
LabelActivateCurrentLinkCallback
onLabelActivateCurrentLink :: (IsLabel a, MonadIO m) => a -> LabelActivateCurrentLinkCallback -> m SignalHandlerId Source #
Connect a signal handler for the activateCurrentLink signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
label #activateCurrentLink callback
wrap_LabelActivateCurrentLinkCallback :: LabelActivateCurrentLinkCallback -> C_LabelActivateCurrentLinkCallback Source #
activateLink
type C_LabelActivateLinkCallback = Ptr () -> CString -> Ptr () -> IO CInt Source #
Type for the callback on the (unwrapped) C side.
type LabelActivateLinkCallback Source #
The signal which gets emitted to activate a URI.
Applications may connect to it to override the default behaviour,
which is to call showUriOnWindow
.
Since: 2.18
afterLabelActivateLink :: (IsLabel a, MonadIO m) => a -> LabelActivateLinkCallback -> m SignalHandlerId Source #
Connect a signal handler for the activateLink signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
label #activateLink callback
genClosure_LabelActivateLink :: MonadIO m => LabelActivateLinkCallback -> m (GClosure C_LabelActivateLinkCallback) Source #
Wrap the callback into a GClosure
.
mk_LabelActivateLinkCallback :: C_LabelActivateLinkCallback -> IO (FunPtr C_LabelActivateLinkCallback) Source #
Generate a function pointer callable from C code, from a C_LabelActivateLinkCallback
.
noLabelActivateLinkCallback :: Maybe LabelActivateLinkCallback Source #
A convenience synonym for
.Nothing
:: Maybe
LabelActivateLinkCallback
onLabelActivateLink :: (IsLabel a, MonadIO m) => a -> LabelActivateLinkCallback -> m SignalHandlerId Source #
Connect a signal handler for the activateLink signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
label #activateLink callback
wrap_LabelActivateLinkCallback :: LabelActivateLinkCallback -> C_LabelActivateLinkCallback Source #
Wrap a LabelActivateLinkCallback
into a C_LabelActivateLinkCallback
.
copyClipboard
type C_LabelCopyClipboardCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type LabelCopyClipboardCallback = IO () Source #
The copyClipboard signal is a [keybinding signal][GtkBindingSignal] which gets emitted to copy the selection to the clipboard.
The default binding for this signal is Ctrl-c.
afterLabelCopyClipboard :: (IsLabel a, MonadIO m) => a -> LabelCopyClipboardCallback -> m SignalHandlerId Source #
Connect a signal handler for the copyClipboard signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
label #copyClipboard callback
genClosure_LabelCopyClipboard :: MonadIO m => LabelCopyClipboardCallback -> m (GClosure C_LabelCopyClipboardCallback) Source #
Wrap the callback into a GClosure
.
mk_LabelCopyClipboardCallback :: C_LabelCopyClipboardCallback -> IO (FunPtr C_LabelCopyClipboardCallback) Source #
Generate a function pointer callable from C code, from a C_LabelCopyClipboardCallback
.
noLabelCopyClipboardCallback :: Maybe LabelCopyClipboardCallback Source #
A convenience synonym for
.Nothing
:: Maybe
LabelCopyClipboardCallback
onLabelCopyClipboard :: (IsLabel a, MonadIO m) => a -> LabelCopyClipboardCallback -> m SignalHandlerId Source #
Connect a signal handler for the copyClipboard signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
label #copyClipboard callback
wrap_LabelCopyClipboardCallback :: LabelCopyClipboardCallback -> C_LabelCopyClipboardCallback Source #
Wrap a LabelCopyClipboardCallback
into a C_LabelCopyClipboardCallback
.
moveCursor
type C_LabelMoveCursorCallback = Ptr () -> CUInt -> Int32 -> CInt -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type LabelMoveCursorCallback Source #
= MovementStep |
|
-> Int32 |
|
-> Bool |
|
-> IO () |
The moveCursor signal is a
[keybinding signal][GtkBindingSignal]
which gets emitted when the user initiates a cursor movement.
If the cursor is not visible in entry
, this signal causes
the viewport to be moved instead.
Applications should not connect to it, but may emit it with
g_signal_emit_by_name()
if they need to control the cursor
programmatically.
The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here.
- Arrow keys move by individual characters/lines
- Ctrl-arrow key combinations move by words/paragraphs
- Home/End keys move to the ends of the buffer
afterLabelMoveCursor :: (IsLabel a, MonadIO m) => a -> LabelMoveCursorCallback -> m SignalHandlerId Source #
Connect a signal handler for the moveCursor signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
label #moveCursor callback
genClosure_LabelMoveCursor :: MonadIO m => LabelMoveCursorCallback -> m (GClosure C_LabelMoveCursorCallback) Source #
Wrap the callback into a GClosure
.
mk_LabelMoveCursorCallback :: C_LabelMoveCursorCallback -> IO (FunPtr C_LabelMoveCursorCallback) Source #
Generate a function pointer callable from C code, from a C_LabelMoveCursorCallback
.
noLabelMoveCursorCallback :: Maybe LabelMoveCursorCallback Source #
A convenience synonym for
.Nothing
:: Maybe
LabelMoveCursorCallback
onLabelMoveCursor :: (IsLabel a, MonadIO m) => a -> LabelMoveCursorCallback -> m SignalHandlerId Source #
Connect a signal handler for the moveCursor signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
label #moveCursor callback
wrap_LabelMoveCursorCallback :: LabelMoveCursorCallback -> C_LabelMoveCursorCallback Source #
Wrap a LabelMoveCursorCallback
into a C_LabelMoveCursorCallback
.
populatePopup
type C_LabelPopulatePopupCallback = Ptr () -> Ptr Menu -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type LabelPopulatePopupCallback Source #
The populatePopup signal gets emitted before showing the context menu of the label. Note that only selectable labels have context menus.
If you need to add items to the context menu, connect
to this signal and append your menuitems to the menu
.
afterLabelPopulatePopup :: (IsLabel a, MonadIO m) => a -> LabelPopulatePopupCallback -> m SignalHandlerId Source #
Connect a signal handler for the populatePopup signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
label #populatePopup callback
genClosure_LabelPopulatePopup :: MonadIO m => LabelPopulatePopupCallback -> m (GClosure C_LabelPopulatePopupCallback) Source #
Wrap the callback into a GClosure
.
mk_LabelPopulatePopupCallback :: C_LabelPopulatePopupCallback -> IO (FunPtr C_LabelPopulatePopupCallback) Source #
Generate a function pointer callable from C code, from a C_LabelPopulatePopupCallback
.
noLabelPopulatePopupCallback :: Maybe LabelPopulatePopupCallback Source #
A convenience synonym for
.Nothing
:: Maybe
LabelPopulatePopupCallback
onLabelPopulatePopup :: (IsLabel a, MonadIO m) => a -> LabelPopulatePopupCallback -> m SignalHandlerId Source #
Connect a signal handler for the populatePopup signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
label #populatePopup callback