elementary merging.
[framework/uifw/elementary.git] / src / lib / elm_colorselector.c
index bd58cc4..8c585d4 100644 (file)
@@ -1,26 +1,12 @@
 #include <Elementary.h>
 #include "elm_priv.h"
 
-/**
- * @addtogroup Colorselector Colorselector
- *
- * By using colorselector, you can select a color.
- * Colorselector made a color using HSV/HSB mode.
- */
-
 #define BASE_STEP 360.0
 #define HUE_STEP 360.0
 #define SAT_STEP 128.0
 #define LIG_STEP 256.0
 #define ALP_STEP 256.0
 
-typedef enum _Button_State
-{
-   BUTTON_RELEASED,
-   L_BUTTON_PRESSED,
-   R_BUTTON_PRESSED
-} Button_State;
-
 typedef enum _Color_Type
 {
    HUE,
@@ -41,7 +27,6 @@ struct _Colorselector_Data
    Evas_Object *arrow;
    Evas_Object *touch_area;
    Color_Type color_type;
-   Button_State button_state;
 };
 
 typedef struct _Widget_Data Widget_Data;
@@ -55,8 +40,6 @@ struct _Widget_Data
    int sr, sg, sb;
    int lr, lg, lb;
    double h, s, l;
-   Ecore_Timer *lp_timer;
-   Ecore_Timer *mv_timer;
 };
 
 static const char *widtype = NULL;
@@ -69,23 +52,27 @@ static void _hsl_to_rgb(void *data);
 static void _color_with_saturation(void *data);
 static void _color_with_lightness(void *data);
 static void _draw_rects(void *data, double x);
-static void _arrow_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void _colorbar_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static Eina_Bool _mv_timer(void *data);
-static Eina_Bool _long_press_timer(void *data);
-static void _left_button_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _right_button_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _left_button_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _right_button_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _arrow_cb(void *data, Evas_Object *obj, const char *emission,
+                      const char *source);
+static void _colorbar_cb(void *data, Evas *e, Evas_Object *obj,
+                         void *event_info);
+static void _left_button_clicked_cb(void *data, Evas_Object * obj,
+                                    void *event_info);
+static void _left_button_repeat_cb(void *data, Evas_Object * obj,
+                                   void *event_info);
+static void _right_button_clicked_cb(void *data, Evas_Object * obj,
+                                     void *event_info);
+static void _right_button_repeat_cb(void *data, Evas_Object * obj,
+                                    void *event_info);
 static void _add_colorbar(Evas_Object *obj);
 static void _set_color(Evas_Object *obj, int r, int g, int b, int a);
 
-#define SIG_CHANGED "changed"
+static const char SIG_CHANGED[] = "changed";
 
 static const Evas_Smart_Cb_Description _signals[] =
 {
-   {SIG_CHANGED, ""},
-   {NULL, NULL}
+     {SIG_CHANGED, ""},
+     {NULL, NULL}
 };
 
 static void
@@ -95,8 +82,6 @@ _del_hook(Evas_Object *obj)
    int i = 0;
 
    if (!wd) return;
-   if (wd->lp_timer) ecore_timer_del(wd->lp_timer);
-   if (wd->mv_timer) ecore_timer_del(wd->mv_timer);
    for (i = 0; i < 4; i++) free(wd->cp[i]);
    free(wd);
 }
@@ -134,6 +119,7 @@ _theme_hook(Evas_Object *obj)
      }
 
    _add_colorbar(obj);
+   elm_colorselector_color_set(obj, wd->r, wd->g, wd->b, wd->a);
    _sizing_eval(obj);
 }
 
