1 // -*- C++ -*-
2 /**
3  * \file LengthCombo.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11 
12 #ifndef LENGTHCOMBO_H
13 #define LENGTHCOMBO_H
14 
15 #include <QComboBox>
16 
17 #include "Length.h"
18 
19 
20 namespace lyx {
21 namespace frontend {
22 
23 /**
24  * A combo box for selecting Length::UNIT types.
25  */
26 class LengthCombo : public QComboBox {
27 	Q_OBJECT
28 
29 public:
30 	LengthCombo(QWidget * parent);
31 
32 	/// set the current item from unit
33 	void setCurrentItem(lyx::Length::UNIT unit);
34 	/// set the current item from length string
35 	virtual void setCurrentItem(QString const & item);
36 	/// set the current item from int
37 	virtual void setCurrentItem(int item);
38 	/// get the current item
39 	lyx::Length::UNIT currentLengthItem() const;
40 	/// enable the widget
41 	virtual void setEnabled(bool b);
42 	/// use the %-items?
43 	void noPercents();
44 	/// Remove EM, EX and MU units
45 	void removeFontDependent();
46 	/// remove a unit from the combo
47 	void removeUnit(lyx::Length::UNIT unit);
48 	/// add a unit to the combo
49 	void addUnit(lyx::Length::UNIT unit);
50 
51 protected Q_SLOTS:
52 	virtual void hasActivated(int index);
53 Q_SIGNALS:
54 	/// the current selection has changed
55 	void selectionChanged(lyx::Length::UNIT unit);
56 };
57 
58 
59 } // namespace frontend
60 } // namespace lyx
61 
62 #endif // LENGTHCOMBO_H
63