]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gnome/GnomeBase.h
A lean, clean and working start to the new, improved gnome frontend.
[lyx.git] / src / frontends / gnome / GnomeBase.h
index 5f8cbb9b366016f2b30e7ac830b436d9b9c4b2c9..b795b8621e8e5c0a6e51245469bbab9fe05f398e 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
  **/
 #include <sigc++/signal_system.h>
 #include "gnome_helpers.h"
 
-namespace Gtk {
-class Button;
-class Entry;
-};
-
 namespace Gnome {
 class Dialog;
 };
 
 /**
- * This is a base class for Gnome dialogs. Basically it handles all the common
+ * This is a base class for Gnome dialogs. It handles all the common
  * work that is needed for all dialogs.
  */
 class GnomeBase : public ViewBC<gnomeBC>, public SigC::Object {
 public:
-       /// 
-       GnomeBase(ControlButton & c, string const & glade_file, string const & name);
+       ///
+       GnomeBase(ControlButtons & c,  string const & name);
        ///
        virtual ~GnomeBase();
 
 protected:
+       /// Get the widget named 'name' from the xml representation.
        template <class T>
-       T* getWidget(char const * name) const; 
+       T* getWidget(char const * name) const;
+
+       /// Get the dialog we use.
+       Gnome::Dialog * dialog();
+
+       /// Show the dialog.
+       void show();
+       /// Hide the dialog.
+       void hide();
+       /// Build the dialog. Also connects signals and prepares it for work.
+       virtual void build() = 0;
+       /// Dialog is valid
+       virtual bool validate();
+       /// Default OK behaviour
+       virtual void OKClicked();
+       /// Default Cancel behaviour
+       virtual void CancelClicked();
+       /// Default Restore behaviour
+       virtual void RestoreClicked();
+       /// Default apply behaviour
+       virtual void ApplyClicked();
+       /// Default changed input behaviour
+       virtual void InputChanged();
 
 private:
        /// Loads the glade file to memory.
        void loadXML() const;
 
        /// The glade file name
-       string file_;
+       const string file_;
        /// The widget name
-       string widget_name_;
+       const string widget_name_;
        /// The XML representation of the dialogs.
        mutable GladeXML * 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_;
 };
 
 
@@ -69,7 +93,7 @@ T* GnomeBase::getWidget(char const * name) const
 
 /**
  * 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
@@ -80,15 +104,14 @@ T* GnomeBase::getWidget(char const * name) const
 template <class Controller>
 class FormCB : public GnomeBase {
 public:
-       FormCB(Controller & c, string const & file, string const & name);
-       
+       FormCB(Controller & c, string const & name);
 protected:
        Controller & controller();
 };
 
 template <class Controller>
-FormCB<Controller>::FormCB(Controller & c, string const & file, string const & name)
-       : GnomeBase(c, file, name)
+FormCB<Controller>::FormCB(Controller & c,  string const & name)
+       : GnomeBase(c, name)
 {}
 
 template <class Controller>