From 0815143253211b2e1b40cba9bfc191944b362b1a Mon Sep 17 00:00:00 2001 From: Davide Andreoli Date: Sat, 27 Sep 2008 21:29:55 +0000 Subject: [PATCH] * add the ability to rename a \'data\' object * initial color_class support SVN revision: 36281 --- legacy/edje/src/lib/Edje_Edit.h | 27 +++++++++++++++-- legacy/edje/src/lib/edje_edit.c | 51 ++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/legacy/edje/src/lib/Edje_Edit.h b/legacy/edje/src/lib/Edje_Edit.h index ab432ae522..c16bba9084 100644 --- a/legacy/edje/src/lib/Edje_Edit.h +++ b/legacy/edje/src/lib/Edje_Edit.h @@ -258,8 +258,31 @@ edje_edit_data_value_get( EAPI unsigned char ///@return TRUE on success edje_edit_data_value_set( Evas_Object * obj, ///< The edje object - const char *itemname, ///< The name of the data item - const char *value ///< The new value to set + const char *itemname, ///< The name of the data item + const char *value ///< The new value to set +); + +EAPI unsigned char ///@return TRUE on success +edje_edit_data_name_set( + Evas_Object *obj, ///< The edje object + const char *itemname, ///< The name of the data item + const char *newname ///< The new name to set +); + +//@} +/******************************************************************************/ +/*********************** COLOR CLASSES API ********************************/ +/******************************************************************************/ +/** @name Color Classes API + * Functions to deal with Color Classes (see @ref edcref). + */ //@{ + +/**Get the list of all the Color Classes in the given edje object. + * Use edje_edit_string_list_free() when you don't need it anymore. + */ +EAPI Evas_List * ///@return An Evas_List* of string (char *)containing all the classes names. +edje_edit_color_classes_list_get( + Evas_Object * obj ///< The edje object ); diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index bd0f60cfc0..794b2506e6 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -995,7 +995,7 @@ edje_edit_data_value_get(Evas_Object * obj, char *itemname) } EAPI unsigned char -edje_edit_data_value_set( Evas_Object * obj, const char *itemname, const char *value) +edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value) { Evas_List *l; @@ -1018,6 +1018,55 @@ edje_edit_data_value_set( Evas_Object * obj, const char *itemname, const char *v return 0; } +EAPI unsigned char +edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname) +{ + Evas_List *l; + + GET_ED_OR_RETURN(0); + + if (!itemname || !newname || !ed->file || !ed->file->data) + return 0; + + for (l = ed->file->data; l; l = l->next) + { + Edje_Data *d = l->data; + if (strcmp(d->key, itemname) == 0) + { + _edje_if_string_free(ed, d->key); + d->key = (char*)evas_stringshare_add(newname); + return 1; + } + } + + return 0; +} + +/***********************/ +/* COLOR CLASSES API */ +/***********************/ + +EAPI Evas_List * +edje_edit_color_classes_list_get(Evas_Object * obj) +{ + Edje_Color_Class *cc; + Evas_List *classes = NULL; + Evas_List *l; + + GET_ED_OR_RETURN(NULL); +printf("GET CLASSES LIST\n"); + if (!ed->file || !!ed->color_classes) + return NULL; +printf("GET CLASSES LIST %d\n", evas_list_count(ed->color_classes)); + for (l = ed->file->color_classes; l; l = l->next) + { + cc = l->data; + classes = evas_list_append(classes, evas_stringshare_add(cc->name)); + } + + return classes; +} + /***************/ /* PARTS API */