lib

spinbox.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3 Copyright (C) 2004 Alexander Dymo <cloudtemple@mskat.net>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KPROPERTY_SPINBOX_H
22#define KPROPERTY_SPINBOX_H
23
24#include <knuminput.h>
25
26#include "../widget.h"
27
28namespace KoProperty {
29
30class IntEdit;
31class DoubleEdit;
32
33// Int Editor
34
35class IntSpinBox : public KIntSpinBox
36{
37 TQ_OBJECT
38
39
40 public:
41 IntSpinBox(int lower, int upper, int step, int value, int base=10,
42 IntEdit *parent=0, const char *name=0);
43 virtual ~IntSpinBox() {;}
44
45 virtual void setValue(const TQVariant &value);
46
47 virtual bool eventFilter(TQObject *o, TQEvent *e);
48 TQLineEdit * editor () const { return KIntSpinBox::editor(); }
49};
50
51class KOPROPERTY_EXPORT IntEdit : public Widget
52{
53 TQ_OBJECT
54
55
56 public:
57 IntEdit(Property *property, TQWidget *parent=0, const char *name=0);
58 virtual ~IntEdit();
59
60 virtual TQVariant value() const;
61 virtual void setValue(const TQVariant &value, bool emitChange=true);
62 virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value);
63
64 protected:
65 virtual void setReadOnlyInternal(bool readOnly);
66 void updateSpinWidgets();
67
68 protected slots:
69 void slotValueChanged(int value);
70
71 private:
72 IntSpinBox *m_edit;
73};
74
75// Double editor
76
77class DoubleSpinBox : public KDoubleSpinBox
78{
79 TQ_OBJECT
80
81
82 public:
84 DoubleSpinBox(double lower, double upper, double step, double value=0,
85 int precision=2, DoubleEdit *parent=0);
86 virtual ~DoubleSpinBox() {;}
87
88 virtual bool eventFilter(TQObject *o, TQEvent *e);
89 TQLineEdit * editor () const { return KDoubleSpinBox::editor(); }
90
91 public slots:
92 virtual void setValue( const TQVariant& value );
93};
94
95class KOPROPERTY_EXPORT DoubleEdit : public Widget
96{
97 TQ_OBJECT
98
99
100 public:
101 DoubleEdit(Property *property, TQWidget *parent=0, const char *name=0);
102 virtual ~DoubleEdit();
103
104 virtual TQVariant value() const;
105 virtual void setValue(const TQVariant &value, bool emitChange=true);
106 virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value);
107
108 protected:
109 virtual void setReadOnlyInternal(bool readOnly);
110 void updateSpinWidgets();
111
112 protected slots:
113 void slotValueChanged(double value);
114
115 private:
116 DoubleSpinBox *m_edit;
117};
118
119}
120
121#endif
int precision() const
double value() const
int base() const
The base class for all item editors used in Editor.
Definition widget.h:37
Namespace for a set of classes implementing generic properties framework.