Skip to content

GtkToolTip: new API to add css classes to GtkTooltipWindow

Nelson Ben requested to merge tooltip_window_set_css_class into main

we add a simple API to allow styling GtkTooltip's window by setting a css class on it:

void gtk_tooltip_set_css_class (GtkTooltip *tooltip,
                                const char *css_class);

By passing NULL it will remove any previously set css class by this function.

We also add to GtkWidget two new signals tooltip-show and tooltip-hide which are emitted when a tooltip window is about to be shown on a widget, and when a tooltip window stopped being shown on a widget.

These signals provide two convenient moments for where to style our tooltip window by using previous new api gtk_tooltip_set_css_class().

The existant GtkWidget signal query-tooltip cannot be used for that as it's triggered on motion events and we cannot distinguish from that when the tooltip window gets shown or hidden.

Issue #5925 (closed)

**Click** to show Video 📹 of this API being used in gtk4-widget-factory Grabación_de_pantalla_desde_2023-07-09_17-01-40
Edited by Nelson Ben

Merge request reports