Class

GtkLabel

Description [src]

class Gtk.Label : Gtk.Misc
  implements Atk.ImplementorIface, Gtk.Buildable {
  /* No available fields */
}

The GtkLabel widget displays a small amount of text. As the name implies, most labels are used to label another widget such as a GtkButton, a GtkMenuItem, or a GtkComboBox.

CSS nodes

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 GtkShortcutsWindow, 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 PangoAttribute values for this label.

An example of a UI definition fragment specifying Pango attributes:

<object class="GtkLabel">
  <attributes>
    <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
    <attribute 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 gtk_label_new_with_mnemonic() or gtk_label_set_text_with_mnemonic().

Mnemonics automatically activate any activatable widget the label is inside, such as a GtkButton; if the label is not inside the mnemonic’s target widget, you have to tell the label about the target using gtk_label_set_mnemonic_widget(). Here’s a simple example where the label is inside a button:

  // 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:

  // 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 GtkEntry, you have to point the label at the entry with gtk_label_set_mnemonic_widget():

  // 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:

  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 gtk_label_set_markup() 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 gtk_label_set_markup(), you’ll want to escape it with g_markup_escape_text() or g_markup_printf_escaped().

Markup strings are just a convenient way to set the PangoAttrList on a label; gtk_label_set_attributes() may be a simpler way to set attributes in some cases. Be careful though; PangoAttrList 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 PangoAttribute requires knowledge of the exact string being displayed, so translations will cause problems.

Selectable labels

Labels can be made selectable with gtk_label_set_selectable(). 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.

Text layout # {#label-text-layout}

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 gtk_label_set_line_wrap().

gtk_label_set_justify() 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 GtkWidget:halign and GtkWidget:valign properties.

The GtkLabel:width-chars and GtkLabel: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 GtkLabel:width-chars and GtkLabel: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:

const gchar *text =
"Go to the"
"<a href=\"http://www.gtk.org title=\"&lt;i&gt;Our&lt;/i&gt; 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 GtkLabel::activate-link signal and the gtk_label_get_current_uri() function.

Hierarchy

hierarchy this GtkLabel implements_0 AtkImplementorIface this--implements_0 implements_1 GtkBuildable this--implements_1 ancestor_0 GtkMisc ancestor_0--this ancestor_1 GtkWidget ancestor_1--ancestor_0 ancestor_2 GInitiallyUnowned ancestor_2--ancestor_1 ancestor_3 GObject ancestor_3--ancestor_2

Descendants

Constructors

gtk_label_new

Creates a new label with the given text inside it. You can pass NULL to get an empty label widget.

gtk_label_new_with_mnemonic

Creates a new GtkLabel, containing the text in str.

Instance methods

gtk_label_get_angle

Gets the angle of rotation for the label. See gtk_label_set_angle().

since: 2.6

gtk_label_get_attributes

Gets the attribute list that was set on the label using gtk_label_set_attributes(), if any. This function does not reflect attributes that come from the labels markup (see gtk_label_set_markup()). If you want to get the effective attributes for the label, use pango_layout_get_attribute (gtk_label_get_layout (label)).

gtk_label_get_current_uri

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.

since: 2.18

gtk_label_get_ellipsize

Returns the ellipsizing position of the label. See gtk_label_set_ellipsize().

since: 2.6

gtk_label_get_justify

Returns the justification of the label. See gtk_label_set_justify().

gtk_label_get_label

Fetches the text from a label widget including any embedded underlines indicating mnemonics and Pango markup. (See gtk_label_get_text()).

gtk_label_get_layout

Gets the PangoLayout used to display the label. The layout is useful to e.g. convert text positions to pixel positions, in combination with gtk_label_get_layout_offsets(). 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.

gtk_label_get_layout_offsets

Obtains the coordinates where the label will draw the PangoLayout representing the text in the label; useful to convert mouse events into coordinates inside the PangoLayout, e.g. to take some action if some part of the label is clicked. Of course you will need to create a GtkEventBox to receive the events, and pack the label inside it, since labels are windowless (they return FALSE from gtk_widget_get_has_window()). Remember when using the PangoLayout functions you need to convert to and from pixels using PANGO_PIXELS() or #PANGO_SCALE.

gtk_label_get_line_wrap

Returns whether lines in the label are automatically wrapped. See gtk_label_set_line_wrap().

