content_get for layout and some macros to make it easier to set

things in common layouts


SVN revision: 53929
This commit is contained in:
Iván Briano 2010-10-27 17:41:25 +00:00
parent 9bd54d59d6
commit 5074503bba
2 changed files with 87 additions and 0 deletions

View File

@ -872,6 +872,7 @@ extern "C" {
EAPI Eina_Bool elm_layout_file_set(Evas_Object *obj, const char *file, const char *group);
EAPI Eina_Bool elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style);
EAPI void elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content);
EAPI const Evas_Object *elm_layout_content_get(const Evas_Object *obj, const char *swallow);
EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow);
EAPI void elm_layout_text_set(Evas_Object *obj, const char *part, const char *text);
EAPI const char *elm_layout_text_get(const Evas_Object *obj, const char *part);
@ -896,6 +897,66 @@ extern "C" {
EAPI Eina_Bool elm_layout_part_cursor_engine_only_set(Evas_Object *obj, const char *part_name, Eina_Bool engine_only);
EAPI Eina_Bool elm_layout_part_cursor_engine_only_get(const Evas_Object *obj, const char *part_name);
/**
* @def elm_layout_icon_set
* Convienience macro to set the icon object in a layout that follows the
* Elementary naming convention for its parts.
*
* @ingroup Layout
*/
#define elm_layout_icon_set(_ly, _obj) \
elm_layout_content_set((_ly), "elm.swallow.icon", (_obj))
/**
* @def elm_layout_icon_get
* Convienience macro to get the icon object from a layout that follows the
* Elementary naming convention for its parts.
*
* @ingroup Layout
*/
#define elm_layout_icon_get(_ly, _obj) \
elm_layout_content_get((_ly), "elm.swallow.icon", (_obj))
/**
* @def elm_layout_end_set
* Convienience macro to set the end object in a layout that follows the
* Elementary naming convention for its parts.
*
* @ingroup Layout
*/
#define elm_layout_end_set(_ly, _obj) \
elm_layout_content_set((_ly), "elm.swallow.end", (_obj))
/**
* @def elm_layout_end_get
* Convienience macro to get the end object in a layout that follows the
* Elementary naming convention for its parts.
*
* @ingroup Layout
*/
#define elm_layout_end_get(_ly, _obj) \
elm_layout_content_get((_ly), "elm.swallow.end", (_obj))
/**
* @def elm_layout_label_set
* Convienience macro to set the label in a layout that follows the
* Elementary naming convention for its parts.
*
* @ingroup Layout
*/
#define elm_layout_label_set(_ly, _txt) \
elm_layout_text_set((_ly), "elm.text", (_txt))
/**
* @def elm_layout_label_get
* Convienience macro to get the label in a layout that follows the
* Elementary naming convention for its parts.
*
* @ingroup Layout
*/
#define elm_layout_label_get(_ly, _txt) \
elm_layout_text_get((_ly), "elm.text", (_txt))
/* smart callbacks called:
*/

View File

@ -416,6 +416,32 @@ elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conte
_request_sizing_eval(wd);
}
/**
* Get the swallowed object in the given part
*
* @param obj The layout object
* @param swallow The SWALLOW part to get its content
*
* @return The swallowed object or NULL if none or an error occurred
*
* @ingroup Layout
*/
EAPI const Evas_Object *
elm_layout_content_get(const Evas_Object *obj, const char *swallow)
{
Widget_Data *wd = elm_widget_data_get(obj);
const Eina_List *l;
Subinfo *si;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_LIST_FOREACH(wd->subs, l, si)
{
if ((si->type == SWALLOW) && !strcmp(swallow, si->part))
return si->obj;
}
return NULL;
}
/**
* Unset the layout content
*