GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ctkRangeSlider.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.commontk.org/LICENSE
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkRangeSlider_h
22 #define __ctkRangeSlider_h
23 
24 // Qt includes
25 #include <QSlider>
26 
27 // CTK includes
28 #include <ctkPimpl.h>
29 
30 #include "ctkConfigure.h"
31 
32 class QStylePainter;
34 
49 class ctk_EXPORT ctkRangeSlider : public QSlider
50 {
51  Q_OBJECT
52  Q_PROPERTY(int minimumValue READ minimumValue WRITE setMinimumValue)
53  Q_PROPERTY(int maximumValue READ maximumValue WRITE setMaximumValue)
54  Q_PROPERTY(int minimumPosition READ minimumPosition WRITE setMinimumPosition)
55  Q_PROPERTY(int maximumPosition READ maximumPosition WRITE setMaximumPosition)
56  Q_PROPERTY(bool symmetricMoves READ symmetricMoves WRITE setSymmetricMoves)
57 
58 public:
59  // Superclass typedef
64  explicit ctkRangeSlider( Qt::Orientation o, QWidget* par= 0 );
65  explicit ctkRangeSlider( QWidget* par = 0 );
66  virtual ~ctkRangeSlider();
67 
73  int minimumValue() const;
74 
80  int maximumValue() const;
81 
85  int minimumPosition() const;
86  void setMinimumPosition(int min);
87 
91  int maximumPosition() const;
92  void setMaximumPosition(int max);
93 
97  void setPositions(int min, int max);
98 
102  bool symmetricMoves()const;
103  void setSymmetricMoves(bool symmetry);
104 
105 signals:
109  void minimumValueChanged(int min);
113  void maximumValueChanged(int max);
116  void valuesChanged(int min, int max);
117 
123  void minimumPositionChanged(int min);
124 
130  void maximumPositionChanged(int max);
131 
135  void positionsChanged(int min, int max);
136 
137 public slots:
144  void setMinimumValue(int min);
145 
152  void setMaximumValue(int max);
153 
161  void setValues(int min, int max);
162 
163 protected slots:
164  void onRangeChanged(int minimum, int maximum);
165 
166 protected:
167  ctkRangeSlider( ctkRangeSliderPrivate* impl, Qt::Orientation o, QWidget* par= 0 );
168  ctkRangeSlider( ctkRangeSliderPrivate* impl, QWidget* par = 0 );
169 
170  // Description:
171  // Standard Qt UI events
172  virtual void mousePressEvent(QMouseEvent* ev);
173  virtual void mouseMoveEvent(QMouseEvent* ev);
174  virtual void mouseReleaseEvent(QMouseEvent* ev);
175 
176  bool isMinimumSliderDown()const;
177  bool isMaximumSliderDown()const;
178 
179  // Description:
180  // Rendering is done here.
181  virtual void paintEvent(QPaintEvent* ev);
182  virtual void initMinimumSliderStyleOption(QStyleOptionSlider* option) const;
183  virtual void initMaximumSliderStyleOption(QStyleOptionSlider* option) const;
184 
185 protected:
187 
188 private:
189  Q_DECLARE_PRIVATE(ctkRangeSlider);
190  Q_DISABLE_COPY(ctkRangeSlider);
191 };
192 
193 #endif