0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the Qt3Support module of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
#ifndef Q3RANGECONTROL_H
|
|
43 |
#define Q3RANGECONTROL_H
|
|
44 |
|
|
45 |
#include <QtCore/qglobal.h>
|
|
46 |
#include <QtGui/qwidget.h>
|
|
47 |
|
|
48 |
QT_BEGIN_HEADER
|
|
49 |
|
|
50 |
QT_BEGIN_NAMESPACE
|
|
51 |
|
|
52 |
QT_MODULE(Qt3SupportLight)
|
|
53 |
|
|
54 |
#ifndef QT_NO_RANGECONTROL
|
|
55 |
|
|
56 |
class Q3RangeControlPrivate;
|
|
57 |
|
|
58 |
class Q_COMPAT_EXPORT Q3RangeControl
|
|
59 |
{
|
|
60 |
public:
|
|
61 |
Q3RangeControl();
|
|
62 |
Q3RangeControl(int minValue, int maxValue,
|
|
63 |
int lineStep, int pageStep, int value);
|
|
64 |
virtual ~Q3RangeControl();
|
|
65 |
|
|
66 |
int value() const;
|
|
67 |
void setValue(int);
|
|
68 |
void addPage();
|
|
69 |
void subtractPage();
|
|
70 |
void addLine();
|
|
71 |
void subtractLine();
|
|
72 |
|
|
73 |
int minValue() const;
|
|
74 |
int maxValue() const;
|
|
75 |
void setRange(int minValue, int maxValue);
|
|
76 |
void setMinValue(int minVal);
|
|
77 |
void setMaxValue(int minVal);
|
|
78 |
|
|
79 |
int lineStep() const;
|
|
80 |
int pageStep() const;
|
|
81 |
void setSteps(int line, int page);
|
|
82 |
|
|
83 |
int bound(int) const;
|
|
84 |
|
|
85 |
protected:
|
|
86 |
int positionFromValue(int val, int space) const;
|
|
87 |
int valueFromPosition(int pos, int space) const;
|
|
88 |
void directSetValue(int val);
|
|
89 |
int prevValue() const;
|
|
90 |
|
|
91 |
virtual void valueChange();
|
|
92 |
virtual void rangeChange();
|
|
93 |
virtual void stepChange();
|
|
94 |
|
|
95 |
private:
|
|
96 |
int minVal, maxVal;
|
|
97 |
int line, page;
|
|
98 |
int val, prevVal;
|
|
99 |
|
|
100 |
Q3RangeControlPrivate * d;
|
|
101 |
|
|
102 |
private:
|
|
103 |
Q_DISABLE_COPY(Q3RangeControl)
|
|
104 |
};
|
|
105 |
|
|
106 |
|
|
107 |
inline int Q3RangeControl::value() const
|
|
108 |
{ return val; }
|
|
109 |
|
|
110 |
inline int Q3RangeControl::prevValue() const
|
|
111 |
{ return prevVal; }
|
|
112 |
|
|
113 |
inline int Q3RangeControl::minValue() const
|
|
114 |
{ return minVal; }
|
|
115 |
|
|
116 |
inline int Q3RangeControl::maxValue() const
|
|
117 |
{ return maxVal; }
|
|
118 |
|
|
119 |
inline int Q3RangeControl::lineStep() const
|
|
120 |
{ return line; }
|
|
121 |
|
|
122 |
inline int Q3RangeControl::pageStep() const
|
|
123 |
{ return page; }
|
|
124 |
|
|
125 |
|
|
126 |
#endif // QT_NO_RANGECONTROL
|
|
127 |
|
|
128 |
#ifndef QT_NO_SPINWIDGET
|
|
129 |
|
|
130 |
class Q3SpinWidgetPrivate;
|
|
131 |
class Q_COMPAT_EXPORT Q3SpinWidget : public QWidget
|
|
132 |
{
|
|
133 |
Q_OBJECT
|
|
134 |
public:
|
|
135 |
Q3SpinWidget(QWidget* parent=0, const char* name=0);
|
|
136 |
~Q3SpinWidget();
|
|
137 |
|
|
138 |
void setEditWidget(QWidget * widget);
|
|
139 |
QWidget * editWidget();
|
|
140 |
|
|
141 |
QRect upRect() const;
|
|
142 |
QRect downRect() const;
|
|
143 |
|
|
144 |
void setUpEnabled(bool on);
|
|
145 |
void setDownEnabled(bool on);
|
|
146 |
|
|
147 |
bool isUpEnabled() const;
|
|
148 |
bool isDownEnabled() const;
|
|
149 |
|
|
150 |
enum ButtonSymbols { UpDownArrows, PlusMinus };
|
|
151 |
virtual void setButtonSymbols(ButtonSymbols bs);
|
|
152 |
ButtonSymbols buttonSymbols() const;
|
|
153 |
|
|
154 |
void arrange();
|
|
155 |
|
|
156 |
Q_SIGNALS:
|
|
157 |
void stepUpPressed();
|
|
158 |
void stepDownPressed();
|
|
159 |
|
|
160 |
public Q_SLOTS:
|
|
161 |
void stepUp();
|
|
162 |
void stepDown();
|
|
163 |
|
|
164 |
protected:
|
|
165 |
void mousePressEvent(QMouseEvent *e);
|
|
166 |
void resizeEvent(QResizeEvent* ev);
|
|
167 |
void mouseReleaseEvent(QMouseEvent *e);
|
|
168 |
void mouseMoveEvent(QMouseEvent *e);
|
|
169 |
#ifndef QT_NO_WHEELEVENT
|
|
170 |
void wheelEvent(QWheelEvent *);
|
|
171 |
#endif
|
|
172 |
void changeEvent(QEvent *);
|
|
173 |
void paintEvent(QPaintEvent *);
|
|
174 |
|
|
175 |
private Q_SLOTS:
|
|
176 |
void timerDone();
|
|
177 |
void timerDoneEx();
|
|
178 |
|
|
179 |
private:
|
|
180 |
Q3SpinWidgetPrivate * d;
|
|
181 |
|
|
182 |
void updateDisplay();
|
|
183 |
|
|
184 |
private:
|
|
185 |
Q_DISABLE_COPY(Q3SpinWidget)
|
|
186 |
};
|
|
187 |
|
|
188 |
#endif // QT_NO_RANGECONTROL
|
|
189 |
|
|
190 |
QT_END_NAMESPACE
|
|
191 |
|
|
192 |
QT_END_HEADER
|
|
193 |
|
|
194 |
#endif // Q3RANGECONTROL_H
|