On Sat, 8 Feb 2014 19:57:28 +0900 ryuan Choi <[email protected]> said:
> I think that it should be improved little bit more. > > For example, what do you think about below scenarios? > > 1) Calls elm_colorselector_palette_item_selected_set(unselected_item, > EINA_FALSE); > Shouled we send "elm,state,unselected" signal? with clearing > sd->selected? errr. yes? that's what the code does... ? > 2) When elm_colorselector_palette_clear is called, should we send signals > for selected item? send signals to the edje objects? no - they are deleted. you mean call callbacks to indicate an item is not selected anymore? or is that what you meant for #1 - ie there is "color,item,selected" - why not also have "color,item,unselected" ? > Best Regards, > Ryuan Choi > > > > 2014-02-08 13:37 GMT+09:00 Shilpa Singh <[email protected]>: > > > raster pushed a commit to branch master. > > > > > > http://git.enlightenment.org/core/elementary.git/commit/?id=68f2f6e7f2a8fc432d2b1e455839022f20e71e34 > > > > commit 68f2f6e7f2a8fc432d2b1e455839022f20e71e34 > > Author: Shilpa Singh <[email protected]> > > Date: Sat Feb 8 13:33:58 2014 +0900 > > > > Colorselector: Item Selection/Unselection logic changes and > > corresponding API additions. > > > > SUMMARY > > Item should remain selected once pressed. > > When one item is selected other items should be unselected. > > No special behavior on long press, item gets selected on mouse up. > > APIs added are to get current selected item and to programmatically > > control the selection/unselection of an item. > > > > This is patch D515 (had to do by hand). > > --- > > src/bin/test_colorselector.c | 5 ++- > > src/lib/elm_colorselector.c | 87 > > ++++++++++++++++++++++++++++++++------ > > src/lib/elm_colorselector_common.h | 21 +++++++++ > > src/lib/elm_colorselector_eo.h | 13 ++++++ > > src/lib/elm_colorselector_legacy.h | 11 +++++ > > src/lib/elm_widget_colorselector.h | 1 - > > 6 files changed, 124 insertions(+), 14 deletions(-) > > > > diff --git a/src/bin/test_colorselector.c b/src/bin/test_colorselector.c > > index 411d7a0..5947632 100644 > > --- a/src/bin/test_colorselector.c > > +++ b/src/bin/test_colorselector.c > > @@ -84,6 +84,7 @@ test_colorselector(void *data EINA_UNUSED, Evas_Object > > *obj EINA_UNUSED, > > const Eina_List *item_list, *last_item_list; > > Elm_Object_Item *color_item; > > int r, g, b, a; > > + Elm_Object_Item *item; > > > > win = elm_win_util_standard_add("colorselector", "ColorSelector"); > > elm_win_autodel_set(win, EINA_TRUE); > > @@ -113,7 +114,9 @@ test_colorselector(void *data EINA_UNUSED, Evas_Object > > *obj EINA_UNUSED, > > evas_object_show(fr); > > > > cs = elm_colorselector_add(fr); > > - elm_colorselector_palette_color_add(cs, 255, 90, 18, 128); > > + item = elm_colorselector_palette_color_add(cs, 255, 90, 18, 128); > > + elm_colorselector_palette_item_selected_set(item, EINA_TRUE); > > + > > elm_colorselector_palette_color_add(cs, 255, 213, 0, 255); > > elm_colorselector_palette_color_add(cs, 146, 255, 11, 255); > > elm_colorselector_palette_color_add(cs, 9, 186, 10, 255); > > diff --git a/src/lib/elm_colorselector.c b/src/lib/elm_colorselector.c > > index 714cd79..daf3261 100644 > > --- a/src/lib/elm_colorselector.c > > +++ b/src/lib/elm_colorselector.c > > @@ -1272,7 +1272,7 @@ _on_color_long_press(void *data) > > ELM_COLORSELECTOR_DATA_GET(WIDGET(item), sd); > > > > sd->longpress_timer = NULL; > > - sd->longpressed = EINA_TRUE; > > + > > evas_object_smart_callback_call > > (WIDGET(item), SIG_COLOR_ITEM_LONGPRESSED, item); > > > > @@ -1293,8 +1293,6 @@ _on_color_pressed(void *data, > > ELM_COLORSELECTOR_DATA_GET(WIDGET(item), sd); > > > > if (ev->button != 1) return; > > - elm_object_signal_emit(VIEW(item), "elm,state,selected", "elm"); > > - sd->longpressed = EINA_FALSE; > > > > ecore_timer_del(sd->longpress_timer); > > sd->longpress_timer = ecore_timer_add > > @@ -1317,15 +1315,17 @@ _on_color_released(void *data, > > > > if (ev->button != 1) return; > > ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del); > > - elm_object_signal_emit(VIEW(item), "elm,state,unselected", "elm"); > > - if (!sd->longpressed) > > - { > > - elm_colorselector_color_set > > - (WIDGET(item), item->color->r, item->color->g, item->color->b, > > - item->color->a); > > - evas_object_smart_callback_call > > - (WIDGET(item), SIG_COLOR_ITEM_SELECTED, item); > > - } > > + > > + elm_object_signal_emit(VIEW(item), "elm,state,selected", "elm"); > > + elm_colorselector_color_set(WIDGET(item), item->color->r, > > item->color->g, > > + item->color->b, item->color->a); > > + evas_object_smart_callback_call(WIDGET(item), SIG_COLOR_ITEM_SELECTED, > > + item); > > + > > + temp_item = eina_list_data_get(sd->selected); > > + if (temp_item && (temp_item != item)) > > + elm_object_signal_emit(VIEW(temp_item), "elm,state,unselected", > > "elm"); > > + > > EINA_LIST_FOREACH(sd->items, l, temp_item) > > if (item == temp_item) sd->selected = l; > > sd->focused = ELM_COLORSELECTOR_PALETTE; > > @@ -2167,6 +2167,67 @@ _palette_items_get(Eo *obj EINA_UNUSED, void *_pd, > > va_list *list) > > } > > > > EAPI void > > +elm_colorselector_palette_item_selected_set(Elm_Object_Item *it, > > + Eina_Bool selected) > > +{ > > + Elm_Color_Item *temp_item, *item; > > + item = (Elm_Color_Item *)it; > > + Eina_List *l; > > + > > + ELM_COLORSELECTOR_DATA_GET(WIDGET(item), sd); > > + ELM_COLORSELECTOR_ITEM_CHECK_OR_RETURN(it); > > + > > + if (selected) > > + { > > + temp_item = eina_list_data_get(sd->selected); > > + if (item == temp_item) return; > > + elm_object_signal_emit(VIEW(item), "elm,state,selected", "elm"); > > + elm_colorselector_color_set(WIDGET(item), item->color->r, > > item->color->g, > > + item->color->b, item->color->a); > > + if (temp_item) > > + elm_object_signal_emit(VIEW(temp_item), "elm,state,unselected", > > "elm"); > > + > > + EINA_LIST_FOREACH(sd->items, l, temp_item) > > + if (item == temp_item) sd->selected = l; > > + } > > + else > > + { > > + elm_object_signal_emit(VIEW(item), "elm,state,unselected", "elm"); > > + sd->selected = NULL; > > + } > > +} > > + > > +EAPI Eina_Bool > > +elm_colorselector_palette_item_selected_get(const Elm_Object_Item *it) > > +{ > > + Elm_Color_Item *temp_item, *item; > > + item = (Elm_Color_Item *)it; > > + ELM_COLORSELECTOR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); > > + ELM_COLORSELECTOR_DATA_GET(WIDGET(item), sd); > > + > > + temp_item = eina_list_data_get(sd->selected); > > + if (item == temp_item) return EINA_TRUE; > > + else return EINA_FALSE; > > +} > > + > > +EAPI Elm_Object_Item * > > +elm_colorselector_palette_selected_item_get(const Evas_Object *obj) > > +{ > > + ELM_COLORSELECTOR_CHECK(obj) NULL; > > + Elm_Object_Item *ret = NULL; > > + eo_do((Eo *) obj, > > elm_obj_colorselector_palette_selected_item_get(&ret)); > > + return ret; > > +} > > + > > +static void > > +_palette_selected_item_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) > > +{ > > + Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **); > > + Elm_Colorselector_Smart_Data *sd = _pd; > > + *ret = eina_list_data_get(sd->selected); > > +} > > + > > +EAPI void > > elm_colorselector_palette_name_set(Evas_Object *obj, > > const char *palette_name) > > { > > @@ -2230,6 +2291,7 @@ _class_constructor(Eo_Class *klass) > > > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET), > > _mode_get), > > > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD), _palette_color_add), > > > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR), _palette_clear), > > + > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_SELECTED_ITEM_GET), > > _palette_selected_item_get), > > > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET), _palette_items_get), > > > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET), _palette_name_set), > > > > EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET), _palette_name_get), > > @@ -2249,6 +2311,7 @@ static const Eo_Op_Description op_desc[] = { > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET, "Get > > Colorselector's mode."), > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD, > > "Add a new color item to palette."), > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR, "Clear > > the palette items."), > > + > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_SELECTED_ITEM_GET, > > "Get Palette's current selected item"), > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET, > > "Get palette's item list"), > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET, > > "Set current palette's name."), > > EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET, > > "Get current palette's name."), > > diff --git a/src/lib/elm_colorselector_common.h > > b/src/lib/elm_colorselector_common.h > > index d39cf56..801b416 100644 > > --- a/src/lib/elm_colorselector_common.h > > +++ b/src/lib/elm_colorselector_common.h > > @@ -56,3 +56,24 @@ EAPI void > > elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, in > > */ > > EAPI void elm_colorselector_palette_item_color_set(Elm_Object_Item *it, > > int r, int g, int b, int a); > > > > +/** > > + * Get the selected state of color palette item. > > + * > > + * @param it The Colorpalette item > > + * @return EINA_TRUE if the item is selected, EINA_FALSE otherwise. > > + * > > + * @since 1.9 > > + * @ingroup Colorselector > > + */ > > +EAPI Eina_Bool elm_colorselector_palette_item_selected_get(const > > Elm_Object_Item *it); > > + > > +/** > > + * Set the selected state of color palette item > > + * > > + * @param it The Colorpalette item > > + * @param selected if it's EINA_TRUE, select the item otherwise, unselect > > the item > > + * > > + * @since 1.9 > > + * @ingroup Colorselector > > + */ > > +EAPI void elm_colorselector_palette_item_selected_set(Elm_Object_Item > > *it, Eina_Bool selected); > > diff --git a/src/lib/elm_colorselector_eo.h > > b/src/lib/elm_colorselector_eo.h > > index b7ac81a..b8cc88e 100644 > > --- a/src/lib/elm_colorselector_eo.h > > +++ b/src/lib/elm_colorselector_eo.h > > @@ -12,6 +12,7 @@ enum > > ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET, > > ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD, > > ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR, > > + ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_SELECTED_ITEM_GET, > > ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET, > > ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET, > > ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET, > > @@ -127,6 +128,18 @@ enum > > #define elm_obj_colorselector_palette_items_get(ret) > > ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET), > > EO_TYPECHECK(const Eina_List **, ret) > > > > /** > > + * @def elm_obj_colorselector_palette_selected_item_get > > + * @since 1.9 > > + * > > + * Get current selected palette item > > + * > > + * @param[out] ret > > + * > > + * @ingroup Colorselector > > + */ > > +#define elm_obj_colorselector_palette_selected_item_get(ret) > > ELM_OBJ_COLORSELECTOR_ID > > (ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_SELECTED_ITEM_GET), EO_TYPECHECK > > (Elm_Object_Item **, ret) + > > +/** > > * @def elm_obj_colorselector_palette_name_set > > * @since 1.8 > > * > > diff --git a/src/lib/elm_colorselector_legacy.h > > b/src/lib/elm_colorselector_legacy.h > > index b366056..7a7dd03 100644 > > --- a/src/lib/elm_colorselector_legacy.h > > +++ b/src/lib/elm_colorselector_legacy.h > > @@ -95,6 +95,17 @@ EAPI void elm_colorselector_palette_clear(Evas_Object > > *obj); > > EAPI const Eina_List *elm_colorselector_palette_items_get(const > > Evas_Object *obj); > > > > /** > > + * Get the selected item in colorselector palette. > > + * > > + * @param obj The Colorselector object > > + * @return The selected item, or NULL if none is selected. > > + * > > + * @since 1.9 > > + * @ingroup Colorselector > > + */ > > +EAPI Elm_Object_Item *elm_colorselector_palette_selected_item_get(const > > Evas_Object *obj); > > + > > +/** > > * Set current palette's name > > * > > * @param obj The Colorselector object > > diff --git a/src/lib/elm_widget_colorselector.h > > b/src/lib/elm_widget_colorselector.h > > index 4dbc4ac..7b1c5ed 100644 > > --- a/src/lib/elm_widget_colorselector.h > > +++ b/src/lib/elm_widget_colorselector.h > > @@ -56,7 +56,6 @@ struct _Elm_Colorselector_Smart_Data > > Elm_Colorselector_Mode mode, focused; > > int sel_color_type; > > > > - Eina_Bool longpressed : 1; > > Eina_Bool config_load : 1; > > }; > > > > > > -- > > > > > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > enlightenment-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) [email protected] ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
