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
15 #include "GuiDialog.h"
17 #include <boost/scoped_ptr.hpp>
19 #include <QApplication>
26 /** This class is an Qt2 GUI base class.
28 class GuiDialogView : public QObject, public Dialog::View
33 GuiDialogView(GuiDialog &, docstring const &);
35 virtual ~GuiDialogView() {}
37 bool readOnly() const;
39 /// the dialog has changed contents
40 virtual void changed();
43 ButtonController & bc();
46 /// build the actual dialog
47 virtual void build_dialog() = 0;
51 virtual void hideView();
52 /// Create the dialog if necessary, update it and display it.
53 virtual void showView();
54 /// update the dialog's contents
55 virtual void update_contents() = 0;
57 virtual bool isVisibleView() const;
58 /// is the dialog currently valid ?
59 virtual bool isValid();
67 // dialog closed from WM
69 // Restore button clicked
73 // Apply button clicked
75 // Close button clicked
79 /// Pointer to the actual instantiation of the Qt dialog
80 virtual QWidget * form() const = 0;
84 template <class GUIDialog>
85 class GuiView : public GuiDialogView {
87 GuiView(GuiDialog & p, docstring const & t)
94 virtual void updateView() {
95 dialog_->setUpdatesEnabled(false);
97 // protect the BC from unwarranted state transitions
102 dialog_->setUpdatesEnabled(true);
106 /// Pointer to the actual instantiation of the Qt dialog
107 virtual GUIDialog * form() const { return dialog_.get(); }
109 /// Real GUI implementation.
110 boost::scoped_ptr<GUIDialog> dialog_;
113 } // namespace frontend
116 #endif // GUIDIALOGVIEW_H