gtk_label_get_line_wrap_mode

Returns line wrap mode used by the label. See gtk_label_set_line_wrap_mode().

since: 2.10

gtk_label_get_lines

Gets the number of lines to which an ellipsized, wrapping label should be limited. See gtk_label_set_lines().

since: 3.10

gtk_label_get_max_width_chars

Retrieves the desired maximum width of label, in characters. See gtk_label_set_width_chars().

since: 2.6

gtk_label_get_mnemonic_keyval

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 #GDK_KEY_VoidSymbol.

gtk_label_get_mnemonic_widget

Retrieves the target of the mnemonic (keyboard shortcut) of this label. See gtk_label_set_mnemonic_widget().

gtk_label_get_selectable

Gets the value set by gtk_label_set_selectable().

gtk_label_get_selection_bounds

Gets the selected range of characters in the label, returning TRUE if there’s a selection.

gtk_label_get_single_line_mode

Returns whether the label is in single line mode.

since: 2.6

gtk_label_get_text

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 gtk_label_get_label()).

gtk_label_get_track_visited_links

Returns whether the label is currently keeping track of clicked links.

since: 2.18

gtk_label_get_use_markup

Returns whether the label’s text is interpreted as marked up with the [Pango text markup language][PangoMarkupFormat]. See gtk_label_set_use_markup ().

gtk_label_get_use_underline

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

gtk_label_get_width_chars

Retrieves the desired width of label, in characters. See gtk_label_set_width_chars().

since: 2.6

gtk_label_get_xalign

Gets the GtkLabel:xalign property for label.

since: 3.16

gtk_label_get_yalign

Gets the GtkLabel:yalign property for label.

since: 3.16

gtk_label_select_region

Selects a range of characters in the label, if the label is selectable. See gtk_label_set_selectable(). If the label is not selectable, this function has no effect. If start_offset or end_offset are -1, then the end of the label will be substituted.

gtk_label_set_angle

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

gtk_label_set_attributes

Sets a PangoAttrList; the attributes in the list are applied to the label text.

gtk_label_set_ellipsize

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

gtk_label_set_justify

Sets the alignment of the lines in the text of the label relative to each other. GTK_JUSTIFY_LEFT is the default value when the widget is first created with gtk_label_new(). If you instead want to set the alignment of the label as a whole, use gtk_widget_set_halign() instead. gtk_label_set_justify() has no effect on labels containing only a single line.

gtk_label_set_label

Sets the text of the label. The label is interpreted as including embedded underlines and/or Pango markup depending on the values of the GtkLabel:use-underline and GtkLabel:use-markup properties.

gtk_label_set_line_wrap

Toggles line wrapping within the GtkLabel 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.

gtk_label_set_line_wrap_mode

If line wrapping is on (see gtk_label_set_line_wrap()) this controls how the line wrapping is done. The default is PANGO_WRAP_WORD which means wrap on word boundaries.

since: 2.10

gtk_label_set_lines

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

gtk_label_set_markup

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.

gtk_label_set_markup_with_mnemonic

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.

gtk_label_set_max_width_chars

Sets the desired maximum width in characters of label to n_chars.

since: 2.6

gtk_label_set_mnemonic_widget

If the label has been set so that it has an mnemonic key (using i.e. gtk_label_set_markup_with_mnemonic(), gtk_label_set_text_with_mnemonic(), gtk_label_new_with_mnemonic() 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 GtkButton or a GtkNotebook tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is a GtkEntry next to the label) you need to set it explicitly using this function.

gtk_label_set_pattern

The pattern of underlines you want under the existing text within the GtkLabel widget. For example if the current text of the label says “FooBarBaz” passing a pattern of “ ” will underline “Foo” and “Baz” but not “Bar”.

gtk_label_set_selectable

Selectable labels allow the user to select text from the label, for copy-and-paste.

gtk_label_set_single_line_mode

Sets whether the label is in single line mode.

since: 2.6

gtk_label_set_text

Sets the text within the GtkLabel widget. It overwrites any text that was there before.

gtk_label_set_text_with_mnemonic

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 gtk_label_set_mnemonic_widget().

gtk_label_set_track_visited_links

Sets whether the label should keep track of clicked links (and use a different color for them).

since: 2.18

gtk_label_set_use_markup

