Re: Another way to create derived widgets from glade



I can only say that i for one am using it! It's great, thanks André!

On 10/8/07, André Gaul <gaul web-yard de> wrote:
Hi!

The libglademm way (get_widget_derived()) of creating derived widget
instances doesn't allow to use arbitrary constructors. The derived
widget's constructor has to look like that:

DerivedDialog::DerivedDialog(BaseObjectType* cobject, const
Glib::RefPtr<Gnome::Glade::Xml>& refGlade)
: Gtk::Dialog(cobject)
{ }

There was some discussion on the mailing list, but I could not find a
good working solution. So I looked at some code proposals (especially
this one: http://bugzilla.gnome.org/show_bug.cgi?id=134161) and tried to
improve it.

I managed to get a working solution and would love to hear some comments
or possible improvements. The code together with an example is attached.
(I don't know if attachments work on this mailing list, so I uploaded
the code here, too:
http://web-yard.de/user/public/gaul web-yard de/widgetloader.tar.bz2 ).

The code works for me and made my life easier (less code and more c++
feeling), but I don't know if it's correct and usable for someone else.

Thanks for responses!

Ciao,
André Gaul

all: example

example: example_main.cc example_mydialog.h widgetloader.h
        g++ `pkg-config --cflags libglademm-2.4` `pkg-config --libs libglademm-2.4` example_main.cc -o example

clean:
        rm -f example

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list





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