edje: Edje_Edit - functions to edit layouts of BOX parts 62/49962/2
authorVitalii Vorobiov <vi.vorobiov@samsung.com>
Fri, 13 Feb 2015 16:47:56 +0000 (18:47 +0200)
committerNikita Belyavskij <m.biliavskyi@samsung.com>
Thu, 22 Oct 2015 23:39:46 +0000 (16:39 -0700)
New functions for setting such BOX's params like primary and fallback layouts:
> edje_edit_state_box_layout_set
> edje_edit_state_box_layout_get
> edje_edit_state_box_alt_layout_set
> edje_edit_state_box_alt_layout_get

@feature

Change-Id: I7ba14f832eb3a8055f2236db628eea4afbe00b3f
origin: upstream

src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index 12db53b..2146b22 100644 (file)
@@ -1833,6 +1833,106 @@ EAPI Eina_Bool edje_edit_part_drag_threshold_set(Evas_Object *obj, const char *p
 
 //@}
 /******************************************************************************/
+/**************************      BOX & TABLE API      *************************/
+/******************************************************************************/
+/** @name Box and Table API
+ *  Functions to deal with table and box (see @ref edcref).
+ */ //@{
+
+/** Get primary layout of the box.
+ *
+ * @note The returned string should be freed with @c eina_stringshare_del().
+ * @param obj Object being edited.
+ * @param part Part that have BOX type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ *
+ * @return Primary layout of a BOX part in given state.
+ * @since 1.14
+ */
+EAPI Eina_Stringshare *
+edje_edit_state_box_layout_get(Evas_Object *obj, const char *part,
+                               const char *state, double value);
+
+/** Set primary layout of the box.
+ *
+ * When trying to set primary layout to NULL, function will use
+ * alternative layout instead.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have BOX type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param layout New primary layout to set name.
+ *
+ * Possible layouts:
+ *     @li horizontal (default)
+ *     @li vertical
+ *     @li horizontal_homogeneous
+ *     @li vertical_homogeneous
+ *     @li horizontal_max (homogeneous to the max sized child)
+ *     @li vertical_max
+ *     @li horizontal_flow
+ *     @li vertical_flow
+ *     @li stack
+ *     @li some_other_custom_layout_set_by_the_application
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+EAPI Eina_Bool
+edje_edit_state_box_layout_set(Evas_Object *obj, const char *part,
+                               const char *state, double value,
+                               char *layout);
+
+/** Get fallback layout of the box.
+ *
+ * @note The returned string should be freed with @c eina_stringshare_del().
+ * @param obj Object being edited.
+ * @param part Part that have BOX type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ *
+ * @return Fallback layout of a BOX part in given state.
+ * @since 1.14
+ */
+EAPI Eina_Stringshare *
+edje_edit_state_box_alt_layout_get(Evas_Object *obj, const char *part,
+                                   const char *state, double value);
+
+/** Set fallback layout of the box.
+ *
+ * When trying to set fallback layout to NULL, function will use
+ * default layout ("horizontal") instead.
+ *
+ * @param obj Object being edited.
+ * @param part Part that have BOX type.
+ * @param state Name of the state.
+ * @param value Value of the state.
+ * @param layout New fallback layout to set name.
+ *
+ * Possible layouts:
+ *     @li horizontal (default)
+ *     @li vertical
+ *     @li horizontal_homogeneous
+ *     @li vertical_homogeneous
+ *     @li horizontal_max (homogeneous to the max sized child)
+ *     @li vertical_max
+ *     @li horizontal_flow
+ *     @li vertical_flow
+ *     @li stack
+ *     @li some_other_custom_layout_set_by_the_application
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ * @since 1.14
+ */
+EAPI Eina_Bool
+edje_edit_state_box_alt_layout_set(Evas_Object *obj, const char *part,
+                                   const char *state, double value,
+                                   char *layout);
+
+//@}
+/******************************************************************************/
 /**************************   BOX & TABLE ITEMS API   *************************/
 /******************************************************************************/
 /** @name Items API
index 8426114..2fb7e0f 100644 (file)
@@ -4135,6 +4135,44 @@ FUNC_PART_DRAG_ID(event);
 FUNC_PART_DRAG_ID(threshold);
 
 /***************************/
+/*     BOX & TABLE API     */
+/***************************/
+
+#define FUNC_STATE_BOX_LAYOUT(Layout) \
+  EAPI Eina_Stringshare * \
+  edje_edit_state_box_##Layout##_get(Evas_Object *obj, const char *part, \
+                                     const char *state, double value) \
+    { \
+       GET_PD_OR_RETURN(0) \
+       if (rp->part->type == EDJE_PART_TYPE_BOX) \
+         { \
+            Edje_Part_Description_Box *box; \
+            box = (Edje_Part_Description_Box *) pd; \
+            return eina_stringshare_add(box->box.Layout); \
+         } \
+       return NULL; \
+    } \
+  EAPI Eina_Bool \
+  edje_edit_state_box_##Layout##_set(Evas_Object *obj, const char *part, \
+                                     const char *state, double value, \
+                                     char *layout) \
+  { \
+     GET_PD_OR_RETURN(EINA_FALSE) \
+     if (rp->part->type == EDJE_PART_TYPE_BOX) \
+       { \
+          Edje_Part_Description_Box *box; \
+          box = (Edje_Part_Description_Box *) pd; \
+          box->box.Layout = layout; \
+       } \
+     else \
+       return EINA_FALSE; \
+     return EINA_TRUE; \
+  }
+
+FUNC_STATE_BOX_LAYOUT(layout);
+FUNC_STATE_BOX_LAYOUT(alt_layout);
+
+/***************************/
 /*  BOX & TABLE ITEMS API  */
 /***************************/