]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QDialogView.C
namespace grfx -> lyx::graphics
[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 #include <qdialog.h>
15 #include <qapplication.h>
16
17 #include "debug.h"
18 #include "qt_helpers.h"
19 #include "QtLyXView.h"
20 #include "QDialogView.h"
21 #include "Qt2BC.h"
22 #include "ButtonController.h"
23 #include "support/LAssert.h"
24
25
26 QDialogView::QDialogView(Dialog & parent, string const & t)
27         : Dialog::View(parent,t), updating_(false)
28 {}
29
30
31 Qt2BC & QDialogView::bcview()
32 {
33         return static_cast<Qt2BC &>(dialog().bc().view());
34 }
35
36
37 bool QDialogView::isVisible() const
38 {
39         return form() && form()->isVisible();
40 }
41
42
43 bool QDialogView::readOnly() const
44 {
45         return kernel().isBufferReadonly();
46 }
47
48
49 void QDialogView::show()
50 {
51         if (!form()) {
52                 build();
53         }
54
55         form()->setMinimumSize(form()->sizeHint());
56
57         update();  // make sure its up-to-date
58
59         form()->setCaption(toqstr(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 }