1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/*
* KMix -- KDE's full featured mini mixer
*
*
* Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KSMALLSLIDER_H
#define KSMALLSLIDER_H
#include <kpanelapplet.h>
#include <tqwidget.h>
#include <tqpixmap.h>
#include <tqrangecontrol.h>
class KSmallSlider : public TQWidget, public TQRangeControl
{
Q_OBJECT
public:
KSmallSlider( TQWidget *parent, const char *name=0 );
KSmallSlider( Qt::Orientation, TQWidget *parent, const char *name=0 );
KSmallSlider( int minValue, int maxValue, int pageStep, int value,
Qt::Orientation, TQWidget *parent, const char *name=0 );
//virtual void setTracking( bool enable );
//bool tracking() const;
TQSize sizeHint() const;
TQSizePolicy sizePolicy() const;
TQSize minimumSizeHint() const;
int minValue() const;
int maxValue() const;
void setMinValue( int ); // Don't use these unless you make versions
void setMaxValue( int ); // that work. -esigra
int lineStep() const;
int pageStep() const;
void setLineStep( int );
void setPageStep( int );
int value() const;
//void paletteChange ( const TQPalette & oldPalette );
bool gray() const;
public slots:
virtual void setValue( int );
void addStep();
void subtractStep();
void setGray( bool value );
void setColors( TQColor high, TQColor low, TQColor back );
void setGrayColors( TQColor high, TQColor low, TQColor back );
signals:
void valueChanged( int value );
void sliderPressed();
void sliderMoved( int value );
void sliderReleased();
protected:
void resizeEvent( TQResizeEvent * );
void paintEvent( TQPaintEvent * );
void mousePressEvent( TQMouseEvent * );
void mouseReleaseEvent( TQMouseEvent * );
void mouseMoveEvent( TQMouseEvent * );
void wheelEvent( TQWheelEvent * );
void valueChange();
void rangeChange();
private:
//enum State { Idle, Dragging };
void init();
int positionFromValue( int ) const;
int valueFromPosition( int ) const;
void moveSlider( int );
//void resetState();
// int slideLength() const;
int available() const;
int goodPart( const TQPoint& ) const;
//void initTicks();
//TQCOORD sliderPos;
//int sliderVal;
//State state;
//bool track;
bool grayed;
Qt::Orientation _orientation;
TQColor colHigh, colLow, colBack;
TQColor grayHigh, grayLow, grayBack;
};
/*
inline bool KSmallSlider::tracking() const
{
return track;
}
*/
#endif
|