summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>2013-12-19 15:33:53 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-19 15:53:27 +0900
commit811c97eabb72f001d0cdb971c5cd9df54700b39c (patch)
treef0f32a01bb4e33f32685e3d46cc65a1aad3abf80 /src/lib
parent0ad1dfe4e596aeb194b205e63a771d26279a1846 (diff)
edje: edje_edit - adding getter and setter for text source
This commit will add API for working with text source. There are two functions will be added: 1. edje_edit_state_text_source_get 2. edje_edit_state_text_source_set Reviewers: cedric, seoz, raster CC: cedric Differential Revision: https://phab.enlightenment.org/D389 Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/Edje_Edit.h27
-rw-r--r--src/lib/edje/edje_edit.c40
2 files changed, 67 insertions, 0 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 5d38a6c255..a264260a35 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -2706,6 +2706,33 @@ edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *s
2706EAPI Eina_Bool 2706EAPI Eina_Bool
2707edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style); 2707edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style);
2708 2708
2709/** Get part name, which used as text source.
2710 *
2711 * @param obj Object being edited.
2712 * @param part Part that contain state.
2713 * @param state The name of the state to set the the maximum vertical size of
2714 * the container to be equal (not including the state value).
2715 *
2716 * @return The name of part or NULL, if text_source param not a setted.
2717 */
2718EAPI const char *
2719edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *state, double value);
2720
2721/** Set the source text part for a given part.
2722 * Causes the part to display the text content of another part and update them
2723 * as they change.
2724 *
2725 * @param obj Object being edited.
2726 * @param part Part that contain state.
2727 * @param state The name of the state to set the the maximum vertical size of
2728 * the container to be equal (not including the state value).
2729 * @param source The text source part name.
2730 *
2731 * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
2732 */
2733EAPI Eina_Bool
2734edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source);
2735
2709/** Get the list of all the fonts in the given edje. 2736/** Get the list of all the fonts in the given edje.
2710 * 2737 *
2711 * Use edje_edit_string_list_free() when you don't need the list anymore. 2738 * Use edje_edit_string_list_free() when you don't need the list anymore.
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 6c8f19a50f..edf558f138 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -4652,6 +4652,46 @@ edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect e
4652 return EINA_TRUE; 4652 return EINA_TRUE;
4653} 4653}
4654 4654
4655EAPI const char *
4656edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *state, double value)
4657{
4658 Edje_Real_Part *rel;
4659
4660 GET_PD_OR_RETURN(NULL);
4661
4662 if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
4663 (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
4664 {
4665 Edje_Part_Description_Text *txt;
4666 txt = (Edje_Part_Description_Text *) pd;
4667 if (txt->text.id_text_source == -1) return NULL;
4668 rel = ed->table_parts[txt->text.id_text_source % ed->table_parts_size];
4669 if (rel->part->name) return eina_stringshare_add(rel->part->name);
4670 }
4671
4672 return NULL;
4673}
4674
4675EAPI Eina_Bool
4676edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source)
4677{
4678 Edje_Part_Description_Text *txt;
4679 int id_text_source;
4680 GET_PD_OR_RETURN(EINA_FALSE);
4681 if (!source) return EINA_FALSE;
4682
4683 if ((rp->part->type != EDJE_PART_TYPE_TEXT) ||
4684 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4685 return EINA_FALSE;
4686
4687 txt = (Edje_Part_Description_Text *) pd;
4688 id_text_source = _edje_part_id_find(ed, source);
4689 txt->text.id_text_source = id_text_source;
4690
4691 /* need to recalc, because the source part can has a text */
4692 edje_object_calc_force(obj);
4693 return EINA_TRUE;
4694}
4655/****************/ 4695/****************/
4656/* IMAGES API */ 4696/* IMAGES API */
4657/****************/ 4697/****************/