forked from enlightenment/efl
elm colorselector: Reviewed colorselector. OK for this widget.
Signed-off-by: Daniel Juyung Seo <seojuyung@gmail.com> SVN revision: 68641
This commit is contained in:
parent
75b760da92
commit
de7fa17f92
|
@ -185,7 +185,7 @@ EAPI extern Elm_Version *elm_version;
|
|||
#include <elm_check.h> // OK
|
||||
#include <elm_clock.h>
|
||||
#include <elm_cnp.h> // XXX: comments in elm_cnp.h
|
||||
#include <elm_colorselector.h>
|
||||
#include <elm_colorselector.h> // OK
|
||||
#include <elm_config.h>
|
||||
#include <elm_conform.h>
|
||||
#include <elm_cursor.h> // XXX: comments in elm_cursor.h. review was not finished.
|
||||
|
|
|
@ -52,12 +52,18 @@ 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 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 _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);
|
||||
|
||||
|
@ -419,7 +425,8 @@ _draw_rects(void *data, double x)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -451,7 +458,8 @@ _colorbar_cb(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
|
|||
}
|
||||
|
||||
static void
|
||||
_left_button_clicked_cb(void *data, 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;
|
||||
double x, y;
|
||||
|
@ -486,7 +494,8 @@ _left_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__, void *event_in
|
|||
}
|
||||
|
||||
static void
|
||||
_left_button_repeat_cb(void *data, 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;
|
||||
|
@ -501,7 +510,8 @@ _left_button_repeat_cb(void *data, Evas_Object * obj __UNUSED__, void *event_inf
|
|||
}
|
||||
|
||||
static void
|
||||
_right_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__, void *event_info __UNUSED__)
|
||||
_right_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__,
|
||||
void *event_info __UNUSED__)
|
||||
{
|
||||
Colorselector_Data *cp = data;
|
||||
double x, y;
|
||||
|
@ -536,7 +546,8 @@ _right_button_clicked_cb(void *data, Evas_Object * obj __UNUSED__, void *event_i
|
|||
}
|
||||
|
||||
static void
|
||||
_right_button_repeat_cb(void *data, 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;
|
||||
double x, y;
|
||||
|
@ -598,7 +609,8 @@ _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));
|
||||
snprintf(buf, sizeof(buf), "%s/%s", colorbar_name,
|
||||
elm_widget_style_get(obj));
|
||||
_elm_theme_object_set(obj, wd->cp[i]->bar, "colorselector", "image",
|
||||
buf);
|
||||
edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar",
|
||||
|
@ -630,7 +642,8 @@ _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));
|
||||
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", buf);
|
||||
edje_object_part_swallow(wd->cp[i]->colorbar, "elm.bar_bg",
|
||||
|
@ -652,29 +665,39 @@ _add_colorbar(Evas_Object *obj)
|
|||
|
||||
/* load left button */
|
||||
wd->cp[i]->lbt = elm_button_add(obj);
|
||||
snprintf(buf, sizeof(buf), "colorselector/left/%s", elm_widget_style_get(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);
|
||||
evas_object_smart_callback_add(wd->cp[i]->lbt, "clicked", _left_button_clicked_cb, wd->cp[i]);
|
||||
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]);
|
||||
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 = elm_button_add(obj);
|
||||
snprintf(buf, sizeof(buf), "colorselector/right/%s", elm_widget_style_get(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);
|
||||
evas_object_smart_callback_add(wd->cp[i]->rbt, "clicked", _right_button_clicked_cb, wd->cp[i]);
|
||||
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]);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -757,7 +780,8 @@ elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue