3 * \file GuiDialogView.h
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.
12 #ifndef GUIDIALOGVIEW_H
13 #define GUIDIALOGVIEW_H
17 #include <boost/scoped_ptr.hpp>
19 #include <QApplication>
28 /** This class is an Qt2 GUI base class.
30 class GuiDialogView : public QObject, public Dialog::View {
34 GuiDialogView(Dialog &, docstring const &);
36 virtual ~GuiDialogView() {}
38 bool readOnly() const;
40 /// the dialog has changed contents
41 virtual void changed();
47 /// build the actual dialog
48 virtual void build_dialog() = 0;
50 virtual void build() = 0;
53 /// Create the dialog if necessary, update it and display it.
55 /// update the dialog's contents
56 virtual void update_contents() = 0;
58 virtual bool isVisible() const;
60 /// is the dialog currently valid ?
61 virtual bool isValid();
67 // dialog closed from WM
70 // Restore button clicked
76 // Apply button clicked
79 // Close button clicked
82 /// Pointer to the actual instantiation of the Qt dialog
83 virtual QWidget * form() const = 0;
87 template <class GUIDialog>
88 class GuiView : public GuiDialogView {
90 GuiView(Dialog & p, docstring const & t)
97 virtual void update() {
98 dialog_->setUpdatesEnabled(false);
100 // protect the BC from unwarranted state transitions
105 dialog_->setUpdatesEnabled(true);
110 virtual void build() {
111 // protect the BC from unwarranted state transitions
117 /// Pointer to the actual instantiation of the Qt dialog
118 virtual GUIDialog * form() const { return dialog_.get(); }
120 /// Real GUI implementation.
121 boost::scoped_ptr<GUIDialog> dialog_;
124 } // namespace frontend
127 #endif // GUIDIALOGVIEW_H