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