3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Jürgen Spitzmüller
8 * Full author contact details are available in file CREDITS.
13 #include "QBoxDialog.h"
15 #include "lengthcombo.h"
16 #include "validators.h"
18 #include "qt_helpers.h"
20 #include <qcombobox.h>
21 #include <qlineedit.h>
22 #include <qpushbutton.h>
27 QBoxDialog::QBoxDialog(QBox * form)
28 : QBoxDialogBase(0, 0, false, 0),
31 connect(restorePB, SIGNAL(clicked()),
32 form, SLOT(slotRestore()));
33 connect(okPB, SIGNAL(clicked()),
34 form, SLOT(slotOK()));
35 connect(applyPB, SIGNAL(clicked()),
36 form, SLOT(slotApply()));
37 connect(closePB, SIGNAL(clicked()),
38 form, SLOT(slotClose()));
40 heightED->setValidator(unsignedLengthValidator(heightED));
41 widthED->setValidator(unsignedLengthValidator(widthED));
45 void QBoxDialog::closeEvent(QCloseEvent * e)
52 void QBoxDialog::change_adaptor()
58 void QBoxDialog::innerBoxChanged(const QString & str)
60 bool ibox = (str != qt_("None"));
61 valignCO->setEnabled(ibox);
62 ialignCO->setEnabled(ibox);
63 halignCO->setEnabled(!ibox);
64 heightED->setEnabled(ibox);
65 heightUnitsLC->setEnabled(ibox);
66 form_->setSpecial(ibox);
70 void QBoxDialog::typeChanged(int index)
72 bool frameless = (index == 0);
74 valignCO->setEnabled(true);
75 ialignCO->setEnabled(true);
76 halignCO->setEnabled(false);
77 heightED->setEnabled(true);
78 heightUnitsLC->setEnabled(true);
79 form_->setSpecial(true);
81 int itype = innerBoxCO->currentItem();
82 form_->setInnerType(frameless, itype);
86 void QBoxDialog::restoreClicked()
88 form_->setInnerType(true, 2);
89 widthED->setText("100");
90 widthUnitsLC->setCurrentItem(LyXLength::PCW);
91 heightED->setText("1");
92 for (int j = 0; j < heightUnitsLC->count(); j++) {
93 if (heightUnitsLC->text(j) == qt_("Total Height"))
94 heightUnitsLC->setCurrentItem(j);
98 } // namespace frontend