From d218676dd0be61bfacb93c01b015c4139fbdfe0d Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Tue, 5 Nov 2013 09:22:25 +0900 Subject: [PATCH] elm_list: Added missing elm_list_multi_select_mode_set/get API for list to fix the API consistency between multi selectable widgets. This was omitted by genlist/gengrid multi select mode set/get() commit ae03d3cef36abd27ff530e350e39ae401f4f389e. --- legacy/elementary/ChangeLog | 2 +- legacy/elementary/NEWS | 2 +- legacy/elementary/src/lib/elm_list.c | 42 +++++++++++++++++++++++++++++ legacy/elementary/src/lib/elm_list_eo.h | 36 +++++++++++++++++++++++++ legacy/elementary/src/lib/elm_list_legacy.h | 35 ++++++++++++++++++++++++ legacy/elementary/src/lib/elm_widget_list.h | 1 + 6 files changed, 116 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 087389e..25cf736 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1734,4 +1734,4 @@ 2013-10-03 Daniel Juyung Seo (SeoZ) - * Genlist/Gengrid: Added multi select mode. + * Genlist/Gengrid/List: Added multi select mode. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index 00229d3..b7492b3 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -100,7 +100,7 @@ Additions: * Add signals "spinner,drag,start" and "spinner,drag,stop" to the spinner widget. * Add support for "clicked" callback on Return/space/KP_Enter key press for image. * Add elm_slider_step_get(), elm_slider_step_set() for slider. - * Add multi select mode for genlist/gengrid. + * Add multi select mode for genlist/gengrid/list. Improvements: diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index 7ebab40..53fa834 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -1914,6 +1914,44 @@ _multi_select_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) *ret = sd->multi; } +EAPI void +elm_list_multi_select_mode_set(Evas_Object *obj, + Elm_Object_Multi_Select_Mode mode) +{ + ELM_LIST_CHECK(obj); + eo_do(obj, elm_obj_list_multi_select_mode_set(mode)); +} + +static void +_multi_select_mode_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + Elm_Object_Multi_Select_Mode mode = va_arg(*list, Elm_Object_Multi_Select_Mode); + Elm_List_Smart_Data *sd = _pd; + + if (mode >= ELM_OBJECT_MULTI_SELECT_MODE_MAX) + return; + + if (sd->multi_select_mode != mode) + sd->multi_select_mode = mode; +} + +EAPI Elm_Object_Multi_Select_Mode +elm_list_multi_select_mode_get(const Evas_Object *obj) +{ + ELM_LIST_CHECK(obj) ELM_OBJECT_MULTI_SELECT_MODE_MAX; + Elm_Object_Multi_Select_Mode ret = ELM_OBJECT_MULTI_SELECT_MODE_MAX; + eo_do((Eo *)obj, elm_obj_list_multi_select_mode_get(&ret)); + return ret; +} + +static void +_multi_select_mode_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + Elm_Object_Multi_Select_Mode *ret = va_arg(*list, Elm_Object_Multi_Select_Mode *); + Elm_List_Smart_Data *sd = _pd; + + *ret = sd->multi_select_mode; +} EAPI void elm_list_mode_set(Evas_Object *obj, @@ -2705,6 +2743,8 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_GO), _go), EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_SET), _multi_select_set), EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_GET), _multi_select_get), + EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_SET), _multi_select_mode_set), + EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_GET), _multi_select_mode_get), EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MODE_SET), _mode_set), EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MODE_GET), _mode_get), EO_OP_FUNC(ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_HORIZONTAL_SET), _horizontal_set), @@ -2739,6 +2779,8 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_GO, "Starts the list."), EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_SET, "Enable or disable multiple items selection on the list object."), EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_GET, "Get a value whether multiple items selection is enabled or not."), + EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_SET, "Set the list multi select mode."), + EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_GET, "Get the list multi select mode."), EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_MODE_SET, "Set which mode to use for the list object."), EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_MODE_GET, "Get the mode the list is at."), EO_OP_DESCRIPTION(ELM_OBJ_LIST_SUB_ID_HORIZONTAL_SET, "Enable or disable horizontal mode on the list object."), diff --git a/legacy/elementary/src/lib/elm_list_eo.h b/legacy/elementary/src/lib/elm_list_eo.h index 91bbf76..605c881 100644 --- a/legacy/elementary/src/lib/elm_list_eo.h +++ b/legacy/elementary/src/lib/elm_list_eo.h @@ -14,6 +14,8 @@ ELM_OBJ_LIST_SUB_ID_GO, ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_SET, ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_GET, + ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_SET, + ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_GET, ELM_OBJ_LIST_SUB_ID_MODE_SET, ELM_OBJ_LIST_SUB_ID_MODE_GET, ELM_OBJ_LIST_SUB_ID_HORIZONTAL_SET, @@ -76,6 +78,40 @@ #define elm_obj_list_multi_select_get(ret) ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_GET), EO_TYPECHECK(Eina_Bool *, ret) /** + * @def elm_obj_list_multi_select_mode_set + * @since 1.8 + * + * Set the list multi select mode. + * + * @param[in] mode + * + * - ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT : select/unselect items whenever each + * item is clicked. + * - ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL : Only one item will be selected + * although multi-selection is enabled, if clicked without pressing control + * key. This mode is only available with multi-selection. + * + * @see elm_list_multi_select_set() + * @see elm_list_multi_select_mode_get() + */ +#define elm_obj_list_multi_select_mode_set(mode) ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_SET), EO_TYPECHECK(Elm_Object_Multi_Select_Mode, mode) + +/** + * @def elm_obj_list_multi_select_mode_get + * @since 1.8 + * + * Get the list multi select mode. + * + * @param[out] ret + * + * (If getting mode is failed, it returns ELM_OBJECT_MULTI_SELECT_MODE_MAX) + * + * @see elm_list_multi_select_set() + * @see elm_list_multi_select_mode_set() + */ +#define elm_obj_list_multi_select_mode_get(ret) ELM_OBJ_LIST_ID(ELM_OBJ_LIST_SUB_ID_MULTI_SELECT_MODE_GET), EO_TYPECHECK(Elm_Object_Multi_Select_Mode *, ret) + +/** * @def elm_obj_list_mode_set * @since 1.8 * diff --git a/legacy/elementary/src/lib/elm_list_legacy.h b/legacy/elementary/src/lib/elm_list_legacy.h index 3371d3b..1c4818a 100644 --- a/legacy/elementary/src/lib/elm_list_legacy.h +++ b/legacy/elementary/src/lib/elm_list_legacy.h @@ -65,6 +65,41 @@ EAPI void elm_list_multi_select_set(Evas_Object *obj, Ei EAPI Eina_Bool elm_list_multi_select_get(const Evas_Object *obj); /** + * Set the list multi select mode. + * + * @param obj The list object + * @param mode The multi select mode + * + * - ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT : select/unselect items whenever each + * item is clicked. + * - ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL : Only one item will be selected + * although multi-selection is enabled, if clicked without pressing control + * key. This mode is only available with multi-selection. + * + * @see elm_list_multi_select_set() + * @see elm_list_multi_select_mode_get() + * + * @ingroup List + * @since 1.8 + */ +EAPI void elm_list_multi_select_mode_set(Evas_Object *obj, Elm_Object_Multi_Select_Mode mode); + +/** + * Get the list multi select mode. + * + * @param obj The list object + * @return The multi select mode + * (If getting mode is failed, it returns ELM_OBJECT_MULTI_SELECT_MODE_MAX) + * + * @see elm_list_multi_select_set() + * @see elm_list_multi_select_mode_set() + * + * @ingroup List + * @since 1.8 + */ +EAPI Elm_Object_Multi_Select_Mode elm_list_multi_select_mode_get(const Evas_Object *obj); + +/** * Set which mode to use for the list object. * * @param obj The list object diff --git a/legacy/elementary/src/lib/elm_widget_list.h b/legacy/elementary/src/lib/elm_widget_list.h index bc72908..c04d41d 100644 --- a/legacy/elementary/src/lib/elm_widget_list.h +++ b/legacy/elementary/src/lib/elm_widget_list.h @@ -29,6 +29,7 @@ struct _Elm_List_Smart_Data Elm_Object_Item *last_selected_item; Evas_Coord minw[2], minh[2]; Elm_Object_Select_Mode select_mode; + Elm_Object_Multi_Select_Mode multi_select_mode; /**< select mode for multiple selection */ int movements; int walking; Elm_List_Mode h_mode; -- 2.7.4