You can add GTK_TYPE_WIDGET as a pre-requisite for your interface using the appropriate GTypeInterface API. That way only widgets will be able to implement the interface and you can use the interface as the child type.
Ciao,
Emmanuele.
On 20 Dec 2009 13:57, "Matthew Bucknall" <matt@xxxxxxxxxxxxxxxx> wrote:
I'm implementing a custom container widget which needs to only accept
child widgets which derive from GtkWidget (obviously) but also implement
a custom Interface called GpanesPanel.
I'm not sure how to enforce this rule within my code's API. What type
should the container's child_type() method return? GPANES_TYPE_PANEL or
GTK_TYPE_WIDGET? Likewise, I'm not sure what type custom insertion
methods for my container should accept, GpanesPanel or GtkWidget?
It doesn't seem enough to use GPANES_TYPE_PANEL/GpanesPanel because, as
it stands, any non-widget class could implement the GpanesPanel
interface but would be unusable as a container child.
Is there anything I can put in the GpanesPanel interface definition that
states that it can only be applied to classes derived from GtkWidget?
I hope I've explained my problem clearly enough. Suggestions gratefully
received.
Matt.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list