]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Qt2Base.C
better selection and scrolling behaviour
[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
29 Qt2Base::Qt2Base(QString const & t)
30         : ViewBase(), updating_(false), title_(t)
31 {}
32
33
34 Qt2BC & Qt2Base::bc()
35 {
36         return static_cast<Qt2BC &>(getController().bc());
37         // return dynamic_cast<Qt2BC &>(getController().bc());
38 }
39
40
41 void Qt2Base::show()
42 {
43         if (!form()) {
44                 build();
45         }
46
47         form()->setMinimumSize(form()->sizeHint());
48
49         update();  // make sure its up-to-date
50
51         if (form()->isVisible()) {
52                 form()->raise();
53         } else {
54                 form()->setCaption(title_);
55                 form()->show();
56         }
57 }
58
59
60 void Qt2Base::hide()
61 {
62         if (form() && form()->isVisible())
63                 form()->hide();
64 }
65
66
67 bool Qt2Base::isValid()
68 {
69         return true;
70 }
71
72
73 void Qt2Base::changed()
74 {
75         if (updating_)
76                 return;
77
78         if (isValid())
79                 bc().valid();
80         else
81                 bc().invalid();
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 }