add orBottomToTop, orRightToLeft, orLeftToRight(orHorizontal), orTopToBottom(OrVertic...
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 19 Jan 2009 12:21:17 +0000 (13:21 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 19 Jan 2009 12:21:17 +0000 (13:21 +0100)
lib/gui/eslider.cpp
lib/gui/eslider.h
skin.py

index dd2aac9..00aaeb7 100644 (file)
@@ -1,7 +1,8 @@
 #include <lib/gui/eslider.h>
 
 eSlider::eSlider(eWidget *parent)
 #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)
                {
 
                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)
                }
                
                if  (start_pix < 0)
@@ -119,6 +128,12 @@ void eSlider::setOrientation(int orientation)
        event(evtChangedSlider);
 }
 
        event(evtChangedSlider);
 }
 
+void eSlider::setDirection(int direction)
+{
+       m_direction = direction;
+       event(evtChangedSlider);
+}
+
 void eSlider::setRange(int min, int max)
 {
        m_min = min;
 void eSlider::setRange(int min, int max)
 {
        m_min = min;
index c544072..47941ed 100644 (file)
@@ -11,9 +11,11 @@ public:
        void setStartEnd(int start, int end);
        void setRange(int min, int max);
        enum { orHorizontal, orVertical };
        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 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:
        void setPixmap(gPixmap *pixmap);
        void setPixmap(ePtr<gPixmap> &pixmap);
 protected:
@@ -24,7 +26,7 @@ private:
                evtChangedSlider = evtUserWidget
        };
        bool m_have_border_color;
                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;
        ePtr<gPixmap> m_pixmap;
        
        gRegion m_currently_filled;
diff --git a/skin.py b/skin.py
index 9795471..0c5f336 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -144,13 +144,23 @@ def applySingleAttribute(guiObject, desktop, attrib, value, scale = ((1,1),(1,1)
                                  "blend": 2,
                                }[value])
                elif attrib == "orientation": # used by eSlider
                                  "blend": 2,
                                }[value])
                elif attrib == "orientation": # used by eSlider
-                       try:
-                               guiObject.setOrientation(
-                                       { "orVertical": guiObject.orVertical,
-                                               "orHorizontal": guiObject.orHorizontal
-                                       }[value])
-                       except KeyError:
-                               print "oprientation must be either orVertical or orHorizontal!"
+                       if value in ("orHorizontal", "orLeftToRight"):
+                               orientation = guiObject.orHorizontal
+                               direction = guiObject.dirNormal
+                       elif value in ("orVertical", "orTopToBottom"):
+                               orientation = guiObject.orVertical
+                               direction = guiObject.dirNormal
+                       elif value == "orRightToLeft":
+                               orientation = guiObject.orHorizontal
+                               direction = guiObject.dirSwapped
+                       elif value == "orBottomToTop":
+                               orientation = guiObject.orVertical
+                               direction = guiObject.dirSwapped
+                       else:
+                               print "orientation must be one of: orTopToBottom,orBottomToTop,orLeftToRight,orRightToLeft"
+                               return
+                       guiObject.setOrientation(orientation)
+                       guiObject.setDirection(direction)
                elif attrib == "valign":
                        try:
                                guiObject.setVAlign(
                elif attrib == "valign":
                        try:
                                guiObject.setVAlign(