edje: add text min and max getters/setter to edje_edit.

This commit is contained in:
Vorobiov Vitalii 2013-09-25 16:18:05 +09:00 committed by Cedric Bail
parent 5b7063b62a
commit 4033943a0d
2 changed files with 104 additions and 13 deletions

View File

@ -2335,6 +2335,90 @@ EAPI Eina_Bool edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part
*/
EAPI void 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 obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to get the the minimum horizontal size of the container to be equal (not including the state value).
* @param value The state value.
*
* @return EINA_TRUE If the part forces container's minimum horizontal size, EINA_FALSE otherwise.
*/
EAPI Eina_Bool edje_edit_state_text_min_x_get(Evas_Object *obj, const char *part, const char *state, double value);
/** Get 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 obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to get the the minimum horizontal size of the container to be equal (not including the state value).
* @param value The state value.
*
* @return EINA_TRUE If the part forces container's maximum horizontal size, EINA_FALSE otherwise.
*/
EAPI Eina_Bool edje_edit_state_text_max_x_get(Evas_Object *obj, const char *part, const char *state, double value);
/** Get 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 obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to get the the minimum vertical size of the container to be equal (not including the state value).
* @param value The state value.
*
* @return EINA_TRUE If the part forces container's minimum vertical size, EINA_FALSE otherwise.
*/
EAPI Eina_Bool edje_edit_state_text_min_y_get(Evas_Object *obj, const char *part, const char *state, double value);
/** Get 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 obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to get the the maximum vertical size of the container to be equal (not including the state value).
* @param value The state value.
*
* @return EINA_TRUE If the part forces container's maximum vertical size, EINA_FALSE otherwise.
*/
EAPI Eina_Bool edje_edit_state_text_max_y_get(Evas_Object *obj, const char *part, const char *state, double value);
/** Set 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 obj Object being edited.
* @param part Part that contain state.
* @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.
*/
EAPI void 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 obj Object being edited.
* @param part Part that contain state.
* @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.
*/
EAPI void 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 obj Object being edited.
* @param part Part that contain state.
* @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.
*/
EAPI void 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 obj Object being edited.
* @param part Part that contain state.
* @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.
*/
EAPI void 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.
*
* Use edje_edit_string_list_free() when you don't need the list anymore.

View File

@ -4265,41 +4265,45 @@ FUNC_TEXT_DOUBLE(align_x, align.x);
FUNC_TEXT_DOUBLE(align_y, align.y);
FUNC_TEXT_DOUBLE(elipsis, elipsis);
#define FUNC_TEXT_BOOL_FIT(Value) \
EAPI Eina_Bool \
edje_edit_state_text_fit_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
#define FUNC_TEXT_BOOL(Name, Type) \
EAPI Eina_Bool \
edje_edit_state_text_##Name##_##Type##_get(Evas_Object *obj, const char *part, const char *state, double value) \
{ \
Edje_Part_Description_Text *txt; \
\
eina_error_set(0); \
\
GET_PD_OR_RETURN(EINA_FALSE); \
\
\
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
return EINA_FALSE; \
\
\
txt = (Edje_Part_Description_Text *) pd; \
return txt->text.fit_##Value; \
return txt->text.Name##_##Type; \
} \
EAPI void \
edje_edit_state_text_fit_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit) \
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 ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
return; \
\
\
txt = (Edje_Part_Description_Text *) pd; \
txt->text.fit_##Value = fit ? 1 : 0; \
txt->text.Name##_##Type = v ? 1 : 0; \
edje_object_calc_force(obj); \
}
FUNC_TEXT_BOOL_FIT(x);
FUNC_TEXT_BOOL_FIT(y);
FUNC_TEXT_BOOL(fit, x);
FUNC_TEXT_BOOL(fit, y);
FUNC_TEXT_BOOL(min, x);
FUNC_TEXT_BOOL(min, y);
FUNC_TEXT_BOOL(max, x);
FUNC_TEXT_BOOL(max, y);
EAPI Eina_List *
edje_edit_fonts_list_get(Evas_Object *obj)
@ -7024,7 +7028,10 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
BUF_APPENDF(I6"text_class: \"%s\";\n", txt->text.text_class);
if (txt->text.fit_x || txt->text.fit_y)
BUF_APPENDF(I6"fit: %d %d;\n", txt->text.fit_x, txt->text.fit_y);
//TODO Support min & max
if (txt->text.min_x || txt->text.min_y)
BUF_APPENDF(I6"min: \"%d\" \"%d\";\n", txt->text.min_x, txt->text.min_y);
if (txt->text.max_x || txt->text.max_y)
BUF_APPENDF(I6"max: %d %d;\n", txt->text.max_x, txt->text.max_y);
if (TO_DOUBLE(txt->text.align.x) != 0.5 || TO_DOUBLE(txt->text.align.y) != 0.5)
BUF_APPENDF(I6"align: %g %g;\n", TO_DOUBLE(txt->text.align.x), TO_DOUBLE(txt->text.align.y));
//TODO Support source