]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gnome/GnomeBase.h
gtkmm-2 upgrade. Still some small bugs to iron out, but mostly functional
[lyx.git] / src / frontends / gnome / GnomeBase.h
index 2b4f2f0064a94534baa3ec5a8754044759dcbb1a..bea178cba1191379a4abc9d88297b9869738044c 100644 (file)
@@ -1,11 +1,11 @@
 // -*- C++ -*-
 /* This file is part of
  * =================================================
- * 
+ *
  *          LyX, The Document Processor
  *          Copyright 1995-2000 The LyX Team.
  *
- * ================================================= 
+ * =================================================
  *
  * \author Baruch Even
  **/
 #pragma interface
 #endif
 
+#include "gnome_helpers.h"
+
+#include <sigc++/sigc++.h>
+#include <libglademm/xml.h>
+
 #include "ViewBase.h"
 #include "gnomeBC.h"
-#include <sigc++/signal_system.h>
-#include "gnome_helpers.h"
 
-namespace Gnome {
-class Dialog;
+
+namespace Gtk {
+       class Dialog;
 };
 
 /**
@@ -32,7 +36,7 @@ class Dialog;
  */
 class GnomeBase : public ViewBC<gnomeBC>, public SigC::Object {
 public:
-       /// 
+       ///
        GnomeBase(ControlButtons & c,  string const & name);
        ///
        virtual ~GnomeBase();
@@ -40,10 +44,10 @@ public:
 protected:
        /// Get the widget named 'name' from the xml representation.
        template <class T>
-       T* getWidget(char const * name) const; 
+       T* getWidget(const string & name) const;
 
        /// Get the dialog we use.
-       Gnome::Dialog * dialog();
+       Gtk::Dialog * dialog();
 
        /// Show the dialog.
        void show();
@@ -66,34 +70,32 @@ protected:
 
 private:
        /// Loads the glade file to memory.
-       void loadXML() const;
+       void loadXML();
 
        /// The glade file name
        const string file_;
        /// The widget name
        const string widget_name_;
        /// The XML representation of the dialogs.
-       mutable GladeXML * xml_;
+       Glib::RefPtr<Gnome::Glade::Xml>  xml_;
 
        /** The dialog we work with, since it is managed by libglade, we do not
         *  need to delete it or destroy it, it will be destroyed with the rest
         *  of the libglade GladeXML structure.
         */
-       Gnome::Dialog * dialog_;
+       Gtk::Dialog * dialog_;
 };
 
 
 template <class T>
-T* GnomeBase::getWidget(char const * name) const
+T* GnomeBase::getWidget(const string & name) const
 {
-       if (xml_ == 0)
-               loadXML();
-       return getWidgetPtr<T>(xml_, name);
+       return dynamic_cast<T*>(xml_->get_widget(name));
 }
 
 /**
  * This class is used to provide a simple automatic casting of the controller.
- * We chose not to make GnomeBase a template since it has some size and we 
+ * We chose not to make GnomeBase a template since it has some size and we
  * have no reason to duplicate it by making it a template.
  *
  * Basically the FormCB<Controller> template instantiates GnomeBase and passes