From 248f878f0dfc4f3aec894a1739567ae21d4baaea Mon Sep 17 00:00:00 2001 From: Hyoyoung Chang Date: Wed, 7 Mar 2012 13:37:18 +0000 Subject: [PATCH] From: Hyoyoung Chang Subject: [E-devel] [patch] elm_gen{list, grid} - add no_highlight_mode_set/get actually change it to hilight_mode/set/get with the inverse. SVN revision: 68947 --- legacy/elementary/src/lib/elm_gen_common.h | 1 + legacy/elementary/src/lib/elm_gengrid.c | 18 ++++++++++- legacy/elementary/src/lib/elm_gengrid.h | 37 ++++++++++++++++++++++ legacy/elementary/src/lib/elm_genlist.c | 21 ++++++++++++ legacy/elementary/src/lib/elm_genlist.h | 37 ++++++++++++++++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) diff --git a/legacy/elementary/src/lib/elm_gen_common.h b/legacy/elementary/src/lib/elm_gen_common.h index eb66d03e1f..ad6c1c1f69 100644 --- a/legacy/elementary/src/lib/elm_gen_common.h +++ b/legacy/elementary/src/lib/elm_gen_common.h @@ -98,6 +98,7 @@ struct _Widget_Data Eina_Bool on_hold : 1; Eina_Bool multi : 1; /**< a flag for item multi selection */ Eina_Bool wasselected : 1; + Eina_Bool no_highlight : 1; Eina_Bool clear_me : 1; /**< a flag whether genlist is marked as to be cleared or not. if this flag is true, genlist clear was already deferred. */ Eina_Bool h_bounce : 1; Eina_Bool v_bounce : 1; diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 0c5794c559..66c2ce500c 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -916,7 +916,9 @@ _mouse_up(void *data, static void _item_highlight(Elm_Gen_Item *it) { - if ((it->wd->select_mode == ELM_OBJECT_NO_SELECT) || (it->generation < it->wd->generation) || (it->highlighted)) return; + if ((it->wd->select_mode == ELM_OBJECT_NO_SELECT) || + (it->wd->no_highlight) || (it->highlighted) || + (it->generation < it->wd->generation)) return; edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); it->highlighted = EINA_TRUE; } @@ -2857,3 +2859,17 @@ elm_gengrid_select_mode_get(const Evas_Object *obj) { return elm_genlist_select_mode_get(obj); } + +EAPI void +elm_gengrid_hilight_mode_set(Evas_Object *obj, + Eina_Bool hilight) +{ + elm_genlist_hilight_mode_set(obj, hilight); +} + +EAPI Eina_Bool +elm_gengrid_hilight_mode_get(const Evas_Object *obj) +{ + return elm_genlist_hilight_mode_get(obj); +} + diff --git a/legacy/elementary/src/lib/elm_gengrid.h b/legacy/elementary/src/lib/elm_gengrid.h index 6b3e0e6c11..8ab0cdb91d 100644 --- a/legacy/elementary/src/lib/elm_gengrid.h +++ b/legacy/elementary/src/lib/elm_gengrid.h @@ -1463,6 +1463,43 @@ elm_gengrid_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode); EAPI Elm_Object_Select_Mode_Type elm_gengrid_select_mode_get(const Evas_Object *obj); +/** + * Set whether the gengrid items' should be hilighted when item selected. + * + * @param obj The gengrid object. + * @param hilight @c EINA_TRUE to enable hilight or @c EINA_FALSE to + * disable it. + * + * This will turn on/off the hilight effect when items are selected and + * they will or will not be hilighted. The selected and clicked + * callback functions will still be called. + * + * hilight is enabled by default. + * + * @see elm_gengrid_hilight_mode_get(). + * + * @ingroup Gengrid + */ + +EAPI void +elm_gengrid_hilight_mode_set(Evas_Object *obj, + Eina_Bool hilight); + +/** + * Get whether the gengrid items' should be hilighted when item selected. + * + * @param obj The gengrid object. + * @return @c EINA_TRUE means items can be hilighted. @c EINA_FALSE indicates + * they can't. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_gengrid_hilight_mode_set() for details. + * + * @ingroup Gengrid + */ + +EAPI Eina_Bool +elm_gengrid_hilight_mode_get(const Evas_Object *obj); + /** * @} */ diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index a936a07657..93fc57758a 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -689,6 +689,7 @@ _item_highlight(Elm_Gen_Item *it) { const char *selectraise; if ((it->wd->select_mode == ELM_OBJECT_NO_SELECT) || + (it->wd->no_highlight) || (it->generation < it->wd->generation) || (it->highlighted) || elm_widget_item_disabled_get(it) || (it->display_only) || (it->item->mode_view)) @@ -5739,6 +5740,26 @@ elm_genlist_select_mode_get(const Evas_Object *obj) return wd->select_mode; } +EAPI void +elm_genlist_hilight_mode_set(Evas_Object *obj, + Eina_Bool hilight) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + hilight = !!hilight; + wd->no_highlight = !hilight; +} + +EAPI Eina_Bool +elm_genlist_hilight_mode_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return !wd->no_highlight; +} + /* for gengrid as of now */ void _elm_genlist_page_relative_set(Evas_Object *obj, diff --git a/legacy/elementary/src/lib/elm_genlist.h b/legacy/elementary/src/lib/elm_genlist.h index 5d1e222bbf..b0bc36252c 100644 --- a/legacy/elementary/src/lib/elm_genlist.h +++ b/legacy/elementary/src/lib/elm_genlist.h @@ -1890,6 +1890,43 @@ elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode); EAPI Elm_Object_Select_Mode_Type elm_genlist_select_mode_get(const Evas_Object *obj); +/** + * Set whether the genlist items' should be highlighted when item selected. + * + * @param obj The genlist object. + * @param hilight @c EINA_TRUE to enable hilighting or @c EINA_FALSE to + * disable it. + * + * This will turn on/off the highlight effect when item selection and + * they will, or will not highlighted. The selected and clicked + * callback functions will still be called. + * + * Highlight is enabled by default. + * + * @see elm_genlist_hilight_mode_get(). + * + * @ingroup Genlist + */ + +EAPI void +elm_genlist_hilight_mode_set(Evas_Object *obj, + Eina_Bool hilight); + +/** + * Get whether the genlist items' should be hilighted when item selected. + * + * @param obj The genlist object. + * @return @c EINA_TRUE means items can be hilighted. @c EINA_FALSE indicates + * they can't. If @p obj is @c NULL, @c EINA_FALSE is returned. + * + * @see elm_genlist_hilight_mode_set() for details. + * + * @ingroup Genlist + */ + +EAPI Eina_Bool +elm_genlist_hilight_mode_get(const Evas_Object *obj); + /** * @} */