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