Re: [gtkmm] general design question



Stephan Zaubzer <s zaubzer gmx at> writes:

> I am relatively new to programming with gtkmm. I often saw in code
> examples that instead of using a standard widget, you derive a widged
> and add your custom "things". If I want to make an application, should
> I derive an application window which contains as members everything
> what I want to show?

Yes. Use one class per window. But you should use Glade to load the
contents of the window. That way you really don't have to let the
class have all the subwidgets as members (but perhaps you will have
some member pointers).

> So the application window would be my only
> "public" data, which contains all other widgets. Can somebody explain
> some design principles for creating applications? Like: Should a
> widget, that is contained in another widget also be a member of its
> parent widget?

Yeah, that's reasonable. But you usually don't have to deal with that
since GTK+ does it for you. You only deal with the toplevel widget,
i.e. the window. The rest of the containments in the hierarchy are
implicit.

> So the only public widget would be my application window?

Well, that's a strange way to put it, but yeah, I think so.


We've discussed this in the past. I wrote a proposal for how to
structure an application with Glade. Look in the archives.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



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