[gtkmm] design question using libglademm



Hi,

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.

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. 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'. Is that the correct approach, or is there something simpler
I've missed?

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.

Cheers,

Eric




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