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