]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QDialogView.C
* src/frontends/qt4/GuiWorkArea.[Ch]:
[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                 form()->activateWindow();
64                 form()->setFocus();
65         } else {
66                 form()->show();
67                 form()->setFocus();
68         }
69 }
70
71
72 void QDialogView::hide()
73 {
74         if (form() && form()->isVisible())
75                 form()->hide();
76 }
77
78
79 bool QDialogView::isValid()
80 {
81         return true;
82 }
83
84
85 void QDialogView::changed()
86 {
87         if (updating_)
88                 return;
89         bc().valid(isValid());
90 }
91
92
93 void QDialogView::slotWMHide()
94 {
95         dialog().CancelButton();
96 }
97
98
99 void QDialogView::slotApply()
100 {
101         dialog().ApplyButton();
102 }
103
104
105 void QDialogView::slotOK()
106 {
107         dialog().OKButton();
108 }
109
110
111 void QDialogView::slotClose()
112 {
113         dialog().CancelButton();
114 }
115
116
117 void QDialogView::slotRestore()
118 {
119         dialog().RestoreButton();
120 }
121
122 } // namespace frontend
123 } // namespace lyx
124
125 #include "QDialogView_moc.cpp"