* Add support for text Ellipsis and Fit

SVN revision: 36502
This commit is contained in:
Davide Andreoli 2008-10-07 16:01:56 +00:00
parent 270e803fb6
commit 0ad6672332
2 changed files with 117 additions and 8 deletions

View File

@ -1243,6 +1243,57 @@ edje_edit_state_text_align_y_set(
double align ///< The new text align Y value
);
/**Get the text elipsis of a part state. The value range is from 0.0(right) to 1.0(left)*/
EAPI double ///@return The text elipsis value
edje_edit_state_text_elipsis_get(
Evas_Object *obj, ///< The edje object
const char *part, ///< The name of the part
const char *state ///< The name of the 'part state' (ex. "default 0.00")
);
/**Set the text vertical align of a part state. The value range is from 0.0(right) to 1.0(left)*/
EAPI void
edje_edit_state_text_elipsis_set(
Evas_Object *obj, ///< The edje object
const char *part, ///< The name of the part
const char *state, ///< The name of the 'part state' (ex. "default 0.00")
double balance ///< The position where to cut the string
);
/**Get if the text part fit it's container horizontally */
EAPI unsigned char ///@return 1 If the part fit it's container horizontally
edje_edit_state_text_fit_x_get(
Evas_Object *obj, ///< The edje object
const char *part, ///< The name of the part
const char *state ///< The name of the 'part state' (ex. "default 0.00")
);
/**Set if the text part should fit it's container horizontally */
EAPI void
edje_edit_state_text_fit_x_set(
Evas_Object *obj, ///< The edje object
const char *part, ///< The name of the part
const char *state, ///< The name of the 'part state' (ex. "default 0.00")
unsigned char fit ///< 1 to make the text fit it's container
);
/**Get if the text part fit it's container vertically */
EAPI unsigned char ///@return 1 If the part fit it's container vertically
edje_edit_state_text_fit_y_get(
Evas_Object *obj, ///< The edje object
const char *part, ///< The name of the part
const char *state ///< The name of the 'part state' (ex. "default 0.00")
);
/**Set if the text part should fit it's container vertically */
EAPI void
edje_edit_state_text_fit_y_set(
Evas_Object *obj, ///< The edje object
const char *part, ///< The name of the part
const char *state, ///< The name of the 'part state' (ex. "default 0.00")
unsigned char fit ///< 1 to make the text fit it's container
);
/**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

@ -2773,6 +2773,64 @@ edje_edit_state_text_align_y_set(Evas_Object *obj, const char *part, const char
edje_object_calc_force(obj);
}
EAPI double
edje_edit_state_text_elipsis_get(Evas_Object *obj, const char *part, const char *state)
{
GET_PD_OR_RETURN(0.0);
//printf("GET TEXT_ELIPSIS of state: %s [%f]\n", state, pd->text.elipsis);
return pd->text.elipsis;
}
EAPI void
edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char *state, double balance)
{
GET_PD_OR_RETURN();
//printf("SET TEXT_ELIPSIS of state: %s [%f]\n", state, balance);
pd->text.elipsis = balance;
edje_object_calc_force(obj);
}
EAPI unsigned char
edje_edit_state_text_fit_x_get(Evas_Object *obj, const char *part, const char *state)
{
GET_PD_OR_RETURN();
//printf("GET TEXT_FIT_VERT of state: %s \n", state);
return pd->text.fit_x;
}
EAPI void
edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *state, unsigned char fit)
{
GET_PD_OR_RETURN();
//printf("SET TEXT_FIT_VERT of state: %s\n", state);
pd->text.fit_x = fit ? 1 : 0;
edje_object_calc_force(obj);
}
EAPI unsigned char
edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part, const char *state)
{
GET_PD_OR_RETURN();
//printf("GET TEXT_FIT_VERT of state: %s \n", state);
return pd->text.fit_y;
}
EAPI void
edje_edit_state_text_fit_y_set(Evas_Object *obj, const char *part, const char *state, unsigned char fit)
{
GET_PD_OR_RETURN();
//printf("SET TEXT_FIT_VERT of state: %s\n", state);
pd->text.fit_y = fit ? 1 : 0;
edje_object_calc_force(obj);
}
EAPI Evas_List *
edje_edit_fonts_list_get(Evas_Object *obj)
{
@ -4656,10 +4714,11 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
rp->part->type == EDJE_PART_TYPE_GRADIENT)
{
fprintf(f, I5"fill {\n");
if (!pd->fill.smooth)
if (rp->part->type == EDJE_PART_TYPE_IMAGE && !pd->fill.smooth)
fprintf(f, I6"smooth: 0;\n");
//TODO Support spread
//TODO Support angle
if (rp->part->type == EDJE_PART_TYPE_GRADIENT && pd->fill.angle)
fprintf(f, I6"angle: %d;\n", pd->fill.angle);
//TODO Support type
if (pd->fill.pos_rel_x || pd->fill.pos_rel_y ||
@ -4697,13 +4756,15 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
fprintf(f, I6"size: %d;\n", pd->text.size);
if (pd->text.text_class)
fprintf(f, I6"text_class: \"%s\";\n", pd->text.text_class);
//TODO Support fit
if (pd->text.fit_x || pd->text.fit_y)
fprintf(f, I6"fit: %d %d;\n", pd->text.fit_x, pd->text.fit_y);
//TODO Support min & max
if (pd->text.align.x != 0.5 || pd->text.align.y != 0.5)
if (pd->text.align.x != 0.5 || pd->text.align.y != 0.5)
fprintf(f, I6"align: %g %g;\n", pd->text.align.x, pd->text.align.y);
//TODO Support source
//TODO Support text_source
//TODO Support elipsis
if (pd->text.elipsis)
fprintf(f, I6"elipsis: %g;\n", pd->text.elipsis);
fprintf(f, I5"}\n");
}
@ -4722,9 +4783,6 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
fprintf(f, I5"}\n");
}
//...and so on...
fprintf(f, I4"}\n");//description
}