Buttons, Images, & Tooltips

The dominant items in a toolbar/headerbar are the buttons, and this is no different for Odysseus. These are rendered as images which you can click, or you can hover over it to be told what it does.

All of Odysseus’s toolbar buttons also have a dropdown menu shown on rightclick or holdclick, but that’s a topic for another time.

As for how the images get rendered, clicks handled, and tooltips shown that all turns out to be pretty simple.

A GtkButton is a “bin” wrapping an GtkImage (or GtkLabel or other widget), which itself integrates GDK Pixbuf into the widget hierarchy via the GtkIconHelper abstraction.

This abstracts away multiple different means of loading an image with hardcoded fallback.

GtkButton also adds event handlers to translate raw mouse/keyboard/touch events into “click” events.

If events aren’t otherwise handled, GTK’s central event dispatch falls back to handing them off off to the GtkTooltip handlers.

This widget is a seperate GtkWindow wrapping a GtkLabel and optionally GtkImage. But what really defines it is it’s formula for where it’s shown onscreen, and it’s event handler which asks a specified widget for the information to display and sets a timeout to trigger it’s display.