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 // Close button clicked or closed from WindowManager
58 void closeEvent(QCloseEvent * e);
61 /** Check whether we may apply our data.
63 * The buttons are disabled if not and (re-)enabled if yes.
65 void setButtonsValid(bool valid);
67 /** \name Dialog Components
68 * Methods to access the various components making up a dialog.
71 ButtonController const & bc() const { return bc_; }
72 ButtonController & bc() { return bc_; }
75 /// the dialog has changed contents
76 virtual void changed();
78 virtual void enableView(bool enable);
80 /// default: do nothing
81 virtual void applyView() {}
82 /// default: do nothing
83 virtual void updateContents() {}
86 /// is the dialog currently valid ?
87 virtual bool isValid() { return true; }
91 /** When applying, it's useful to know whether the dialog is about
92 * to close or not (no point refreshing the display for example).
94 bool isClosing() const { return is_closing_; }
96 /// Update the display of the dialog whilst it is still visible.
97 virtual void updateView();
100 ButtonController bc_;
101 /// are we updating ?
108 } // namespace frontend
111 #endif // GUIDIALOG_H