ctkDoubleRangeSlider.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 #ifndef __ctkDoubleRangeSlider_h
00022 #define __ctkDoubleRangeSlider_h
00023 
00024 // Qt includes
00025 #include <QWidget>
00026 #include <QAbstractSlider>
00027 
00028 // CTK includes
00029 #include <ctkPimpl.h>
00030 #include "CTKWidgetsExport.h"
00031 
00032 class ctkDoubleRangeSliderPrivate;
00033 class CTK_WIDGETS_EXPORT ctkDoubleRangeSlider : public QWidget
00034 {
00035   Q_OBJECT      
00036   Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
00037   Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
00038   Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
00039   Q_PROPERTY(double minimumValue READ minimumValue WRITE setMinimumValue)
00040   Q_PROPERTY(double maximumValue READ maximumValue WRITE setMaximumValue)
00041   Q_PROPERTY(double minimumPosition READ minimumPosition WRITE setMinimumPosition)
00042   Q_PROPERTY(double maximumPosition READ maximumPosition WRITE setMaximumPosition)
00043   Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
00044   Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
00045   Q_PROPERTY(double tickInterval READ tickInterval WRITE setTickInterval)
00046 public:
00047   // Superclass typedef
00048   typedef QWidget Superclass;
00049   
00050   // Constructors
00051   ctkDoubleRangeSlider( Qt::Orientation o, QWidget* par= 0 );
00052   ctkDoubleRangeSlider( QWidget* par = 0 );
00053   
00058   void setSingleStep(double ss);
00059   double singleStep()const;
00060   
00066   void setTickInterval(double ti);
00067   double tickInterval()const;
00068   
00074   double minimum()const;
00075   void setMinimum(double min);
00076 
00082   double maximum()const;
00083   void setMaximum(double max);
00084 
00088   void setRange(double min, double max);
00089 
00095   double minimumValue() const;
00096 
00102   double maximumValue() const;
00103   
00107   double minimumPosition() const;
00108   void setMinimumPosition(double minPos);
00109 
00113   double maximumPosition() const;
00114   void setMaximumPosition(double maxPos);
00115 
00119   void setPositions(double minPos, double maxPos);
00120 
00128   void setTracking(bool enable);
00129   bool hasTracking()const;
00130   
00135   void triggerAction(QAbstractSlider::SliderAction action);
00136 
00140   Qt::Orientation orientation()const;
00141   void setOrientation(Qt::Orientation orientation);
00142 signals:
00146   void minimumValueChanged(double minVal);
00147 
00151   void maximumValueChanged(double maxVal);
00152 
00155   void valuesChanged(double minVal, double maxVal);
00156 
00162   void minimumPositionChanged(double minPos);
00163 
00169   void maximumPositionChanged(double maxPos);
00170   
00174   void positionsChanged(double minPos, double maxPos);
00175 
00179   void sliderPressed();
00180 
00184   void sliderReleased();
00185 
00186     
00187 public slots:
00193   void setMinimumValue(double minVal);
00194 
00200   void setMaximumValue(double maxVal);
00201   
00204   void setValues(double minVal, double maxVal);
00205 
00206 protected slots:
00207   void onMinValueChanged(int value);
00208   void onMaxValueChanged(int value);
00209   void onValuesChanged(int min, int max);
00210 
00211   void onMinPosChanged(int value);
00212   void onMaxPosChanged(int value);
00213   void onPositionsChanged(int min, int max);
00214 private:
00215   CTK_DECLARE_PRIVATE(ctkDoubleRangeSlider);
00216 };
00217 
00218 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines