gtkmm 2.24.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Related Functions

# Gtk::Label Class Reference
Widgets

A widget that displays a small to medium amount of text. More...

Inheritance diagram for Gtk::Label:
[legend]
Collaboration diagram for Gtk::Label:
[legend]

List of all members.

## Public Member Functions
virtual | ~Label ()
GtkLabel* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkLabel* | gobj () const
| Provides access to the underlying C GtkObject.
| Label ()
| Label (const Glib::ustring& label, bool mnemonic=false)
| Label (const Glib::ustring& label, float xalign, float yalign, bool mnemonic=false)
| This constructor is a shortcut for often used code when you want to create a label with alignment different than default one.
| Label (const Glib::ustring& label, AlignmentEnum xalign, AlignmentEnum yalign=ALIGN_CENTER, bool mnemonic=false)
| This constructor is a shortcut for often used code when you want to create a label with alignment different than default one.
void | set_text (const Glib::ustring& str)
| Doesn't use markup.
Glib::ustring | get_text () const
| Fetches the text from a label widget, as displayed on the screen.
void | set_attributes (Pango::AttrList& attrs)
| Sets a Pango::AttrList; the attributes in the list are applied to the label text.
Pango::AttrList | get_attributes () const
| Gets the attribute list that was set on the label using set_attributes(), if any.
void | set_label (const Glib::ustring& str)
| Sets the text of the label.
Glib::ustring | get_label () const
| Fetches the text from a label widget including any embedded underlines indicating mnemonics and Pango markup.
void | set_markup (const Glib::ustring& str)
| Parses str which is marked up with the ", str); gtk_label_set_markup (GTK_LABEL (label), markup); g_free (markup); ]|.
void | set_use_markup (bool setting=true)
| Sets whether the text of the label contains markup in .
bool | get_use_markup () const
| Returns whether the label's text is interpreted as marked up with the .
void | set_use_underline (bool setting=true)
| If true, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
bool | get_use_underline () const
| Returns whether an embedded underline in the label indicates a mnemonic.
void | set_markup_with_mnemonic (const Glib::ustring& str)
| Parses str which is marked up with the , setting the label's text and attribute list based on the parse results.
guint | get_mnemonic_keyval () const
| If the label has been set so that it has an mnemonic key this function returns the keyval used for the mnemonic accelerator.
void | set_mnemonic_widget (Widget& widget)
| If the label has been set so that it has an mnemonic key (using i.e. set_markup_with_mnemonic(), set_text_with_mnemonic(), new_with_mnemonic() or the "use_underline" property) the label can be associated with a widget that is the target of the mnemonic.
Widget* | get_mnemonic_widget ()
| Retrieves the target of the mnemonic (keyboard shortcut) of this label.
const Widget* | get_mnemonic_widget () const
| Retrieves the target of the mnemonic (keyboard shortcut) of this label.
void | set_text_with_mnemonic (const Glib::ustring& str)
| Sets the label's text from the string str.
void | set_justify (Justification jtype)
| Sets the alignment of the lines in the text of the label relative to each other.
Justification | get_justify () const
| Returns the justification of the label.
void | set_ellipsize (Pango::EllipsizeMode mode)
| Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string.
Pango::EllipsizeMode | get_ellipsize () const
| Returns the ellipsizing position of the label.
void | set_width_chars (int n_chars)
| Sets the desired width in characters of label to n_chars.
int | get_width_chars () const
| Retrieves the desired width of label, in characters.
void | set_max_width_chars (int n_chars)
| Sets the desired maximum width in characters of label to n_chars.
int | get_max_width_chars () const
| Retrieves the desired maximum width of label, in characters.
void | set_pattern (const Glib::ustring& pattern)
void | set_line_wrap (bool wrap=true)
| Toggles line wrapping within the Gtk::Label widget.
bool | get_line_wrap () const
| Returns whether lines in the label are automatically wrapped.
void | set_line_wrap_mode (Pango::WrapMode wrap_mode)
| If line wrapping is on (see set_line_wrap()) this controls how the line wrapping is done.
Pango::WrapMode | get_line_wrap_mode () const
| Returns line wrap mode used by the label.
void | set_selectable (bool setting=true)
| Selectable labels allow the user to select text from the label, for copy-and-paste.
bool | get_selectable () const
| Gets the value set by set_selectable().
void | set_angle (double angle)
| Sets the angle of rotation for the label.
double | get_angle () const
| Gets the angle of rotation for the label.
void | select_region (int start_offset, int end_offset)
| Selects a range of characters in the label, if the label is selectable.
void | select_region (int start_offset)
| Selects a range of characters in the label, from start_offset to the end, if the label is selectable.
bool | get_selection_bounds (int&start, int&end) const
| Gets the selected range of characters in the label, returning `true` if there's a selection.
Glib::RefPtr< Pango::Layout > | get_layout ()
| Gets the Pango::Layout used to display the label.
Glib::RefPtr< const Pango::Layout > | get_layout () const
| Gets the Pango::Layout used to display the label.
void | get_layout_offsets (int& x, int& y) const
| Obtains the coordinates where the label will draw the Pango::Layout representing the text in the label; useful to convert mouse events into coordinates inside the Pango::Layout, e.g. to take some action if some part of the label is clicked.
void | set_single_line_mode (bool single_line_mode=true)
| Sets whether the label is in single line mode.
bool | get_single_line_mode () const
| Returns whether the label is in single line mode.
Glib::ustring | get_current_uri () const
| Returns the URI for the currently active link in the label.
void | set_track_visited_links (bool track_links=true)
| Sets whether the label should keep track of clicked links (and use a different color for them).
bool | get_track_visited_links () const
| Returns whether the label is currently keeping track of clicked links.
Glib::SignalProxy1< void, Menu* > | signal_populate_popup ()
Glib::SignalProxy1< bool, const Glib::ustring& > | signal_activate_link ()
Glib::PropertyProxy < Glib::ustring > | property_label ()
| The text of the label.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_label () const
| The text of the label.
Glib::PropertyProxy < Pango::AttrList > | property_attributes ()
| A list of style attributes to apply to the text of the label.
Glib::PropertyProxy_ReadOnly < Pango::AttrList > | property_attributes () const
| A list of style attributes to apply to the text of the label.
Glib::PropertyProxy< bool > | property_use_markup ()
| The text of the label includes XML markup.
Glib::PropertyProxy_ReadOnly < bool > | property_use_markup () const
| The text of the label includes XML markup.
Glib::PropertyProxy< bool > | property_use_underline ()
| If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
Glib::PropertyProxy_ReadOnly < bool > | property_use_underline () const
| If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
Glib::PropertyProxy < Justification > | property_justify ()
| The alignment of the lines in the text of the label relative to each other.
Glib::PropertyProxy_ReadOnly < Justification > | property_justify () const
| The alignment of the lines in the text of the label relative to each other.
Glib::PropertyProxy_WriteOnly < Glib::ustring > | property_pattern ()
| A string with _ characters in positions correspond to characters in the text to underline.
Glib::PropertyProxy< bool > | property_wrap ()
| If set, wrap lines if the text becomes too wide.
Glib::PropertyProxy_ReadOnly < bool > | property_wrap () const
| If set, wrap lines if the text becomes too wide.
Glib::PropertyProxy < Pango::WrapMode > | property_wrap_mode ()
| If wrap is set, controls how linewrapping is done.
Glib::PropertyProxy_ReadOnly < Pango::WrapMode > | property_wrap_mode () const
| If wrap is set, controls how linewrapping is done.
Glib::PropertyProxy< bool > | property_selectable ()
| Whether the label text can be selected with the mouse.
Glib::PropertyProxy_ReadOnly < bool > | property_selectable () const
| Whether the label text can be selected with the mouse.
Glib::PropertyProxy_ReadOnly < guint > | property_mnemonic_keyval () const
| The mnemonic accelerator key for this label.
Glib::PropertyProxy< Widget* > | property_mnemonic_widget ()
| The widget to be activated when the label's mnemonic key is pressed.
Glib::PropertyProxy_ReadOnly < Widget* > | property_mnemonic_widget () const
| The widget to be activated when the label's mnemonic key is pressed.
Glib::PropertyProxy_ReadOnly< int > | property_cursor_position () const
| The current position of the insertion cursor in chars.
Glib::PropertyProxy_ReadOnly< int > | property_selection_bound () const
| The position of the opposite end of the selection from the cursor in chars.
Glib::PropertyProxy < Pango::EllipsizeMode > | property_ellipsize ()
| The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
Glib::PropertyProxy_ReadOnly < Pango::EllipsizeMode > | property_ellipsize () const
| The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
Glib::PropertyProxy< int > | property_width_chars ()
| The desired width of the label, in characters.
Glib::PropertyProxy_ReadOnly< int > | property_width_chars () const
| The desired width of the label, in characters.
Glib::PropertyProxy< bool > | property_single_line_mode ()
| Whether the label is in single line mode.
Glib::PropertyProxy_ReadOnly < bool > | property_single_line_mode () const
| Whether the label is in single line mode.
Glib::PropertyProxy< double > | property_angle ()
| Angle at which the label is rotated.
Glib::PropertyProxy_ReadOnly < double > | property_angle () const
| Angle at which the label is rotated.
Glib::PropertyProxy< int > | property_max_width_chars ()
| The desired maximum width of the label, in characters.
Glib::PropertyProxy_ReadOnly< int > | property_max_width_chars () const
| The desired maximum width of the label, in characters.
Glib::PropertyProxy< bool > | property_track_visited_links ()
| Whether visited links should be tracked.
Glib::PropertyProxy_ReadOnly < bool > | property_track_visited_links () const
| Whether visited links should be tracked.
## Protected Member Functions
virtual void | on_populate_popup (Menu* menu)
## Related Functions
(Note that these are not member functions.)
Gtk::Label* | wrap (GtkLabel* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A widget that displays a small to medium amount of text.

A simple setable widget for holding a Glib::ustring.

The Label widget looks like this:

## Constructor & Destructor Documentation

virtual Gtk::Label::~Label | ( |  | ) | `[virtual]`

Gtk::Label::Label | ( |  | ) |

Gtk::Label::Label | ( | const Glib::ustring & | label,
|  | bool | mnemonic = `false`
| ) |  | `[explicit]`

Gtk::Label::Label | ( | const Glib::ustring & | label,
|  | float | xalign,
|  | float | yalign,
|  | bool | mnemonic = `false`
| ) |  |

This constructor is a shortcut for often used code when you want to create a label with alignment different than default one.

     Gtk::Label label(text, x, y, mnemonic);

is equivalent to:

     Gtk::Label label(text, mnemonic);
     label.set_alignment(x, y);

Gtk::Label::Label | ( | const Glib::ustring & | label,
|  | AlignmentEnum | xalign,
|  | AlignmentEnum | yalign = `ALIGN_CENTER`,
|  | bool | mnemonic = `false`
| ) |  |

This constructor is a shortcut for often used code when you want to create a label with alignment different than default one.

     Gtk::Label label(text, x, y, mnemonic);

is equivalent to:

     Gtk::Label label(text, mnemonic);
     label.set_alignment(x, y);

## Member Function Documentation

double Gtk::Label::get_angle | ( |  | ) | const

Gets the angle of rotation for the label.

See set_angle().

Since gtkmm 2.6:

Returns:
  The angle of rotation for the label.

Pango::AttrList Gtk::Label::get_attributes | ( |  | ) | const

Gets the attribute list that was set on the label using set_attributes(), if any.

This function does not reflect attributes that come from the labels markup (see set_markup()). If you want to get the effective attributes for the label, use pango_layout_get_attribute (gtk_label_get_layout (label)).

Returns:
  The attribute list, or `0` if none was set.

Glib::ustring Gtk::Label::get_current_uri | ( |  | ) | const

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 Gtk::Label::activate-link handler or for use in a Gtk::Widget::query-tooltip handler.

Since gtkmm 2.18:

Returns:
  The currently active URI. The string is owned by GTK+ and must not be freed or modified.

Pango::EllipsizeMode Gtk::Label::get_ellipsize | ( |  | ) | const

Returns the ellipsizing position of the label.

See set_ellipsize().

Since gtkmm 2.6:

Returns:
  Pango::EllipsizeMode.

Justification Gtk::Label::get_justify | ( |  | ) | const

Returns the justification of the label.

See set_justify().

Returns:
  Gtk::Justification.

Glib::ustring Gtk::Label::get_label | ( |  | ) | const

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

(See get_text()).

Returns:
  The text of the label widget..

Glib::RefPtr<Pango::Layout> Gtk::Label::get_layout | ( |  | ) |

Gets the Pango::Layout used to display the label.

The layout is useful to e.g. convert text positions to pixel positions, in combination with get_layout_offsets().

Returns:
  The Pango::Layout for this label.

Glib::RefPtr<const Pango::Layout> Gtk::Label::get_layout | ( |  | ) | const

Gets the Pango::Layout used to display the label.

The layout is useful to e.g. convert text positions to pixel positions, in combination with get_layout_offsets().

Returns:
  The Pango::Layout for this label.

void Gtk::Label::get_layout_offsets | ( | int & | x,
|  | int & | y
| ) |  | const

Obtains the coordinates where the label will draw the Pango::Layout representing the text in the label; useful to convert mouse events into coordinates inside the Pango::Layout, e.g. to take some action if some part of the label is clicked.

Of course you will need to create a Gtk::EventBox to receive the events, and pack the label inside it, since labels are a Gtk::NO_WINDOW widget. Remember when using the Pango::Layout functions you need to convert to and from pixels using PANGO_PIXELS() or Pango::SCALE.

Parameters:

  x | Location to store X offset of layout, or `0`.
  y | Location to store Y offset of layout, or `0`.

bool Gtk::Label::get_line_wrap | ( |  | ) | const

Returns whether lines in the label are automatically wrapped.

See set_line_wrap().

Returns:
  `true` if the lines of the label are automatically wrapped.

Pango::WrapMode Gtk::Label::get_line_wrap_mode | ( |  | ) | const

Returns line wrap mode used by the label.

See set_line_wrap_mode().

Since gtkmm 2.10:

Returns:
  `true` if the lines of the label are automatically wrapped.

int Gtk::Label::get_max_width_chars | ( |  | ) | const

Retrieves the desired maximum width of label, in characters.

See set_width_chars().

Since gtkmm 2.6:

Returns:
  The maximum width of the label in characters.

guint Gtk::Label::get_mnemonic_keyval | ( |  | ) | const

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_VoidSymbol.

Returns:
  GDK keyval usable for accelerators, or #GDK_VoidSymbol.

Widget* Gtk::Label::get_mnemonic_widget | ( |  | ) |

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

See set_mnemonic_widget().

Returns:
  The target of the label's mnemonic, or `0` if none has been set and the default algorithm will be used.

const Widget* Gtk::Label::get_mnemonic_widget | ( |  | ) | const

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

See set_mnemonic_widget().

Returns:
  The target of the label's mnemonic, or `0` if none has been set and the default algorithm will be used.

bool Gtk::Label::get_selectable | ( |  | ) | const

Gets the value set by set_selectable().

Returns:
  `true` if the user can copy text from the label.

bool Gtk::Label::get_selection_bounds | ( | int & | start,
|  | int & | end
| ) |  | const

Gets the selected range of characters in the label, returning `true` if there's a selection.

Parameters:

  start | Return location for start of selection, as a character offset.
  end | Return location for end of selection, as a character offset.

Returns:
  `true` if selection is non-empty.

bool Gtk::Label::get_single_line_mode | ( |  | ) | const

Returns whether the label is in single line mode.

Since gtkmm 2.6:

Returns:
  `true` when the label is in single line mode.

Glib::ustring Gtk::Label::get_text | ( |  | ) | const

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 get_label())

