Why do constructors return GtkWidget?



Hello,

I'd like to continue the discussion here of thread [1] from gtk-app-devel-list:

The question: why is it normal for GTK widget "constructors" to return
GtkWidget and not their real type?

For instance I would expect:

   gtk_menu_item_new ()

To return GtkMenuItem*. But it doesn't, it returns GtkWidget*.
IMHO is much clear that constructors return their real type, instead
GtkWidget. But maybe there is a technical reason for this.

Can someone give me some light about this?

Thank you for your responses,

PD: If there is not technical reasons, maybe we can change this for
GTK+ 3 (or 4 ;)), as I think a change like this will break the 2.x
ABI.

[1] http://mail.gnome.org/archives/gtk-app-devel-list/2009-September/msg00023.html
-- 
Javier Jardón Cabezas


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]