3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS
15 #pragma implementation
18 #include "lengthcombo.h"
19 #include <qwhatsthis.h>
21 #include "lengthcommon.h"
25 LengthCombo::LengthCombo(QWidget * parent, char * name)
26 : QComboBox(parent, name)
28 for (int i=0; i < num_units; i++)
29 insertItem(unit_name_gui[i]);
31 connect(this, SIGNAL(activated(int)),
32 this, SLOT(has_activated(int)));
34 QWhatsThis::add(this, _("Choose one of the units or relative lengths"));
38 LyXLength::UNIT LengthCombo::currentLengthItem() const
40 return static_cast<LyXLength::UNIT>(currentItem());
44 void LengthCombo::has_activated(int)
46 emit selectionChanged(currentLengthItem());
50 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
52 QComboBox::setCurrentItem(int(unit));
56 void LengthCombo::setEnabled(bool b)
58 QComboBox::setEnabled(b);