From 184720bf16ab81f21482efdd359c8008c5cc54c4 Mon Sep 17 00:00:00 2001 From: Andrii Kroitor Date: Wed, 4 Jun 2014 19:57:10 +0200 Subject: [PATCH] edje: Edje_Edit - add getters and setters for source2-source6 TEXTBLOCK properties Reviewers: cedric, raster, seoz, Hermet CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D943 Signed-off-by: Cedric BAIL --- src/lib/edje/Edje_Edit.h | 132 +++++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 38 +++++++++++ 2 files changed, 170 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 382f862c33..6712d8cecb 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -1000,6 +1000,138 @@ EAPI const char * edje_edit_part_source_get(Evas_Object *obj, const char *part); */ EAPI Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source); +/** Get the source2 of part. + * + * Only available to TEXTBLOCK parts. It is used for the group to be loaded and + * used for selection display OVER the selected text. source is used for under + * of the selected text, if source is specified. + * + * @param obj Object being edited. + * @param part Part to get the source from. + * + * @return Content of the source2 parameter or NULL if nothing set or an error occurred. + */ +EAPI const char * edje_edit_part_source2_get(Evas_Object *obj, const char *part); + +/** Set the source2 of part. + * + * @param obj Object being edited. + * @param part Part to set the source of. + * @param source Value for the source parameter. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + * + * @see edje_edit_part_source2_get() + * + */ +EAPI Eina_Bool edje_edit_part_source2_set(Evas_Object *obj, const char *part, const char *source); + +/** Get the source3 of part. + * + * Only available to TEXTBLOCK parts. It is used for the group to be loaded and + * used for cursor display UNDER the cursor position. source4 is used for over + * the cursor text, if source4 is specified. + * + * @param obj Object being edited. + * @param part Part to get the source from. + * + * @return Content of the source3 parameter or NULL if nothing set or an error occurred. + */ +EAPI const char * edje_edit_part_source3_get(Evas_Object *obj, const char *part); + +/** Set the source3 of part. + * + * @param obj Object being edited. + * @param part Part to set the source of. + * @param source Value for the source parameter. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + * + * @see edje_edit_part_source3_get() + * + * NOTE: This is not applied now. You must reload the edje to see the change. + */ +EAPI Eina_Bool edje_edit_part_source3_set(Evas_Object *obj, const char *part, const char *source); + +/** Get the source4 of part. + * + * Only available to TEXTBLOCK parts. It is used for the group to be loaded and + * used for cursor display OVER the cursor position. source3 is used for under + * the cursor text, if source4 is specified. + * + * @param obj Object being edited. + * @param part Part to get the source from. + * + * @return Content of the source4 parameter or NULL if nothing set or an error occurred. + */ +EAPI const char * edje_edit_part_source4_get(Evas_Object *obj, const char *part); + +/** Set the source4 of part. + * + * @param obj Object being edited. + * @param part Part to set the source of. + * @param source Value for the source parameter. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + * + * @see edje_edit_part_source4_get() + * + * NOTE: This is not applied now. You must reload the edje to see the change. + */ +EAPI Eina_Bool edje_edit_part_source4_set(Evas_Object *obj, const char *part, const char *source); + +/** Get the source5 of part. + * + * Only available to TEXTBLOCK parts. It is used for the group to be loaded and + * used for anchors display UNDER the anchor position. source6 is used for over + * the anchors text, if source6 is specified. + * + * @param obj Object being edited. + * @param part Part to get the source from. + * + * @return Content of the source5 parameter or NULL if nothing set or an error occurred. + */ +EAPI const char * edje_edit_part_source5_get(Evas_Object *obj, const char *part); + +/** Set the source5 of part. + * + * @param obj Object being edited. + * @param part Part to set the source of. + * @param source Value for the source parameter. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + * + * @see edje_edit_part_source5_get() + * + */ +EAPI Eina_Bool edje_edit_part_source5_set(Evas_Object *obj, const char *part, const char *source); + +/** Get the source6 of part. + * + * Only available to TEXTBLOCK parts. It is used for the group to be loaded and + * used for anchor display OVER the anchor position. source5 is used for under + * the anchor text, if source6 is specified. + * + * @param obj Object being edited. + * @param part Part to get the source from. + * + * @return Content of the source6 parameter or NULL if nothing set or an error occurred. + */ +EAPI const char * edje_edit_part_source6_get(Evas_Object *obj, const char *part); + +/** Set the source6 of part. + * + * @param obj Object being edited. + * @param part Part to set the source of. + * @param source Value for the source parameter. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + * + * @see edje_edit_part_source6_get() + * + */ +EAPI Eina_Bool edje_edit_part_source6_set(Evas_Object *obj, const char *part, const char *source); + /** Get the effect for a given part. * * Gets the effect used for parts of type TEXT. See @ref edcref for more details. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index f4416903ea..38e1c020b3 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -3004,6 +3004,44 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source } } +#define TEXT_BLOCK_SOURCE_GET(N) \ +EAPI const char * \ +edje_edit_part_source ## N ## _get(Evas_Object *obj, const char *part) \ +{ \ + GET_RP_OR_RETURN(NULL); \ + if (!rp->part->source ## N) return NULL; \ + return eina_stringshare_add(rp->part->source ## N); \ +} + +#define TEXT_BLOCK_SOURCE_SET(N) \ +EAPI Eina_Bool \ +edje_edit_part_source ## N ##_set(Evas_Object *obj, const char *part, const char *source) \ +{ \ + GET_RP_OR_RETURN(EINA_FALSE); \ + \ + if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) \ + return EINA_FALSE; \ + \ + eina_stringshare_del(rp->part->source ## N); \ + if (source) \ + rp->part->source ## N = eina_stringshare_add(source); \ + else \ + rp->part->source ## N = NULL; \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ +} +TEXT_BLOCK_SOURCE_GET(2); +TEXT_BLOCK_SOURCE_GET(3); +TEXT_BLOCK_SOURCE_GET(4); +TEXT_BLOCK_SOURCE_GET(5); +TEXT_BLOCK_SOURCE_GET(6); + +TEXT_BLOCK_SOURCE_SET(2); +TEXT_BLOCK_SOURCE_SET(3); +TEXT_BLOCK_SOURCE_SET(4); +TEXT_BLOCK_SOURCE_SET(5); +TEXT_BLOCK_SOURCE_SET(6); + EAPI int edje_edit_part_drag_x_get(Evas_Object *obj, const char *part) {