From 2b8ae14cd26eb8fc9b0e97f0dcbbae94b4f9af6c Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Wed, 27 Jul 2011 09:49:14 +0000 Subject: [PATCH] elementary - added common APIs elm_object_content_set/get/unset Now need to widgets use them. SVN revision: 61802 --- legacy/elementary/src/lib/Elementary.h.in | 45 +++++++++++++++++ legacy/elementary/src/lib/elm_main.c | 21 ++++++++ legacy/elementary/src/lib/elm_widget.c | 61 +++++++++++++++++++++++ legacy/elementary/src/lib/elm_widget.h | 7 ++- 4 files changed, 133 insertions(+), 1 deletion(-) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 064f4a5639..d8f7fce035 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -710,6 +710,51 @@ extern "C" { #define elm_object_text_get(obj) elm_object_text_part_get((obj), NULL) + /** + * Set a content of an object + * + * @param obj The Elementary object + * @param item The content id to set (NULL for the default content) + * @param content The new content of the object + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ + EAPI void elm_object_content_part_set(Evas_Object *obj, const char *item, Evas_Object *content); + +#define elm_object_content_set(obj, content) elm_object_content_part_set((obj), NULL, (content)) + + /** + * Get a content of an object + * + * @param obj The Elementary object + * @param item The content id to get (NULL for the default content) + * @return content of the object or + * NULL for any error + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ + EAPI Evas_Object *elm_object_content_part_get(const Evas_Object *obj, const char *item); + +#define elm_object_content_get(obj) elm_object_content_part_get((obj), NULL) + + /** + * Unset a content of an object + * + * @param obj The Elementary object + * @param item The content id to unset (NULL for the default content) + * + * @note Elementary objects may have many contents + * + * @ingroup General + */ + EAPI Evas_Object *elm_object_content_part_unset(Evas_Object *obj, const char *item); + +#define elm_object_content_unset(obj) elm_object_content_part_unset((obj), NULL) + /** * @} */ diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 983b528d51..e8ad7a8f4b 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -1214,6 +1214,27 @@ elm_object_text_part_get(const Evas_Object *obj, const char *item) return elm_widget_text_part_get(obj, item); } +EAPI void +elm_object_content_part_set(Evas_Object *obj, const char *item, Evas_Object *content) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + elm_widget_content_part_set(obj, item, content); +} + +EAPI Evas_Object * +elm_object_content_part_get(const Evas_Object *obj, const char *item) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_content_part_get(obj, item); +} + +EAPI Evas_Object * +elm_object_content_part_unset(Evas_Object *obj, const char *item) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + return elm_widget_content_part_unset(obj, item); +} + /** * Get the global scaling factor * diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 9f321e4a2c..7ee72792f8 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -75,6 +75,13 @@ struct _Smart_Data const char *text); const char *(*on_text_get_func)(const Evas_Object *obj, const char *item); + void (*on_content_set_func)(Evas_Object *obj, + const char *item, + Evas_Object *content); + Evas_Object *(*on_content_get_func)(const Evas_Object *obj, + const char *item); + Evas_Object *(*on_content_unset_func)(Evas_Object *obj, + const char *item); void *data; Evas_Coord rx, ry, rw, rh; int scroll_hold; @@ -501,6 +508,33 @@ elm_widget_text_get_hook_set(Evas_Object *obj, sd->on_text_get_func = func; } +EAPI void +elm_widget_content_set_hook_set(Evas_Object *obj, + void (*func)(Evas_Object *obj, + const char *item, + Evas_Object *content)) +{ + API_ENTRY return; + sd->on_content_set_func = func; +} + +EAPI void +elm_widget_content_get_hook_set(Evas_Object *obj, + Evas_Object *(*func)(const Evas_Object *obj, const char *item)) +{ + API_ENTRY return; + sd->on_content_get_func = func; +} + +EAPI void +elm_widget_content_unset_hook_set(Evas_Object *obj, + Evas_Object *(*func)(Evas_Object *obj, + const char *item)) +{ + API_ENTRY return; + sd->on_content_unset_func = func; +} + EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj)) @@ -2042,6 +2076,33 @@ elm_widget_text_part_get(const Evas_Object *obj, const char *item) return sd->on_text_get_func(obj, item); } +EAPI void +elm_widget_content_part_set(Evas_Object *obj, const char *item, Evas_Object *content) +{ + API_ENTRY return; + + if (!sd->on_content_set_func) return; + sd->on_content_set_func(obj, item, content); +} + +EAPI Evas_Object * +elm_widget_content_part_get(const Evas_Object *obj, const char *item) +{ + API_ENTRY return NULL; + + if (!sd->on_content_get_func) return NULL; + return sd->on_content_get_func(obj, item); +} + +EAPI Evas_Object * +elm_widget_content_part_unset(Evas_Object *obj, const char *item) +{ + API_ENTRY return NULL; + + if (!sd->on_content_unset_func) return NULL; + return sd->on_content_unset_func(obj, item); +} + EAPI Elm_Theme * elm_widget_theme_get(const Evas_Object *obj) { diff --git a/legacy/elementary/src/lib/elm_widget.h b/legacy/elementary/src/lib/elm_widget.h index b8885beb42..895a424cb6 100644 --- a/legacy/elementary/src/lib/elm_widget.h +++ b/legacy/elementary/src/lib/elm_widget.h @@ -230,6 +230,9 @@ EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void EAPI void elm_widget_focus_region_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)); EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *item, const char *text)); EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, const char *(*func)(const Evas_Object *obj, const char *item)); +EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *item, Evas_Object *content)); +EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Evas_Object *(*func)(const Evas_Object *obj, const char *item)); +EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Evas_Object *(*func)(Evas_Object *obj, const char *item)); EAPI void elm_widget_on_focus_region_hook_set(Evas_Object *obj, void (*func) (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)); EAPI void elm_widget_data_set(Evas_Object *obj, void *data); EAPI void *elm_widget_data_get(const Evas_Object *obj); @@ -313,7 +316,9 @@ EAPI void elm_widget_focus_mouse_down_handle(Evas_Object *obj); EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj); EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *item, const char *label); EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *item); - +EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *item, Evas_Object *content); +EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *item); +EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *item); EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size); EAPI void _elm_widget_item_del(Elm_Widget_Item *item); EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);