@@ -258,35 +244,35 @@ _hsl_to_rgb(void *data)
         switch (i)
           {
            case 0:
-             r = v;
-             g = t;
-             b = p;
-             break;
-          case 1:
-             r = q;
-             g = v;
-             b = p;
-             break;
-          case 2:
-             r = p;
-             g = v;
-             b = t;
-             break;
-          case 3:
-             r = p;
-             g = q;
-             b = v;
-             break;
-          case 4:
-             r = t;
-             g = p;
-             b = v;
-             break;
-          case 5:
-             r = v;
-             g = p;
-             b = q;
-             break;
+              r = v;
+              g = t;
+              b = p;
+              break;
+           case 1:
+              r = q;
+              g = v;
+              b = p;
+              break;
+           case 2:
+              r = p;
+              g = v;
+              b = t;
+              break;
+           case 3:
+              r = p;
+              g = q;
+              b = v;
+              break;
+           case 4:
+              r = t;
+              g = p;
+              b = v;
+              break;
+           case 5:
+              r = v;
+              g = p;
+              b = q;
+              break;
           }
      }
    i = (int)(r * 255.0);
@@ -357,85 +343,90 @@ _draw_rects(void *data, double x)
 
    switch (cp->color_type)
      {
-     case HUE:
-        wd->h = 360.0 * x;
-
-        if (x < one_six)
-          {
-             wd->er = 255;
-             wd->eg = (255.0 * x * 6.0);
-             wd->eb = 0;
-          }
-        else if (x < 2 * one_six)
-          {
-             wd->er = 255 - (int)(255.0 * (x - one_six) * 6.0);
-             wd->eg = 255;
-             wd->eb = 0;
-          }
-        else if (x < 3 * one_six)
-          {
-             wd->er = 0;
-             wd->eg = 255;
-             wd->eb = (int)(255.0 * (x - (2.0 * one_six)) * 6.0);
-          }
-        else if (x < 4 * one_six)
-          {
-             wd->er = 0;
-             wd->eg = 255 - (int)(255.0 * (x - (3.0 * one_six)) * 6.0);
-             wd->eb = 255;
-          }
-        else if (x < 5 * one_six)
-          {
-             wd->er = 255.0 * (x - (4.0 * one_six)) * 6.0;
-             wd->eg = 0;
-             wd->eb = 255;
-          }
-        else
-          {
-             wd->er = 255;
-             wd->eg = 0;
-             wd->eb = 255 - (int)(255.0 * (x - (5.0 * one_six)) * 6.0);
-          }
-
-        evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255);
-        evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255);
-        evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255);
-        evas_object_color_set(wd->cp[3]->bar, wd->er, wd->eg, wd->eb, 255);
-
-        _color_with_saturation(wd);
-        evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
-
-        _color_with_lightness(wd);
-        evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
-
-        evas_object_color_set(wd->cp[3]->arrow,
-                              (wd->er * wd->a) / 255,
-                              (wd->eg * wd->a) / 255,
-                              (wd->eb * wd->a) / 255,
-                              wd->a);
-        break;
-     case SATURATION:
-        wd->s = 1.0 - x;
-        _color_with_saturation(wd);
-        evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
-        break;
-     case LIGHTNESS:
-        wd->l = x;
-        _color_with_lightness(wd);
-        evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
-        break;
-     case ALPHA:
-        wd->a = 255.0 * x;
-        evas_object_color_set(wd->cp[3]->arrow, wd->er, wd->eg, wd->eb, wd->a);
-        break;
-     default:
-        break;
+      case HUE:
+         wd->h = 360.0 * x;
+
+         if (x < one_six)
+           {
+              wd->er = 255;
+              wd->eg = (255.0 * x * 6.0);
+              wd->eb = 0;
+           }
+         else if (x < 2 * one_six)
+           {
+              wd->er = 255 - (int)(255.0 * (x - one_six) * 6.0);
+              wd->eg = 255;
+              wd->eb = 0;
+           }
+         else if (x < 3 * one_six)
+           {
+              wd->er = 0;
+              wd->eg = 255;
+              wd->eb = (int)(255.0 * (x - (2.0 * one_six)) * 6.0);
+           }
+         else if (x < 4 * one_six)
+           {
+              wd->er = 0;
+              wd->eg = 255 - (int)(255.0 * (x - (3.0 * one_six)) * 6.0);
+              wd->eb = 255;
+           }
+         else if (x < 5 * one_six)
+           {
+              wd->er = 255.0 * (x - (4.0 * one_six)) * 6.0;
+              wd->eg = 0;
+              wd->eb = 255;
+           }
+         else
+           {
+              wd->er = 255;
+              wd->eg = 0;
+              wd->eb = 255 - (int)(255.0 * (x - (5.0 * one_six)) * 6.0);
+           }
+
+         evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255);
+         evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255);
+         evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255);
+         evas_object_color_set(wd->cp[3]->bar, wd->er, wd->eg, wd->eb, 255);
+
+         _color_with_saturation(wd);
+         evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
+
+         _color_with_lightness(wd);
+         evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
+
+         evas_object_color_set(wd->cp[3]->arrow,
+                               (wd->er * wd->a) / 255,
+                               (wd->eg * wd->a) / 255,
+                               (wd->eb * wd->a) / 255,
+                               wd->a);
+         break;
+      case SATURATION:
+         wd->s = 1.0 - x;
+         _color_with_saturation(wd);
+         evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
+         break;
+      case LIGHTNESS:
+         wd->l = x;
+         _color_with_lightness(wd);
+         evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
+         break;
+      case ALPHA:
+         wd->a = 255.0 * x;
+         evas_object_color_set(wd->cp[3]->arrow,
+                               (wd->er * wd->a) / 255,
+                               (wd->eg * wd->a) / 255,
+                               (wd->eb * wd->a) / 255,
+                               wd->a);
+         break;
+      default:
+         break;
      }
    _hsl_to_rgb(wd);
 }
 
 static void
