class Gtk::Tooltip

Overview

Gtk::Tooltip is an object representing a widget tooltip.

Basic tooltips can be realized simply by using Gtk::Widget#tooltip_text= or Gtk::Widget#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:

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/tooltip.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void)? data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void)? qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void)?) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void)? steal_data, steal_qdata(quark : UInt32) : Pointer(Void)? steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, cast?(obj : GObject::Object) : self? cast?, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

compat_control(what : UInt64, data : Pointer(Void)?) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def self.new #

Initialize a new Tooltip.


Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


Instance Method Detail

def custom=(custom_widget : Gtk::Widget?) : Nil #

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 gtk_tooltip_set_markup() and gtk_tooltip_set_icon().


def icon=(paintable : Gdk::Paintable?) : Nil #

Sets the icon of the tooltip (which is in front of the text) to be @paintable. If @paintable is nil, the image will be hidden.


def icon_from_gicon=(gicon : Gio::Icon?) : Nil #

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 nil, the image will be hidden.


def icon_from_icon_name=(icon_name : String?) : Nil #

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 nil, the image will be hidden.


def markup=(markup : String?) : Nil #

Sets the text of the tooltip to be @markup.

The string must be marked up with Pango markup. If @markup is nil, the label will be hidden.


def text=(text : String?) : Nil #

Sets the text of the tooltip to be @text.

If @text is nil, the label will be hidden. See also Gtk::Tooltip#markup=.


def tip_area=(rect : Gdk::Rectangle) : Nil #

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_tree_view_set_tooltip_row() and gtk_tree_view_set_tooltip_cell().