#include <Elementary.h>
#include "elm_priv.h"
-/**
- * @defgroup Label Label
- *
- * Display text, with simple html-like markup. The theme of course
- * can invent new markup tags and style them any way it likes
- */
-
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
Evas_Coord lastw;
Evas_Coord wrap_w;
Evas_Coord wrap_h;
- Eina_Bool linewrap : 1;
+ Elm_Wrap_Type linewrap;
Eina_Bool changed : 1;
Eina_Bool bgcolor : 1;
Eina_Bool ellipsis : 1;
if (!wd) return;
wd->deferred_recalc_job = NULL;
-
+
evas_object_geometry_get(wd->lbl, NULL, NULL, &resw, &resh);
if (wd->wrap_w > resw)
resw = wd->wrap_w;
return wd->label;
}
-/**
- * Add a new label to the parent
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Label
- */
+static void
+_translate_hook(Evas_Object *obj)
+{
+ evas_object_smart_callback_call(obj, "language,changed", NULL);
+}
+
EAPI Evas_Object *
elm_label_add(Evas_Object *parent)
{
elm_widget_can_focus_set(obj, EINA_FALSE);
elm_widget_text_set_hook_set(obj, _elm_label_label_set);
elm_widget_text_get_hook_set(obj, _elm_label_label_get);
+ elm_widget_translate_hook_set(obj, _translate_hook);
wd->bgcolor = EINA_FALSE;
wd->bg = evas_object_rectangle_add(e);
evas_object_color_set(wd->bg, 0, 0, 0, 0);
- wd->linewrap = EINA_FALSE;
+ wd->linewrap = ELM_WRAP_NONE;
wd->ellipsis = EINA_FALSE;
wd->slidingmode = EINA_FALSE;
wd->slidingellipsis = EINA_FALSE;
return obj;
}
-/**
- * Set the label on the label object
- *
- * @param obj The label object
- * @param label The label will be used on the label object
- *
- * @ingroup Label
- */
EAPI void
elm_label_label_set(Evas_Object *obj, const char *label)
{
_elm_label_label_set(obj, NULL, label);
}
-/**
- * Get the label used on the label object
- *
- * @param obj The label object
- * @return The string inside the label
- * @ingroup Label
- * @deprecated
- */
EAPI const char *
elm_label_label_get(const Evas_Object *obj)
{
return _elm_label_label_get(obj, NULL);
}
-/**
- * Set the wrapping behavior of the label
- *
- * @param obj The label object
- * @param wrap To wrap text or not
- * @ingroup Label
- * @deprecated
- */
EAPI void
elm_label_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
{
}
}
-/**
- * Get the wrapping behavior of the label
- *
- * @param obj The label object
- * @return Wrap type
- * @ingroup Label
- */
EAPI Elm_Wrap_Type
elm_label_line_wrap_get(const Evas_Object *obj)
{
return wd->linewrap;
}
-/**
- * Set wrap width of the label
- *
- * @param obj The label object
- * @param w The wrap width in pixels at a minimum where words need to wrap
- * @ingroup Label
- */
EAPI void
elm_label_wrap_width_set(Evas_Object *obj, Evas_Coord w)
{
_sizing_eval(obj);
}
-/**
- * get wrap width of the label
- *
- * @param obj The label object
- * @return The wrap width in pixels at a minimum where words need to wrap
- * @ingroup Label
- */
EAPI Evas_Coord
elm_label_wrap_width_get(const Evas_Object *obj)
{
return wd->wrap_w;
}
-/**
- * Set wrap height of the label
- *
- * @param obj The label object
- * @param w The wrap width in pixels at a minimum where words need to wrap
- * @ingroup Label
- */
EAPI void
elm_label_wrap_height_set(Evas_Object *obj,
Evas_Coord h)
_sizing_eval(obj);
}
-/**
- * get wrap width of the label
- *
- * @param obj The label object
- * @return The wrap height in pixels at a minimum where words need to wrap
- * @ingroup Label
- */
EAPI Evas_Coord
elm_label_wrap_height_get(const Evas_Object *obj)
{
return wd->wrap_h;
}
-/**
- * Set the font size on the label object.
- *
- * NEVER use this. It is for hyper-special cases only. use styles instead. e.g.
- * "big", "medium", "small" - or better name them by use:
- * "title", "footnote", "quote" etc.
- *
- * @param obj The label object
- * @param size font size
- *
- * @ingroup Label
- */
EAPI void
elm_label_fontsize_set(Evas_Object *obj, int fontsize)
{
eina_strbuf_free(fontbuf);
}
-/**
- * Set the text align on the label object
- *
- * NEVER use this. It is for hyper-special cases only. use styles instead. e.g.
- * "big", "medium", "small" - or better name them by use:
- * "title", "footnote", "quote" etc.
- *
- * @param obj The label object
- * @param align align mode ("left", "center", "right")
- *
- * @ingroup Label
- */
EAPI void
elm_label_text_align_set(Evas_Object *obj, const char *alignmode)
{
_sizing_eval(obj);
}
-/**
- * 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
- *
- * @ingroup Label
- */
EAPI void
elm_label_text_color_set(Evas_Object *obj,
unsigned int r,
eina_strbuf_free(colorbuf);
}
-/**
- * Set background color of the label
- *
- * NEVER use this. It is for hyper-special cases only. use styles instead. e.g.
- * "big", "medium", "small" - or better name them by use:
- * "title", "footnote", "quote" etc.
- *
- * @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
- *
- * @ingroup Label
- */
EAPI void
elm_label_background_color_set(Evas_Object *obj,
unsigned int r,
if (!wd) return;
evas_object_color_set(wd->bg, r, g, b, a);
- if (!wd) return;
_elm_dangerous_call_check(__FUNCTION__);
if (wd->bgcolor == EINA_FALSE)
{
}
}
-/**
- * Set the wrapmode of the label
- *
- * @param obj The label object
- * @param wrapmode 0 is charwrap, 1 is wordwrap
- * @ingroup Label
- * @deprecated
-*/
-EAPI void
-elm_label_wrap_mode_set(Evas_Object *obj,
- Eina_Bool wrapmode)
-{
- return;
-}
-
-/**
- * Set the ellipsis behavior of the label
- *
- * @param obj The label object
- * @param ellipsis To ellipsis text or not
- * @ingroup Label
- */
EAPI void
elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis)
{
}
-/**
- * Set the text slide of the label
- *
- * @param obj The label object
- * @param slide To start slide or stop
- * @ingroup Label
- */
EAPI void
elm_label_slide_set(Evas_Object *obj,
Eina_Bool slide)
_sizing_eval(obj);
}
-/**
- * get the text slide mode of the label
- *
- * @param obj The label object
- * @return slide slide mode value
- * @ingroup Label
- */
EAPI Eina_Bool
elm_label_slide_get(Evas_Object *obj)
{
return wd->slidingmode;
}
-/**
- * set the slide duration(speed) of the label
- *
- * @param obj The label object
- * @return The duration time in moving text from slide begin position to slide end position
- * @ingroup Label
- */
EAPI void
elm_label_slide_duration_set(Evas_Object *obj, double duration)
{
edje_object_message_send(wd->lbl, EDJE_MESSAGE_FLOAT_SET, 0, msg);
}
-/**
- * get the slide duration(speed) of the label
- *
- * @param obj The label object
- * @return The duration time in moving text from slide begin position to slide end position
- * @ingroup Label
- */
EAPI double
elm_label_slide_duration_get(Evas_Object *obj)
{