-_arrow_cb(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
+_arrow_cb(void *data, Evas_Object *obj, const char *emission __UNUSED__,
+          const char *source __UNUSED__)
 {
    Colorselector_Data *cp = data;
    double x, y;
@@ -456,7 +447,7 @@ _colorbar_cb(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
    evas_object_geometry_get(cp->bar, &x, &y, &w, &h);
    edje_object_part_drag_value_get(cp->colorbar, "elm.arrow",
                                    &arrow_x, &arrow_y);
-   if (w > 0) arrow_x = (double)(ev->output.x - x) / (double)w;
+   if (w > 0) arrow_x = (double)(ev->canvas.x - x) / (double)w;
    if (arrow_x > 1) arrow_x = 1;
    if (arrow_x < 0) arrow_x = 0;
    edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", arrow_x, arrow_y);
@@ -466,56 +457,11 @@ _colorbar_cb(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
    evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, 0, NULL);
 }
 
-static Eina_Bool
-_mv_timer(void *data)
-{
-   Colorselector_Data *cp = data;
-   Widget_Data *wd = elm_widget_data_get(cp->parent);
-   double x, y;
-
-   if (!wd) return EINA_FALSE;
-
-   edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y);
-   if (cp->button_state == L_BUTTON_PRESSED)
-     {
-        x -= 1.0 / BASE_STEP;
-        if (x < 0.0) x = 0.0;
-        edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y);
-        _draw_rects(data, x);
-        evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL);
-        return EINA_TRUE;
-     }
-   else if (cp->button_state == R_BUTTON_PRESSED)
-     {
-        x += 1.0 / BASE_STEP;
-        if (x > 1.0) x = 1.0;
-        edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y);
-        _draw_rects(data, x);
-        evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL);
-        return EINA_TRUE;
-     }
-   wd->mv_timer = NULL;
-   return EINA_FALSE;
-}
-
-static Eina_Bool
-_long_press_timer(void *data)
-{
-   Colorselector_Data *cp = data;
-   Widget_Data *wd = elm_widget_data_get(cp->parent);
-
-   if (wd->mv_timer) ecore_timer_del(wd->mv_timer);
-   wd->mv_timer = ecore_timer_add(0.01, _mv_timer, cp);
-
-   wd->lp_timer = NULL;
-   return EINA_FALSE;
-}
-
 static void
-_left_button_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+_left_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__,
+                        void *event_info __UNUSED__)
 {
    Colorselector_Data *cp = data;
-   Widget_Data *wd = elm_widget_data_get(cp->parent);
    double x, y;
 
    edje_object_signal_emit(cp->lbt, "elm,state,left,button,down",
@@ -545,16 +491,29 @@ _left_button_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
    edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y);
    _draw_rects(data, x);
    evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL);
