]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Qt2Base.C
dont use pragma impementation and interface anymore
[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
14 #include <qdialog.h>
15 #include <qapplication.h>
16
17 #include "debug.h"
18 #include "QtLyXView.h"
19 #include "Dialogs.h"
20 #include "Qt2Base.h"
21 #include "Qt2BC.h"
22 #include "ControlButtons.h"
23 #include "support/LAssert.h"
24
25
26 Qt2Base::Qt2Base(QString const & t)
27         : ViewBase(), updating_(false), title_(t)
28 {}
29
30
31 Qt2BC & Qt2Base::bc()
32 {
33         return static_cast<Qt2BC &>(getController().bc());
34         // return dynamic_cast<Qt2BC &>(getController().bc());
35 }
36
37
38 bool Qt2Base::isVisible() const
39 {
40         return form() && form()->isVisible();
41 }
42
43
44 void Qt2Base::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         if (form()->isVisible()) {
55                 form()->raise();
56         } else {
57                 form()->setCaption(title_);
58                 form()->show();
59         }
60 }
61
62
63 void Qt2Base::hide()
64 {
65         if (form() && form()->isVisible())
66                 form()->hide();
67 }
68
69
70 bool Qt2Base::isValid()
71 {
72         return true;
73 }
74
75
76 void Qt2Base::changed()
77 {
78         if (updating_)
79                 return;
80
81         if (isValid())
82                 bc().valid();
83         else
84                 bc().invalid();
85 }
86
87
88 void Qt2Base::slotWMHide()
89 {
90         getController().CancelButton();
91 }
92
93
94 void Qt2Base::slotApply()
95 {
96         getController().ApplyButton();
97 }
98
99
100 void Qt2Base::slotOK()
101 {
102         getController().OKButton();
103 }
104
105
106 void Qt2Base::slotClose()
107 {
108         getController().CancelButton();
109 }
110
111
112 void Qt2Base::slotRestore()
113 {
114         getController().RestoreButton();
115 }