]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QERT.C
Lots and lots of little trivial bits.
[lyx.git] / src / frontends / qt2 / QERT.C
1 /**
2  * \file QERT.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
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 "ControlERT.h"
18 #include "gettext.h"
19
20 #include <qradiobutton.h>
21 #include <qpushbutton.h>
22
23 #include "QERTDialog.h"
24 #include "QERT.h"
25 #include "Qt2BC.h"
26
27 typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
28
29 QERT::QERT()
30         : base_class(_("LaTeX ERT"))
31 {
32 }
33
34
35 void QERT::build_dialog()
36 {
37         dialog_.reset(new QERTDialog(this));
38
39         bc().setOK(dialog_->okPB);
40         bc().setCancel(dialog_->closePB);
41 }
42
43
44 void QERT::apply()
45 {
46         if (dialog_->openRB->isChecked())
47                 controller().params().status = InsetERT::Open;
48         else if (dialog_->inlineRB->isChecked())
49                 controller().params().status = InsetERT::Inlined;
50         else
51                 controller().params().status = InsetERT::Collapsed;
52 }
53
54
55 void QERT::update_contents()
56 {
57         QRadioButton * rb;
58
59         switch (controller().params().status) {
60                 case InsetERT::Open: rb = dialog_->openRB; break;
61                 case InsetERT::Inlined: rb = dialog_->inlineRB; break;
62                 case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
63         }
64
65         rb->setChecked(true);
66 }