]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QDialogView.C
get rid of broken_header.h and some unneeded tests
[lyx.git] / src / frontends / qt2 / 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
55         form()->setCaption(toqstr(getTitle()));
56
57         if (form()->isVisible()) {
58                 form()->raise();
59         } else {
60                 form()->show();
61         }
62 }
63
64
65 void QDialogView::hide()
66 {
67         if (form() && form()->isVisible())
68                 form()->hide();
69 }
70
71
72 bool QDialogView::isValid()
73 {
74         return true;
75 }
76
77
78 void QDialogView::changed()
79 {
80         if (updating_)
81                 return;
82         bc().valid(isValid());
83 }
84
85
86 void QDialogView::slotWMHide()
87 {
88         dialog().CancelButton();
89 }
90
91
92 void QDialogView::slotApply()
93 {
94         dialog().ApplyButton();
95 }
96
97
98 void QDialogView::slotOK()
99 {
100         dialog().OKButton();
101 }
102
103
104 void QDialogView::slotClose()
105 {
106         dialog().CancelButton();
107 }
108
109
110 void QDialogView::slotRestore()
111 {
112         dialog().RestoreButton();
113 }
114
115 } // namespace frontend
116 } // namespace lyx