RE: [gtkmm] design question using libglademm
- From: Murray Cumming Comneon com
- To: ericb computer org, gtkmm-list gnome org
- Subject: RE: [gtkmm] design question using libglademm
- Date: Fri, 31 Oct 2003 08:41:26 +0100
Eric Bourque wrote:
> I've started converting an app I had which use to use the pre
> gtk-2 versions of bakery, gtkmm, gnomemm, etc., and have
> decided that using glade instead makes a lot of sense. There
> are some things which are unclear to me after reading the
> available documentation however, so I would appreciate
> comments on what the 'preferred' methods are.
I assume that you are talking about libglademm rather than glademm.
>
> Aggregate objects vs. derived objects?
>
> I used to create new compound gui objects by deriving from
> some existing gtkmm object, say a window, or vbox for
> example. From an OO standpoint this made a lot of sense.
> However, with glade, there is something with this approach
> which is not clear to me. Suppose you create a glade file
> which has a window with several other widgets in it. It seems
> the normal approach is to reparent the glade window's
> top-most child to the derived window class. The problem I
> have found with this approach is that there is no way (that I
> know of) to create just a vbox containing other widgets in
> glade without using a placeholder window or dialog.
Yes. But you can choose to only instantiate a sub widget.
> This
> means that after creating the Glade::Xml instance and
> reparenting, there is still a blank window which shows up
> unless you set the visible flag to 'no'.
I don't know why anybody would ever set the visible flag to 'yes'.
> Is that the correct
> approach, or is there something simpler I've missed?
Yes, that's why I added the derived_widget stuff in libglademm 2.1/2.2.
> I guess the other approach is to not derive from an existing
> gtkmm widget, but to simply let libglademm bring up the
> window or dialog as well, and connect to slots in the
> aggregate object. There is no need for reparenting this way,
> but it doesn't seem as clean to me. I also don't see how to
> properly 'destroy' windows this way (can you just call hide()
> and assume everything is cleaned up when the
> Glib::RefPtr<Gnome::Glade::Xml> goes out of scope during destruction?)
>
> Any comments are appreciated.
I think you maybe haven't seen the new stuff in libglademm 2.1/2.2:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch19s03.html
There was some talk about that on this list a few weeks ago. Someone needs
to decide whether we need to improve it before we freeze it.
Murray Cumming
www.murrayc.com
murrayc usa net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]