Sets whether the text of the label contains markup in [Pango’s text markup language][PangoMarkupFormat]. See gtk_label_set_markup().

gtk_label_set_use_underline

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

gtk_label_set_width_chars

Sets the desired width in characters of label to n_chars.

since: 2.6

gtk_label_set_xalign

Sets the GtkLabel:xalign property for label.

since: 3.16

gtk_label_set_yalign

Sets the GtkLabel:yalign property for label.

since: 3.16

Methods inherited from GtkMisc (4)
gtk_misc_get_alignment

Gets the X and Y alignment of the widget within its allocation. See gtk_misc_set_alignment().

deprecated: 3.14 

gtk_misc_get_padding

Gets the padding in the X and Y directions of the widget. See gtk_misc_set_padding().

deprecated: 3.14 

gtk_misc_set_alignment

Sets the alignment of the widget.

deprecated: 3.14 

gtk_misc_set_padding

Sets the amount of space to add around the widget.

deprecated: 3.14 

Methods inherited from GtkWidget (263)

Please see GtkWidget for a full list of methods.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GtkBuildable (10)
gtk_buildable_add_child

Adds a child to buildable. type is an optional string describing how the child should be added.

since: 2.12

gtk_buildable_construct_child

Constructs a child of buildable with the name name.

since: 2.12

gtk_buildable_custom_finished

This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

since: 2.12

gtk_buildable_custom_tag_end

This is called at the end of each custom element handled by the buildable.

since: 2.12

gtk_buildable_custom_tag_start

This is called for each unknown element under <child>.

since: 2.12

gtk_buildable_get_internal_child

Get the internal child called childname of the buildable object.

since: 2.12

gtk_buildable_get_name

Gets the name of the buildable object.

since: 2.12

gtk_buildable_parser_finished

Called when the builder finishes the parsing of a [GtkBuilder UI definition][BUILDER-UI]. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

since: 2.12

gtk_buildable_set_buildable_property

Sets the property name name to value on the buildable object.

since: 2.12

gtk_buildable_set_name

Sets the name of the buildable object.

since: 2.12

Properties

Gtk.Label: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

Gtk.Label:attributes
No description available.

Gtk.Label:cursor-position
No description available.

Gtk.Label:ellipsize

The preferred place to ellipsize the string, if the label does not have enough room to display the entire string, specified as a PangoEllipsizeMode.

since: 2.6

Gtk.Label:justify
No description available.

Gtk.Label:label

The contents of the label.

Gtk.Label: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

Gtk.Label:max-width-chars

The desired maximum width of the label, in characters. If this property is set to -1, the width will be calculated automatically.

since: 2.6

Gtk.Label:mnemonic-keyval
No description available.

Gtk.Label:mnemonic-widget
No description available.

Gtk.Label:pattern
No description available.

Gtk.Label:selectable
No description available.

Gtk.Label:selection-bound
No description available.

Gtk.Label:single-line-mode

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

Gtk.Label:track-visited-links

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

Gtk.Label:use-markup
No description available.

Gtk.Label:use-underline
No description available.

Gtk.Label:width-chars

The desired width of the label, in characters. If this property is set to -1, the width will be calculated automatically.

since: 2.6

Gtk.Label:wrap
No description available.

Gtk.Label:wrap-mode

If line wrapping is on (see the GtkLabel:wrap property) this controls how the line wrapping is done. The default is PANGO_WRAP_WORD, which means wrap on word boundaries.

since: 2.10

Gtk.Label:xalign

The xalign property determines the horizontal aligment of the label text inside the labels size allocation. Compare this to GtkWidget:halign, which determines how the labels size allocation is positioned in the space available for the label.

since: 3.16

Gtk.Label:yalign

The yalign property determines the vertical aligment of the label text inside the labels size allocation. Compare this to GtkWidget:valign, which determines how the labels size allocation is positioned in the space available for the label.

since: 3.16

Properties inherited from GtkMisc (4)
Gtk.Misc:xalign

The horizontal alignment. A value of 0.0 means left alignment (or right on RTL locales); a value of 1.0 means right alignment (or left on RTL locales).

deprecated: 3.14 

Gtk.Misc:xpad

The amount of space to add on the left and right of the widget, in pixels.

deprecated: 3.14 

Gtk.Misc:yalign

