From fb06522eb47f2e2191e04d0a50ba58301efce533 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 4 Feb 2010 08:06:41 +0000 Subject: [PATCH] allow genlist items to be "display only" - eg used as spacers or state indicators, section markers etc. SVN revision: 45862 --- legacy/elementary/src/lib/Elementary.h.in | 23 ++------- legacy/elementary/src/lib/elm_genlist.c | 57 +++++++++++++++++++++-- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 91a6295306..2af96a1d3b 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -883,6 +883,9 @@ extern "C" { EAPI Eina_Bool elm_genlist_item_expanded_get(const Elm_Genlist_Item *item); EAPI void elm_genlist_item_disabled_set(Elm_Genlist_Item *item, Eina_Bool disabled); EAPI Eina_Bool elm_genlist_item_disabled_get(const Elm_Genlist_Item *item); + EAPI void elm_genlist_item_display_only_set(Elm_Genlist_Item *it, Eina_Bool display_only); + EAPI Eina_Bool elm_genlist_item_display_only_get(const Elm_Genlist_Item *it); + EAPI void elm_genlist_item_show(Elm_Genlist_Item *item); EAPI void elm_genlist_item_bring_in(Elm_Genlist_Item *item); EAPI void elm_genlist_item_top_show(Elm_Genlist_Item *item); @@ -907,16 +910,6 @@ extern "C" { * double_label * icon_top_text_bottom */ - /* smart callbacks called: - * "clicked" - when the user double-clicked an item - * "selected" - when the user selected an item - * "unselected" - when the user selected an item - * "longpressed" - an item in the hoversel list is long-pressed - * "expanded" - when the user expanded an item - * "contracted" - when the user contracted an item - * "expand,request" - when the user requested to expand an item - * "contract,request" - when the user requested to expand an item - */ EAPI Evas_Object *elm_check_add(Evas_Object *parent); EAPI void elm_check_label_set(Evas_Object *obj, const char *label); @@ -926,9 +919,6 @@ extern "C" { EAPI void elm_check_state_set(Evas_Object *obj, Eina_Bool state); EAPI Eina_Bool elm_check_state_get(const Evas_Object *obj); EAPI void elm_check_state_pointer_set(Evas_Object *obj, Eina_Bool *statep); - /* smart callbacks called: - * "changed" - the user toggled the state - */ EAPI Evas_Object *elm_radio_add(Evas_Object *parent); EAPI void elm_radio_label_set(Evas_Object *obj, const char *label); @@ -940,9 +930,6 @@ extern "C" { EAPI void elm_radio_value_set(Evas_Object *obj, int value); EAPI int elm_radio_value_get(const Evas_Object *obj); EAPI void elm_radio_value_pointer_set(Evas_Object *obj, int *valuep); - /* smart callbacks called: - * "changed" - the user toggled the state - */ EAPI Evas_Object *elm_pager_add(Evas_Object *parent); EAPI void elm_pager_content_push(Evas_Object *obj, Evas_Object *content); @@ -955,8 +942,6 @@ extern "C" { * fade * fade_translucide */ - /* smart callbacks called: - */ typedef struct _Elm_Slideshow_Item_Class Elm_Slideshow_Item_Class; typedef struct _Elm_Slideshow_Item_Class_Func Elm_Slideshow_Item_Class_Func; @@ -988,8 +973,6 @@ extern "C" { EAPI void * elm_slideshow_item_data_get(Elm_Slideshow_Item *item); EAPI Elm_Slideshow_Item* elm_slideshow_item_current_get(Evas_Object *obj); EAPI Evas_Object* elm_slideshow_item_object_get(Elm_Slideshow_Item* item); - /* smart callbacks called: - */ EAPI Evas_Object *elm_fileselector_add(Evas_Object *parent); diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 0eddf0f203..0be1ba98f2 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -316,6 +316,7 @@ struct _Elm_Genlist_Item Eina_Bool hilighted : 1; Eina_Bool expanded : 1; Eina_Bool disabled : 1; + Eina_Bool display_only : 1; Eina_Bool mincalcd : 1; Eina_Bool queued : 1; Eina_Bool showme : 1; @@ -495,7 +496,8 @@ _mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info) evas_object_smart_callback_call(it->wd->obj, "drag", it); return; } - elm_coords_finger_size_adjust(1, &minw, 1, &minh); + if (!it->display_only) + elm_coords_finger_size_adjust(1, &minw, 1, &minh); evas_object_geometry_get(obj, &x, &y, NULL, NULL); x = ev->cur.canvas.x - x; y = ev->cur.canvas.y - y; @@ -815,10 +817,12 @@ _item_realize(Elm_Genlist_Item *it, int in, int calc) if (!it->mincalcd) { Evas_Coord mw = -1, mh = -1; - - elm_coords_finger_size_adjust(1, &mw, 1, &mh); + + if (!it->display_only) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); edje_object_size_min_restricted_calc(it->base, &mw, &mh, mw, mh); - elm_coords_finger_size_adjust(1, &mw, 1, &mh); + if (!it->display_only) + elm_coords_finger_size_adjust(1, &mw, 1, &mh); it->w = it->minw = mw; it->h = it->minh = mh; it->mincalcd = EINA_TRUE; @@ -2387,6 +2391,51 @@ elm_genlist_item_disabled_get(const Elm_Genlist_Item *it) return it->disabled; } +/** + * Sets the display only state of an item. + * + * A display only item cannot be selected or unselected. It is for display + * only and not selecting or otherwise clicking, dragging etc. by the user, + * thus finger size rules will not be applied to this item. + * + * @param it The item + * @param display_only The display only state + * + * @ingroup Genlist + */ +EAPI void +elm_genlist_item_display_only_set(Elm_Genlist_Item *it, Eina_Bool display_only) +{ + if (!it) return; + if (!it->block) return; + if (it->display_only == display_only) return; + if (it->delete_me) return; + it->display_only = display_only; + it->mincalcd = EINA_FALSE; + it->updateme = EINA_TRUE; + it->block->updateme = EINA_TRUE; + if (it->wd->update_job) ecore_job_del(it->wd->update_job); + it->wd->update_job = ecore_job_add(_update_job, it->wd); +} + +/** + * Get the display only state of an item + * + * This gets the display only state of the given item. + * + * @param it The item + * @return The display only state + * + * @ingroup Genlist + */ +EAPI Eina_Bool +elm_genlist_item_display_only_get(const Elm_Genlist_Item *it) +{ + if (!it) return EINA_FALSE; + if (it->delete_me) return EINA_FALSE; + return it->display_only; +} + /** * Show the given item *