ctkRangeSlider.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 __ctkRangeSlider_h
00022 #define __ctkRangeSlider_h
00023 
00024 // Qt includes
00025 #include <QSlider>
00026 
00027 // CTK includes
00028 #include <ctkPimpl.h>
00029 
00030 #include "CTKWidgetsExport.h"
00031 
00032 class QStylePainter;
00033 class ctkRangeSliderPrivate;
00034 
00043 class CTK_WIDGETS_EXPORT ctkRangeSlider : public QSlider
00044 {
00045   Q_OBJECT
00046   Q_PROPERTY(int minimumValue READ minimumValue WRITE setMinimumValue)
00047   Q_PROPERTY(int maximumValue READ maximumValue WRITE setMaximumValue)
00048   Q_PROPERTY(int minimumPosition READ minimumPosition WRITE setMinimumPosition)
00049   Q_PROPERTY(int maximumPosition READ maximumPosition WRITE setMaximumPosition)
00050 
00051 public:
00052   // Superclass typedef
00053   typedef QSlider Superclass;
00054   // Constructors
00055   explicit ctkRangeSlider( Qt::Orientation o, QWidget* par= 0 );
00056   explicit ctkRangeSlider( QWidget* par = 0 );
00057   virtual ~ctkRangeSlider();
00058 
00064   int minimumValue() const;
00065 
00071   int maximumValue() const;
00072 
00076   int minimumPosition() const;
00077   void setMinimumPosition(int min);
00078 
00082   int maximumPosition() const;
00083   void setMaximumPosition(int max);
00084 
00088   void setPositions(int min, int max);
00089 
00090 signals:
00094   void minimumValueChanged(int min);
00098   void maximumValueChanged(int max);
00101   void valuesChanged(int min, int max);
00102 
00108   void minimumPositionChanged(int min);
00109 
00115   void maximumPositionChanged(int max);
00116 
00120   void positionsChanged(int min, int max);
00121 
00122 public slots:
00128   void setMinimumValue(int min);
00129 
00135   void setMaximumValue(int max);
00136 
00139   void setValues(int min, int max);
00140 
00141 protected slots:
00142   void onRangeChanged(int minimum, int maximum);
00143 
00144 protected:
00145   // Description:
00146   // Standard Qt UI events
00147   virtual void mousePressEvent(QMouseEvent* ev);
00148   virtual void mouseMoveEvent(QMouseEvent* ev);
00149   virtual void mouseReleaseEvent(QMouseEvent* ev);
00150 
00151   // Description:
00152   // Rendering is done here.
00153   virtual void paintEvent(QPaintEvent* ev);
00154 
00155 private:
00156   CTK_DECLARE_PRIVATE(ctkRangeSlider);
00157 };
00158 
00159 #endif
00160 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines