fix String:wrapExtend to fill out to the actual requested size
[supercollider.git] / QtCollider / widgets / QcRangeSlider.h
blob8d1f369907ff86441dfe7ede5934cb499064f0f6
1 /************************************************************************
3 * Copyright 2010 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
22 #ifndef QC_RANGE_SLIDER
23 #define QC_RANGE_SLIDER
25 #include "QcAbstractStepValue.h"
26 #include "../QcHelper.h"
27 #include "../style/style.hpp"
29 #include <QWidget>
31 class QcRangeSlider :
32 public QWidget, QcHelper, QcAbstractStepValue, QtCollider::Style::Client
34 Q_OBJECT
35 Q_PROPERTY( Qt::Orientation orientation
36 READ orientation WRITE setOrientation );
37 Q_PROPERTY( float loValue READ loValue WRITE setLoValue )
38 Q_PROPERTY( float hiValue READ hiValue WRITE setHiValue )
39 Q_PROPERTY( float shiftScale READ dummyFloat WRITE setShiftScale );
40 Q_PROPERTY( float ctrlScale READ dummyFloat WRITE setCtrlScale );
41 Q_PROPERTY( float altScale READ dummyFloat WRITE setAltScale );
42 Q_PROPERTY( float step READ dummyFloat WRITE setStep )
43 Q_PROPERTY( QColor grooveColor READ grooveColor WRITE setGrooveColor );
44 Q_PROPERTY( QColor focusColor READ focusColor WRITE setFocusColor );
46 public:
47 enum MouseMode {
48 None = 0,
49 Move,
50 MoveHi,
51 MoveLo,
52 SetLo,
53 SetHi
56 QcRangeSlider();
57 Qt::Orientation orientation() const { return _ort; }
58 void setOrientation( Qt::Orientation o );
59 float loValue() const { return _lo; }
60 void setLoValue( float );
61 float hiValue() const { return _hi; }
62 void setHiValue( float );
63 void setRange( double val, double range );
64 void setStep( float f ) { _step = f; }
65 QSize sizeHint() const;
66 QSize minimumSizeHint() const;
68 public Q_SLOTS:
69 void increment( double factor );
70 void decrement( double factor );
72 Q_SIGNALS:
73 void action();
75 private:
76 QRect thumbRect();
77 QRect valueRect();
78 double valueFromPos( const QPoint& pos );
79 void moveBy( float );
80 void increment();
81 void decrement();
82 void mouseMoveEvent ( QMouseEvent * );
83 void mousePressEvent ( QMouseEvent * );
84 void mouseReleaseEvent ( QMouseEvent * );
85 void keyPressEvent ( QKeyEvent * );
86 void paintEvent ( QPaintEvent * );
88 Qt::Orientation _ort;
89 float _lo;
90 float _hi;
91 float _step;
92 QPoint dragOrigin;
93 double dragVal, dragRange;
94 MouseMode mouseMode;
97 #endif