From dad510faffa29bb52330bba0a053070ce9d4911a Mon Sep 17 00:00:00 2001 From: Sanjeev BA Date: Tue, 6 Mar 2012 01:45:25 +0000 Subject: [PATCH] Rename mbe shrink_mode to expanded. Consistent with genlist naming. Signed-off-by: Sanjeev BA SVN revision: 68760 --- .../src/bin/test_multibuttonentry.c | 4 +-- .../elementary/src/lib/elc_multibuttonentry.c | 35 ++++++++++++++++--- .../elementary/src/lib/elc_multibuttonentry.h | 32 +++++++++++------ legacy/elementary/src/lib/elm_deprecated.h | 14 ++++++++ 4 files changed, 67 insertions(+), 18 deletions(-) diff --git a/legacy/elementary/src/bin/test_multibuttonentry.c b/legacy/elementary/src/bin/test_multibuttonentry.c index 52c4e091e1..6b64e82dea 100644 --- a/legacy/elementary/src/bin/test_multibuttonentry.c +++ b/legacy/elementary/src/bin/test_multibuttonentry.c @@ -48,7 +48,7 @@ _mbe_clicked_cb(void *data __UNUSED__, void *event_info __UNUSED__ ) { //Unset the multibuttonentry to contracted mode of single line - elm_multibuttonentry_shrink_mode_set(obj, 0); + elm_multibuttonentry_expanded_set(obj, EINA_TRUE); printf("A multibuttonentry is clicked!\n"); Evas_Object *entry; entry = elm_multibuttonentry_entry_get(obj); @@ -71,7 +71,7 @@ _mbe_unfocused_cb(void *data __UNUSED__, void *event_info __UNUSED__ ) { //Set the multibuttonentry to contracted mode of single line - elm_multibuttonentry_shrink_mode_set(obj, EINA_TRUE); + elm_multibuttonentry_expanded_set(obj, EINA_FALSE); printf("multibuttonentry unfocused!\n"); } diff --git a/legacy/elementary/src/lib/elc_multibuttonentry.c b/legacy/elementary/src/lib/elc_multibuttonentry.c index 4e8545f380..8296e7794a 100644 --- a/legacy/elementary/src/lib/elc_multibuttonentry.c +++ b/legacy/elementary/src/lib/elc_multibuttonentry.c @@ -1467,25 +1467,50 @@ elm_multibuttonentry_guide_text_set(Evas_Object *obj, const char *guidetext) _set_guidetext(obj, ""); } -EAPI int +EINA_DEPRECATED EAPI int elm_multibuttonentry_shrink_mode_get(const Evas_Object *obj) +{ + if (elm_multibuttonentry_expanded_get(obj)) + return 0; + else + return 1; +} + +EAPI Eina_Bool +elm_multibuttonentry_expanded_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) -1; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return -1; - return wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK ? 1 : 0; + return (wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK ? EINA_FALSE : EINA_TRUE); + +} + +EINA_DEPRECATED EAPI void +elm_multibuttonentry_shrink_mode_set(Evas_Object *obj, int shrink) +{ + if (shrink==0) + elm_multibuttonentry_expanded_set(obj, EINA_TRUE); + + if (shrink==1) + elm_multibuttonentry_expanded_set(obj, EINA_FALSE); } EAPI void -elm_multibuttonentry_shrink_mode_set(Evas_Object *obj, int shrink) +elm_multibuttonentry_expanded_set(Evas_Object *obj, Eina_Bool expanded) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd || !wd->box || - ((wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) ? 1 : 0) == shrink) return; - _shrink_mode_set(obj, shrink); + ((wd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK) ? EINA_FALSE : EINA_TRUE) == expanded) return; + + if (expanded) + _shrink_mode_set(obj, 0); + else + _shrink_mode_set(obj, 1); + } EAPI Elm_Object_Item * diff --git a/legacy/elementary/src/lib/elc_multibuttonentry.h b/legacy/elementary/src/lib/elc_multibuttonentry.h index dcf3f19c58..1f6ce85160 100644 --- a/legacy/elementary/src/lib/elc_multibuttonentry.h +++ b/legacy/elementary/src/lib/elc_multibuttonentry.h @@ -1,11 +1,16 @@ /** * @defgroup Multibuttonentry Multibuttonentry * - * A Multibuttonentry is a widget to allow a user enter text and manage it as a number of buttons - * Each text button is inserted by pressing the "return" key. If there is no space in the current row, - * a new button is added to the next row. When a text button is pressed, it will become focused. + * A Multibuttonentry is a widget to allow a user enter text and manage it as a number + * of buttons. Each text button is inserted by pressing the "return" key. + * If there is no space in the current row, a new button is added to the next row. + * When a text button is pressed, it will become focused. * Backspace removes the focus. - * When the Multibuttonentry loses focus items longer than 1 lines are shrunk to one line. + * When the Multibuttonentry loses focus items longer than one line are shrunk + * to one line. + * + * Typical use case of multibuttonentry is, composing emails/messages to a group + * of addresses, each of which is an item that can be clicked for further actions. * * Smart callbacks one can register: * - @c "item,selected" - when item is selected. May be called on backspace key. @@ -41,7 +46,6 @@ * 1. docs are lacking. * 2. name sucks * 3. should use the elm_object_part_text_set to set guide text. - * 4. shrink_mode is an awful name. * 5. bugs: offset bug with the "tap to add recipient" + delete doesn't delete items but backspace does. */ /** @@ -94,24 +98,30 @@ EAPI const char *elm_multibuttonentry_guide_text_get(const Evas_O EAPI void elm_multibuttonentry_guide_text_set(Evas_Object *obj, const char *guidetext); /** - * Get the value of shrink_mode state. + * Get the value of expanded state. + * In expanded state, the complete entry will be displayed. + * Otherwise, only single line of the entry will be displayed. * * @param obj The multibuttonentry object - * @return the value of shrink mode state. + * @return EINA_TRUE if the widget is in expanded state. EINA_FALSE if not. * * @ingroup Multibuttonentry */ -EAPI int elm_multibuttonentry_shrink_mode_get(const Evas_Object *obj); +EAPI Eina_Bool elm_multibuttonentry_expanded_get(const Evas_Object *obj); /** - * Set/Unset the multibuttonentry to shrink mode state of single line + * Set/Unset the multibuttonentry to expanded state. + * In expanded state, the complete entry will be displayed. + * Otherwise, only single line of the entry will be displayed. * * @param obj The multibuttonentry object - * @param shrink the value of shrink_mode state. Set this to 1 to set the multibuttonentry to shrink state of single line. Set this to 0 to unset the contracted state. + * @param expanded the value of expanded state. + * Set this to EINA_TRUE for expanded state. + * Set this to EINA_FALSE for single line state. * * @ingroup Multibuttonentry */ -EAPI void elm_multibuttonentry_shrink_mode_set(Evas_Object *obj, int shrink); +EAPI void elm_multibuttonentry_expanded_set(Evas_Object *obj, Eina_Bool expanded); /** * Prepend a new item to the multibuttonentry diff --git a/legacy/elementary/src/lib/elm_deprecated.h b/legacy/elementary/src/lib/elm_deprecated.h index 6aacd176db..ec22d35351 100644 --- a/legacy/elementary/src/lib/elm_deprecated.h +++ b/legacy/elementary/src/lib/elm_deprecated.h @@ -4950,6 +4950,20 @@ EINA_DEPRECATED EAPI void elm_icon_scale_get(const Evas_Object * @ingroup Index */ EINA_DEPRECATED EAPI Elm_Object_Item *elm_index_item_selected_get(const Evas_Object *obj, int level); + +/** + * Get the value of shrink_mode state. + * + * @deprecated elm_multibuttonentry_expanded_get() + */ +EINA_DEPRECATED EAPI int elm_multibuttonentry_shrink_mode_get(const Evas_Object *obj); + +/** + * Set/Unset the multibuttonentry to shrink mode state of single line + * + * @deprecated elm_multibuttonentry_expanded_set() + */ +EINA_DEPRECATED EAPI void elm_multibuttonentry_shrink_mode_set(Evas_Object *obj, int shrink_mode); /** * @} */