Re: [gtk-list] Widget inheritance question



Square Avenue <dfinton@d.umn.edu> writes:
> I'm currently following the GTK tutorial on how to inherit widgets to
> create new composite widgets and I have a question about the inheritance
> itself.
> 
> In C++, you can simply pass on arguments to the parent class (or widget)
> in the constructor.  However, in vanilla GTK, I don't see any way to pass
> the arguments I need to the parent widget (in this case GtkWindow).

Some widgets (unfortunately not all) has gtk_foobar_construct() methods
which are supposed to do exactly this. This is only available for those
widgets where the *_new() function implementation is too large to
be cut/pasted to the derived widgets _new() method.

> How do I get my new widget to set the type of its parent widget
> (GtkWindow) to GTK_WINDOW_TOPLEVEL by default?  Pointers to examples or
> tips on how to do this would be greatly appreciated.  Thanks!

gtk-- does this by cut/pasting the _new() method implementation or
calling the construct() method where available. (btw, gnome widgets
seems to have the same problem, need cut/paste of too large widgets..)

(the real problem of course is that the _new() method does things that
are specific to exactly that class - This becomes a problem when new() method
takes some special arguments or when there's several versions of new method
are available..)

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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