forked from enlightenment/efl
Label: formatting
This commit is contained in:
parent
920b556d36
commit
b79fe302a0
|
@ -40,13 +40,11 @@ _recalc(void *data)
|
||||||
Evas_Coord resw;
|
Evas_Coord resw;
|
||||||
|
|
||||||
evas_event_freeze(evas_object_evas_get(data));
|
evas_event_freeze(evas_object_evas_get(data));
|
||||||
evas_object_geometry_get
|
evas_object_geometry_get(wd->resize_obj, NULL, NULL, &resw, NULL);
|
||||||
(wd->resize_obj, NULL, NULL, &resw, NULL);
|
|
||||||
if (sd->wrap_w > resw)
|
if (sd->wrap_w > resw)
|
||||||
resw = sd->wrap_w;
|
resw = sd->wrap_w;
|
||||||
|
|
||||||
edje_object_size_min_restricted_calc
|
edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, resw, 0);
|
||||||
(wd->resize_obj, &minw, &minh, resw, 0);
|
|
||||||
|
|
||||||
/* This is a hack to workaround the way min size hints are treated.
|
/* This is a hack to workaround the way min size hints are treated.
|
||||||
* If the minimum width is smaller than the restricted width, it means
|
* If the minimum width is smaller than the restricted width, it means
|
||||||
|
@ -65,8 +63,7 @@ _recalc(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_label_format_set(Evas_Object *obj,
|
_label_format_set(Evas_Object *obj, const char *format)
|
||||||
const char *format)
|
|
||||||
{
|
{
|
||||||
if (format)
|
if (format)
|
||||||
edje_object_part_text_style_user_push(obj, "elm.text", format);
|
edje_object_part_text_style_user_push(obj, "elm.text", format);
|
||||||
|
@ -150,8 +147,7 @@ _label_slide_change(Evas_Object *obj)
|
||||||
msg->count = 1;
|
msg->count = 1;
|
||||||
msg->val[0] = sd->slide_duration;
|
msg->val[0] = sd->slide_duration;
|
||||||
|
|
||||||
edje_object_message_send
|
edje_object_message_send(wd->resize_obj, EDJE_MESSAGE_FLOAT_SET, 0, msg);
|
||||||
(wd->resize_obj, EDJE_MESSAGE_FLOAT_SET, 0, msg);
|
|
||||||
edje_object_signal_emit(wd->resize_obj, "elm,state,slide,start", "elm");
|
edje_object_signal_emit(wd->resize_obj, "elm,state,slide,start", "elm");
|
||||||
}
|
}
|
||||||
//no slide effect.
|
//no slide effect.
|
||||||
|
@ -200,8 +196,7 @@ _elm_label_smart_sizing_eval(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_
|
||||||
|
|
||||||
if (sd->linewrap)
|
if (sd->linewrap)
|
||||||
{
|
{
|
||||||
evas_object_geometry_get
|
evas_object_geometry_get(wd->resize_obj, NULL, NULL, &resw, &resh);
|
||||||
(wd->resize_obj, NULL, NULL, &resw, &resh);
|
|
||||||
if (resw == sd->lastw) return;
|
if (resw == sd->lastw) return;
|
||||||
sd->lastw = resw;
|
sd->lastw = resw;
|
||||||
_recalc(obj);
|
_recalc(obj);
|
||||||
|
@ -218,10 +213,7 @@ _elm_label_smart_sizing_eval(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_on_label_resize(void *data,
|
_on_label_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
Evas *e EINA_UNUSED,
|
|
||||||
Evas_Object *obj EINA_UNUSED,
|
|
||||||
void *event_info EINA_UNUSED)
|
|
||||||
{
|
{
|
||||||
ELM_LABEL_DATA_GET(data, sd);
|
ELM_LABEL_DATA_GET(data, sd);
|
||||||
|
|
||||||
|
@ -230,9 +222,7 @@ _on_label_resize(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_get_value_in_key_string(const char *oldstring,
|
_get_value_in_key_string(const char *oldstring, const char *key, char **value)
|
||||||
const char *key,
|
|
||||||
char **value)
|
|
||||||
{
|
{
|
||||||
char *curlocater, *endtag;
|
char *curlocater, *endtag;
|
||||||
int firstindex = 0, foundflag = -1;
|
int firstindex = 0, foundflag = -1;
|
||||||
|
@ -264,10 +254,7 @@ _get_value_in_key_string(const char *oldstring,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_strbuf_key_value_replace(Eina_Strbuf *srcbuf,
|
_strbuf_key_value_replace(Eina_Strbuf *srcbuf, const char *key, const char *value, int deleteflag)
|
||||||
const char *key,
|
|
||||||
const char *value,
|
|
||||||
int deleteflag)
|
|
||||||
{
|
{
|
||||||
char *kvalue;
|
char *kvalue;
|
||||||
const char *srcstring = NULL;
|
const char *srcstring = NULL;
|
||||||
|
@ -300,9 +287,8 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf,
|
||||||
if (*srcstring)
|
if (*srcstring)
|
||||||
{
|
{
|
||||||
/* -1 because we want it before the ' */
|
/* -1 because we want it before the ' */
|
||||||
eina_strbuf_insert_printf
|
eina_strbuf_insert_printf (srcbuf, " %s=%s",
|
||||||
(srcbuf, " %s=%s", eina_strbuf_length_get(srcbuf) - 1, key,
|
eina_strbuf_length_get(srcbuf) - 1, key, value);
|
||||||
value);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -314,10 +300,7 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_stringshare_key_value_replace(const char **srcstring,
|
_stringshare_key_value_replace(const char **srcstring, const char *key, const char *value, int deleteflag)
|
||||||
const char *key,
|
|
||||||
const char *value,
|
|
||||||
int deleteflag)
|
|
||||||
{
|
{
|
||||||
Eina_Strbuf *sharebuf = NULL;
|
Eina_Strbuf *sharebuf = NULL;
|
||||||
|
|
||||||
|
@ -339,9 +322,10 @@ _elm_label_smart_text_set(Eo *obj, void *_pd, va_list *list)
|
||||||
const char *part = va_arg(*list, const char *);
|
const char *part = va_arg(*list, const char *);
|
||||||
const char *label = va_arg(*list, const char *);
|
const char *label = va_arg(*list, const char *);
|
||||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||||
if (ret) *ret = EINA_FALSE;
|
|
||||||
Eina_Bool int_ret = EINA_FALSE;
|
Eina_Bool int_ret = EINA_FALSE;
|
||||||
|
|
||||||
|
if (ret) *ret = EINA_FALSE;
|
||||||
|
|
||||||
if (!label) label = "";
|
if (!label) label = "";
|
||||||
_label_format_set(wd->resize_obj, sd->format);
|
_label_format_set(wd->resize_obj, sd->format);
|
||||||
|
|
||||||
|
@ -394,9 +378,8 @@ _elm_label_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||||
priv->format = eina_stringshare_add("");
|
priv->format = eina_stringshare_add("");
|
||||||
_label_format_set(wd->resize_obj, priv->format);
|
_label_format_set(wd->resize_obj, priv->format);
|
||||||
|
|
||||||
evas_object_event_callback_add
|
evas_object_event_callback_add(wd->resize_obj, EVAS_CALLBACK_RESIZE,
|
||||||
(wd->resize_obj, EVAS_CALLBACK_RESIZE,
|
_on_label_resize, obj);
|
||||||
_on_label_resize, obj);
|
|
||||||
|
|
||||||
edje_object_signal_callback_add(wd->resize_obj, "elm,state,slide,end", "",
|
edje_object_signal_callback_add(wd->resize_obj, "elm,state,slide,end", "",
|
||||||
_on_slide_end, obj);
|
_on_slide_end, obj);
|
||||||
|
@ -405,10 +388,10 @@ _elm_label_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||||
elm_widget_can_focus_set(obj, _elm_config->access_mode);
|
elm_widget_can_focus_set(obj, _elm_config->access_mode);
|
||||||
|
|
||||||
_elm_access_object_register(obj, wd->resize_obj);
|
_elm_access_object_register(obj, wd->resize_obj);
|
||||||
_elm_access_text_set
|
_elm_access_text_set(_elm_access_info_get(obj), ELM_ACCESS_TYPE,
|
||||||
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Label"));
|
E_("Label"));
|
||||||
_elm_access_callback_set
|
_elm_access_callback_set(_elm_access_info_get(obj), ELM_ACCESS_INFO,
|
||||||
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
_access_info_cb, NULL);
|
||||||
|
|
||||||
if (!elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)))
|
if (!elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)))
|
||||||
CRI("Failed to set layout!");
|
CRI("Failed to set layout!");
|
||||||
|
@ -422,6 +405,7 @@ elm_label_add(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||||
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
||||||
|
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -436,8 +420,7 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_label_line_wrap_set(Evas_Object *obj,
|
elm_label_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
|
||||||
Elm_Wrap_Type wrap)
|
|
||||||
{
|
{
|
||||||
ELM_LABEL_CHECK(obj);
|
ELM_LABEL_CHECK(obj);
|
||||||
eo_do(obj, elm_obj_label_line_wrap_set(wrap));
|
eo_do(obj, elm_obj_label_line_wrap_set(wrap));
|
||||||
|
@ -506,8 +489,7 @@ _line_wrap_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_label_wrap_width_set(Evas_Object *obj,
|
elm_label_wrap_width_set(Evas_Object *obj, Evas_Coord w)
|
||||||
Evas_Coord w)
|
|
||||||
{
|
{
|
||||||
ELM_LABEL_CHECK(obj);
|
ELM_LABEL_CHECK(obj);
|
||||||
eo_do(obj, elm_obj_label_wrap_width_set(w));
|
eo_do(obj, elm_obj_label_wrap_width_set(w));
|
||||||
|
@ -549,8 +531,7 @@ _wrap_width_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_label_ellipsis_set(Evas_Object *obj,
|
elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis)
|
||||||
Eina_Bool ellipsis)
|
|
||||||
{
|
{
|
||||||
ELM_LABEL_CHECK(obj);
|
ELM_LABEL_CHECK(obj);
|
||||||
eo_do(obj, elm_obj_label_ellipsis_set(ellipsis));
|
eo_do(obj, elm_obj_label_ellipsis_set(ellipsis));
|
||||||
|
@ -641,8 +622,7 @@ _slide_mode_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_DEPRECATED EAPI void
|
EINA_DEPRECATED EAPI void
|
||||||
elm_label_slide_set(Evas_Object *obj,
|
elm_label_slide_set(Evas_Object *obj, Eina_Bool slide)
|
||||||
Eina_Bool slide)
|
|
||||||
{
|
{
|
||||||
if (slide)
|
if (slide)
|
||||||
elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
|
elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
|
||||||
|
|
Loading…
Reference in New Issue