class library: PriorityQueue - implement removeValue, hide array
[supercollider.git] / QtCollider / widgets / QcSlider2D.h
bloba6fd1b3de9af31d9a64c836a72d77fe9f9e95ab0
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_SLIDER_2D
23 #define QC_SLIDER_2D
25 #include "QcAbstractStepValue.h"
26 #include "../QcHelper.h"
28 #include <QWidget>
30 class QcSlider2D : public QWidget, public QcHelper, public QcAbstractStepValue
32 Q_OBJECT
33 Q_PROPERTY( float xValue READ xValue WRITE setXValue )
34 Q_PROPERTY( float yValue READ yValue WRITE setYValue )
35 Q_PROPERTY( float shiftScale READ dummyFloat WRITE setShiftScale );
36 Q_PROPERTY( float ctrlScale READ dummyFloat WRITE setCtrlScale );
37 Q_PROPERTY( float altScale READ dummyFloat WRITE setAltScale );
38 Q_PROPERTY( float step READ dummyFloat WRITE setStep )
40 public:
41 QcSlider2D();
42 float xValue() const { return _x; }
43 float yValue() const { return _y; }
44 void setXValue( float x ) { setValue( QPointF( x, _y ), false ); }
45 void setYValue( float y ) { setValue( QPointF( _x, y ), false ); }
46 void setStep( float f ) { _step = f;}
47 QSize sizeHint() const { return QSize(150,150); }
48 QSize minimumSizeHint() const { return QSize(30,30); }
49 public Q_SLOTS:
50 void incrementX( double factor = 1.f );
51 void decrementX( double factor = 1.f );
52 void incrementY( double factor = 1.f );
53 void decrementY( double factor = 1.f );
54 Q_SIGNALS:
55 void action();
56 void randomize();
57 private:
58 QRect thumbRect();
59 QPointF valueFromPos( const QPoint pos );
60 void setValue( const QPointF val, bool doAction = true );
61 void mouseMoveEvent ( QMouseEvent * );
62 void mousePressEvent ( QMouseEvent * );
63 void keyPressEvent ( QKeyEvent * );
64 void paintEvent ( QPaintEvent * );
66 float _x;
67 float _y;
68 QSize _thumbSize;
69 float _step;
72 #endif