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