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 QWidget * asQWidget() override { return this; }
43 QWidget const * asQWidget() const override { 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
52 // Restore Defaults button clicked
53 virtual void slotRestoreDefaults() {}
56 // Apply button clicked
58 // AutoApply checkbox clicked
60 // Close button clicked or closed from WindowManager
62 // A collectiong slot for QDialogButtonBox
63 void slotButtonBox(QAbstractButton *);
65 void closeEvent(QCloseEvent * e) override;
68 void onBufferViewChanged() override {}
71 /** Check whether we may apply our data.
73 * The buttons are disabled if not and (re-)enabled if yes.
75 void setButtonsValid(bool valid);
77 /** \name Dialog Components
78 * Methods to access the various components making up a dialog.
81 ButtonController const & bc() const { return bc_; }
82 ButtonController & bc() { return bc_; }
85 /// the dialog has changed contents
86 virtual void changed();
88 void enableView(bool enable) override;
90 /// default: do nothing
91 void applyView() override {}
92 /// default: do nothing
93 virtual void updateContents() {}
96 /// is the dialog currently valid ?
97 virtual bool isValid() { return true; }
101 /** When applying, it's useful to know whether the dialog is about
102 * to close or not (no point refreshing the display for example).
104 bool isClosing() const override { return is_closing_; }
107 bool needBufferOpen() const override { return isBufferDependent(); }
109 /// Update the display of the dialog whilst it is still visible.
110 void updateView() override;
113 ButtonController bc_;
114 /// are we updating ?
121 } // namespace frontend
124 #endif // GUIDIALOG_H