From d9ead1fb2626640d86db93ec532a9cb7dbc1186c Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Tue, 28 Feb 2012 05:26:49 +0000 Subject: [PATCH] elementary/genlist - reviewed. SVN revision: 68488 --- legacy/elementary/src/lib/Elementary.h.in | 2 +- legacy/elementary/src/lib/elm_genlist.c | 46 +++++++++++----------- legacy/elementary/src/lib/elm_genlist.h | 48 ++++++++++++++++++----- legacy/elementary/src/lib/elm_glview.c | 2 +- 4 files changed, 64 insertions(+), 34 deletions(-) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index ccf54b1a3c..1c33e95a22 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -204,7 +204,7 @@ EAPI extern Elm_Version *elm_version; #include #include #include //Done -#include +#include //Done + XXX in header, insufficient doc. #include //Done // Woohyun Jung diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index f3196bc966..eb65d807db 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -3557,12 +3557,12 @@ _elm_genlist_item_new(Widget_Data *wd, elm_widget_item_content_get_hook_set(it, _item_content_get_hook); elm_widget_item_content_set_hook_set(it, _item_content_set_hook); elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook); + elm_widget_item_text_get_hook_set(it, _item_text_hook); elm_widget_item_disable_hook_set(it, _item_disable_hook); elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); /* TEMPORARY */ it->sel_cb = (Ecore_Cb)_item_select; - elm_widget_item_text_get_hook_set(it, _item_text_hook); return it; } @@ -4239,7 +4239,8 @@ elm_genlist_item_direct_sorted_insert(Evas_Object *obj, int cmp_result; l = eina_list_search_sorted_near_list(it->parent->item->items, - _elm_genlist_item_list_compare, it, + _elm_genlist_item_list_compare, + it, &cmp_result); if (l) rel = eina_list_data_get(l); @@ -4334,7 +4335,7 @@ _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby) if (wd->walking > 0) { - wd->clear_me = 1; + wd->clear_me = EINA_TRUE; return; } evas_event_freeze(evas_object_evas_get(wd->obj)); @@ -4355,7 +4356,7 @@ _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby) if (itn) itn->walking--; } } - wd->clear_me = 0; + wd->clear_me = EINA_FALSE; wd->pan_changed = EINA_TRUE; if (wd->calc_job) { @@ -4392,7 +4393,7 @@ elm_genlist_multi_select_set(Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->multi = multi; + wd->multi = !!multi; } EAPI Eina_Bool @@ -4439,7 +4440,7 @@ elm_genlist_realized_items_get(const Evas_Object *obj) Eina_List *l; Elm_Gen_Item *it; - done = 1; + done = EINA_TRUE; EINA_LIST_FOREACH(itb->items, l, it) { if (it->realized) list = eina_list_append(list, it); @@ -4628,6 +4629,7 @@ elm_genlist_item_expanded_set(Elm_Object_Item *it, { ELM_OBJ_ITEM_CHECK_OR_RETURN(it); Elm_Gen_Item *_it = (Elm_Gen_Item *) it; + expanded = !!expanded; if (_it->item->expanded == expanded) return; _it->item->expanded = expanded; if (_it->item->expanded) @@ -4662,14 +4664,14 @@ elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it) return ((Elm_Gen_Item *) it)->item->expanded_depth; } -EAPI void +EINA_DEPRECATED EAPI void elm_genlist_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) { elm_object_item_disabled_set(it, disabled); } -EAPI Eina_Bool +EINA_DEPRECATED EAPI Eina_Bool elm_genlist_item_disabled_get(const Elm_Object_Item *it) { return elm_object_item_disabled_get(it); @@ -5184,7 +5186,7 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it) } EAPI int -elm_genlist_item_index_get(Elm_Object_Item *it) +elm_genlist_item_index_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1); Elm_Gen_Item *_it = (Elm_Gen_Item *) it; @@ -5229,13 +5231,13 @@ elm_genlist_mode_get(const Evas_Object *obj) return wd->mode; } -EAPI Elm_List_Mode +EINA_DEPRECATED EAPI Elm_List_Mode elm_genlist_horizontal_get(const Evas_Object *obj) { return elm_genlist_mode_get(obj); } -EAPI Elm_List_Mode +EINA_DEPRECATED EAPI Elm_List_Mode elm_genlist_horizontal_mode_get(const Evas_Object *obj) { return elm_genlist_mode_get(obj); @@ -5248,7 +5250,7 @@ elm_genlist_always_select_mode_set(Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->always_select = always_select; + wd->always_select = !!always_select; } EAPI Eina_Bool @@ -5267,7 +5269,7 @@ elm_genlist_no_select_mode_set(Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->no_select = no_select; + wd->no_select = !!no_select; } EAPI Eina_Bool @@ -5286,7 +5288,7 @@ elm_genlist_compress_mode_set(Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->compress = compress; + wd->compress = !!compress; if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE); } @@ -5331,9 +5333,9 @@ elm_genlist_bounce_set(Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce); - wd->h_bounce = h_bounce; - wd->v_bounce = v_bounce; + wd->h_bounce = !!h_bounce; + wd->v_bounce = !!v_bounce; + elm_smart_scroller_bounce_allow_set(wd->scr, wd->h_bounce, wd->v_bounce); } EAPI void @@ -5356,7 +5358,7 @@ elm_genlist_homogeneous_set(Evas_Object *obj, Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE); - wd->homogeneous = homogeneous; + wd->homogeneous = !!homogeneous; } EAPI Eina_Bool @@ -5370,12 +5372,12 @@ elm_genlist_homogeneous_get(const Evas_Object *obj) EAPI void elm_genlist_block_count_set(Evas_Object *obj, - int n) + int count) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->max_items_per_block = n; + wd->max_items_per_block = count; wd->item_cache_max = wd->max_items_per_block * 2; _item_cache_clean(wd); } @@ -5556,9 +5558,9 @@ elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode) Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; + edit_mode = !!edit_mode; if (wd->edit_mode == edit_mode) return; - wd->edit_mode = !!edit_mode; list = elm_genlist_realized_items_get(obj); if (!wd->edit_mode) { @@ -5592,7 +5594,7 @@ elm_genlist_reorder_mode_set(Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->reorder_mode = reorder_mode; + wd->reorder_mode = !!reorder_mode; } EAPI Eina_Bool diff --git a/legacy/elementary/src/lib/elm_genlist.h b/legacy/elementary/src/lib/elm_genlist.h index 07094118ee..f90694f350 100644 --- a/legacy/elementary/src/lib/elm_genlist.h +++ b/legacy/elementary/src/lib/elm_genlist.h @@ -348,7 +348,8 @@ * * @ingroup Genlist */ -typedef enum +//XXX: Elm_Genlist_Item_Type + typedef enum { ELM_GENLIST_ITEM_NONE = 0, /**< simple item */ ELM_GENLIST_ITEM_SUBITEMS = (1 << 0), /**< may expand and have child items */ @@ -357,9 +358,11 @@ typedef enum ELM_GENLIST_ITEM_MAX = (1 << 2) } Elm_Genlist_Item_Flags; +//XXX: Elm_Genlist_Item_Field_Type typedef enum { ELM_GENLIST_ITEM_FIELD_ALL = 0, + //XXX:ELM_GENLSIT_ITEM_FIELD_TEXT ELM_GENLIST_ITEM_FIELD_LABEL = (1 << 0), ELM_GENLIST_ITEM_FIELD_CONTENT = (1 << 1), ELM_GENLIST_ITEM_FIELD_STATE = (1 << 2) @@ -535,6 +538,7 @@ EAPI Elm_List_Mode elm_genlist_mode_get(const Evas_Object *obj); * * @ingroup Genlist */ +//XXX: How about elm_genlist_select_mode_set() ? EAPI void elm_genlist_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select); /** @@ -548,6 +552,7 @@ EAPI void elm_genlist_always_select_mode_set(Evas_Objec * * @ingroup Genlist */ +//XXX: How about elm_genlist_select_mode_get() ? EAPI Eina_Bool elm_genlist_always_select_mode_get(const Evas_Object *obj); /** @@ -564,6 +569,7 @@ EAPI Eina_Bool elm_genlist_always_select_mode_get(const Evas * * @ingroup Genlist */ +//XXX: elm_genlist_always_select_mode_set and elm_genlist_no_select_mode_set API could be merged to elm_genlist_select_mode_set() EAPI void elm_genlist_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select); /** @@ -577,6 +583,7 @@ EAPI void elm_genlist_no_select_mode_set(Evas_Object *o * * @ingroup Genlist */ +//XXX: elm_genlist_always_select_mode_get and elm_genlist_no_select_mode_get API could be merged to elm_genlist_select_mode_get() EAPI Eina_Bool elm_genlist_no_select_mode_get(const Evas_Object *obj); /** @@ -634,6 +641,7 @@ EAPI Eina_Bool elm_genlist_compress_mode_get(const Evas_Obje * * @ingroup Genlist */ +//XXX: API name is ambiguous.. How about elm_genlist_mode_fixed_width_set? EAPI void elm_genlist_height_for_width_mode_set(Evas_Object *obj, Eina_Bool height_for_width); /** @@ -645,6 +653,7 @@ EAPI void elm_genlist_height_for_width_mode_set(Evas_Ob * * @ingroup Genlist */ +//XXX: API name is ambigious elm_genlist_mode_fixed_width_get() ????? EAPI Eina_Bool elm_genlist_height_for_width_mode_get(const Evas_Object *obj); /** @@ -718,10 +727,10 @@ EAPI Eina_Bool elm_genlist_homogeneous_get(const Evas_Object * Set the maximum number of items within an item block * * @param obj The genlist object - * @param n Maximum number of items within an item block. Default is 32. + * @param count Maximum number of items within an item block. Default is 32. * - * This will configure the block count to tune to the target with - * particular performance matrix. + * This will configure the block count to tune to the target with particular + * performance matrix. * * A block of objects will be used to reduce the number of operations due to * many objects in the screen. It can determine the visibility, or if the @@ -737,7 +746,7 @@ EAPI Eina_Bool elm_genlist_homogeneous_get(const Evas_Object * * @ingroup Genlist */ -EAPI void elm_genlist_block_count_set(Evas_Object *obj, int n); +EAPI void elm_genlist_block_count_set(Evas_Object *obj, int count); /** * Get the maximum number of items within an item block @@ -755,12 +764,16 @@ EAPI int elm_genlist_block_count_get(const Evas_Object * Set the timeout in seconds for the longpress event. * * @param obj The genlist object - * @param timeout timeout in seconds. Default is 1. + * @param timeout timeout in seconds. Default is elm config value(1.0) * * This option will change how long it takes to send an event "longpressed" * after the mouse down signal is sent to the list. If this event occurs, no * "clicked" event will be sent. * + * @warning If you set the longpress timeout value with this API, your genlist + * will not be affected by the longpress value of elementary config value + * later. + * * @see elm_genlist_longpress_timeout_set() * * @ingroup Genlist @@ -893,7 +906,8 @@ EAPI Elm_Object_Item *elm_genlist_item_insert_after(Evas_Object *obj * @ingroup Genlist */ // XXX: deprecate elm_genlist_item_sorted_insert() and rename -// elm_genlist_item_direct_sorted_insert() +// elm_genlist_item_direct_sorted_insert() +// XXX: direct_sorted?? how about deprecating elm_genlist_item_direct_sorted_insert insetead? EAPI Elm_Object_Item *elm_genlist_item_sorted_insert(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Flags flags, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); EAPI Elm_Object_Item *elm_genlist_item_direct_sorted_insert(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Object_Item *parent, Elm_Genlist_Item_Flags flags, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); @@ -1196,6 +1210,7 @@ EAPI int elm_genlist_item_expanded_depth_get(const Elm * * @ingroup Genlist */ +//XXX: elm_genlist_item_event_freeze_set()? EAPI void elm_genlist_item_display_only_set(Elm_Object_Item *it, Eina_Bool display_only); /** @@ -1209,6 +1224,7 @@ EAPI void elm_genlist_item_display_only_set(Elm_Object_ * * @ingroup Genlist */ +//XXX: elm_genlist_item_event_freeze_get()? EAPI Eina_Bool elm_genlist_item_display_only_get(const Elm_Object_Item *it); /** @@ -1218,7 +1234,7 @@ EAPI Eina_Bool elm_genlist_item_display_only_get(const Elm_O * @param it The item to display * * This causes genlist to jump to the given item @p it and show it (by - * immediately scrolling to that position), if it is not fully visible. + * jumping to that position), if it is not fully visible. * * @see elm_genlist_item_bring_in() * @see elm_genlist_item_top_show() @@ -1226,6 +1242,7 @@ EAPI Eina_Bool elm_genlist_item_display_only_get(const Elm_O * * @ingroup Genlist */ +//XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show... EAPI void elm_genlist_item_show(Elm_Object_Item *it); /** @@ -1244,6 +1261,7 @@ EAPI void elm_genlist_item_show(Elm_Object_Item *it); * * @ingroup Genlist */ +//XXX: elm_genlist_item_bring_in(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - bring_in, top_bring_in ... EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it); /** @@ -1253,7 +1271,7 @@ EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it * @param it The item to display * * This causes genlist to jump to the given item @p it and show it (by - * immediately scrolling to that position), if it is not fully visible. + * jumping to the top position), if it is not fully visible. * * The item will be positioned at the top of the genlist viewport. * @@ -1262,6 +1280,7 @@ EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it * * @ingroup Genlist */ +//XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show... EAPI void elm_genlist_item_top_show(Elm_Object_Item *it); /** @@ -1281,6 +1300,7 @@ EAPI void elm_genlist_item_top_show(Elm_Object_Item *it * * @ingroup Genlist */ +//XXX: elm_genlist_item_bring_in(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - bring_in, top_bring_in ... EAPI void elm_genlist_item_top_bring_in(Elm_Object_Item *it); /** @@ -1299,6 +1319,7 @@ EAPI void elm_genlist_item_top_bring_in(Elm_Object_Item * * @ingroup Genlist */ +//XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show... EAPI void elm_genlist_item_middle_show(Elm_Object_Item *it); /** @@ -1318,6 +1339,7 @@ EAPI void elm_genlist_item_middle_show(Elm_Object_Item * * @ingroup Genlist */ +//XXX: elm_genlist_item_bring_in(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - bring_in, top_bring_in ... EAPI void elm_genlist_item_middle_bring_in(Elm_Object_Item *it); /** @@ -1332,6 +1354,7 @@ EAPI void elm_genlist_item_middle_bring_in(Elm_Object_I * * @ingroup Genlist */ +//XXX: elm_genlist_item_all_contents_unset() ?? EAPI void elm_genlist_item_contents_orphan(Elm_Object_Item *it); /** @@ -1354,6 +1377,7 @@ EAPI void elm_genlist_item_contents_orphan(Elm_Object_I * * @ingroup Genlist */ +//XXX: Should be deprecated EAPI const Evas_Object *elm_genlist_item_object_get(const Elm_Object_Item *it); /** @@ -1474,6 +1498,7 @@ EAPI void elm_genlist_item_tooltip_text_set(Elm_Object_ * * @ingroup Genlist */ +//XXX: Need to review tooltip & cursor APIs EAPI void elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); /** @@ -1692,7 +1717,7 @@ EAPI Eina_Bool elm_genlist_item_cursor_engine_only_get(const * * @ingroup Genlist */ -EAPI int elm_genlist_item_index_get(Elm_Object_Item *it); +EAPI int elm_genlist_item_index_get(const Elm_Object_Item *it); /** * Update the contents of all realized items. @@ -1752,6 +1777,7 @@ EAPI void elm_genlist_realized_items_update(Evas_Object * * @ingroup Genlist */ +//XXX: How bout elm_genlist_mode_item_set EAPI void elm_genlist_item_mode_set(Elm_Object_Item *it, const char *mode_type, Eina_Bool mode_set); /** @@ -1767,6 +1793,7 @@ EAPI void elm_genlist_item_mode_set(Elm_Object_Item *it * * @ingroup Genlist */ +//XXX: looks weird... set the mode type to item and get the mode type from object... EAPI const char *elm_genlist_mode_type_get(const Evas_Object *obj); /** @@ -1819,6 +1846,7 @@ EAPI Eina_Bool elm_genlist_reorder_mode_get(const Evas_Objec * * @ingroup Genlist */ +//XXX: type would be more intuitive... EAPI Elm_Genlist_Item_Flags elm_genlist_item_flags_get(const Elm_Object_Item *it); #define ELM_GENLIST_ITEM_CLASS_VERSION 2 /* current version number */ diff --git a/legacy/elementary/src/lib/elm_glview.c b/legacy/elementary/src/lib/elm_glview.c index 049e8a58dc..d9fd98c692 100644 --- a/legacy/elementary/src/lib/elm_glview.c +++ b/legacy/elementary/src/lib/elm_glview.c @@ -5,7 +5,7 @@ typedef struct _Widget_Data Widget_Data; struct _Widget_Data { - Evas_Object *glview_image; + Evas_Object *glview_image; Elm_GLView_Mode mode; Elm_GLView_Resize_Policy scale_policy;