Add actionslider widget object
authorJoe Konno <joe.konno@intel.com>
Tue, 19 Jun 2012 17:37:36 +0000 (10:37 -0700)
committerJoe Konno <joe.konno@intel.com>
Tue, 19 Jun 2012 17:52:41 +0000 (10:52 -0700)
Signed-off-by: Joe Konno <joe.konno@intel.com>
src/efl/Makefile.am
src/efl/actionslider.cpp [new file with mode: 0644]
src/efl/actionslider.h [new file with mode: 0644]

index e3659d3..33de4af 100644 (file)
@@ -20,6 +20,7 @@ bin_PROGRAMS = $(TESTS)
 
 wayland_efl_test_SOURCES =     \
        evasobject.cpp          \
+       actionslider.cpp        \
        window.cpp              \
        application.cpp         \
        elmtestharness.cpp      \
diff --git a/src/efl/actionslider.cpp b/src/efl/actionslider.cpp
new file mode 100644 (file)
index 0000000..e1f7d25
--- /dev/null
@@ -0,0 +1,42 @@
+#include "actionslider.h"
+
+Actionslider::Actionslider(Evas_Object *parent, const std::string& left, const bool leftOn, const std::string& center, const bool centerOn, const std::string& right, const bool rightOn)
+       : EvasObject::EvasObject(
+               elm_actionslider_add(parent)
+       )
+       , parent(parent)
+{
+       elm_object_part_text_set(*this, "left", left.c_str());
+       elm_object_part_text_set(*this, "center", center.c_str());
+       elm_object_part_text_set(*this, "right", right.c_str());
+
+       unsigned int posEnabled = ELM_ACTIONSLIDER_NONE;
+       if (leftOn)
+       {
+               posEnabled |= ELM_ACTIONSLIDER_LEFT;
+       }
+       if (centerOn)
+       {
+               posEnabled |= ELM_ACTIONSLIDER_CENTER;
+       }
+       if (rightOn)
+       {
+               posEnabled |= ELM_ACTIONSLIDER_RIGHT;
+       }
+       elm_actionslider_enabled_pos_set(*this, static_cast<Elm_Actionslider_Pos>(posEnabled));
+}
+
+void Actionslider::setPos(Elm_Actionslider_Pos pos)
+{
+       elm_actionslider_indicator_pos_set(*this, pos);
+}
+
+Elm_Actionslider_Pos Actionslider::getPos()
+{
+       return elm_actionslider_indicator_pos_get(*this);
+}
+
+Actionslider::operator Evas_Object*()
+{
+       return EvasObject::obj_;
+}
diff --git a/src/efl/actionslider.h b/src/efl/actionslider.h
new file mode 100644 (file)
index 0000000..2d40bb8
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef __WAYLAND_EFL_ACTIONSLIDER_H__
+#define __WAYLAND_EFL_ACTIONSLIDER_H__
+
+#include <string>
+#include <Elementary.h>
+
+#include "evasobject.h"
+
+class Actionslider : public EvasObject
+{
+public:
+       Actionslider(Evas_Object *, const std::string& = "Left", const bool = true, const std::string& = "Center", const bool = true, const std::string& = "Right", const bool = true);
+
+       void setPos(Elm_Actionslider_Pos pos);
+
+       Elm_Actionslider_Pos getPos();
+
+       operator Evas_Object*();
+
+private:
+       Evas_Object *parent;
+};
+
+#endif
+