00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KPROPERTY_SPINBOX_H
00022 #define KPROPERTY_SPINBOX_H
00023
00024 #include <knuminput.h>
00025
00026 #include "../widget.h"
00027
00028 #include <QEvent>
00029
00030 namespace KoProperty {
00031
00032 class IntEdit;
00033 class DoubleEdit;
00034
00035
00036
00037 class IntSpinBox : public KIntSpinBox
00038 {
00039 Q_OBJECT
00040
00041 public:
00042 IntSpinBox(int lower, int upper, int step, int value, int base=10,
00043 IntEdit *parent=0);
00044 virtual ~IntSpinBox() {;}
00045
00046 virtual void setValue(const QVariant &value);
00047
00048 virtual bool eventFilter(QObject *o, QEvent *e);
00049 QLineEdit * lineEdit() const { return KIntSpinBox::lineEdit(); }
00050 };
00051
00052 class KOPROPERTY_EXPORT IntEdit : public Widget
00053 {
00054 Q_OBJECT
00055
00056 public:
00057 IntEdit(Property *property, QWidget *parent=0);
00058 virtual ~IntEdit();
00059
00060 virtual QVariant value() const;
00061 virtual void setValue(const QVariant &value, bool emitChange=true);
00062 virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00063
00064 protected:
00065 virtual void setReadOnlyInternal(bool readOnly);
00066 void updateSpinWidgets();
00067
00068 protected slots:
00069 void slotValueChanged(int value);
00070
00071 private:
00072 IntSpinBox *m_edit;
00073 };
00074
00075
00076
00077 class DoubleSpinBox : public KDoubleSpinBox
00078 {
00079 Q_OBJECT
00080
00081 public:
00083 DoubleSpinBox(double lower, double upper, double step, double value=0,
00084 int precision=2, DoubleEdit *parent=0);
00085 virtual ~DoubleSpinBox() {;}
00086
00087 virtual bool eventFilter(QObject *o, QEvent *e);
00088 QLineEdit * lineEdit() const { return KDoubleSpinBox::lineEdit(); }
00089
00090 public slots:
00091 virtual void setValue( const QVariant& value );
00092 };
00093
00094 class KOPROPERTY_EXPORT DoubleEdit : public Widget
00095 {
00096 Q_OBJECT
00097
00098 public:
00099 DoubleEdit(Property *property, QWidget *parent=0);
00100 virtual ~DoubleEdit();
00101
00102 virtual QVariant value() const;
00103 virtual void setValue(const QVariant &value, bool emitChange=true);
00104 virtual void drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value);
00105
00106 protected:
00107 virtual void setReadOnlyInternal(bool readOnly);
00108 void updateSpinWidgets();
00109
00110 protected slots:
00111 void slotValueChanged(double value);
00112
00113 private:
00114 DoubleSpinBox *m_edit;
00115 };
00116
00117 }
00118
00119 #endif