? Makefile
? Makefile.in
? aclocal.m4
? autom4te.cache
? config.log
? config.status
? configure
? get_widget_derived.patch
? libglademm.spec
? libtool
? MSVC_Net2003/libglademm/libglademmconfig.h
? docs/Makefile
? docs/Makefile.in
? docs/reference/Doxyfile
? docs/reference/Makefile
? docs/reference/Makefile.in
? docs/reference/html
? docs/reference/libglademm_doxygen_tags
? docs/reference/xml
? examples/Makefile
? examples/Makefile.in
? examples/basic/Makefile
? examples/basic/Makefile.in
? examples/basic/basic
? examples/derived/Makefile
? examples/derived/Makefile.in
? examples/derived/derived
? examples/menus/Makefile
? examples/menus/Makefile.in
? examples/menus/example
? examples/variablesmap/Makefile
? examples/variablesmap/Makefile.in
? examples/variablesmap/example
? libglade/Makefile
? libglade/Makefile.in
? libglade/libglademm-2.4-uninstalled.pc
? libglade/libglademm-2.4.pc
? libglade/libglademmconfig.h
? libglade/stamp-h
? libglade/libglademm/Makefile
? libglade/libglademm/Makefile.in
? libglade/libglademm/wrap_init.cc
? libglade/libglademm/xml.cc
? libglade/libglademm/xml.h
? libglade/libglademm/private/Makefile
? libglade/libglademm/private/Makefile.in
? libglade/libglademm/private/xml_p.h
? libglade/src/.stamps
? libglade/src/Makefile
? libglade/src/Makefile.in
? scripts/Makefile
? scripts/Makefile.in
? tools/Makefile
? tools/Makefile.in
? tools/extra_defs_gen/Makefile
? tools/extra_defs_gen/Makefile.in
? tools/extra_defs_gen/generate_extra_defs
? tools/m4/Makefile
? tools/m4/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnomemm/libglademm/ChangeLog,v
retrieving revision 1.65
diff -u -p -r1.65 ChangeLog
--- ChangeLog	10 Mar 2005 12:43:30 -0000	1.65
+++ ChangeLog	4 May 2005 19:56:03 -0000
@@ -1,3 +1,9 @@
+2005-05-04  Marek Materzok <tilk@lucifer.czad.org>
+
+	* libglade/src/xml.hg: Added another version of
+	Glade::Xml::get_widget_derived, which allows arbitrary constructors
+	of derived widgets.
+
 2005-03-10  Cedric Gustin <cedric.gustin@swing.be>
 
 	* MSVC_Net2003/Makefile.am: Add blank.cpp to EXTRA_DIST.
Index: libglade/src/xml.hg
===================================================================
RCS file: /cvs/gnome/gnomemm/libglademm/libglade/src/xml.hg,v
retrieving revision 1.21
diff -u -p -r1.21 xml.hg
--- libglade/src/xml.hg	19 Sep 2004 12:55:53 -0000	1.21
+++ libglade/src/xml.hg	4 May 2005 19:56:04 -0000
@@ -18,6 +18,7 @@
  */
 
 #include <gtkmm/container.h>
+#include <sigc++/slot.h>
 
 _DEFS(libglademm,libglade)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -43,7 +44,6 @@ private:
   Glib::ustring message_;
 };
 
-
 class Xml : public Glib::Object
 {
   _CLASS_GOBJECT(Xml, GladeXML, GLADE_XML, Glib::Object, GObject)
@@ -66,6 +66,19 @@ protected:
   Gtk::Widget* get_widget_checked(const Glib::ustring& name, GType type);
   GtkWidget* get_cwidget(const Glib::ustring& name);
 
+private:
+  // A wrapper functor for get_widget_derived()
+  template <class T_Widget>
+  struct ConstructDerived: public sigc::functor_base
+  {
+    typedef T_Widget *result_type;
+    typedef  typename T_Widget::BaseObjectType cwidget_type;
+    T_Widget *operator()(cwidget_type *pCWidget, const Glib::RefPtr<Gnome::Glade::Xml> &refThis) const
+    {
+      return new T_Widget(pCWidget, refThis);
+    }
+  };
+    
 public:
   typedef Gnome::Glade::XmlError Error;
 
@@ -170,6 +183,23 @@ public:
   template <class T_Widget> inline
   T_Widget* get_widget_derived(const Glib::ustring& name, T_Widget*& widget)
   {
+	  return get_widget_derived<T_Widget>(name, widget, ConstructDerived<T_Widget>());
+  }
+  
+/*
+  template <class T_Widget, typename T_Construct> inline
+  T_Widget* get_widget_derived(const Glib::ustring& name, T_Widget*& widget, const T_Construct &construct)
+  {
+	  return get_widget_derived<T_Widget>(name, widget, const_cast<T_Construct&>(construct));
+  }
+*/
+  
+  template <class T_Widget> inline
+  T_Widget* get_widget_derived(const Glib::ustring& name, T_Widget*& widget, 
+		  const sigc::slot<T_Widget*, 
+		  typename T_Widget::BaseObjectType*, 
+		  const Glib::RefPtr<Gnome::Glade::Xml> &> &construct)
+  {
      // initialize input parameter
      widget = 0;
      
@@ -203,7 +233,7 @@ public:
        //Set the output variable. We needed to do this because we can not template the return type.
        Glib::RefPtr<Gnome::Glade::Xml> refThis(this);
        refThis->reference(); //take a copy.
-       widget = new T_Widget(pCWidget, refThis);
+       widget = construct(pCWidget, refThis);
      }
 
      //We return it as well (we need the parameter as well, because C++ can not just template the return type.)