The vertical alignment. A value of 0.0 means top alignment; a value of 1.0 means bottom alignment.

deprecated: 3.14 

Gtk.Misc:ypad

The amount of space to add on the top and bottom of the widget, in pixels.

deprecated: 3.14 

Properties inherited from GtkWidget (39)
Gtk.Widget:app-paintable
No description available.

Gtk.Widget:can-default
No description available.

Gtk.Widget:can-focus
No description available.

Gtk.Widget:composite-child
No description available.

Gtk.Widget:double-buffered

Whether the widget is double buffered.

deprecated: 3.14 since: 2.18

Gtk.Widget:events
No description available.

Gtk.Widget:expand

Whether to expand in both directions. Setting this sets both GtkWidget:hexpand and GtkWidget:vexpand.

since: 3.0

Gtk.Widget:focus-on-click

Whether the widget should grab focus when it is clicked with the mouse.

since: 3.20

Gtk.Widget:halign

How to distribute horizontal space if widget gets extra space, see GtkAlign.

since: 3.0

Gtk.Widget:has-default
No description available.

Gtk.Widget:has-focus
No description available.

Gtk.Widget:has-tooltip

Enables or disables the emission of GtkWidget::query-tooltip on widget. A value of TRUE indicates that widget can have a tooltip, in this case the widget will be queried using GtkWidget::query-tooltip to determine whether it will provide a tooltip or not.

since: 2.12

Gtk.Widget:height-request
No description available.

Gtk.Widget:hexpand

Whether to expand horizontally. See gtk_widget_set_hexpand().

since: 3.0

Gtk.Widget:hexpand-set

Whether to use the GtkWidget:hexpand property. See gtk_widget_get_hexpand_set().

since: 3.0

Gtk.Widget:is-focus
No description available.

Gtk.Widget:margin

Sets all four sides’ margin at once. If read, returns max margin on any side.

since: 3.0

Gtk.Widget:margin-bottom

Margin on bottom side of widget.

since: 3.0

Gtk.Widget:margin-end

Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

since: 3.12

Gtk.Widget:margin-left

Margin on left side of widget.

deprecated: 3.12 since: 3.0

Gtk.Widget:margin-right

Margin on right side of widget.

deprecated: 3.12 since: 3.0

Gtk.Widget:margin-start

Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

since: 3.12

Gtk.Widget:margin-top

Margin on top side of widget.

since: 3.0

Gtk.Widget:name
No description available.

Gtk.Widget:no-show-all
No description available.

Gtk.Widget:opacity

The requested opacity of the widget. See gtk_widget_set_opacity() for more details about window opacity.

since: 3.8

Gtk.Widget:parent
No description available.

Gtk.Widget:receives-default
No description available.

Gtk.Widget:scale-factor

The scale factor of the widget. See gtk_widget_get_scale_factor() for more details about widget scaling.

since: 3.10

Gtk.Widget:sensitive
No description available.

Gtk.Widget:style

The style of the widget, which contains information about how it will look (colors, etc).

deprecated: Unknown 

Gtk.Widget:tooltip-markup

Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. Also see gtk_tooltip_set_markup().

since: 2.12

Gtk.Widget:tooltip-text

Sets the text of tooltip to be the given string.

since: 2.12

Gtk.Widget:valign

How to distribute vertical space if widget gets extra space, see GtkAlign.

since: 3.0

Gtk.Widget:vexpand

Whether to expand vertically. See gtk_widget_set_vexpand().

since: 3.0

Gtk.Widget:vexpand-set

Whether to use the GtkWidget:vexpand property. See gtk_widget_get_vexpand_set().

since: 3.0

Gtk.Widget:visible
No description available.

Gtk.Widget:width-request
No description available.

Gtk.Widget:window

The widget’s window if it is realized, NULL otherwise.

since: 2.14

Signals

Gtk.Label::activate-current-link

A [keybinding signal][GtkBindingSignal] which gets emitted when the user activates a link in the label.

since: 2.18

Gtk.Label::activate-link

The signal which gets emitted to activate a URI. Applications may connect to it to override the default behaviour, which is to call gtk_show_uri_on_window().

since: 2.18

Gtk.Label::copy-clipboard

The ::copy-clipboard signal is a [keybinding signal][GtkBindingSignal] which gets emitted to copy the selection to the clipboard.

Gtk.Label::move-cursor

