You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
0 B
137 lines
0 B
15 years ago
|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||
|
* Qwt Widget Library
|
||
|
* Copyright (C) 1997 Josef Wilgen
|
||
|
* Copyright (C) 2002 Uwe Rathmann
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the Qwt License, Version 1.0
|
||
|
*****************************************************************************/
|
||
|
|
||
|
// vim: expandtab
|
||
|
|
||
|
#ifndef QWT_SLIDER_H
|
||
|
#define QWT_SLIDER_H
|
||
|
|
||
|
#include "qwt_global.h"
|
||
|
#include "qwt_abstract_scale.h"
|
||
|
#include "qwt_abstract_slider.h"
|
||
|
|
||
|
class QwtScaleDraw;
|
||
|
|
||
|
/*!
|
||
|
\brief The Slider Widget
|
||
|
|
||
|
QwtSlider is a slider widget which operates on an interval
|
||
|
of type double. QwtSlider supports different layouts as
|
||
|
well as a scale.
|
||
|
|
||
|
\image html sliders.png
|
||
|
|
||
|
\sa QwtAbstractSlider and QwtAbstractScale for the descriptions
|
||
|
of the inherited members.
|
||
|
*/
|
||
|
|
||
|
class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractScale
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
Q_ENUMS( ScalePos )
|
||
|
Q_ENUMS( BGSTYLE )
|
||
|
Q_PROPERTY( ScalePos scalePosition READ scalePosition
|
||
14 years ago
|
WRITE setScalePosition )
|
||
15 years ago
|
Q_PROPERTY( BGSTYLE bgStyle READ bgStyle WRITE setBgStyle )
|
||
|
Q_PROPERTY( int thumbLength READ thumbLength WRITE setThumbLength )
|
||
|
Q_PROPERTY( int thumbWidth READ thumbWidth WRITE setThumbWidth )
|
||
|
Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
|
||
14 years ago
|
|
||
15 years ago
|
public:
|
||
|
|
||
14 years ago
|
/*!
|
||
15 years ago
|
Scale position. QwtSlider tries to enforce valid combinations of its
|
||
|
orientation and scale position:
|
||
|
- Qt::Horizonal combines with NoScale, TopScale and BottomScale
|
||
|
- Qt::Vertical combines with NoScale, LeftScale and RightScale
|
||
|
|
||
|
\sa QwtSlider::QwtSlider
|
||
|
*/
|
||
14 years ago
|
enum ScalePos {
|
||
|
NoScale,
|
||
|
|
||
|
LeftScale,
|
||
|
RightScale,
|
||
|
TopScale,
|
||
|
BottomScale
|
||
15 years ago
|
};
|
||
|
|
||
14 years ago
|
/*!
|
||
15 years ago
|
Background style.
|
||
|
\sa QwtSlider::QwtSlider
|
||
|
*/
|
||
14 years ago
|
enum BGSTYLE {
|
||
|
BgTrough = 0x1,
|
||
|
BgSlot = 0x2,
|
||
15 years ago
|
BgBoth = BgTrough | BgSlot
|
||
|
};
|
||
|
|
||
|
explicit QwtSlider(QWidget *parent,
|
||
14 years ago
|
Qt::Orientation = Qt::Horizontal,
|
||
|
ScalePos = NoScale, BGSTYLE bgStyle = BgTrough);
|
||
15 years ago
|
#if QT_VERSION < 0x040000
|
||
|
explicit QwtSlider(QWidget *parent, const char *name);
|
||
|
#endif
|
||
14 years ago
|
|
||
15 years ago
|
virtual ~QwtSlider();
|
||
|
|
||
14 years ago
|
virtual void setOrientation(Qt::Orientation);
|
||
15 years ago
|
|
||
|
void setBgStyle(BGSTYLE);
|
||
|
BGSTYLE bgStyle() const;
|
||
14 years ago
|
|
||
15 years ago
|
void setScalePosition(ScalePos s);
|
||
|
ScalePos scalePosition() const;
|
||
|
|
||
|
int thumbLength() const;
|
||
|
int thumbWidth() const;
|
||
|
int borderWidth() const;
|
||
|
|
||
|
void setThumbLength(int l);
|
||
|
void setThumbWidth(int w);
|
||
|
void setBorderWidth(int bw);
|
||
|
void setMargins(int x, int y);
|
||
|
|
||
|
virtual QSize sizeHint() const;
|
||
|
virtual QSize minimumSizeHint() const;
|
||
14 years ago
|
|
||
15 years ago
|
void setScaleDraw(QwtScaleDraw *);
|
||
|
const QwtScaleDraw *scaleDraw() const;
|
||
|
|
||
|
protected:
|
||
|
virtual double getValue(const QPoint &p);
|
||
14 years ago
|
virtual void getScrollMode(const QPoint &p,
|
||
|
int &scrollMode, int &direction);
|
||
15 years ago
|
|
||
|
void draw(QPainter *p, const QRect& update_rect);
|
||
|
virtual void drawSlider (QPainter *p, const QRect &r);
|
||
|
virtual void drawThumb(QPainter *p, const QRect &, int pos);
|
||
|
|
||
|
virtual void resizeEvent(QResizeEvent *e);
|
||
|
virtual void paintEvent (QPaintEvent *e);
|
||
|
|
||
|
virtual void valueChange();
|
||
|
virtual void rangeChange();
|
||
|
virtual void scaleChange();
|
||
|
virtual void fontChange(const QFont &oldFont);
|
||
|
|
||
|
void layoutSlider( bool update = true );
|
||
|
int xyPosition(double v) const;
|
||
|
|
||
|
QwtScaleDraw *scaleDraw();
|
||
|
|
||
|
private:
|
||
|
void initSlider(Qt::Orientation, ScalePos scalePos, BGSTYLE bgStyle);
|
||
|
|
||
|
class PrivateData;
|
||
|
PrivateData *d_data;
|
||
|
};
|
||
|
|
||
|
#endif
|