X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/a7c338df0271d2fb3506786bf769ab0317d11d5e..7373f39fe2ebe1b5007ed56ddd86d9ce0ad3efb7:/lib/gui/eslider.cpp diff --git a/lib/gui/eslider.cpp b/lib/gui/eslider.cpp index 7f3bb348..19097ad4 100644 --- a/lib/gui/eslider.cpp +++ b/lib/gui/eslider.cpp @@ -1,10 +1,15 @@ #include 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_orientation_swapped(0), m_border_width(0) { } +void eSlider::setPixmap(ePtr &pixmap) +{ + setPixmap(pixmap.operator->()); +} + void eSlider::setPixmap(gPixmap *pixmap) { m_pixmap = pixmap; @@ -44,7 +49,7 @@ int eSlider::event(int event, void *data, void *data2) if (!m_pixmap) painter.fill(m_currently_filled); else - painter.blit(m_pixmap, ePoint(0, 0), m_currently_filled.extends); + painter.blit(m_pixmap, ePoint(0, 0), m_currently_filled.extends, isTransparent() ? gPainter::BT_ALPHATEST : 0); // border if (m_have_border_color) @@ -65,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; @@ -108,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); }