Returns:
  The text in the label widget.

bool Gtk::Label::get_track_visited_links | ( |  | ) | const

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

Since gtkmm 2.18:

Returns:
  `true` if clicked links are remembered.

bool Gtk::Label::get_use_markup | ( |  | ) | const

Returns whether the label's text is interpreted as marked up with the .

See set_use_markup().

Returns:
  `true` if the label's text will be parsed for markup.

bool Gtk::Label::get_use_underline | ( |  | ) | const

Returns whether an embedded underline in the label indicates a mnemonic.

See set_use_underline().

Returns:
  `true` whether an embedded underline in the label indicates the mnemonic accelerator keys.

int Gtk::Label::get_width_chars | ( |  | ) | const

Retrieves the desired width of label, in characters.

See set_width_chars().

Since gtkmm 2.6:

Returns:
  The width of the label in characters.

GtkLabel* Gtk::Label::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Misc.

Reimplemented in Gtk::AccelLabel.

const GtkLabel* Gtk::Label::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Misc.

Reimplemented in Gtk::AccelLabel.

virtual void Gtk::Label::on_populate_popup | ( | Menu* | menu | ) | `[protected, virtual]`

Glib::PropertyProxy<double> Gtk::Label::property_angle | ( |  | ) |

Angle at which the label is rotated.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Gtk::Label::property_angle | ( |  | ) | const

