From: discomfitor Date: Thu, 29 Dec 2011 23:05:26 +0000 (+0000) Subject: add items_count for toolbar to bypase O(N) counting on an inlist X-Git-Tag: REL_F_I9500_20120323_1~17^2~1023 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12ca1b911f2311f2c6f9d9788c88a957820c8f6b;p=framework%2Fuifw%2Felementary.git add items_count for toolbar to bypase O(N) counting on an inlist git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66646 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index a9f5187..b2de943 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -1563,7 +1563,6 @@ extern "C" { * @param size The cache flush interval time * @ingroup Caches */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_cache_flush_interval_all_set(int size); /** @@ -1606,7 +1605,6 @@ extern "C" { * @param size The cache flush enabled state * @ingroup Caches */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_cache_flush_enabled_all_set(Eina_Bool enabled); /** @@ -1639,7 +1637,6 @@ extern "C" { * @param size The font cache size * @ingroup Caches */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_font_cache_all_set(int size); /** @@ -1672,7 +1669,6 @@ extern "C" { * @param size The image cache size * @ingroup Caches */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_image_cache_all_set(int size); /** @@ -1707,7 +1703,6 @@ extern "C" { * @param size The edje file cache size * @ingroup Caches */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_edje_file_cache_all_set(int size); /** @@ -1742,7 +1737,6 @@ extern "C" { * @param size The edje collections cache size * @ingroup Caches */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_edje_collection_cache_all_set(int size); /** @@ -1794,7 +1788,6 @@ extern "C" { * @param scale The scaling factor to set * @ingroup Scaling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scale_all_set(double scale); /** @@ -2263,7 +2256,6 @@ extern "C" { * * @see elm_engine_set() */ - // XXX: rename to elm_engine_get() EAPI const char *elm_engine_current_get(void); /** @@ -2394,7 +2386,6 @@ extern "C" { * * This applies all font overlays set to all objects in the UI. */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_font_overlay_all_apply(void); /** @@ -2526,7 +2517,6 @@ extern "C" { * @param size The finger size * @ingroup Fingers */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_finger_size_all_set(Evas_Coord size); /** @@ -2868,7 +2858,6 @@ extern "C" { * @see elm_thumbscroll_bounce_enabled_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_bounce_enabled_all_set(Eina_Bool enabled); /** @@ -2901,7 +2890,6 @@ extern "C" { * @see elm_thumbscroll_bounce_friction_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_bounce_friction_all_set(double friction); /** @@ -2934,7 +2922,6 @@ extern "C" { * @see elm_thumbscroll_page_scroll_friction_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_page_scroll_friction_all_set(double friction); /** @@ -2967,7 +2954,6 @@ extern "C" { * @see elm_thumbscroll_bring_in_scroll_friction_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_bring_in_scroll_friction_all_set(double friction); /** @@ -3001,7 +2987,6 @@ extern "C" { * @see elm_thumbscroll_zoom_friction_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_zoom_friction_all_set(double friction); /** @@ -3038,7 +3023,6 @@ extern "C" { * @see elm_thumbscroll_enabled_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled); /** @@ -3074,7 +3058,6 @@ extern "C" { * @see elm_thumbscroll_threshould_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold); /** @@ -3110,7 +3093,6 @@ extern "C" { * @see elm_thumbscroll_momentum_threshould_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold); /** @@ -3143,7 +3125,6 @@ extern "C" { * @see elm_thumbscroll_friction_get() * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_thumbscroll_friction_all_set(double friction); /** @@ -3187,7 +3168,6 @@ extern "C" { * * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_thumbscroll_border_friction_all_set(double friction); /** @@ -3228,7 +3208,6 @@ extern "C" { * * @ingroup Scrolling */ - // XXX: deprecate and replace with elm_config_all_flush() EAPI void elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction); /** @@ -4343,7 +4322,6 @@ extern "C" { * * @see elm_win_transparent_set() */ - // XXX: deprecate this EAPI Eina_Bool elm_win_transparent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** @@ -4356,7 +4334,6 @@ extern "C" { * * @see elm_win_alpha_set() */ - // XXX: deprecate this EAPI void elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent) EINA_ARG_NONNULL(1); /** @@ -4850,7 +4827,6 @@ extern "C" { * @param parent The parent object * @return The new object or NULL if it cannot be created */ - // XXX: deprecate this EAPI Evas_Object *elm_win_inwin_add(Evas_Object *obj) EINA_ARG_NONNULL(1); /** @@ -4866,7 +4842,6 @@ extern "C" { * * @param obj The inwin to activate */ - // XXX: deprecate this EAPI void elm_win_inwin_activate(Evas_Object *obj) EINA_ARG_NONNULL(1); /** @@ -4879,7 +4854,6 @@ extern "C" { * @param obj The inwin object * @param content The object to set as content */ - // XXX: deprecate this EAPI void elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1); /** @@ -4897,7 +4871,6 @@ extern "C" { * @param obj The inwin object * @return The content that is being used */ - // XXX: deprecate this EAPI Evas_Object *elm_win_inwin_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** @@ -4908,7 +4881,6 @@ extern "C" { * @param obj The inwin object * @return The content that was being used */ - // XXX: deprecate this EAPI Evas_Object *elm_win_inwin_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); /** @@ -5705,11 +5677,8 @@ extern "C" { ELM_IMAGE_ROTATE_90 = 1, /**< rotate 90 degrees clockwise */ ELM_IMAGE_ROTATE_180 = 2, /**< rotate 180 degrees clockwise */ ELM_IMAGE_ROTATE_270 = 3, /**< rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise) */ - // XXX: remove /*EINA_DEPRECATED*/ELM_IMAGE_ROTATE_90_CW = 1, /**< rotate 90 degrees clockwise */ - // XXX: remove /*EINA_DEPRECATED*/ELM_IMAGE_ROTATE_180_CW = 2, /**< rotate 180 degrees clockwise */ - // XXX: remove /*EINA_DEPRECATED*/ELM_IMAGE_ROTATE_90_CCW = 3, /**< rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise) */ ELM_IMAGE_FLIP_HORIZONTAL = 4, /**< flip image horizontally */ ELM_IMAGE_FLIP_VERTICAL = 5, /**< flip image vertically */ @@ -16685,6 +16654,14 @@ extern "C" { * @ingroup Toolbar */ EAPI Eina_Bool elm_toolbar_horizontal_get(const Evas_Object *obj); + + /** + * Get the number of items in a toolbar + * @param obj The toolbar object + * @return The number of items in @p obj toolbar + * @ingroup Toolbar + */ + EAPI unsigned int elm_toolbar_items_count(const Evas_Object *obj) EINA_ARG_NONNULL(1) EINA_PURE; /** * @} */ diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index c0e4b51..55969a2 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -16,6 +16,7 @@ struct _Widget_Data Elm_Toolbar_Shrink_Mode shrink_mode; Elm_Icon_Lookup_Order lookup_order; int icon_size; + unsigned int item_count; double align; Eina_Bool homogeneous : 1; Eina_Bool no_select : 1; @@ -855,6 +856,7 @@ _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb f evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_RESIZE, _resize_item, obj); if ((!wd->items) && wd->always_select) _item_select(it); + wd->item_count++; return it; } @@ -1460,6 +1462,7 @@ elm_toolbar_item_del(Elm_Object_Item *it) obj2 = WIDGET(item); next = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(item)->next); wd->items = eina_inlist_remove(wd->items, EINA_INLIST_GET(item)); + wd->item_count--; if (!next) next = ELM_TOOLBAR_ITEM_FROM_INLIST(wd->items); if (wd->always_select && item->selected && next) _item_select(next); _item_del(item); @@ -2025,3 +2028,12 @@ elm_toolbar_horizontal_get(const Evas_Object *obj) if (!wd) return EINA_FALSE; return !wd->vertical; } + +EAPI unsigned int +elm_toolbar_items_count(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + return wd->item_count; +}