3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
12 #include "lengthcombo.h"
14 #include <qwhatsthis.h>
16 LengthCombo::LengthCombo(QWidget * parent, char * name)
17 : QComboBox(parent, name)
19 // FIXME: check these should all be here, I think not
36 connect(this, SIGNAL(activated(int)),
37 this, SLOT(has_activated(int)));
39 QWhatsThis::add(this, _("FIXME - describe the units."));
43 LyXLength::UNIT LengthCombo::currentLengthItem() const
46 int i = currentItem();
49 case 0: unit = LyXLength::CM; break;
50 case 1: unit = LyXLength::IN; break;
51 case 2: unit = LyXLength::PT; break;
52 case 3: unit = LyXLength::MM; break;
53 case 4: unit = LyXLength::PC; break;
54 case 5: unit = LyXLength::EX; break;
55 case 6: unit = LyXLength::EM; break;
56 case 7: unit = LyXLength::SP; break;
57 case 8: unit = LyXLength::BP; break;
58 case 9: unit = LyXLength::DD; break;
59 case 10: unit = LyXLength::CC; break;
60 case 11: unit = LyXLength::MU; break;
61 case 12: unit = LyXLength::PPW; break;
62 case 13: unit = LyXLength::PCW; break;
63 case 14: unit = LyXLength::PLW; break;
64 // FIXME: LyXLength::PTW ?
70 void LengthCombo::has_activated(int)
72 emit selectionChanged(currentLengthItem());
76 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
81 case LyXLength::CM: i = 0; break;
82 case LyXLength::IN: i = 1; break;
83 case LyXLength::PT: i = 2; break;
84 case LyXLength::MM: i = 3; break;
85 case LyXLength::PC: i = 4; break;
86 case LyXLength::EX: i = 5; break;
87 case LyXLength::EM: i = 6; break;
88 case LyXLength::SP: i = 7; break;
89 case LyXLength::BP: i = 8; break;
90 case LyXLength::DD: i = 9; break;
91 case LyXLength::CC: i = 10; break;
92 case LyXLength::MU: i = 11; break;
93 case LyXLength::PPW: i = 12; break;
94 case LyXLength::PCW: i = 13; break;
95 case LyXLength::PLW: i = 14; break;
96 // FIXME: LyXLength::PTW ?
98 QComboBox::setCurrentItem(i);