Angle at which the label is rotated.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Pango::AttrList> Gtk::Label::property_attributes | ( |  | ) |

A list of style attributes to apply to the text of the label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Pango::AttrList> Gtk::Label::property_attributes | ( |  | ) | const

A list of style attributes to apply to the text of the label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Label::property_cursor_position | ( |  | ) | const

The current position of the insertion cursor in chars.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Pango::EllipsizeMode> Gtk::Label::property_ellipsize | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Pango::EllipsizeMode> Gtk::Label::property_ellipsize | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Justification> Gtk::Label::property_justify | ( |  | ) |

The alignment of the lines in the text of the label relative to each other.

This does NOT affect the alignment of the label within its allocation. See GtkMisc::xalign for that.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Justification> Gtk::Label::property_justify | ( |  | ) | const

The alignment of the lines in the text of the label relative to each other.

This does NOT affect the alignment of the label within its allocation. See GtkMisc::xalign for that.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gtk::Label::property_label | ( |  | ) |

The text of the label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::Label::property_label | ( |  | ) | const

The text of the label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Label::property_max_width_chars | ( |  | ) | const

The desired maximum width of the label, in characters.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::Label::property_max_width_chars | ( |  | ) |

The desired maximum width of the label, in characters.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Label::property_mnemonic_keyval | ( |  | ) | const

