4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
16 #include "ButtonController.h"
24 /// Base class for historical LyX dialogs.
26 * \warning New dialogs should use the leaner classes \c DialogView or
27 * \c DockView depending on the intent. Eventally, old dialog should be
28 * converted to \c DialogView too.
30 class GuiDialog : public QDialog, public Dialog
35 /// \param lv is the access point for the dialog to the LyX kernel.
36 /// \param name is the identifier given to the dialog by its parent
38 /// \param title is the window title used for decoration.
39 GuiDialog(GuiView & lv, QString const & name, QString const & title);
41 virtual QWidget * asQWidget() { return this; }
42 virtual QWidget const * asQWidget() const { return this; }
46 * These methods are publicly accessible because they are invoked
47 * by the View when the user presses... guess what ;-)
49 // Restore button clicked
53 // Apply button clicked
55 // AutoApply checkbox clicked
57 // Close button clicked or closed from WindowManager
60 void closeEvent(QCloseEvent * e);
63 /** Check whether we may apply our data.
65 * The buttons are disabled if not and (re-)enabled if yes.
67 void setButtonsValid(bool valid);
69 /** \name Dialog Components
70 * Methods to access the various components making up a dialog.
73 ButtonController const & bc() const { return bc_; }
74 ButtonController & bc() { return bc_; }
77 /// the dialog has changed contents
78 virtual void changed();
80 virtual void enableView(bool enable);
82 /// default: do nothing
83 virtual void applyView() {}
84 /// default: do nothing
85 virtual void updateContents() {}
88 /// is the dialog currently valid ?
89 virtual bool isValid() { return true; }
93 /** When applying, it's useful to know whether the dialog is about
94 * to close or not (no point refreshing the display for example).
96 bool isClosing() const { return is_closing_; }
99 bool needBufferOpen() const { return isBufferDependent(); }
101 /// Update the display of the dialog whilst it is still visible.
102 virtual void updateView();
105 ButtonController bc_;
106 /// are we updating ?
113 } // namespace frontend
116 #endif // GUIDIALOG_H