The ::move-cursor 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.

Gtk.Label::populate-popup

The ::populate-popup signal gets emitted before showing the context menu of the label. Note that only selectable labels have context menus.

Signals inherited from GtkWidget (69)
GtkWidget::accel-closures-changed
No description available.

GtkWidget::button-press-event

The ::button-press-event signal will be emitted when a button (typically from a mouse) is pressed.

GtkWidget::button-release-event

The ::button-release-event signal will be emitted when a button (typically from a mouse) is released.

GtkWidget::can-activate-accel

Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This signal is present to allow applications and derived widgets to override the default GtkWidget handling for determining whether an accelerator can be activated.

GtkWidget::child-notify

The ::child-notify signal is emitted for each [child property][child-properties] that has changed on an object. The signal’s detail holds the property name.

GtkWidget::composited-changed

The ::composited-changed signal is emitted when the composited status of widgets screen changes. See gdk_screen_is_composited().

deprecated: 3.22 

GtkWidget::configure-event

The ::configure-event signal will be emitted when the size, position or stacking of the widgets window has changed.

GtkWidget::damage-event

Emitted when a redirected window belonging to widget gets drawn into. The region/area members of the event shows what area of the redirected drawable was drawn into.

since: 2.14

GtkWidget::delete-event

The ::delete-event signal is emitted if a user requests that a toplevel window is closed. The default handler for this signal destroys the window. Connecting gtk_widget_hide_on_delete() to this signal will cause the window to be hidden instead, so that it can later be shown again without reconstructing it.

GtkWidget::destroy

Signals that all holders of a reference to the widget should release the reference that they hold. May result in finalization of the widget if all references are released.

GtkWidget::destroy-event

The ::destroy-event signal is emitted when a GdkWindow is destroyed. You rarely get this signal, because most widgets disconnect themselves from their window before they destroy it, so no widget owns the window at destroy time.

GtkWidget::direction-changed

The ::direction-changed signal is emitted when the text direction of a widget changes.

GtkWidget::drag-begin

The ::drag-begin signal is emitted on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with e.g. gtk_drag_source_set_icon_pixbuf().

GtkWidget::drag-data-delete

The ::drag-data-delete signal is emitted on the drag source when a drag with the action GDK_ACTION_MOVE is successfully completed. The signal handler is responsible for deleting the data that has been dropped. What “delete” means depends on the context of the drag operation.

GtkWidget::drag-data-get

The ::drag-data-get signal is emitted on the drag source when the drop site requests the data which is dragged. It is the responsibility of the signal handler to fill data with the data in the format which is indicated by info. See gtk_selection_data_set() and gtk_selection_data_set_text().

GtkWidget::drag-data-received

The ::drag-data-received signal is emitted on the drop site when the dragged data has been received. If the data was received in order to determine whether the drop will be accepted, the handler is expected to call gdk_drag_status() and not finish the drag. If the data was received in response to a GtkWidget::drag-drop signal (and this is the last target to be received), the handler for this signal is expected to process the received data and then call gtk_drag_finish(), setting the success parameter depending on whether the data was processed successfully.

GtkWidget::drag-drop

The ::drag-drop signal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns FALSE and no further processing is necessary. Otherwise, the handler returns TRUE. In this case, the handler must ensure that gtk_drag_finish() is called to let the source know that the drop is done. The call to gtk_drag_finish() can be done either directly or in a GtkWidget::drag-data-received handler which gets triggered by calling gtk_drag_get_data() to receive the data for one or more of the supported targets.

GtkWidget::drag-end

The ::drag-end signal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in GtkWidget::drag-begin.

GtkWidget::drag-failed

The ::drag-failed signal is emitted on the drag source when a drag has failed. The signal handler may hook custom code to handle a failed DnD operation based on the type of error, it returns TRUE is the failure has been already handled (not showing the default “drag operation failed” animation), otherwise it returns FALSE.

since: 2.12

GtkWidget::drag-leave

The ::drag-leave signal is emitted on the drop site when the cursor leaves the widget. A typical reason to connect to this signal is to undo things done in GtkWidget::drag-motion, e.g. undo highlighting with gtk_drag_unhighlight().

GtkWidget::drag-motion

