~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/widgets/qabstractslider.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the widgets module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QABSTRACTSLIDER_H
 
30
#define QABSTRACTSLIDER_H
 
31
 
 
32
#include "QtGui/qwidget.h"
 
33
 
 
34
class QAbstractSliderPrivate;
 
35
 
 
36
class Q_GUI_EXPORT QAbstractSlider : public QWidget
 
37
{
 
38
    Q_OBJECT
 
39
 
 
40
    Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
 
41
    Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
 
42
    Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
 
43
    Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep)
 
44
    Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
 
45
    Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved)
 
46
    Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
 
47
    Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
 
48
    Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
 
49
    Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
 
50
    Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false)
 
51
 
 
52
public:
 
53
    explicit QAbstractSlider(QWidget *parent=0);
 
54
    ~QAbstractSlider();
 
55
 
 
56
    Qt::Orientation orientation() const;
 
57
 
 
58
    void setMinimum(int);
 
59
    int minimum() const;
 
60
 
 
61
    void setMaximum(int);
 
62
    int maximum() const;
 
63
 
 
64
    void setRange(int min, int max);
 
65
 
 
66
    void setSingleStep(int);
 
67
    int singleStep() const;
 
68
 
 
69
    void setPageStep(int);
 
70
    int pageStep() const;
 
71
 
 
72
    void setTracking(bool enable);
 
73
    bool hasTracking() const;
 
74
 
 
75
    void setSliderDown(bool);
 
76
    bool isSliderDown() const;
 
77
 
 
78
    void setSliderPosition(int);
 
79
    int sliderPosition() const;
 
80
 
 
81
    void setInvertedAppearance(bool);
 
82
    bool invertedAppearance() const;
 
83
 
 
84
    void setInvertedControls(bool);
 
85
    bool invertedControls() const;
 
86
 
 
87
    enum SliderAction {
 
88
        SliderNoAction,
 
89
        SliderSingleStepAdd,
 
90
        SliderSingleStepSub,
 
91
        SliderPageStepAdd,
 
92
        SliderPageStepSub,
 
93
        SliderToMinimum,
 
94
        SliderToMaximum,
 
95
        SliderMove
 
96
    };
 
97
 
 
98
    int value() const;
 
99
 
 
100
    void triggerAction(SliderAction action);
 
101
 
 
102
public slots:
 
103
    void setValue(int);
 
104
    void setOrientation(Qt::Orientation);
 
105
 
 
106
signals:
 
107
    void valueChanged(int value);
 
108
 
 
109
    void sliderPressed();
 
110
    void sliderMoved(int position);
 
111
    void sliderReleased();
 
112
 
 
113
    void rangeChanged(int min, int max);
 
114
 
 
115
    void actionTriggered(int action);
 
116
 
 
117
protected:
 
118
    void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50);
 
119
    SliderAction repeatAction() const;
 
120
 
 
121
    enum SliderChange {
 
122
        SliderRangeChange,
 
123
        SliderOrientationChange,
 
124
        SliderStepsChange,
 
125
        SliderValueChange
 
126
    };
 
127
    virtual void sliderChange(SliderChange change);
 
128
 
 
129
    void keyPressEvent(QKeyEvent *ev);
 
130
    void timerEvent(QTimerEvent *);
 
131
    void wheelEvent(QWheelEvent *e);
 
132
    void changeEvent(QEvent *e);
 
133
 
 
134
#ifdef QT3_SUPPORT
 
135
public:
 
136
    inline QT3_SUPPORT int minValue() const { return minimum(); }
 
137
    inline QT3_SUPPORT int maxValue() const { return maximum(); }
 
138
    inline QT3_SUPPORT int lineStep() const { return singleStep(); }
 
139
    inline QT3_SUPPORT void setMinValue(int v) { setMinimum(v); }
 
140
    inline QT3_SUPPORT void setMaxValue(int v) { setMaximum(v); }
 
141
    inline QT3_SUPPORT void setLineStep(int v) { setSingleStep(v); }
 
142
    inline QT3_SUPPORT void setSteps(int single, int page) { setSingleStep(single); setPageStep(page); }
 
143
    inline QT3_SUPPORT void addPage() { triggerAction(SliderPageStepAdd); }
 
144
    inline QT3_SUPPORT void subtractPage() { triggerAction(SliderPageStepSub); }
 
145
    inline QT3_SUPPORT void addLine() { triggerAction(SliderSingleStepAdd); }
 
146
    inline QT3_SUPPORT void subtractLine() { triggerAction(SliderSingleStepSub); }
 
147
#endif
 
148
 
 
149
protected:
 
150
    QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent=0);
 
151
 
 
152
private:
 
153
    Q_DISABLE_COPY(QAbstractSlider)
 
154
    Q_DECLARE_PRIVATE(QAbstractSlider)
 
155
};
 
156
 
 
157
#endif // QABSTRACTSLIDER_H