From 98694d15ec9cf073b8bc2337cd4ec5ce738dd973 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Thu, 16 Feb 2012 11:39:07 +0000 Subject: [PATCH] Reviewed elm_label's API and documentation SVN revision: 68024 --- legacy/elementary/src/lib/Elementary.h.in | 2 +- legacy/elementary/src/lib/elm_deprecated.h | 53 +++++++++++++++ legacy/elementary/src/lib/elm_label.c | 13 +++- legacy/elementary/src/lib/elm_label.h | 78 ++++++---------------- 4 files changed, 85 insertions(+), 61 deletions(-) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 0f5a4d1ae4..ff109d9305 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -211,7 +211,7 @@ EAPI extern Elm_Version *elm_version; #include // OK #include // OK #include // OK -#include +#include // OK #include #include #include diff --git a/legacy/elementary/src/lib/elm_deprecated.h b/legacy/elementary/src/lib/elm_deprecated.h index c1dec10843..1137a3f6b6 100644 --- a/legacy/elementary/src/lib/elm_deprecated.h +++ b/legacy/elementary/src/lib/elm_deprecated.h @@ -4739,6 +4739,59 @@ EINA_DEPRECATED EAPI void elm_pager_item_style_default_set(Evas_Obje */ EINA_DEPRECATED EAPI const char *elm_pager_item_style_default_get(const Evas_Object *obj); +/** + * @brief Set the font size on the label object. + * + * @param obj The label object + * @param size font size + * + * @warning NEVER use this. It is for hyper-special cases only. use styles + * instead. e.g. "default", "marker", "slide_long" etc. + * @deprecated Use tag instead + */ +EAPI void elm_label_fontsize_set(Evas_Object *obj, int fontsize); + +/** + * @brief Set the text color on the label object + * + * @param obj The label object + * @param r Red property background color of The label object + * @param g Green property background color of The label object + * @param b Blue property background color of The label object + * @param a Alpha property background color of The label object + * + * @warning NEVER use this. It is for hyper-special cases only. use styles + * instead. e.g. "default", "marker", "slide_long" etc. + * @deprecated Use tag instead + */ +EAPI void elm_label_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a); + +/** + * @brief Set the text align on the label object + * + * @param obj The label object + * @param align align mode ("left", "center", "right") + * + * @warning NEVER use this. It is for hyper-special cases only. use styles + * instead. e.g. "default", "marker", "slide_long" etc. + * @deprecated Use tag instead + */ +EAPI void elm_label_text_align_set(Evas_Object *obj, const char *alignmode); + +/** + * @brief Set background color of the label + * + * @param obj The label object + * @param r Red property background color of The label object + * @param g Green property background color of The label object + * @param b Blue property background color of The label object + * @param a Alpha property background alpha of The label object + * + * @warning NEVER use this. It is for hyper-special cases only. use styles + * instead. e.g. "default", "marker", "slide_long" etc. + * @deprecated Just make colored background by yourself. + */ +EAPI void elm_label_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a); /** * @} diff --git a/legacy/elementary/src/lib/elm_label.c b/legacy/elementary/src/lib/elm_label.c index f3b9927109..1628d8ca27 100644 --- a/legacy/elementary/src/lib/elm_label.c +++ b/legacy/elementary/src/lib/elm_label.c @@ -773,6 +773,15 @@ elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis) } +EAPI Eina_Bool +elm_label_ellipsis_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->ellipsis; +} + EAPI void elm_label_slide_set(Evas_Object *obj, Eina_Bool slide) @@ -789,7 +798,7 @@ elm_label_slide_set(Evas_Object *obj, } EAPI Eina_Bool -elm_label_slide_get(Evas_Object *obj) +elm_label_slide_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); @@ -812,7 +821,7 @@ elm_label_slide_duration_set(Evas_Object *obj, double duration) } EAPI double -elm_label_slide_duration_get(Evas_Object *obj) +elm_label_slide_duration_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) 0.0; Widget_Data *wd = elm_widget_data_get(obj); diff --git a/legacy/elementary/src/lib/elm_label.h b/legacy/elementary/src/lib/elm_label.h index 1179cf713e..c71dd7098e 100644 --- a/legacy/elementary/src/lib/elm_label.h +++ b/legacy/elementary/src/lib/elm_label.h @@ -10,7 +10,7 @@ * text doesn't fit the geometry of the label it will be ellipsized or be * cut. Elementary provides several styles for this widget: * @li default - No animation - * @li marker - Centers the text in the label and make it bold by default + * @li marker - Centers the text in the label and makes it bold by default * @li slide_long - The entire text appears from the right of the screen and * slides until it disappears in the left of the screen(reappearing on the * right again). @@ -95,6 +95,7 @@ EAPI Evas_Coord elm_label_wrap_width_get(const Evas_Object *obj * * @warning This is only relevant if the label is inside a container. */ +//XXX: Maybe added for supporting multi-line ellpisis. Evas textlock supports multi-line ellipsis by itself, no more needs for this API. EAPI void elm_label_wrap_height_set(Evas_Object *obj, Evas_Coord h); /** @@ -103,58 +104,9 @@ EAPI void elm_label_wrap_height_set(Evas_Object *obj, Eva * @param obj The label object * @return The wrap height in pixels at a minimum where words need to wrap */ +//XXX: Maybe added for supporting multi-line ellpisis. Evas textlock supports multi-line ellipsis by itself, no more needs for this API. EAPI Evas_Coord elm_label_wrap_height_get(const Evas_Object *obj); -/** - * @brief Set the font size on the label object. - * - * @param obj The label object - * @param size font size - * - * @warning NEVER use this. It is for hyper-special cases only. use styles - * instead. e.g. "default", "marker", "slide_long" etc. - */ -EAPI void elm_label_fontsize_set(Evas_Object *obj, int fontsize); - -/** - * @brief Set the text color on the label object - * - * @param obj The label object - * @param r Red property background color of The label object - * @param g Green property background color of The label object - * @param b Blue property background color of The label object - * @param a Alpha property background color of The label object - * - * @warning NEVER use this. It is for hyper-special cases only. use styles - * instead. e.g. "default", "marker", "slide_long" etc. - */ -EAPI void elm_label_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a); - -/** - * @brief Set the text align on the label object - * - * @param obj The label object - * @param align align mode ("left", "center", "right") - * - * @warning NEVER use this. It is for hyper-special cases only. use styles - * instead. e.g. "default", "marker", "slide_long" etc. - */ -EAPI void elm_label_text_align_set(Evas_Object *obj, const char *alignmode); - -/** - * @brief Set background color of the label - * - * @param obj The label object - * @param r Red property background color of The label object - * @param g Green property background color of The label object - * @param b Blue property background color of The label object - * @param a Alpha property background alpha of The label object - * - * @warning NEVER use this. It is for hyper-special cases only. use styles - * instead. e.g. "default", "marker", "slide_long" etc. - */ -EAPI void elm_label_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a); - /** * @brief Set the ellipsis behavior of the label * @@ -170,10 +122,20 @@ EAPI void elm_label_background_color_set(Evas_Object *obj EAPI void elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis); /** - * @brief Set the text slide of the label + * @brief Get the ellipsis behavior of the label * * @param obj The label object - * @param slide To start slide or stop + * @return If true, an ellipsis will be shown at the end of the label area. + * + * @see elm_label_ellipsis_set() + */ +EAPI Eina_Bool elm_label_ellipsis_get(const Evas_Object *obj); + +/** + * @brief Set sliding effect of label widget. + * + * @param obj The label object + * @param slide If true, sliding effect will be shown * * If set to true, the text of the label will slide/scroll through the length of * label. @@ -184,20 +146,20 @@ EAPI void elm_label_ellipsis_set(Evas_Object *obj, Eina_B EAPI void elm_label_slide_set(Evas_Object *obj, Eina_Bool slide); /** - * @brief Get the text slide mode of the label + * @brief Get whether sliding effect is shown or not. * * @param obj The label object - * @return slide slide mode value + * @return If true, sliding effect is shown. * * @see elm_label_slide_set() */ -EAPI Eina_Bool elm_label_slide_get(Evas_Object *obj); +EAPI Eina_Bool elm_label_slide_get(const Evas_Object *obj); /** * @brief Set the slide duration(speed) of the label * * @param obj The label object - * @return The duration in seconds in moving text from slide begin position + * @param duration The duration in seconds in moving text from slide begin position * to slide end position */ EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration); @@ -210,7 +172,7 @@ EAPI void elm_label_slide_duration_set(Evas_Object *obj, * * @see elm_label_slide_duration_set() */ -EAPI double elm_label_slide_duration_get(Evas_Object *obj); +EAPI double elm_label_slide_duration_get(const Evas_Object *obj); /** * @}