diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-01-19 12:55:27 +0100 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-01-19 13:41:59 +0100 |
| commit | 4621e2ba14ebc9c955e3bf669a5c8799f65f46e1 (patch) | |
| tree | ada4a21b4a90650cd210c2d9a479cfd7cf706437 /lib/gui | |
| parent | 1076e4717bcf0eb93d803f73b2b75a8ae192b143 (diff) | |
| download | enigma2-4621e2ba14ebc9c955e3bf669a5c8799f65f46e1.tar.gz enigma2-4621e2ba14ebc9c955e3bf669a5c8799f65f46e1.zip | |
make slider orientation configurable into 4 directions
Diffstat (limited to 'lib/gui')
| -rw-r--r-- | lib/gui/eslider.cpp | 13 | ||||
| -rw-r--r-- | lib/gui/eslider.h | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/gui/eslider.cpp b/lib/gui/eslider.cpp index dd2aac9e..c8b467c9 100644 --- a/lib/gui/eslider.cpp +++ b/lib/gui/eslider.cpp @@ -70,10 +70,14 @@ int eSlider::event(int event, void *data, void *data2) if (m_min < m_max) { - num_pix = pixsize * (m_value - m_start) / (m_max - m_min); - start_pix = pixsize * m_start / (m_max - m_min); + int val_range = m_max - m_min; + num_pix = (pixsize * (m_value - m_start) + val_range - 1) / val_range; /* properly round up */ + start_pix = (pixsize * m_start + val_range - 1) / val_range; + + if (m_orientation_swapped) + start_pix = pixsize - num_pix - start_pix; } - + if (start_pix < 0) { num_pix += start_pix; @@ -113,9 +117,10 @@ void eSlider::setStartEnd(int start, int end) event(evtChangedSlider); } -void eSlider::setOrientation(int orientation) +void eSlider::setOrientation(int orientation, int swapped) { m_orientation = orientation; + m_orientation_swapped = swapped; event(evtChangedSlider); } diff --git a/lib/gui/eslider.h b/lib/gui/eslider.h index c5440726..9a3e8395 100644 --- a/lib/gui/eslider.h +++ b/lib/gui/eslider.h @@ -11,7 +11,7 @@ public: void setStartEnd(int start, int end); void setRange(int min, int max); enum { orHorizontal, orVertical }; - void setOrientation(int orientation); + void setOrientation(int orientation, int swapped = 0); void setBorderWidth(int pixel); void setBorderColor(const gRGB &color); void setPixmap(gPixmap *pixmap); @@ -24,7 +24,7 @@ private: evtChangedSlider = evtUserWidget }; bool m_have_border_color; - int m_min, m_max, m_value, m_start, m_orientation, m_border_width; + int m_min, m_max, m_value, m_start, m_orientation, m_orientation_swapped, m_border_width; ePtr<gPixmap> m_pixmap; gRegion m_currently_filled; |
