]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QDialogView.C
get rid of QT3_SUPPORT and some cleanup
[lyx.git] / src / frontends / qt4 / QDialogView.C
1 /**
2  * \file QDialogView.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QDialogView.h"
14 #include "Qt2BC.h"
15 #include "qt_helpers.h"
16
17 #include "controllers/ButtonController.h"
18
19 namespace lyx {
20 namespace frontend {
21
22 QDialogView::QDialogView(Dialog & parent, std::string const & t)
23         : Dialog::View(parent,t), updating_(false)
24 {}
25
26
27 Qt2BC & QDialogView::bcview()
28 {
29         return static_cast<Qt2BC &>(dialog().bc().view());
30 }
31
32
33 bool QDialogView::isVisible() const
34 {
35         return form() && form()->isVisible();
36 }
37
38
39 bool QDialogView::readOnly() const
40 {
41         return kernel().isBufferReadonly();
42 }
43
44
45 void QDialogView::show()
46 {
47         if (!form()) {
48                 build();
49         }
50
51         form()->setMinimumSize(form()->sizeHint());
52
53         update();  // make sure its up-to-date
54         if (dialog().controller().exitEarly())
55                 return;
56
57         form()->setWindowTitle(toqstr("LyX: " + getTitle()));
58
59         if (form()->isVisible()) {
60                 form()->raise();
61         } else {
62                 form()->show();
63         }
64 }
65
66
67 void QDialogView::hide()
68 {
69         if (form() && form()->isVisible())
70                 form()->hide();
71 }
72
73
74 bool QDialogView::isValid()
75 {
76         return true;
77 }
78
79
80 void QDialogView::changed()
81 {
82         if (updating_)
83                 return;
84         bc().valid(isValid());
85 }
86
87
88 void QDialogView::slotWMHide()
89 {
90         dialog().CancelButton();
91 }
92
93
94 void QDialogView::slotApply()
95 {
96         dialog().ApplyButton();
97 }
98
99
100 void QDialogView::slotOK()
101 {
102         dialog().OKButton();
103 }
104
105
106 void QDialogView::slotClose()
107 {
108         dialog().CancelButton();
109 }
110
111
112 void QDialogView::slotRestore()
113 {
114         dialog().RestoreButton();
115 }
116
117 } // namespace frontend
118 } // namespace lyx
119
120 #include "QDialogView_moc.cpp"