X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiDialog.h;h=2359d740122f260fad455380a79d27bb112613a4;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=db52058e65a11de6ccf84b30d6934c8eea5b5a5f;hpb=212386be8a1573fb52b5da718961835816a3c8e2;p=lyx.git diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index db52058e65..2359d74012 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -15,39 +15,57 @@ #include "Dialog.h" #include "ButtonController.h" +#include + + namespace lyx { namespace frontend { -/** \c Dialog collects the different parts of a Model-Controller-View - * split of a generic dialog together. - */ -class GuiDialog : public Dialog +/// Base class for historical LyX dialogs. +/** + * \warning New dialogs should use the leaner classes \c DialogView or + * \c DockView depending on the intent. Eventally, old dialog should be + * converted to \c DialogView too. + */ +class GuiDialog : public QDialog, public Dialog { + Q_OBJECT + 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. - GuiDialog(LyXView & lv, std::string const & name); + /// \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 * These methods are publicly accessible because they are invoked * by the View when the user presses... guess what ;-) */ - //@{ - void ApplyButton(); - void OKButton(); - void CancelButton(); - void RestoreButton(); - //@} + // Restore button clicked + void slotRestore(); + // OK button clicked + 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 * Methods to access the various components making up a dialog. */ @@ -56,15 +74,39 @@ public: ButtonController & bc() { return bc_; } //@} - void preShow(); - void postShow(); - void preUpdate(); - void postUpdate(); + /// 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() {} + +public: + /// is the dialog currently valid ? + virtual bool isValid() { return true; } + +public: + + /** 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_; } + + /// Update the display of the dialog whilst it is still visible. + virtual void updateView(); private: ButtonController bc_; + /// are we updating ? + bool updating_; + + bool is_closing_; }; + } // namespace frontend } // namespace lyx