]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/Qt2Base.C
No longer pass Controller & or Dialogs & to the View c-tors.
[lyx.git] / src / frontends / qt2 / Qt2Base.C
1 /* This file is part of
2  * ======================================================
3  *
4  *                 LyX, The Document Processor
5  *
6  *                 Copyright 2000 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \author Angus Leeming <a.leeming@ic.ac.uk>
11  */
12
13 #include <config.h>
14
15 #ifdef __GNUG__
16 #pragma implementation
17 #endif
18
19 #include <qdialog.h>
20 #include <qapplication.h>
21
22 #include "debug.h"
23 #include "QtLyXView.h"
24 #include "Dialogs.h"
25 #include "Qt2Base.h"
26 #include "Qt2BC.h"
27 #include "ControlButtons.h"
28 #include "support/LAssert.h"
29
30 Qt2Base::Qt2Base(QString const & t)
31         : ViewBase(), updating_(false), title_(t)
32 {}
33
34
35 Qt2BC & Qt2Base::bc()
36 {
37         return static_cast<Qt2BC &>(getController().bc());
38         // return dynamic_cast<Qt2BC &>(getController().bc());
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 }