Image Component Library (ICL)
FSliderHandle.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLQt/src/ICLQt/FSliderHandle.h **
10 ** Module : ICLQt **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLQt/GUIHandle.h>
36 
38 class QSlider;
39 class QLCDNumber;
42 namespace icl{
43  namespace qt{
44 
46  class ICLQt_API FSliderHandle : public GUIHandle<ThreadedUpdatableSlider>{
48  QLCDNumber *lcd;
49  public:
51  FSliderHandle();
52 
54  FSliderHandle(ThreadedUpdatableSlider *sl,float *minV, float *maxV, float *M, float *B,int range, GUIWidget *w, QLCDNumber *lcd=0);
55 
57 
58  inline QLCDNumber *getDisplay() { return lcd; }
59 
61  void setMin(float min);
62 
64  void setMax(float max);
65 
67  void setRange(float min, float max){ setMin(min); setMax(max); }
68 
70  void setValue(float val);
71 
73  void setAll(float min ,float max, float val){ setRange(min,max); setValue(val); }
74 
76  float getMin() const;
77 
79  float getMax() const;
80 
82  float getValue() const;
83 
85  void operator=(float val) { setValue(val); }
86 
88 
100  virtual void registerCallback(const GUI::Callback &cb, const std::string &events="value"){
101  (***this).registerCallback(cb,events);
102  }
103 
106 
108  virtual void removeCallbacks(){
110  (***this).removeCallbacks();
111  }
112 
113  private:
114 
116  void updateMB();
117 
119  float *m_fMin;
120 
122  float *m_fMax;
123 
125  int f2i(float f) const{
126  return (int)((f-*m_fB)/ *m_fM);
127  }
128 
130  float i2f(int i) const{
131  return *m_fM*i+*m_fB;
132  }
133 
135  float *m_fM;
136 
138  float *m_fB;
139 
142  };
143 
144  } // namespace qt
145 }
146 
float * m_fMin
current min value
Definition: FSliderHandle.h:119
undocument this line if you encounter any issues!
Definition: Any.h:37
float * m_fM
Slope for the internal slider equation.
Definition: FSliderHandle.h:135
void setAll(float min, float max, float val)
sets all parameters of a slider
Definition: FSliderHandle.h:73
virtual void removeCallbacks()
empties both callback locations (GUIHandleBase and ThreadedUpdatableSlider)
Definition: FSliderHandle.h:108
QLCDNumber * lcd
associated display
Definition: FSliderHandle.h:48
Handle class for slider componets.
Definition: FSliderHandle.h:46
int m_iSliderRange
accumulator of the current slider range
Definition: FSliderHandle.h:141
Abstract base class for Handle classes.
Definition: GUIHandle.h:40
virtual void removeCallbacks()
removes all callbacks from parent GUIWidget component
Definition: GUIHandleBase.h:93
int f2i(float f) const
utility function tranlating from valued to slider coordinates
Definition: FSliderHandle.h:125
void setRange(float min, float max)
set the range of the slider
Definition: FSliderHandle.h:67
virtual void registerCallback(const GUI::Callback &cb, const std::string &events="all")
registers a callback on this gui widget
Definition: GUIHandleBase.h:73
Abstract class for GUI components.
Definition: GUIWidget.h:52
QLCDNumber * getDisplay()
retuns the QLCDNumber that is used as display
Definition: FSliderHandle.h:58
void operator=(float val)
assigns a new value to the slider (equal to setValue)
Definition: FSliderHandle.h:85
#define ICLQt_API
Definition: CompatMacros.h:178
float * m_fMax
current max value
Definition: FSliderHandle.h:122
virtual void registerCallback(const GUI::Callback &cb, const std::string &events="value")
overloaded method for registering callbacks to specific slider events
Definition: FSliderHandle.h:100
float i2f(int i) const
utility function tranlating from slider to value coordinates
Definition: FSliderHandle.h:130
Compability class.
Definition: ThreadedUpdatableSlider.h:52
float * m_fB
Bias for the internal slider equation.
Definition: FSliderHandle.h:138