]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QDialogView.C
* Painter.h:
[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 using lyx::docstring;
20
21 namespace lyx {
22 namespace frontend {
23
24 QDialogView::QDialogView(Dialog & parent, docstring const & t)
25         : Dialog::View(parent,t), updating_(false)
26 {}
27
28
29 Qt2BC & QDialogView::bcview()
30 {
31         return static_cast<Qt2BC &>(dialog().bc().view());
32 }
33
34
35 bool QDialogView::isVisible() const
36 {
37         return form() && form()->isVisible();
38 }
39
40
41 bool QDialogView::readOnly() const
42 {
43         return kernel().isBufferReadonly();
44 }
45
46
47 void QDialogView::show()
48 {
49         if (!form()) {
50                 build();
51         }
52
53         form()->setMinimumSize(form()->sizeHint());
54
55         update();  // make sure its up-to-date
56         if (dialog().controller().exitEarly())
57                 return;
58
59         form()->setWindowTitle(toqstr("LyX: " + getTitle()));
60
61         if (form()->isVisible()) {
62                 form()->raise();
63         } else {
64                 form()->show();
65         }
66 }
67
68
69 void QDialogView::hide()
70 {
71         if (form() && form()->isVisible())
72                 form()->hide();
73 }
74
75
76 bool QDialogView::isValid()
77 {
78         return true;
79 }
80
81
82 void QDialogView::changed()
83 {
84         if (updating_)
85                 return;
86         bc().valid(isValid());
87 }
88
89
90 void QDialogView::slotWMHide()
91 {
92         dialog().CancelButton();
93 }
94
95
96 void QDialogView::slotApply()
97 {
98         dialog().ApplyButton();
99 }
100
101
102 void QDialogView::slotOK()
103 {
104         dialog().OKButton();
105 }
106
107
108 void QDialogView::slotClose()
109 {
110         dialog().CancelButton();
111 }
112
113
114 void QDialogView::slotRestore()
115 {
116         dialog().RestoreButton();
117 }
118
119 } // namespace frontend
120 } // namespace lyx
121
122 #include "QDialogView_moc.cpp"