]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QBoxDialog.C
Minipage is no more (long live the box inset)
[lyx.git] / src / frontends / qt2 / QBoxDialog.C
1 /**
2  * \file QBoxDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Spitzmüller
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13
14 #include "QBox.h"
15 #include "QBoxDialog.h"
16 #include "qt_helpers.h"
17
18 #include "lengthcombo.h"
19 #include <qcombobox.h>
20 #include <qpushbutton.h>
21 #include <qlineedit.h>
22
23
24 QBoxDialog::QBoxDialog(QBox * form)
25         : QBoxDialogBase(0, 0, false, 0),
26         form_(form)
27 {
28         connect(restorePB, SIGNAL(clicked()),
29                 form, SLOT(slotRestore()));
30         connect(okPB, SIGNAL(clicked()),
31                 form, SLOT(slotOK()));
32         connect(applyPB, SIGNAL(clicked()),
33                 form, SLOT(slotApply()));
34         connect(closePB, SIGNAL(clicked()),
35                 form, SLOT(slotClose()));
36 }
37
38
39 void QBoxDialog::closeEvent(QCloseEvent * e)
40 {
41         form_->slotWMHide();
42         e->accept();
43 }
44
45
46 void QBoxDialog::change_adaptor()
47 {
48         form_->changed();
49 }
50
51
52 void QBoxDialog::innerBoxChanged(const QString & str)
53 {
54         bool ibox = (str != qt_("None"));
55         valignCO->setEnabled(ibox);
56         ialignCO->setEnabled(ibox);
57         halignCO->setEnabled(!ibox);
58         heightED->setEnabled(ibox);
59         heightUnitsLC->setEnabled(ibox);
60         form_->setSpecial(ibox);
61 }
62
63
64 void QBoxDialog::typeChanged(int index)
65 {
66         bool frameless = (index == 0);
67         if (frameless) {
68                 valignCO->setEnabled(true);
69                 ialignCO->setEnabled(true);
70                 halignCO->setEnabled(false);
71                 heightED->setEnabled(true);
72                 heightUnitsLC->setEnabled(true);
73                 form_->setSpecial(true);
74         }
75         int itype = innerBoxCO->currentItem();
76         form_->setInnerType(frameless, itype);
77 }
78
79
80 void QBoxDialog::restoreClicked()
81 {
82         form_->setInnerType(true, 2);
83         widthED->setText("100");
84         widthUnitsLC->setCurrentItem(LyXLength::PCW);
85         heightED->setText("1");
86         for (int j = 0; j < heightUnitsLC->count(); j++) {
87                 if (heightUnitsLC->text(j) == qt_("Total Height"))
88                         heightUnitsLC->setCurrentItem(j);
89         }
90 }