]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Qt2Base.C
namespace grfx -> lyx::graphics
[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 "qt_helpers.h"
18 #include "QtLyXView.h"
19 #include "Qt2Base.h"
20 #include "Qt2BC.h"
21 #include "ButtonController.h"
22 #include "ControlButtons.h"
23 #include "support/LAssert.h"
24
25
26 Qt2Base::Qt2Base(string const & t)
27         : ViewBase(t), updating_(false)
28 {}
29
30
31 Qt2BC & Qt2Base::bcview()
32 {
33         return static_cast<Qt2BC &>(bc().view());
34         // return dynamic_cast<Qt2BC &>(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         form()->setCaption(toqstr(getTitle()));
55
56         if (form()->isVisible()) {
57                 form()->raise();
58         } else {
59                 form()->show();
60         }
61 }
62
63
64 void Qt2Base::hide()
65 {
66         if (form() && form()->isVisible())
67                 form()->hide();
68 }
69
70
71 bool Qt2Base::isValid()
72 {
73         return true;
74 }
75
76
77 void Qt2Base::changed()
78 {
79         if (updating_)
80                 return;
81         bc().valid(isValid());
82 }
83
84
85 void Qt2Base::slotWMHide()
86 {
87         getController().CancelButton();
88 }
89
90
91 void Qt2Base::slotApply()
92 {
93         getController().ApplyButton();
94 }
95
96
97 void Qt2Base::slotOK()
98 {
99         getController().OKButton();
100 }
101
102
103 void Qt2Base::slotClose()
104 {
105         getController().CancelButton();
106 }
107
108
109 void Qt2Base::slotRestore()
110 {
111         getController().RestoreButton();
112 }