-   cp->button_state = L_BUTTON_PRESSED;
-   if (wd->lp_timer) ecore_timer_del(wd->lp_timer);
-   wd->lp_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press_timer, cp);
 }
 
 static void
-_right_button_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+_left_button_repeat_cb(void *data, Evas_Object * obj __UNUSED__,
+                       void *event_info __UNUSED__)
+{
+   Colorselector_Data *cp = data;
+   double x, y;
+
+   edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y);
+   x -= 1.0 / BASE_STEP;
+   if (x < 0.0) x = 0.0;
+   edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y);
+   _draw_rects(data, x);
+   evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL);
+
+}
+
+static void
+_right_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__,
+                         void *event_info __UNUSED__)
 {
    Colorselector_Data *cp = data;
-   Widget_Data *wd = elm_widget_data_get(cp->parent);
    double x, y;
 
    edje_object_signal_emit(cp->rbt, "elm,state,right,button,down",
@@ -584,51 +543,21 @@ _right_button_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
    edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y);
    _draw_rects(data, x);
    evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL);
-   cp->button_state = R_BUTTON_PRESSED;
-   wd->lp_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press_timer, cp);
-}
-
-static void
-_left_button_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
-   Colorselector_Data *cp = data;
-   Widget_Data *wd = elm_widget_data_get(cp->parent);
-
-   if (wd->lp_timer)
-     {
-        ecore_timer_del(wd->lp_timer);
-        wd->lp_timer = NULL;
-     }
-   if (wd->mv_timer)
-     {
-        ecore_timer_del(wd->mv_timer);
-        wd->mv_timer = NULL;
-     }
-
-   cp->button_state = BUTTON_RELEASED;
-   edje_object_signal_emit(cp->lbt, "elm,state,left,button,up", "left_button");
 }
 
 static void
-_right_button_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+_right_button_repeat_cb(void *data, Evas_Object * obj __UNUSED__,
+                        void *event_info __UNUSED__)
 {
    Colorselector_Data *cp = data;
-   Widget_Data *wd = elm_widget_data_get(cp->parent);
-
-   if (wd->lp_timer)
-     {
-        ecore_timer_del(wd->lp_timer);
-        wd->lp_timer = NULL;
-     }
-   if (wd->mv_timer)
-     {
-        ecore_timer_del(wd->mv_timer);
-        wd->mv_timer = NULL;
-     }
+   double x, y;
 
-   cp->button_state = BUTTON_RELEASED;
-   edje_object_signal_emit(cp->rbt, "elm,state,right,button,up",
-                           "right_button");
+   edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y);
+   x += 1.0 / BASE_STEP;
+   if (x > 1.0) x = 1.0;
+   edje_object_part_drag_value_set(cp->colorbar, "elm.arrow", x, y);
+   _draw_rects(data, x);
+   evas_object_smart_callback_call(cp->parent, SIG_CHANGED, NULL);
 }
 
 static void
@@ -639,6 +568,7 @@ _add_colorbar(Evas_Object *obj)
    Widget_Data *wd;
    Evas *e;
    int i = 0;
+   char buf[1024];
 
    wd = elm_widget_data_get(obj);
    if (!wd) return;
@@ -669,7 +599,7 @@ _add_colorbar(Evas_Object *obj)
         /* load colorbar area */
         wd->cp[i]->colorbar = edje_object_add(e);
         _elm_theme_object_set(obj, wd->cp[i]->colorbar, "colorselector", "base",
-                              "default");
+                              elm_widget_style_get(obj));
         snprintf(colorbar_name, sizeof(colorbar_name), "colorbar_%d", i);
         snprintf(colorbar_s, sizeof(colorbar_s), "elm.colorbar_%d", i);
         edje_object_signal_callback_add(wd->cp[i]->colorbar, "drag", "*",
@@ -679,8 +609,10 @@ _add_colorbar(Evas_Object *obj)
 
         /* load colorbar image */
         wd->cp[i]->bar = edje_object_add(e);
+        snprintf(buf, sizeof(buf), "%s/%s", colorbar_name,
+                 elm_widget_style_get(obj));
         _elm_theme_object_set(obj, wd->cp[i]->bar, "colorselector", "image",
-                              colorbar_name);
+                              buf);
         edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar",
                                  wd->cp[i]->bar);
         elm_widget_sub_object_add(obj, wd->cp[i]->bar);
