furrymyad pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d4b622e9eb3b39ea082040bb8416871d270c5e53

commit d4b622e9eb3b39ea082040bb8416871d270c5e53
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Tue Feb 23 17:25:21 2016 +0000

    Edje_Edit: support new edje top block "size classes" with edje_edit API
    
    Plenty of new API:
    edje_edit_size_classes_list_get - to return total list of size_classes 
inside of
    loaded collection of groups
    edje_edit_size_class_add - add new size class into loaded collection
    edje_edit_size_class_del - deleting
    edje_edit_size_class_name_set - renaming existing size class into something 
new
    and some setters and getters for min and max (width and height) of size 
class.
---
 src/lib/edje/Edje_Edit.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++
 src/lib/edje/edje_edit.c | 136 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 297 insertions(+)

diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 2d44e02..12af3d7 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -730,6 +730,167 @@ EAPI Eina_Bool edje_edit_group_data_name_set(Evas_Object 
*obj, const char *itemn
 
 //@}
 /*****************************************************************************/
+/***********************   SIZE CLASSES API   ********************************/
+/*****************************************************************************/
+/** @name Size Classes API
+ *  Functions to deal with Size Classes (see @ref edcref).
+ */ //@{
+
+/** Get the list of all the Size Classes in the given edje object.
+ *
+ * @param obj Object being edited.
+ *
+ * @return List of strings, each being one size class.
+ *         The return value should be freed with edje_edit_string_list_free().
+ *
+ * @see edje_edit_string_list_free()
+ *
+ * @since 1.18
+ */
+EAPI Eina_List *
+edje_edit_size_classes_list_get(Evas_Object *obj);
+
+/** Create a new size class object in the given edje.
+ *
+ * If class is already exist then nothing is created and EINA_FALSE returned.
+ *
+ * @param obj Object being edited.
+ * @param name Name for the new size class.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_add(Evas_Object *obj, const char *name);
+
+/** Delete size class object from edje.
+ *
+ * @param obj Object being edited.
+ * @param name Size class to delete.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_del(Evas_Object *obj, const char *name);
+
+/** Change name of a size class.
+ *
+ * @param obj Object being edited.
+ * @param name Size class to rename.
+ * @param newname New name for the size class.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_name_set(Evas_Object *obj, const char *name, const char 
*newname);
+
+/** Return width min size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to fetch values.
+ *
+ * @return @c Evas_Coord.
+ *
+ * @since 1.18
+ */
+EAPI Evas_Coord
+edje_edit_size_class_min_w_get(Evas_Object *obj, const char *class_name);
+
+/** Set width min size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to set values.
+ * @param size Size which is greater or equal than zero (0).
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_min_w_set(Evas_Object *obj, const char *class_name, 
Evas_Coord size);
+
+/** Return width max size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to fetch values.
+ *
+ * @return @c Evas_Coord.
+ *
+ * @since 1.18
+ */
+EAPI Evas_Coord
+edje_edit_size_class_max_w_get(Evas_Object *obj, const char *class_name);
+
+/** Set width max size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to set values.
+ * @param size Size which is greater or equal than zero (0).
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_max_w_set(Evas_Object *obj, const char *class_name, 
Evas_Coord size);
+
+/** Return height min size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to fetch values.
+ *
+ * @return @c Evas_Coord.
+ *
+ * @since 1.18
+ */
+EAPI Evas_Coord
+edje_edit_size_class_min_h_get(Evas_Object *obj, const char *class_name);
+
+/** Set height min size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to set values.
+ * @param size Size which is greater or equal than zero (0).
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_min_h_set(Evas_Object *obj, const char *class_name, 
Evas_Coord size);
+
+/** Return height max size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to fetch values.
+ *
+ * @return @c Evas_Coord (-1 is default value).
+ *
+ * @since 1.18
+ */
+EAPI Evas_Coord
+edje_edit_size_class_max_h_get(Evas_Object *obj, const char *class_name);
+
+/** Set height max size of specified size class.
+ *
+ * @param obj Object being edited.
+ * @param class_name Size class to set values.
+ * @param size Size which is greater or equal minus one (-1, which is default 
value).
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ *
+ * @since 1.18
+ */
+EAPI Eina_Bool
+edje_edit_size_class_max_h_set(Evas_Object *obj, const char *class_name, 
Evas_Coord size);
+
+//@}
+/*****************************************************************************/
 /***********************   TEXT CLASSES API   ********************************/
 /*****************************************************************************/
 /** @name Text Classes API
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index d9545bc..5299b2d 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -7374,6 +7374,142 @@ edje_edit_state_map_on_set(Evas_Object *obj, const char 
*part, const char *state
 }
 
 /*********************/
+/*  SIZE CLASSES API */
+/*********************/
+
+EAPI Eina_List *
+edje_edit_size_classes_list_get(Evas_Object *obj)
+{
+   Eina_List *classes = NULL;
+   Eina_List *l;
+   Edje_Size_Class *sc;
+
+   GET_ED_OR_RETURN(NULL);
+
+   if (!ed->file || !ed->file->size_classes)
+     return NULL;
+   EINA_LIST_FOREACH(ed->file->size_classes, l, sc)
+     classes = eina_list_append(classes, eina_stringshare_add(sc->name));
+
+   return classes;
+}
+
+EAPI Eina_Bool
+edje_edit_size_class_add(Evas_Object *obj, const char *name)
+{
+   Eina_List *l;
+   Edje_Size_Class *sc, *s;
+
+   GET_ED_OR_RETURN(EINA_FALSE);
+
+   if (!name || !ed->file)
+     return EINA_FALSE;
+
+   EINA_LIST_FOREACH(ed->file->size_classes, l, sc)
+     if (strcmp(sc->name, name) == 0)
+       return EINA_FALSE;
+
+   s = _alloc(sizeof(Edje_Size_Class));
+   if (!s) return EINA_FALSE;
+
+   s->name = eina_stringshare_add(name);
+   /* set default values for max */
+   s->maxh = -1;
+   s->maxh = -1;
+
+   ed->file->size_classes = eina_list_append(ed->file->size_classes, s);
+
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_size_class_del(Evas_Object *obj, const char *name)
+{
+   Eina_List *l;
+   Edje_Size_Class *sc;
+
+   GET_ED_OR_RETURN(EINA_FALSE);
+
+   if (!name || !ed->file || !ed->file->size_classes)
+     return EINA_FALSE;
+
+   EINA_LIST_FOREACH(ed->file->size_classes, l, sc)
+     if (strcmp(sc->name, name) == 0)
+       {
+          _edje_if_string_free(ed, &sc->name);
+          ed->file->size_classes = eina_list_remove(ed->file->size_classes, 
sc);
+          free(sc);
+          return EINA_TRUE;
+       }
+   return EINA_FALSE;
+}
+
+EAPI Eina_Bool
+edje_edit_size_class_name_set(Evas_Object *obj, const char *name, const char 
*newname)
+{
+   Eina_List *l;
+   Edje_Size_Class *sc;
+
+   GET_ED_OR_RETURN(EINA_FALSE);
+
+   if (!ed->file || !ed->file->size_classes || !newname)
+     return EINA_FALSE;
+
+   EINA_LIST_FOREACH(ed->file->size_classes, l, sc)
+     if (!strcmp(sc->name, name))
+       {
+          _edje_if_string_replace(ed, &sc->name, newname);
+          return EINA_TRUE;
+       }
+
+   return EINA_FALSE;
+}
+#define FUNC_SIZE_CLASS(TYPE, VALUE, MIN)                                      
        \
+EAPI Evas_Coord                                                                
        \
+edje_edit_size_class_##TYPE##_##VALUE##_get(Evas_Object *obj, const char 
*class_name)  \
+{                                                                              
        \
+   Eina_List *l;                                                               
        \
+   Edje_Size_Class *sc;                                                        
        \
+                                                                               
        \
+   GET_ED_OR_RETURN(EINA_FALSE);                                               
        \
+                                                                               
        \
+   if (!ed->file || !ed->file->size_classes || !class_name)                    
        \
+     return EINA_FALSE;                                                        
        \
+                                                                               
        \
+   EINA_LIST_FOREACH(ed->file->size_classes, l, sc)                            
        \
+      if (!strcmp(sc->name, class_name))                                       
        \
+        return sc->TYPE##VALUE;                                                
        \
+                                                                               
        \
+   return 0;                                                                   
        \
+}                                                                              
        \
+EAPI Eina_Bool                                                                 
        \
+edje_edit_size_class_##TYPE##_##VALUE##_set(Evas_Object *obj, const char 
*class_name, Evas_Coord size)\
+{                                                                              
        \
+   Eina_List *l;                                                               
        \
+   Edje_Size_Class *sc;                                                        
        \
+                                                                               
        \
+   GET_ED_OR_RETURN(EINA_FALSE);                                               
        \
+                                                                               
        \
+   if (!ed->file || !ed->file->size_classes || !class_name)                    
        \
+     return EINA_FALSE;                                                        
        \
+   if (size < MIN)                                                             
        \
+     return EINA_FALSE;                                                        
        \
+                                                                               
        \
+   EINA_LIST_FOREACH(ed->file->size_classes, l, sc)                            
        \
+     if (!strcmp(sc->name, class_name))                                        
        \
+       {                                                                       
        \
+          sc->TYPE##VALUE = size;                                              
        \
+          return EINA_TRUE;                                                    
        \
+       }                                                                       
        \
+   return EINA_FALSE;                                                          
        \
+}
+
+FUNC_SIZE_CLASS(min, w, 0)
+FUNC_SIZE_CLASS(min, h, 0)
+FUNC_SIZE_CLASS(max, w, -1)
+FUNC_SIZE_CLASS(max, h, -1)
+
+/*********************/
 /*  TEXT CLASSES API */
 /*********************/
 

-- 


Reply via email to