The ::drag-motion signal is emitted on the drop site when the user moves the cursor over the widget during a drag. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns FALSE and no further processing is necessary. Otherwise, the handler returns TRUE. In this case, the handler is responsible for providing the necessary information for displaying feedback to the user, by calling gdk_drag_status().

GtkWidget::draw

This signal is emitted when a widget is supposed to render itself. The widgets top left corner must be painted at the origin of the passed in context and be sized to the values returned by gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height().

since: 3.0

GtkWidget::enter-notify-event

The ::enter-notify-event will be emitted when the pointer enters the widgets window.

GtkWidget::event

The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic ::event signal, another, more specific, signal that matches the type of event delivered (e.g. GtkWidget::key-press-event) and finally a generic GtkWidget::event-after signal.

GtkWidget::event-after

After the emission of the GtkWidget::event signal and (optionally) the second more specific signal, ::event-after will be emitted regardless of the previous two signals handlers return values.

GtkWidget::focus
No description available.

GtkWidget::focus-in-event

The ::focus-in-event signal will be emitted when the keyboard focus enters the widgets window.

GtkWidget::focus-out-event

The ::focus-out-event signal will be emitted when the keyboard focus leaves the widgets window.

GtkWidget::grab-broken-event

Emitted when a pointer or keyboard grab on a window belonging to widget gets broken.

since: 2.8

GtkWidget::grab-focus
No description available.

GtkWidget::grab-notify

The ::grab-notify signal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.

GtkWidget::hide

The ::hide signal is emitted when widget is hidden, for example with gtk_widget_hide().

GtkWidget::hierarchy-changed

The ::hierarchy-changed signal is emitted when the anchored state of a widget changes. A widget is “anchored” when its toplevel ancestor is a GtkWindow. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.

GtkWidget::key-press-event

The ::key-press-event signal is emitted when a key is pressed. The signal emission will reoccur at the key-repeat rate when the key is kept pressed.

GtkWidget::key-release-event

The ::key-release-event signal is emitted when a key is released.

GtkWidget::keynav-failed

Gets emitted if keyboard navigation fails. See gtk_widget_keynav_failed() for details.

since: 2.12

GtkWidget::leave-notify-event

The ::leave-notify-event will be emitted when the pointer leaves the widgets window.

GtkWidget::map

The ::map signal is emitted when widget is going to be mapped, that is when the widget is visible (which is controlled with gtk_widget_set_visible()) and all its parents up to the toplevel widget are also visible. Once the map has occurred, GtkWidget::map-event will be emitted.

GtkWidget::map-event

The ::map-event signal will be emitted when the widgets window is mapped. A window is mapped when it becomes visible on the screen.

GtkWidget::mnemonic-activate

The default handler for this signal activates widget if group_cycling is FALSE, or just makes widget grab focus if group_cycling is TRUE.

GtkWidget::motion-notify-event

The ::motion-notify-event signal is emitted when the pointer moves over the widget’s GdkWindow.

GtkWidget::move-focus
No description available.

GtkWidget::parent-set

The ::parent-set signal is emitted when a new parent has been set on a widget.

GtkWidget::popup-menu

This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the GtkEntry widget creates a menu with clipboard commands. See the [Popup Menu Migration Checklist][checklist-popup-menu] for an example of how to use this signal.

GtkWidget::property-notify-event

The ::property-notify-event signal will be emitted when a property on the widgets window has been changed or deleted.

GtkWidget::proximity-in-event

To receive this signal the GdkWindow associated to the widget needs to enable the #GDK_PROXIMITY_IN_MASK mask.

GtkWidget::proximity-out-event

To receive this signal the GdkWindow associated to the widget needs to enable the #GDK_PROXIMITY_OUT_MASK mask.

GtkWidget::query-tooltip

Emitted when GtkWidget:has-tooltip is TRUE and the hover timeout has expired with the cursor hovering “above” widget; or emitted when widget got focus in keyboard mode.

since: 2.12

GtkWidget::realize

The ::realize signal is emitted when widget is associated with a GdkWindow, which means that gtk_widget_realize() has been called or the widget has been mapped (that is, it is going to be drawn).

GtkWidget::screen-changed

The ::screen-changed signal gets emitted when the screen of a widget has changed.

GtkWidget::scroll-event

The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.

GtkWidget::selection-clear-event

The ::selection-clear-event signal will be emitted when the the widgets window has lost ownership of a selection.

