]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDialog.h
Typos in the comment.
[lyx.git] / src / frontends / qt4 / GuiDialog.h
index 6e3618b888113facfb436bcedc73a59dc78f9b95..1e95fc5e371ae79e21cc2d70ac7e4119ccad1309 100644 (file)
 #include "Dialog.h"
 #include "ButtonController.h"
 
-#include "insets/InsetCommandParams.h"
-
 #include <QDialog>
-#include <QObject>
 
-class QCloseEvent;
-class QShowEvent;
 
 namespace lyx {
 namespace frontend {
 
-/** \c Dialog collects the different parts of a Model-Controller-View
- *  split of a generic dialog together.
- */
+/// Base class for historical LyX dialogs.
+/** 
+  * \warning New dialogs should use the leaner classes \c DialogView or
+  * \c DockView depending on the intent. Eventually, old dialogs should be
+  * converted to \c DialogView too.
+  */
 class GuiDialog : public QDialog, public Dialog
 {
        Q_OBJECT
@@ -37,8 +35,11 @@ public:
        /// \param lv is the access point for the dialog to the LyX kernel.
        /// \param name is the identifier given to the dialog by its parent
        /// container.
-       explicit GuiDialog(LyXView & lv, std::string const & name);
-       ~GuiDialog();
+       /// \param title is the window title used for decoration.
+       GuiDialog(GuiView & lv, QString const & name, QString const & title);
+
+       virtual QWidget * asQWidget() { return this; }
+       virtual QWidget const * asQWidget() const { return this; }
 
 public Q_SLOTS:
        /** \name Buttons
@@ -51,15 +52,18 @@ public Q_SLOTS:
        void slotOK();
        // Apply button clicked
        void slotApply();
+       // AutoApply checkbox clicked
+       void slotAutoApply();
        // Close button clicked or closed from WindowManager
        void slotClose();
+       ///
+       void closeEvent(QCloseEvent * e);
 
 public:
        /** Check whether we may apply our data.
         *
         *  The buttons are disabled if not and (re-)enabled if yes.
         */
-       void checkStatus();
        void setButtonsValid(bool valid);
 
        /** \name Dialog Components
@@ -70,67 +74,29 @@ public:
        ButtonController & bc() { return bc_; }
        //@}
 
-       void setViewTitle(docstring const & title);
-
-
        /// the dialog has changed contents
        virtual void changed();
 
+       virtual void enableView(bool enable);
+
        /// default: do nothing
        virtual void applyView() {}
        /// default: do nothing
        virtual void updateContents() {}
-       ///
-       void closeEvent(QCloseEvent *);
-       ///
-       void showEvent(QShowEvent *);
 
-protected:
-       /// Hide the dialog.
-       virtual void hideView();
-       /// Create the dialog if necessary, update it and display it.
-       virtual void showView();
-       ///
-       virtual bool isVisibleView() const;
+public:
        /// is the dialog currently valid ?
        virtual bool isValid() { return true; }
 
 public:
-       /** \name Container Access
-        *  These methods are publicly accessible because they are invoked
-        *  by the parent container acting on commands from the LyX kernel.
-        */
-       //@{
-       /// \param data is a string encoding of the data to be displayed.
-       /// It is passed to the Controller to be translated into a useable form.
-       void showData(std::string const & data);
-       void updateData(std::string const & data);
-
-       void hide();
-
-       /** This function is called, for example, if the GUI colours
-        *  have been changed.
-        */
-       void redraw() { redrawView(); }
-       //@}
 
        /** When applying, it's useful to know whether the dialog is about
         *  to close or not (no point refreshing the display for example).
         */
        bool isClosing() const { return is_closing_; }
-
-       /** Defaults to nothing. Can be used by the Controller, however, to
-        *  indicate to the View that something has changed and that the
-        *  dialog therefore needs updating.
-        *  \param id identifies what should be updated.
-        */
-       virtual void partialUpdateView(int /*id*/) {}
-
+       
        ///
-       std::string name() const { return name_; }
-
-       void apply();
-       void redrawView() {}
+       bool needBufferOpen() const { return isBufferDependent(); }
 
        /// Update the display of the dialog whilst it is still visible.
        virtual void updateView();
@@ -141,38 +107,9 @@ private:
        bool updating_;
 
        bool is_closing_;
-       /** The Dialog's name is the means by which a dialog identifies
-        *  itself to the kernel.
-        */
-       std::string name_;
 };
 
 
-class GuiCommand : public GuiDialog
-{
-public:
-       /// We need to know with what sort of inset we're associated.
-       // FIXME This should probably be an InsetCode
-       GuiCommand(LyXView &, std::string const & name);
-       ///
-       bool initialiseParams(std::string const & data);
-       /// clean-up on hide.
-       void clearParams() { params_.clear(); }
-       /// clean-up on hide.
-       void dispatchParams();
-       ///
-       bool isBufferDependent() const { return true; }
-
-protected:
-       ///
-       InsetCommandParams params_;
-       //FIXME It should be possible to eliminate lfun_name_
-       //now and recover that information from params().insetType().
-       //But let's not do that quite yet.
-       /// Flags what action is taken by Kernel::dispatch()
-       std::string const lfun_name_;
-};
-
 } // namespace frontend
 } // namespace lyx