]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Qt2Base.C
Lots and lots of little trivial bits.
[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 Qt2Base::Qt2Base(QString const & t)
29         : ViewBase(), updating_(false), title_(t)
30 {}
31
32
33 Qt2BC & Qt2Base::bc()
34 {
35         return static_cast<Qt2BC &>(getController().bc());
36         // return dynamic_cast<Qt2BC &>(getController().bc());
37 }
38
39
40 void Qt2Base::show()
41 {
42         if (!form()) {
43                 build();
44         }
45
46         form()->setMinimumSize(form()->sizeHint());
47
48         update();  // make sure its up-to-date
49
50         if (form()->isVisible()) {
51                 form()->raise();
52         } else {
53                 form()->setCaption(title_);
54                 form()->show();
55         }
56 }
57
58
59 void Qt2Base::hide()
60 {
61         if (form() && form()->isVisible())
62                 form()->hide();
63 }
64
65
66 bool Qt2Base::isValid()
67 {
68         return true;
69 }
70
71
72 void Qt2Base::changed()
73 {
74         if (updating_)
75                 return;
76
77         if (isValid())
78                 bc().valid();
79         else
80                 bc().invalid();
81 }
82
83
84 void Qt2Base::slotWMHide()
85 {
86         getController().CancelButton();
87 }
88
89
90 void Qt2Base::slotApply()
91 {
92         getController().ApplyButton();
93 }
94
95
96 void Qt2Base::slotOK()
97 {
98         getController().OKButton();
99 }
100
101
102 void Qt2Base::slotClose()
103 {
104         getController().CancelButton();
105 }
106
107
108 void Qt2Base::slotRestore()
109 {
110         getController().RestoreButton();
111 }