The mnemonic accelerator key for this label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Widget*> Gtk::Label::property_mnemonic_widget | ( |  | ) |

The widget to be activated when the label's mnemonic key is pressed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Widget*> Gtk::Label::property_mnemonic_widget | ( |  | ) | const

The widget to be activated when the label's mnemonic key is pressed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_WriteOnly<Glib::ustring> Gtk::Label::property_pattern | ( |  | ) |

A string with _ characters in positions correspond to characters in the text to underline.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Label::property_selectable | ( |  | ) |

Whether the label text can be selected with the mouse.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Label::property_selectable | ( |  | ) | const

Whether the label text can be selected with the mouse.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Label::property_selection_bound | ( |  | ) | const

The position of the opposite end of the selection from the cursor in chars.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Label::property_single_line_mode | ( |  | ) |

Whether the label is in single line mode.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Label::property_single_line_mode | ( |  | ) | const

Whether the label is in single line mode.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Label::property_track_visited_links | ( |  | ) |

Whether visited links should be tracked.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Label::property_track_visited_links | ( |  | ) | const

Whether visited links should be tracked.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Label::property_use_markup | ( |  | ) |

The text of the label includes XML markup.

See pango_parse_markup().

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Label::property_use_markup | ( |  | ) | const

The text of the label includes XML markup.

