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"
18 #include <QAbstractButton>
25 /// Base class for historical LyX dialogs.
27 * \warning New dialogs should use the leaner classes \c DialogView or
28 * \c DockView depending on the intent. Eventually, old dialogs should be
29 * converted to \c DialogView too.
31 class GuiDialog : public QDialog, public Dialog
36 /// \param lv is the access point for the dialog to the LyX kernel.
37 /// \param name is the identifier given to the dialog by its parent
39 /// \param title is the window title used for decoration.
40 GuiDialog(GuiView & lv, QString const & name, QString const & title);
42 virtual QWidget * asQWidget() { return this; }
43 virtual QWidget const * asQWidget() const { return this; }
47 * These methods are publicly accessible because they are invoked
48 * by the View when the user presses... guess what ;-)
50 // Restore button clicked
54 // Apply button clicked
56 // AutoApply checkbox clicked
58 // Close button clicked or closed from WindowManager
60 // A collectiong slot for QDialogButtonBox
61 void slotButtonBox(QAbstractButton *);
63 void closeEvent(QCloseEvent * e);
66 void onBufferViewChanged() {};//override
69 /** Check whether we may apply our data.
71 * The buttons are disabled if not and (re-)enabled if yes.
73 void setButtonsValid(bool valid);
75 /** \name Dialog Components
76 * Methods to access the various components making up a dialog.
79 ButtonController const & bc() const { return bc_; }
80 ButtonController & bc() { return bc_; }
83 /// the dialog has changed contents
84 virtual void changed();
86 virtual void enableView(bool enable);
88 /// default: do nothing
89 virtual void applyView() {}
90 /// default: do nothing
91 virtual void updateContents() {}
94 /// is the dialog currently valid ?
95 virtual bool isValid() { return true; }
99 /** When applying, it's useful to know whether the dialog is about
100 * to close or not (no point refreshing the display for example).
102 bool isClosing() const { return is_closing_; }
105 bool needBufferOpen() const { return isBufferDependent(); }
107 /// Update the display of the dialog whilst it is still visible.
108 virtual void updateView();
111 ButtonController bc_;
112 /// are we updating ?
119 } // namespace frontend
122 #endif // GUIDIALOG_H