* @brief Functions to deal with edje internal object. Don't use in standard
* situations. The use of any of the edje_edit_* functions can break your
* theme ability, remember that the program must be separated from the interface!
- *
+ *
* This was intended ONLY for use in an actual edje editor program. Unless
* you are writing one of these, do NOT use this API here.
*
* @param state The name of the state to set text (not including the state value).
* @param value The state value.
* @param text The new text to assign.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value,const char *text);
+EAPI Eina_Bool edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value,const char *text);
/** Get font name for a given part state.
*
* @param state The name of the state to set text size (not including the state value).
* @param value The state value.
* @param size The new font size to set (in pixel)
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size);
+EAPI Eina_Bool edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size);
/** Get the text horizontal align of a part state.
*
* The value range is from 0.0(right) to 1.0(left)
+ * If the value is between -1.0 and 0.0 then it uses align automatically.
*
* @param obj Object being edited.
* @param part Part that contain state.
/** Set the text horizontal align of a part state.
*
* The value range is from 0.0(right) to 1.0(left)
+ * If the value is between -1.0 and 0.0 then it uses align automatically.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set the text horizontal align (not including the state value).
* @param value The state value.
* @param align The new text horizontal align value
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
+EAPI Eina_Bool edje_edit_state_text_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
/** Set the text vertical align of a part state.
*
* @param state The name of the state to set the text vertical align (not including the state value).
* @param value The state value.
* @param align The new text vertical align value
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
+EAPI Eina_Bool edje_edit_state_text_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align);
/** Get the text elipsis of a part state.
*
- * The value range is from 0.0(right) to 1.0(left)
+ * The value range is from 0.0(right) to 1.0(left), and -1.0 (if disabled)
*
* @param obj Object being edited.
* @param part Part that contain state.
/** Set the text vertical align of a part state.
*
* The value range is from 0.0(right) to 1.0(left)
+ * If the value is in range from -1.0 to 0.0 then ellipsis is disabled.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set the text elipses value (not including the state value).
* @param value The state value.
* @param balance The position where to cut the string
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char *state, double value, double balance);
+EAPI Eina_Bool edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char *state, double value, double balance);
/** Get if the text part fit it's container horizontally
*
* @param state The name of the state to set the if the text part fit it's container horizontally (not including the state value).
* @param value The state value.
* @param fit EINA_TRUE to make the text fit it's container horizontally, EINA_FALSE otherwise.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit);
+EAPI Eina_Bool edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit);
/** Get if the text part fit it's container vertically
*
* @param state The name of the state to set the if the text part fit it's container vertically (not including the state value).
* @param value The state value.
* @param fit EINA_TRUE to make the text fit it's container vertically, EINA_FALSE otherwise.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_fit_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit);
+EAPI Eina_Bool edje_edit_state_text_fit_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit);
/** Get if the text part forces the minimum horizontal size of the container to be equal to the minimum horizontal size of the text part
*
* @param state The name of the state to set the the minimum horizontal size of the container to be equal (not including the state value).
* @param value The state value.
* @param v EINA_TRUE to make the text force it's forces container's minimum horizontal size, EINA_FALSE otherwise.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_min_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
+EAPI Eina_Bool edje_edit_state_text_min_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
/** Set if the text part forces the maximum horizontal size of the container to be equal to the maximum horizontal size of the text part
*
* @param state The name of the state to set the the maximum horizontal size of the container to be equal (not including the state value).
* @param value The state value.
* @param v EINA_TRUE to make the text force it's forces container's maximum horizontal size, EINA_FALSE otherwise.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_max_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
+EAPI Eina_Bool edje_edit_state_text_max_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
/** Set if the text part forces the minimum vertical size of the container to be equal to the minimum vertical size of the text part
*
* @param state The name of the state to set the the minimum vertical size of the container to be equal (not including the state value).
* @param value The state value.
* @param v EINA_TRUE to make the text force it's forces container's minimum vertical size, EINA_FALSE otherwise.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_min_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
+EAPI Eina_Bool edje_edit_state_text_min_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
/** Set if the text part forces the maximum vertical size of the container to be equal to the maximum vertical size of the text part
*
* @param state The name of the state to set the the maximum vertical size of the container to be equal (not including the state value).
* @param value The state value.
* @param v EINA_TRUE to make the text force it's forces container's maximum vertical size, EINA_FALSE otherwise.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
-EAPI void edje_edit_state_text_max_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
+EAPI Eina_Bool edje_edit_state_text_max_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
/** Get the list of all the fonts in the given edje.
*
return NULL;
txt = (Edje_Part_Description_Text *) pd;
- //printf("GET TEXT of state: %s\n", state);
return eina_stringshare_add(edje_string_get(&txt->text.text));
}
-EAPI void
+EAPI Eina_Bool
edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text)
{
Edje_Part_Description_Text *txt;
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT of state: %s\n", state);
-
- if (!text) return;
+ if ((!obj) || (!part) || (!state) || (!text))
+ return EINA_FALSE;
+ GET_PD_OR_RETURN(EINA_FALSE);
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return;
+ return EINA_FALSE;
txt = (Edje_Part_Description_Text *) pd;
txt->text.text.id = 0;
edje_object_calc_force(obj);
+ return EINA_TRUE;
}
EAPI int
return -1;
txt = (Edje_Part_Description_Text *) pd;
- //printf("GET TEXT_SIZE of state: %s [%d]\n", state, pd->text.size);
+
return txt->text.size;
}
-EAPI void
+EAPI Eina_Bool
edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size)
{
Edje_Part_Description_Text *txt;
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT_SIZE of state: %s [%d]\n", state, size);
-
- if (size < 0) return;
+ if ((!obj) || (!part) || (!state))
+ return EINA_FALSE;
+ if (size < 0) return EINA_FALSE;
+ GET_PD_OR_RETURN(EINA_FALSE);
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return;
+ return EINA_FALSE;
txt = (Edje_Part_Description_Text *) pd;
txt->text.size = size;
edje_object_calc_force(obj);
+ return EINA_TRUE;
}
-#define FUNC_TEXT_DOUBLE(Name, Value) \
+#define FUNC_TEXT_DOUBLE(Name, Value, Min) \
EAPI double \
edje_edit_state_text_##Name##_get(Evas_Object *obj, const char *part, const char *state, double value) \
{ \
txt = (Edje_Part_Description_Text *) pd; \
return TO_DOUBLE(txt->text.Value); \
} \
- EAPI void \
+ EAPI Eina_Bool \
edje_edit_state_text_##Name##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
{ \
Edje_Part_Description_Text *txt; \
+ if ((!obj) || (!part) || (!state)) \
+ return EINA_FALSE; \
+ if ((v < Min) || (v > 1.0)) \
+ return EINA_FALSE; \
\
- GET_PD_OR_RETURN(); \
+ GET_PD_OR_RETURN(EINA_FALSE); \
\
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
- return; \
+ return EINA_FALSE; \
\
txt = (Edje_Part_Description_Text *) pd; \
txt->text.Value = FROM_DOUBLE(v); \
edje_object_calc_force(obj); \
- } \
+ return EINA_TRUE; \
+ }
-FUNC_TEXT_DOUBLE(align_x, align.x);
-FUNC_TEXT_DOUBLE(align_y, align.y);
-FUNC_TEXT_DOUBLE(elipsis, elipsis);
+FUNC_TEXT_DOUBLE(align_x, align.x, -1.0);
+FUNC_TEXT_DOUBLE(align_y, align.y, 0.0);
+FUNC_TEXT_DOUBLE(elipsis, elipsis, -1.0);
#define FUNC_TEXT_BOOL(Name, Type) \
EAPI Eina_Bool \
txt = (Edje_Part_Description_Text *) pd; \
return txt->text.Name##_##Type; \
} \
- EAPI void \
+ EAPI Eina_Bool \
edje_edit_state_text_##Name##_##Type##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v) \
{ \
Edje_Part_Description_Text *txt; \
- \
- GET_PD_OR_RETURN(); \
+ if ((!obj) || (!part) || (!state)) \
+ return EINA_FALSE; \
+ GET_PD_OR_RETURN(EINA_FALSE); \
\
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
- return; \
+ return EINA_FALSE; \
\
txt = (Edje_Part_Description_Text *) pd; \
txt->text.Name##_##Type = v ? 1 : 0; \
edje_object_calc_force(obj); \
+ return EINA_TRUE; \
}
FUNC_TEXT_BOOL(fit, x);