See pango_parse_markup().

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Label::property_use_underline | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Label::property_use_underline | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::Label::property_width_chars | ( |  | ) |

The desired width of the label, in characters.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Label::property_width_chars | ( |  | ) | const

The desired width of the label, in characters.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Label::property_wrap | ( |  | ) | const

If set, wrap lines if the text becomes too wide.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Label::property_wrap | ( |  | ) |

If set, wrap lines if the text becomes too wide.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Pango::WrapMode> Gtk::Label::property_wrap_mode | ( |  | ) |

If wrap is set, controls how linewrapping is done.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Pango::WrapMode> Gtk::Label::property_wrap_mode | ( |  | ) | const

If wrap is set, controls how linewrapping is done.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Label::select_region | ( | int | start_offset | ) |

Selects a range of characters in the label, from start_offset to the end, if the label is selectable.

See gtk_label_set_selectable(). If the label is not selectable, this function has no effect.

Parameters:

  start_offset | Start offset (in characters not bytes)

void Gtk::Label::select_region | ( | int | start_offset,
|  | int | end_offset
| ) |  |

Selects a range of characters in the label, if the label is selectable.

See 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.

Parameters:

  start_offset | Start offset (in characters not bytes).
  end_offset | End offset (in characters not bytes).

void Gtk::Label::set_angle | ( | double | 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 gtkmm 2.6:

Parameters:

  angle | The angle that the baseline of the label makes with the horizontal, in degrees, measured counterclockwise.

void Gtk::Label::set_attributes | ( | Pango::AttrList & | attrs | ) |

Sets a Pango::AttrList; the attributes in the list are applied to the label text.

<note>The attributes set with this function will be applied and merged with any other attributes previously effected by way of the Gtk::Label:use-underline or Gtk::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.</note>

Parameters:

  attrs | A Pango::AttrList.

void Gtk::Label::set_ellipsize | ( | Pango::EllipsizeMode | mode | ) |

Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string.

Since gtkmm 2.6:

Parameters:

  mode | A Pango::EllipsizeMode.

void Gtk::Label::set_justify | ( | Justification | jtype | ) |

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 new(). If you instead want to set the alignment of the label as a whole, use Gtk::Misc::set_alignment() instead. set_justify() has no effect on labels containing only a single line.

Parameters:

  jtype | A Gtk::Justification.

void Gtk::Label::set_label | ( | const Glib::ustring & | str | ) |

Sets the text of the label.

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

Parameters:

  str | The new text to set for the label.

void Gtk::Label::set_line_wrap | ( | bool | wrap = `true` | ) |

Toggles line wrapping within the Gtk::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 Gtk::Widget::set_size_request().

Parameters:

  wrap | The setting.

void Gtk::Label::set_line_wrap_mode | ( | Pango::WrapMode | wrap_mode | ) |

If line wrapping is on (see set_line_wrap()) this controls how the line wrapping is done.

The default is Pango::WRAP_WORD which means wrap on word boundaries.

Since gtkmm 2.10:

Parameters:

  wrap_mode | The line wrapping mode.

void Gtk::Label::set_markup | ( | const Glib::ustring & | str | ) |

Parses str which is marked up with the ", str); gtk_label_set_markup (GTK_LABEL (label), markup); g_free (markup); ]|.

Parameters:

  str | A markup string (see ).

void Gtk::Label::set_markup_with_mnemonic | ( | const Glib::ustring & | str | ) |

Parses str which is marked up with the , 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 set_mnemonic_widget().

Parameters:

  str | A markup string (see ).

void Gtk::Label::set_max_width_chars | ( | int | n_chars | ) |

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

Since gtkmm 2.6:

Parameters:

  n_chars | The new desired maximum width, in characters.

void Gtk::Label::set_mnemonic_widget | ( | Widget& | widget | ) |

If the label has been set so that it has an mnemonic key (using i.e. set_markup_with_mnemonic(), set_text_with_mnemonic(), 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 Gtk::Button or a Gtk::Notebook tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is a Gtk::Entry next to the label) you need to set it explicitly using this function.

The target widget will be accelerated by emitting the GtkWidget::mnemonic-activate 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.

Parameters:

  widget | The target Gtk::Widget.

void Gtk::Label::set_pattern | ( | const Glib::ustring & | pattern | ) |

void Gtk::Label::set_selectable | ( | bool | setting = `true` | ) |

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

Parameters:

  setting | `true` to allow selecting text in the label.

void Gtk::Label::set_single_line_mode | ( | bool | single_line_mode = `true` | ) |

Sets whether the label is in single line mode.

Since gtkmm 2.6:

Parameters:

  single_line_mode | `true` if the label should be in single line mode.

void Gtk::Label::set_text | ( | const Glib::ustring & | str | ) |

Doesn't use markup.

void Gtk::Label::set_text_with_mnemonic | ( | const Glib::ustring & | str | ) |

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

Parameters:

  str | A string.

void Gtk::Label::set_track_visited_links | ( | bool | track_links = `true` | ) |

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

Since gtkmm 2.18:

Parameters:

  track_links | `true` to track visited links.

void Gtk::Label::set_use_markup | ( | bool | setting = `true` | ) |

Sets whether the text of the label contains markup in .

See set_markup().

Parameters:

  setting | `true` if the label's text should be parsed for markup.

void Gtk::Label::set_use_underline | ( | bool | setting = `true` | ) |

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

Parameters:

  setting | `true` if underlines in the text indicate mnemonics.

void Gtk::Label::set_width_chars | ( | int | n_chars | ) |

Sets the desired width in characters of label to n_chars.

Since gtkmm 2.6:

Parameters:

  n_chars | The new desired width, in characters.

Glib::SignalProxy1< bool,const Glib::ustring& > Gtk::Label::signal_activate_link | ( |  | ) |

Prototype:
  `bool on_my_activate_link(const Glib::ustring& uri)`

Glib::SignalProxy1< void,Menu* > Gtk::Label::signal_populate_popup | ( |  | ) |

Prototype:
  `void on_my_populate_popup(Menu* menu)`

## Friends And Related Function Documentation

Gtk::Label* wrap | ( | GtkLabel * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/label.h