add orBottomToTop, orRightToLeft, orLeftToRight(orHorizontal), orTopToBottom(OrVertic...
[vuplus_dvbapp] / lib / gui / eslider.cpp
index 7f3bb34..00aaeb7 100644 (file)
@@ -1,10 +1,16 @@
 #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)
 {
 }
 
+void eSlider::setPixmap(ePtr<gPixmap> &pixmap)
+{
+       setPixmap(pixmap.operator->());
+}
+
 void eSlider::setPixmap(gPixmap *pixmap)
 {
        m_pixmap = pixmap;
@@ -44,7 +50,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,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)
@@ -114,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;