@@ -710,8 +642,10 @@ _add_colorbar(Evas_Object *obj)
         if (i == 3)
           {
              wd->cp[i]->bg_rect = edje_object_add(e);
+             snprintf(buf, sizeof(buf), "%s/%s", colorbar_name,
+                      elm_widget_style_get(obj));
              _elm_theme_object_set(obj, wd->cp[i]->bg_rect, "colorselector",
-                                   "bg_image", colorbar_name);
+                                   "bg_image", buf);
              edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar_bg",
                                       wd->cp[i]->bg_rect);
              elm_widget_sub_object_add(obj, wd->cp[i]->bg_rect);
@@ -719,8 +653,8 @@ _add_colorbar(Evas_Object *obj)
           }
         /* load arrow image, pointing the colorbar */
         wd->cp[i]->arrow = edje_object_add(e);
-        _elm_theme_object_set(obj, wd->cp[i]->arrow, "colorselector", "image",
-                              "updown");
+        _elm_theme_object_set(obj, wd->cp[i]->arrow, "colorselector", "arrow",
+                              elm_widget_style_get(obj));
         edje_object_part_swallow(wd->cp[i]->colorbar, "elm.arrow_icon",
                                  wd->cp[i]->arrow);
         elm_widget_sub_object_add(obj, wd->cp[i]->arrow);
@@ -730,28 +664,40 @@ _add_colorbar(Evas_Object *obj)
           evas_object_color_set(wd->cp[i]->arrow, wd->er, wd->eg, wd->eb, 255);
 
         /* load left button */
-        wd->cp[i]->lbt = edje_object_add(e);
-        _elm_theme_object_set(obj, wd->cp[i]->lbt, "colorselector", "button",
-                              "left");
-        evas_object_event_callback_add(wd->cp[i]->lbt, EVAS_CALLBACK_MOUSE_DOWN,
-                                       _left_button_down_cb, wd->cp[i]);
-        evas_object_event_callback_add(wd->cp[i]->lbt, EVAS_CALLBACK_MOUSE_UP,
-                                       _left_button_up_cb, wd->cp[i]);
+        wd->cp[i]->lbt = elm_button_add(obj);
+        snprintf(buf, sizeof(buf), "colorselector/left/%s",
+                 elm_widget_style_get(obj));
+        elm_object_style_set(wd->cp[i]->lbt, buf);
+        elm_widget_sub_object_add(obj, wd->cp[i]->lbt);
         edje_object_part_swallow(wd->cp[i]->colorbar, "elm.l_button",
                                  wd->cp[i]->lbt);
-        elm_widget_sub_object_add(obj, wd->cp[i]->lbt);
+        evas_object_smart_callback_add(wd->cp[i]->lbt, "clicked",
+                                       _left_button_clicked_cb, wd->cp[i]);
+        elm_button_autorepeat_set(wd->cp[i]->lbt, EINA_TRUE);
+        elm_button_autorepeat_initial_timeout_set(wd->cp[i]->lbt,
+                                                  _elm_config->longpress_timeout);
+        elm_button_autorepeat_gap_timeout_set(wd->cp[i]->lbt,
+                                              (1.0 / _elm_config->fps));
+        evas_object_smart_callback_add(wd->cp[i]->lbt, "repeated",
+                                       _left_button_repeat_cb, wd->cp[i]);
 
         /* load right button */
-        wd->cp[i]->rbt = edje_object_add(e);
-        _elm_theme_object_set(obj, wd->cp[i]->rbt, "colorselector", "button",
-                              "right");
-        evas_object_event_callback_add(wd->cp[i]->rbt, EVAS_CALLBACK_MOUSE_DOWN,
-                                       _right_button_down_cb, wd->cp[i]);
-        evas_object_event_callback_add(wd->cp[i]->rbt, EVAS_CALLBACK_MOUSE_UP,
-                                       _right_button_up_cb, wd->cp[i]);
+        wd->cp[i]->rbt = elm_button_add(obj);
+        snprintf(buf, sizeof(buf), "colorselector/right/%s",
+                 elm_widget_style_get(obj));
+        elm_object_style_set(wd->cp[i]->rbt, buf);
+        elm_widget_sub_object_add(obj, wd->cp[i]->rbt);
         edje_object_part_swallow(wd->cp[i]->colorbar, "elm.r_button",
                                  wd->cp[i]->rbt);
