]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/lengthcombo.C
dont use pragma impementation and interface anymore
[lyx.git] / src / frontends / qt2 / lengthcombo.C
1 /**
2  * \file lengthcombo.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  * \author Herbert Voss
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14
15 #include "lengthcombo.h"
16 #include <qwhatsthis.h>
17
18 #include "lengthcommon.h"
19 #include "qt_helpers.h"
20
21
22 LengthCombo::LengthCombo(QWidget * parent, char * name)
23         : QComboBox(parent, name)
24 {
25         for (int i=0; i < num_units; i++)
26                 insertItem(unit_name_gui[i]);
27
28         connect(this, SIGNAL(activated(int)),
29                 this, SLOT(has_activated(int)));
30
31         QWhatsThis::add(this, qt_("Choose one of the units or relative lengths"));
32 }
33
34
35 LyXLength::UNIT LengthCombo::currentLengthItem() const
36 {
37         return static_cast<LyXLength::UNIT>(currentItem());
38 }
39
40
41 void LengthCombo::has_activated(int)
42 {
43         emit selectionChanged(currentLengthItem());
44 }
45
46
47 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
48 {
49         QComboBox::setCurrentItem(int(unit));
50 }
51
52
53 void LengthCombo::setEnabled(bool b)
54 {
55         QComboBox::setEnabled(b);
56 }