]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Qt2Base.C
fix bug 850 (fix confirmed by John)
[lyx.git] / src / frontends / qt2 / Qt2Base.C
1 /**
2  * \file Qt2Base.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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include <qdialog.h>
18 #include <qapplication.h>
19
20 #include "debug.h"
21 #include "QtLyXView.h"
22 #include "Dialogs.h"
23 #include "Qt2Base.h"
24 #include "Qt2BC.h"
25 #include "ControlButtons.h"
26 #include "support/LAssert.h"
27
28
29 Qt2Base::Qt2Base(QString const & t)
30         : ViewBase(), updating_(false), title_(t)
31 {}
32
33
34 Qt2BC & Qt2Base::bc()
35 {
36         return static_cast<Qt2BC &>(getController().bc());
37         // return dynamic_cast<Qt2BC &>(getController().bc());
38 }
39
40
41 bool Qt2Base::isVisible() const
42 {
43         return form() && form()->isVisible();
44 }
45
46
47 void Qt2Base::show()
48 {
49         if (!form()) {
50                 build();
51         }
52
53         form()->setMinimumSize(form()->sizeHint());
54
55         update();  // make sure its up-to-date
56
57         if (form()->isVisible()) {
58                 form()->raise();
59         } else {
60                 form()->setCaption(title_);
61                 form()->show();
62         }
63 }
64
65
66 void Qt2Base::hide()
67 {
68         if (form() && form()->isVisible())
69                 form()->hide();
70 }
71
72
73 bool Qt2Base::isValid()
74 {
75         return true;
76 }
77
78
79 void Qt2Base::changed()
80 {
81         if (updating_)
82                 return;
83
84         if (isValid())
85                 bc().valid();
86         else
87                 bc().invalid();
88 }
89
90
91 void Qt2Base::slotWMHide()
92 {
93         getController().CancelButton();
94 }
95
96
97 void Qt2Base::slotApply()
98 {
99         getController().ApplyButton();
100 }
101
102
103 void Qt2Base::slotOK()
104 {
105         getController().OKButton();
106 }
107
108
109 void Qt2Base::slotClose()
110 {
111         getController().CancelButton();
112 }
113
114
115 void Qt2Base::slotRestore()
116 {
117         getController().RestoreButton();
118 }