-        elm_widget_sub_object_add(obj, wd->cp[i]->rbt);
+        evas_object_smart_callback_add(wd->cp[i]->rbt, "clicked",
+                                       _right_button_clicked_cb, wd->cp[i]);
+        elm_button_autorepeat_set(wd->cp[i]->rbt, EINA_TRUE);
+        elm_button_autorepeat_initial_timeout_set(wd->cp[i]->rbt,
+                                                  _elm_config->longpress_timeout);
+        elm_button_autorepeat_gap_timeout_set(wd->cp[i]->rbt,
+                                              (1.0 / _elm_config->fps));
+        evas_object_smart_callback_add(wd->cp[i]->rbt, "repeated",
+                                       _right_button_repeat_cb, wd->cp[i]);
      }
 }
 
@@ -789,14 +735,6 @@ _set_color(Evas_Object *obj, int r, int g, int b, int a)
    _draw_rects(wd->cp[3], x);
 }
 
-/**
- * Add a new colorselector to the parent
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Colorselector
- */
 EAPI Evas_Object *
 elm_colorselector_add(Evas_Object *parent)
 {
@@ -805,7 +743,7 @@ elm_colorselector_add(Evas_Object *parent)
    Evas *e;
 
    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-   
+
    ELM_SET_WIDTYPE(widtype, "colorselector");
    elm_widget_type_set(obj, "colorselector");
    elm_widget_sub_object_add(parent, obj);
@@ -834,17 +772,6 @@ elm_colorselector_add(Evas_Object *parent)
    return obj;
 }
 
-/**
- * Set a color for the colorselector
- *
- * @param obj   Colorselector object
- * @param r     r-value of color
- * @param g     g-value of color
- * @param b     b-value of color
- * @param a     a-value of color
- *
- * @ingroup Colorselector
- */
 EAPI void
 elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a)
 {
@@ -852,19 +779,8 @@ elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a)
    _set_color(obj, r, g, b, a);
 }
 
-/**
- * Get a color from the colorselector
- *
- * @param obj   Colorselector object
- * @param r     integer pointer for r-value of color
- * @param g     integer pointer for g-value of color
- * @param b     integer pointer for b-value of color
- * @param a     integer pointer for a-value of color
- *
- * @ingroup Colorselector
- */
 EAPI void
-elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int*a)
+elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    ELM_CHECK_WIDTYPE(obj, widtype);
@@ -874,3 +790,62 @@ elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int*
    if (b) *b = wd->b;
    if (a) *a = wd->a;
 }
+
+EAPI void
+elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode __UNUSED__)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   //TODO: Implement!
+}
+
+EAPI Elm_Colorselector_Mode
+elm_colorselector_mode_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) ELM_COLORSELECTOR_PALETTE;
+   //TODO: Implement!
+   return ELM_COLORSELECTOR_PALETTE;
+}
+
+EAPI void
+elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r __UNUSED__, int *g __UNUSED__, int *b __UNUSED__, int*a __UNUSED__)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   //TODO: Implement!
+}
+
+EAPI void
+elm_colorselector_palette_item_color_set(Elm_Object_Item *it, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   //TODO: Implement!
+}
+
+EAPI Elm_Object_Item *
+elm_colorselector_palette_color_add(Evas_Object *obj, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   //TODO: Implement!
+   return NULL;
+}
+
+EAPI void
+elm_colorselector_palette_clear(Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   //TODO: Implement!
+}
+
+EAPI void
+elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name __UNUSED__)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   //TODO: Implement!
+}
+
+EAPI const char*
+elm_colorselector_palette_name_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   //TODO: Implement!
+   return NULL;
+}