gtkmm 4.16.0
|
Add tips to your widgets. More...
#include <gtkmm/tooltip.h>
Public Member Functions | |
Tooltip (Tooltip &&src) noexcept | |
Tooltip & | operator= (Tooltip &&src) noexcept |
~Tooltip () noexcept override | |
GtkTooltip * | gobj () |
Provides access to the underlying C GObject. | |
const GtkTooltip * | gobj () const |
Provides access to the underlying C GObject. | |
GtkTooltip * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
void | set_markup (const Glib::ustring &markup) |
Sets the text of the tooltip to be markup. | |
void | unset_markup () |
Hide the label. | |
void | set_text (const Glib::ustring &text) |
Sets the text of the tooltip to be text. | |
void | unset_text () |
Hide the label. | |
void | set_icon (const Glib::RefPtr< Gdk::Paintable > &paintable) |
Sets the icon of the tooltip (which is in front of the text) to be paintable. | |
void | set_icon (const Glib::RefPtr< Gio::Icon > &gicon) |
Sets the icon of the tooltip (which is in front of the text) to be the icon indicated by gicon with the size indicated by size. | |
void | set_icon (const Glib::ustring &icon_name) |
Sets the icon of the tooltip (which is in front of the text) to be the icon indicated by icon_name with the size indicated by size. | |
void | unset_icon () |
Hide the image. | |
void | set_custom (Widget &custom_widget) |
Replaces the widget packed into the tooltip with custom_widget. | |
void | unset_custom () |
Remove the custom widget. | |
void | set_tip_area (const Gdk::Rectangle &rect) |
Sets the area of the widget, where the contents of this tooltip apply, to be rect (in widget coordinates). | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gtk::Tooltip > | wrap (GtkTooltip *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Add tips to your widgets.
Basic tooltips can be realized simply by using set_tooltip_text() or set_tooltip_markup() without any explicit tooltip object.
When you need a tooltip with a little more fancy contents, like adding an image, or you want the tooltip to have different contents per Gtk::TreeView row or cell, you will have to do a little more work:
Return true from your query-tooltip handler. This causes the tooltip to be show. If you return false, it will not be shown.
|
noexcept |
|
overridenoexcept |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkTooltip * Gtk::Tooltip::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Replaces the widget packed into the tooltip with custom_widget.
custom_widget does not get destroyed when the tooltip goes away. By default a box with a Gtk::Image
and Gtk::Label
is embedded in the tooltip, which can be configured using set_markup() and set_icon().
custom_widget | A Gtk::Widget , or nullptr to unset the old custom widget. |
void Gtk::Tooltip::set_icon | ( | const Glib::RefPtr< Gdk::Paintable > & | paintable | ) |
Sets the icon of the tooltip (which is in front of the text) to be paintable.
If paintable is nullptr
, the image will be hidden.
paintable | A Gdk::Paintable . |
Sets the icon of the tooltip (which is in front of the text) to be the icon indicated by gicon with the size indicated by size.
If gicon is nullptr
, the image will be hidden.
gicon | A Gio::Icon representing the icon. |
Sets the icon of the tooltip (which is in front of the text) to be the icon indicated by icon_name with the size indicated by size.
If icon_name is nullptr
, the image will be hidden.
icon_name | An icon name. |
Sets the text of the tooltip to be markup.
The string must be marked up with Pango markup. If markup is nullptr
, the label will be hidden.
markup | A string with Pango markup or N::LL. |
Sets the text of the tooltip to be text.
If text is nullptr
, the label will be hidden. See also set_markup().
text | A text string. |
void Gtk::Tooltip::set_tip_area | ( | const Gdk::Rectangle & | rect | ) |
Sets the area of the widget, where the contents of this tooltip apply, to be rect (in widget coordinates).
This is especially useful for properly setting tooltips on Gtk::TreeView
rows and cells, Gtk::IconViews
, etc.
For setting tooltips on Gtk::TreeView
, please refer to the convenience functions for this: Gtk::TreeView::set_tooltip_row() and Gtk::TreeView::set_tooltip_cell().
rect | A Gdk::Rectangle . |
void Gtk::Tooltip::unset_custom | ( | ) |
Remove the custom widget.
void Gtk::Tooltip::unset_icon | ( | ) |
Hide the image.
void Gtk::Tooltip::unset_markup | ( | ) |
Hide the label.
void Gtk::Tooltip::unset_text | ( | ) |
Hide the label.
|
related |
A Glib::wrap() method for this object.
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. |