]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/dlg/lengthentry.h
c++ mode and inherit privately from noncopyable
[lyx.git] / src / frontends / kde / dlg / lengthentry.h
1 /*
2  * lengthentry.h
3  * (C) 2001 LyX Team
4  * John Levon, moz@compsoc.man.ac.uk
5  */
6
7 /***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15
16 #ifndef LENGTHENTRY_H
17 #define LENGTHENTRY_H
18
19 #include <qwidget.h>
20
21 #include "vspace.h"
22
23 class QVBoxLayout;
24 class KRestrictedLine;
25 class QComboBox;
26
27 #include "boost/utility.hpp"
28
29 /**
30  * This widget provides a value edit and a combo box
31  * for LyXLengths.
32  */
33 class LengthEntry : public QWidget, boost::noncopyable {
34    Q_OBJECT
35 public:
36         LengthEntry(QWidget * parent = 0, const char * name = 0);
37         
38         ~LengthEntry();
39
40         /// get length string represented
41         const string getLengthStr() const; 
42
43         /// get the value
44         double getValue() const;
45
46         /// get the units as a string
47         const string getStrUnits() const;
48
49         /// get the units as a UNIT
50         LyXLength::UNIT getUnits() const;
51
52         /// set from a length string
53         bool setFromLengthStr(const string & str);
54
55         /// set the value
56         void setValue(double value);
57
58         /// set the value by a string 
59         void setValue(const string & str);
60
61         /// set the units from string e.g. "mm"
62         bool setUnits(const string & str);
63  
64         /// set the units from a UNIT
65         bool setUnits(LyXLength::UNIT unit);
66
67         /// enable/disable
68         virtual void setEnabled(bool enable);
69
70 private:
71         KRestrictedLine *value;
72         QComboBox *box;
73         QVBoxLayout *topLayout;
74 };
75
76 #endif