diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2009-01-19 13:21:17 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2009-01-19 13:21:17 +0100 |
| commit | 2e02d72e10207215592e4aeda8b1c5cf18f7115a (patch) | |
| tree | 79e320c35c4d32ea61f812e7ee1210f0a1fbf4b1 /lib | |
| parent | 1076e4717bcf0eb93d803f73b2b75a8ae192b143 (diff) | |
| download | enigma2-2e02d72e10207215592e4aeda8b1c5cf18f7115a.tar.gz enigma2-2e02d72e10207215592e4aeda8b1c5cf18f7115a.zip | |
add orBottomToTop, orRightToLeft, orLeftToRight(orHorizontal), orTopToBottom(OrVertical) to eSlider
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gui/eslider.cpp | 21 | ||||
| -rw-r--r-- | lib/gui/eslider.h | 4 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/gui/eslider.cpp b/lib/gui/eslider.cpp index dd2aac9e..00aaeb74 100644 --- a/lib/gui/eslider.cpp +++ b/lib/gui/eslider.cpp @@ -1,7 +1,8 @@ #include <lib/gui/eslider.h> eSlider::eSlider(eWidget *parent) - :eWidget(parent), m_have_border_color(false), m_start(0), m_orientation(orHorizontal), m_border_width(0) + :eWidget(parent), m_have_border_color(false), m_start(0) + ,m_orientation(orHorizontal), m_direction(dirNormal), m_border_width(0) { } @@ -70,8 +71,16 @@ 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); + if (m_direction == dirSwapped) + { + start_pix = pixsize * (m_start + (m_max - m_min) - m_value) / (m_max - m_min); + num_pix = pixsize * (m_start + (m_max - m_min)) / (m_max - m_min); + } + else // dirNormal + { + num_pix = pixsize * (m_value - m_start) / (m_max - m_min); + start_pix = pixsize * m_start / (m_max - m_min); + } } if (start_pix < 0) @@ -119,6 +128,12 @@ void eSlider::setOrientation(int orientation) event(evtChangedSlider); } +void eSlider::setDirection(int direction) +{ + m_direction = direction; + event(evtChangedSlider); +} + void eSlider::setRange(int min, int max) { m_min = min; diff --git a/lib/gui/eslider.h b/lib/gui/eslider.h index c5440726..47941eda 100644 --- a/lib/gui/eslider.h +++ b/lib/gui/eslider.h @@ -11,9 +11,11 @@ public: void setStartEnd(int start, int end); void setRange(int min, int max); enum { orHorizontal, orVertical }; + enum { dirNormal, dirSwapped }; void setOrientation(int orientation); void setBorderWidth(int pixel); void setBorderColor(const gRGB &color); + void setDirection(int direction); void setPixmap(gPixmap *pixmap); void setPixmap(ePtr<gPixmap> &pixmap); protected: @@ -24,7 +26,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_direction, m_border_width; ePtr<gPixmap> m_pixmap; gRegion m_currently_filled; |
