Re: [gtk-list] Widget inheritance question



On Thu, 23 Jul 1998, Square Avenue wrote:

> 
> 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).
> 
> 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!

for GleShell, which is a composite widget derived from GtkWindow, i do this:

void
gle_shell_init (GleShell *shell)
{
  gtk_widget_set (GTK_WIDGET (shell),
                  "title", "GLE-Shell",
                  "type", GTK_WINDOW_TOPLEVEL,
                  "allow_shrink", TRUE,
                  "allow_grow", TRUE,
                  "auto_shrink", FALSE,
                  NULL);
}


> 
>                                       - Dave
> 

---
ciaoTJ



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