GtkWidget::selection-get
No description available.

GtkWidget::selection-notify-event
No description available.

GtkWidget::selection-received
No description available.

GtkWidget::selection-request-event

The ::selection-request-event signal will be emitted when another client requests ownership of the selection owned by the widgets window.

GtkWidget::show

The ::show signal is emitted when widget is shown, for example with gtk_widget_show().

GtkWidget::show-help
No description available.

GtkWidget::size-allocate
No description available.

GtkWidget::state-changed

The ::state-changed signal is emitted when the widget state changes. See gtk_widget_get_state().

deprecated: 3.0 

GtkWidget::state-flags-changed

The ::state-flags-changed signal is emitted when the widget state changes, see gtk_widget_get_state_flags().

since: 3.0

GtkWidget::style-set

The ::style-set signal is emitted when a new style has been set on a widget. Note that style-modifying functions like gtk_widget_modify_base() also cause this signal to be emitted.

deprecated: 3.0 

GtkWidget::style-updated

The ::style-updated signal is a convenience signal that is emitted when the GtkStyleContext::changed signal is emitted on the widgets associated GtkStyleContext as returned by gtk_widget_get_style_context().

since: 3.0

GtkWidget::touch-event
No description available.

GtkWidget::unmap

The ::unmap signal is emitted when widget is going to be unmapped, which means that either it or any of its parents up to the toplevel widget have been set as hidden.

GtkWidget::unmap-event

The ::unmap-event signal will be emitted when the widgets window is unmapped. A window is unmapped when it becomes invisible on the screen.

GtkWidget::unrealize

The ::unrealize signal is emitted when the GdkWindow associated with widget is destroyed, which means that gtk_widget_unrealize() has been called or the widget has been unmapped (that is, it is going to be hidden).

GtkWidget::visibility-notify-event

The ::visibility-notify-event will be emitted when the widgets window is obscured or unobscured.

deprecated: 3.12 

GtkWidget::window-state-event

The ::window-state-event will be emitted when the state of the toplevel window associated to the widget changes.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkLabelClass {
  GtkMiscClass parent_class;
  void (* move_cursor) (
    GtkLabel* label,
    GtkMovementStep step,
    gint count,
    gboolean extend_selection
  );
  void (* copy_clipboard) (
    GtkLabel* label
  );
  void (* populate_popup) (
    GtkLabel* label,
    GtkMenu* menu
  );
  gboolean (* activate_link) (
    GtkLabel* label,
    const gchar* uri
  );
  void (* _gtk_reserved1) (
void
  );
  void (* _gtk_reserved2) (
void
  );
  void (* _gtk_reserved3) (
void
  );
  void (* _gtk_reserved4) (
void
  );
  void (* _gtk_reserved5) (
void
  );
  void (* _gtk_reserved6) (
void
  );
  void (* _gtk_reserved7) (
void
  );
  void (* _gtk_reserved8) (
void
  );
  
}

No description available.

Class members
parent_class: GtkMiscClass

No description available.

move_cursor: void (* move_cursor) ( GtkLabel* label, GtkMovementStep step, gint count, gboolean extend_selection )

No description available.

copy_clipboard: void (* copy_clipboard) ( GtkLabel* label )

No description available.

populate_popup: void (* populate_popup) ( GtkLabel* label, GtkMenu* menu )

No description available.

activate_link: gboolean (* activate_link) ( GtkLabel* label, const gchar* uri )

No description available.

_gtk_reserved1: void (* _gtk_reserved1) ( void )

No description available.

_gtk_reserved2: void (* _gtk_reserved2) ( void )

No description available.

_gtk_reserved3: void (* _gtk_reserved3) ( void )

No description available.

_gtk_reserved4: void (* _gtk_reserved4) ( void )

No description available.

_gtk_reserved5: void (* _gtk_reserved5) ( void )

No description available.

_gtk_reserved6: void (* _gtk_reserved6) ( void )

No description available.

_gtk_reserved7: void (* _gtk_reserved7) ( void )

No description available.

_gtk_reserved8: void (* _gtk_reserved8) ( void )

No description available.

Virtual methods

No description available.

Gtk.LabelClass.copy_clipboard
No description available.

Gtk.LabelClass.move_cursor
No description available.

Gtk.LabelClass.populate_popup
No description available.