Search code examples
c++widgetvirtualgtkmm

Implementing custom Gtkmm widget: what should I return in the virtual on_* functions?


What should I return when overriding virtual bool Gtk::Widget::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) of Gtk::Widget? The documentation doesn't say anything about that at all.


Solution

  • Indeed, the C documentation doesn't say anything either. You should report this oversight as a bug on bugzilla.gnome.org.

    Perhaps it is the same as other event signals in GTK? That is, return TRUE to stop other handlers being invoked, FALSE to propagate the event further? Even though it's not an event signal, its predecessor in GTK 2 was, perhaps it's for backwards compatibility? A quick glance at the source code of GtkButton, for example, shows that it simply returns FALSE.