From 87a5388919385ba489626797806f1618e3207111 Mon Sep 17 00:00:00 2001 From: Vitalii Vorobiov Date: Fri, 13 Feb 2015 18:47:56 +0200 Subject: [PATCH] edje: Edje_Edit - functions to edit layouts of BOX parts 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 --- src/lib/edje/Edje_Edit.h | 100 +++++++++++++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 38 ++++++++++++++++++ 2 files changed, 138 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 12db53b..2146b22 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -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 diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index f7fe909..49a3290 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -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 */ /***************************/ -- 2.7.4