2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
#include "elm_priv.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2012-08-01 14:03:51 -07:00
|
|
|
#include "elm_widget_label.h"
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
EAPI Eo_Op ELM_OBJ_LABEL_BASE_ID = EO_NOOP;
|
|
|
|
|
|
|
|
#define MY_CLASS ELM_OBJ_LABEL_CLASS
|
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Label"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_label"
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2013-01-04 20:56:06 -08:00
|
|
|
static const char SIG_SLIDE_END[] = "slide,end";
|
2013-06-09 01:56:30 -07:00
|
|
|
static const char SIG_LANG_CHANGED[] = "language,changed";
|
2013-01-04 20:56:06 -08:00
|
|
|
|
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-06-09 01:56:30 -07:00
|
|
|
{SIG_LANG_CHANGED, ""},
|
2013-01-04 20:56:06 -08:00
|
|
|
{SIG_SLIDE_END, ""},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
{"default", "elm.text"},
|
|
|
|
{NULL, NULL}
|
2008-09-29 23:58:56 -07:00
|
|
|
};
|
|
|
|
|
2010-01-07 18:33:03 -08:00
|
|
|
static void
|
2012-05-03 15:42:38 -07:00
|
|
|
_recalc(void *data)
|
2010-01-07 18:33:03 -08:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_DATA_GET(data, sd);
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2011-06-12 05:02:57 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
|
|
|
Evas_Coord resw;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2011-09-30 01:03:56 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(data));
|
2012-05-03 15:42:38 -07:00
|
|
|
evas_object_geometry_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, NULL, NULL, &resw, NULL);
|
2012-05-03 15:42:38 -07:00
|
|
|
if (sd->wrap_w > resw)
|
|
|
|
resw = sd->wrap_w;
|
|
|
|
|
|
|
|
edje_object_size_min_restricted_calc
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, &minw, &minh, resw, 0);
|
2011-06-12 05:02:57 -07:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
* the mininmum doesn't matter. */
|
2012-05-03 15:42:38 -07:00
|
|
|
if ((minw <= resw) && (minw != sd->wrap_w))
|
2010-01-27 02:19:54 -08:00
|
|
|
{
|
2011-06-12 05:02:57 -07:00
|
|
|
Evas_Coord ominw = -1;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2011-06-12 05:02:57 -07:00
|
|
|
evas_object_size_hint_min_get(data, &ominw, NULL);
|
|
|
|
minw = ominw;
|
2010-01-27 02:19:54 -08:00
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2011-06-12 05:02:57 -07:00
|
|
|
evas_object_size_hint_min_set(data, minw, minh);
|
2011-09-30 01:03:56 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(data));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(data));
|
2010-01-07 18:33:03 -08:00
|
|
|
}
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
static void
|
2012-05-03 15:42:38 -07:00
|
|
|
_label_format_set(Evas_Object *obj,
|
|
|
|
const char *format)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
if (format)
|
|
|
|
edje_object_part_text_style_user_push(obj, "elm.text", format);
|
|
|
|
else
|
|
|
|
edje_object_part_text_style_user_pop(obj, "elm.text");
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
2008-11-15 05:58:50 -08:00
|
|
|
static void
|
2013-01-03 23:39:14 -08:00
|
|
|
_label_slide_change(Evas_Object *obj)
|
2008-11-15 05:58:50 -08:00
|
|
|
{
|
2013-01-04 02:47:51 -08:00
|
|
|
Evas_Object *tb;
|
2012-05-03 15:42:38 -07:00
|
|
|
char *plaintxt;
|
|
|
|
int plainlen = 0;
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_DATA_GET(obj, sd);
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2013-01-04 20:10:33 -08:00
|
|
|
edje_object_signal_emit(wd->resize_obj, "elm,state,slide,stop", "elm");
|
|
|
|
|
|
|
|
//doesn't support multiline slide effect
|
2012-05-03 15:42:38 -07:00
|
|
|
if (sd->linewrap)
|
|
|
|
{
|
2013-01-04 00:00:56 -08:00
|
|
|
WRN("Doesn't support slide effect for multiline! : label=%p", obj);
|
2012-05-03 15:42:38 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-04 20:10:33 -08:00
|
|
|
//stop if the text is none.
|
2012-05-03 15:42:38 -07:00
|
|
|
plaintxt = _elm_util_mkup_to_text
|
2013-01-04 20:10:33 -08:00
|
|
|
(edje_object_part_text_get(wd->resize_obj, "elm.text"));
|
|
|
|
if (plaintxt)
|
2012-05-03 15:42:38 -07:00
|
|
|
{
|
|
|
|
plainlen = strlen(plaintxt);
|
|
|
|
free(plaintxt);
|
|
|
|
}
|
2013-01-06 20:33:29 -08:00
|
|
|
if (plainlen < 1) return;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2013-01-04 20:10:33 -08:00
|
|
|
//has slide effect.
|
2013-01-04 02:47:51 -08:00
|
|
|
if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE)
|
2012-05-03 15:42:38 -07:00
|
|
|
{
|
2013-01-06 22:06:16 -08:00
|
|
|
if (sd->ellipsis)
|
|
|
|
{
|
|
|
|
sd->slide_ellipsis = EINA_TRUE;
|
|
|
|
elm_label_ellipsis_set(obj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2013-01-04 02:47:51 -08:00
|
|
|
//slide only if the slide area is smaller than text width size.
|
|
|
|
if (sd->slide_mode == ELM_LABEL_SLIDE_MODE_AUTO)
|
|
|
|
{
|
|
|
|
tb = (Evas_Object *) edje_object_part_object_get(wd->resize_obj,
|
|
|
|
"elm.text");
|
|
|
|
if (tb)
|
|
|
|
{
|
|
|
|
Evas_Coord w, tb_w;
|
|
|
|
|
|
|
|
evas_object_textblock_size_formatted_get(tb, &tb_w, NULL);
|
|
|
|
evas_object_geometry_get(wd->resize_obj,
|
|
|
|
NULL, NULL, &w, NULL);
|
2013-01-06 22:06:16 -08:00
|
|
|
if ((tb_w > 0) && (tb_w < w))
|
|
|
|
{
|
|
|
|
if (sd->slide_ellipsis)
|
|
|
|
{
|
|
|
|
sd->slide_ellipsis = EINA_FALSE;
|
|
|
|
elm_label_ellipsis_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2013-01-04 02:47:51 -08:00
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
Edje_Message_Float_Set *msg =
|
|
|
|
alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double)));
|
|
|
|
|
|
|
|
msg->count = 1;
|
|
|
|
msg->val[0] = sd->slide_duration;
|
|
|
|
|
|
|
|
edje_object_message_send
|
2013-01-04 20:10:33 -08:00
|
|
|
(wd->resize_obj, EDJE_MESSAGE_FLOAT_SET, 0, msg);
|
|
|
|
edje_object_signal_emit(wd->resize_obj, "elm,state,slide,start", "elm");
|
2012-05-03 15:42:38 -07:00
|
|
|
}
|
2013-01-04 20:10:33 -08:00
|
|
|
//no slide effect.
|
2012-05-03 15:42:38 -07:00
|
|
|
else
|
|
|
|
{
|
2013-01-03 23:32:10 -08:00
|
|
|
if (sd->slide_ellipsis)
|
2012-05-03 15:42:38 -07:00
|
|
|
{
|
2013-01-03 23:32:10 -08:00
|
|
|
sd->slide_ellipsis = EINA_FALSE;
|
2012-05-03 15:42:38 -07:00
|
|
|
elm_label_ellipsis_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_elm_label_smart_theme(Eo *obj, void *_pd, va_list *list)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2011-09-30 01:03:56 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, elm_wdg_theme(&int_ret));
|
2012-11-25 22:32:53 -08:00
|
|
|
if (!int_ret) goto end;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_label_format_set(wd->resize_obj, sd->format);
|
2013-01-03 23:39:14 -08:00
|
|
|
_label_slide_change(obj);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
|
|
|
end:
|
2011-09-30 01:03:56 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2012-11-25 22:32:53 -08:00
|
|
|
if (ret) *ret = int_ret;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2008-11-15 05:58:50 -08:00
|
|
|
}
|
|
|
|
|
2008-09-29 23:58:56 -07:00
|
|
|
static void
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_label_smart_sizing_eval(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2011-06-12 05:02:57 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2010-03-08 23:30:48 -08:00
|
|
|
Evas_Coord resw, resh;
|
2011-06-09 06:56:09 -07:00
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_DATA_GET(obj, sd);
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
|
|
|
if (sd->linewrap)
|
2010-01-07 18:33:03 -08:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
evas_object_geometry_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, NULL, NULL, &resw, &resh);
|
2012-05-03 15:42:38 -07:00
|
|
|
if (resw == sd->lastw) return;
|
|
|
|
sd->lastw = resw;
|
|
|
|
_recalc(obj);
|
2010-01-07 18:33:03 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-09-30 01:03:56 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2013-01-04 21:50:13 -08:00
|
|
|
edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
|
2012-05-03 15:42:38 -07:00
|
|
|
if (sd->wrap_w > 0 && minw > sd->wrap_w) minw = sd->wrap_w;
|
2010-01-07 18:33:03 -08:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2011-09-30 01:03:56 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2010-01-07 18:33:03 -08:00
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
}
|
|
|
|
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
static void
|
2012-05-03 15:42:38 -07:00
|
|
|
_on_label_resize(void *data,
|
|
|
|
Evas *e __UNUSED__,
|
|
|
|
Evas_Object *obj __UNUSED__,
|
|
|
|
void *event_info __UNUSED__)
|
2010-01-07 18:33:03 -08:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_DATA_GET(data, sd);
|
2010-07-15 22:50:45 -07:00
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
if (sd->linewrap) elm_layout_sizing_eval(data);
|
2012-03-07 06:02:42 -08:00
|
|
|
}
|
|
|
|
|
2010-07-15 22:50:45 -07:00
|
|
|
static int
|
2012-05-03 15:42:38 -07:00
|
|
|
_get_value_in_key_string(const char *oldstring,
|
|
|
|
const char *key,
|
|
|
|
char **value)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
2012-01-23 08:10:53 -08:00
|
|
|
char *curlocater, *endtag;
|
2010-07-15 22:50:45 -07:00
|
|
|
int firstindex = 0, foundflag = -1;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-07-15 22:50:45 -07:00
|
|
|
curlocater = strstr(oldstring, key);
|
|
|
|
if (curlocater)
|
|
|
|
{
|
2010-10-18 19:17:37 -07:00
|
|
|
int key_len = strlen(key);
|
|
|
|
endtag = curlocater + key_len;
|
2010-08-21 06:52:25 -07:00
|
|
|
if ((!endtag) || (*endtag != '='))
|
2010-12-19 23:18:23 -08:00
|
|
|
{
|
|
|
|
foundflag = 0;
|
|
|
|
return -1;
|
|
|
|
}
|
2010-07-15 22:50:45 -07:00
|
|
|
firstindex = abs(oldstring - curlocater);
|
2010-10-18 19:17:37 -07:00
|
|
|
firstindex += key_len + 1; // strlen("key") + strlen("=")
|
2010-07-15 23:21:25 -07:00
|
|
|
*value = (char *)oldstring + firstindex;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2012-01-23 08:10:53 -08:00
|
|
|
foundflag = 1;
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-15 23:21:25 -07:00
|
|
|
foundflag = 0;
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-07-15 22:50:45 -07:00
|
|
|
if (foundflag == 1) return 0;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-07-15 22:50:45 -07:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-05-03 15:42:38 -07:00
|
|
|
_strbuf_key_value_replace(Eina_Strbuf *srcbuf,
|
|
|
|
const char *key,
|
|
|
|
const char *value,
|
|
|
|
int deleteflag)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
2012-01-23 08:10:53 -08:00
|
|
|
char *kvalue;
|
2010-07-15 22:50:45 -07:00
|
|
|
const char *srcstring = NULL;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-07-15 22:50:45 -07:00
|
|
|
srcstring = eina_strbuf_string_get(srcbuf);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2012-01-23 08:10:53 -08:00
|
|
|
if (_get_value_in_key_string(srcstring, key, &kvalue) == 0)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
2012-01-23 08:10:53 -08:00
|
|
|
const char *val_end;
|
|
|
|
int val_end_idx = 0;
|
|
|
|
int key_start_idx = 0;
|
|
|
|
val_end = strchr(kvalue, ' ');
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2012-01-23 08:10:53 -08:00
|
|
|
if (val_end)
|
2012-05-03 15:42:38 -07:00
|
|
|
val_end_idx = val_end - srcstring;
|
2012-01-23 08:10:53 -08:00
|
|
|
else
|
2012-05-03 15:42:38 -07:00
|
|
|
val_end_idx = kvalue - srcstring + strlen(kvalue) - 1;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2012-01-23 08:10:53 -08:00
|
|
|
/* -1 is because of the '=' */
|
|
|
|
key_start_idx = kvalue - srcstring - 1 - strlen(key);
|
|
|
|
eina_strbuf_remove(srcbuf, key_start_idx, val_end_idx);
|
|
|
|
if (!deleteflag)
|
|
|
|
{
|
|
|
|
eina_strbuf_insert_printf(srcbuf, "%s=%s", key_start_idx, key,
|
2012-05-03 15:42:38 -07:00
|
|
|
value);
|
2012-01-23 08:10:53 -08:00
|
|
|
}
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
2012-01-23 08:10:53 -08:00
|
|
|
else if (!deleteflag)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
2012-01-23 08:10:53 -08:00
|
|
|
if (*srcstring)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
2012-01-23 08:10:53 -08:00
|
|
|
/* -1 because we want it before the ' */
|
2012-05-03 15:42:38 -07:00
|
|
|
eina_strbuf_insert_printf
|
|
|
|
(srcbuf, " %s=%s", eina_strbuf_length_get(srcbuf) - 1, key,
|
|
|
|
value);
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-01-23 08:10:53 -08:00
|
|
|
eina_strbuf_append_printf(srcbuf, "DEFAULT='%s=%s'", key, value);
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
return 0;
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-05-03 15:42:38 -07:00
|
|
|
_stringshare_key_value_replace(const char **srcstring,
|
|
|
|
const char *key,
|
|
|
|
const char *value,
|
|
|
|
int deleteflag)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
Eina_Strbuf *sharebuf = NULL;
|
|
|
|
|
2010-07-15 22:50:45 -07:00
|
|
|
sharebuf = eina_strbuf_new();
|
|
|
|
eina_strbuf_append(sharebuf, *srcstring);
|
|
|
|
_strbuf_key_value_replace(sharebuf, key, value, deleteflag);
|
|
|
|
eina_stringshare_del(*srcstring);
|
|
|
|
*srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf));
|
|
|
|
eina_strbuf_free(sharebuf);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_elm_label_smart_text_set(Eo *obj, void *_pd, va_list *list)
|
2011-06-28 23:41:20 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2013-07-22 13:34:19 -07:00
|
|
|
const char *part = va_arg(*list, const char *);
|
2012-11-25 22:32:53 -08:00
|
|
|
const char *label = va_arg(*list, const char *);
|
|
|
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
|
|
if (ret) *ret = EINA_FALSE;
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2011-06-28 23:41:20 -07:00
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
if (!label) label = "";
|
2012-11-25 22:32:53 -08:00
|
|
|
_label_format_set(wd->resize_obj, sd->format);
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2013-07-22 13:34:19 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, elm_obj_layout_text_set(part, label, &int_ret));
|
2012-11-25 22:32:53 -08:00
|
|
|
if (int_ret)
|
2012-11-21 09:09:44 -08:00
|
|
|
{
|
|
|
|
sd->lastw = 0;
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj, elm_obj_layout_sizing_eval());
|
2012-11-21 09:09:44 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
if (ret) *ret = int_ret;
|
2012-05-03 15:42:38 -07:00
|
|
|
}
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_elm_label_smart_translate(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
2012-05-03 15:42:38 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
2013-06-09 01:56:30 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_LANG_CHANGED, NULL);
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
if (ret) *ret = EINA_TRUE;
|
2011-06-28 23:41:20 -07:00
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static char *
|
2012-12-23 06:50:56 -08:00
|
|
|
_access_info_cb(void *data __UNUSED__, Evas_Object *obj)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
const char *txt = elm_widget_access_info_get(obj);
|
|
|
|
|
2013-01-24 20:06:17 -08:00
|
|
|
if (!txt) txt = _elm_util_mkup_to_text(elm_layout_text_get(obj, NULL));
|
2012-08-18 06:52:03 -07:00
|
|
|
if (txt) return strdup(txt);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-04 20:56:06 -08:00
|
|
|
static void
|
|
|
|
_on_slide_end(void *data, Evas_Object *obj __UNUSED__,
|
|
|
|
const char *emission __UNUSED__, const char *source __UNUSED__)
|
|
|
|
{
|
2013-01-06 20:33:29 -08:00
|
|
|
ELM_LABEL_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
if (sd->slide_ellipsis)
|
|
|
|
eo_do(data, elm_obj_label_ellipsis_set(EINA_TRUE));
|
|
|
|
|
2013-01-04 20:56:06 -08:00
|
|
|
evas_object_smart_callback_call(data, SIG_SLIDE_END, NULL);
|
|
|
|
}
|
|
|
|
|
2011-10-19 07:17:14 -07:00
|
|
|
static void
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_label_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
2011-10-19 07:17:14 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *priv = _pd;
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-02-20 21:57:05 -08:00
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
priv->linewrap = ELM_WRAP_NONE;
|
|
|
|
priv->wrap_w = -1;
|
|
|
|
priv->slide_duration = 10;
|
|
|
|
|
|
|
|
priv->format = eina_stringshare_add("");
|
2012-11-25 22:32:53 -08:00
|
|
|
_label_format_set(wd->resize_obj, priv->format);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, EVAS_CALLBACK_RESIZE,
|
2012-05-03 15:42:38 -07:00
|
|
|
_on_label_resize, obj);
|
|
|
|
|
2013-01-04 20:56:06 -08:00
|
|
|
edje_object_signal_callback_add(wd->resize_obj, "elm,state,slide,end", "",
|
|
|
|
_on_slide_end, obj);
|
|
|
|
|
2013-02-07 22:16:03 -08:00
|
|
|
/* access */
|
|
|
|
elm_widget_can_focus_set(obj, _elm_config->access_mode);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_access_object_register(obj, wd->resize_obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_text_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Label"));
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
2013-02-20 21:57:05 -08:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)))
|
|
|
|
CRITICAL("Failed to set layout!");
|
|
|
|
|
2013-02-20 21:57:05 -08:00
|
|
|
elm_layout_text_set(obj, NULL, "<br>");
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 09:59:20 -07:00
|
|
|
|
2008-10-06 18:23:49 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_label_add(Evas_Object *parent)
|
2008-09-29 23:58:56 -07:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
|
|
|
eo_unref(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
2013-01-04 20:56:06 -08:00
|
|
|
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
|
2008-10-06 18:23:49 -07:00
|
|
|
}
|
2008-09-29 23:58:56 -07:00
|
|
|
|
2009-10-10 22:57:05 -07:00
|
|
|
EAPI void
|
2012-05-03 15:42:38 -07:00
|
|
|
elm_label_line_wrap_set(Evas_Object *obj,
|
|
|
|
Elm_Wrap_Type wrap)
|
2009-10-10 22:57:05 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
ELM_LABEL_CHECK(obj);
|
|
|
|
eo_do(obj, elm_obj_label_line_wrap_set(wrap));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_line_wrap_set(Eo *obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Elm_Wrap_Type wrap = va_arg(*list, Elm_Wrap_Type);
|
2012-05-03 15:42:38 -07:00
|
|
|
const char *wrap_str, *text;
|
2011-06-09 06:56:09 -07:00
|
|
|
int len;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
|
|
|
if (sd->linewrap == wrap) return;
|
|
|
|
|
|
|
|
sd->linewrap = wrap;
|
|
|
|
text = elm_layout_text_get(obj, NULL);
|
|
|
|
if (!text) return;
|
|
|
|
|
|
|
|
len = strlen(text);
|
2011-06-09 06:56:09 -07:00
|
|
|
if (len <= 0) return;
|
|
|
|
|
|
|
|
switch (wrap)
|
|
|
|
{
|
|
|
|
case ELM_WRAP_CHAR:
|
2012-05-03 15:42:38 -07:00
|
|
|
wrap_str = "char";
|
|
|
|
break;
|
|
|
|
|
2011-06-09 06:56:09 -07:00
|
|
|
case ELM_WRAP_WORD:
|
2012-05-03 15:42:38 -07:00
|
|
|
wrap_str = "word";
|
|
|
|
break;
|
|
|
|
|
2011-06-09 06:56:09 -07:00
|
|
|
case ELM_WRAP_MIXED:
|
2012-05-03 15:42:38 -07:00
|
|
|
wrap_str = "mixed";
|
|
|
|
break;
|
|
|
|
|
2011-06-09 06:56:09 -07:00
|
|
|
default:
|
2012-05-03 15:42:38 -07:00
|
|
|
wrap_str = "none";
|
|
|
|
break;
|
2011-06-09 06:56:09 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
if (_stringshare_key_value_replace(&sd->format, "wrap", wrap_str, 0) == 0)
|
2011-06-09 06:56:09 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
_label_format_set(wd->resize_obj, sd->format);
|
2012-05-03 15:42:38 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-06-09 06:56:09 -07:00
|
|
|
}
|
2009-10-10 22:57:05 -07:00
|
|
|
}
|
2010-01-26 00:42:37 -08:00
|
|
|
|
2011-05-02 03:56:16 -07:00
|
|
|
EAPI Elm_Wrap_Type
|
2010-01-26 00:42:37 -08:00
|
|
|
elm_label_line_wrap_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj) EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Wrap_Type ret = EINA_FALSE;
|
|
|
|
eo_do((Eo *) obj, elm_obj_label_line_wrap_get(&ret));
|
|
|
|
return ret;
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_line_wrap_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Elm_Wrap_Type *ret = va_arg(*list, Elm_Wrap_Type *);
|
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
|
|
|
*ret = sd->linewrap;
|
2010-01-26 00:42:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-05-03 15:42:38 -07:00
|
|
|
elm_label_wrap_width_set(Evas_Object *obj,
|
|
|
|
Evas_Coord w)
|
2010-01-26 00:42:37 -08:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj, elm_obj_label_wrap_width_set(w));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_wrap_width_set(Eo *obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Coord w = va_arg(*list, Evas_Coord);
|
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2010-12-19 23:18:23 -08:00
|
|
|
if (w < 0) w = 0;
|
2012-05-03 15:42:38 -07:00
|
|
|
|
|
|
|
if (sd->wrap_w == w) return;
|
|
|
|
|
|
|
|
if (sd->ellipsis)
|
2012-11-25 22:32:53 -08:00
|
|
|
_label_format_set(wd->resize_obj, sd->format);
|
2012-05-03 15:42:38 -07:00
|
|
|
sd->wrap_w = w;
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2010-01-26 00:42:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Coord
|
|
|
|
elm_label_wrap_width_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj) 0;
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Coord ret = 0;
|
|
|
|
eo_do((Eo *) obj, elm_obj_label_wrap_width_get(&ret));
|
|
|
|
return ret;
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_wrap_width_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Evas_Coord *ret = va_arg(*list, Evas_Coord *);
|
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
|
|
|
*ret = sd->wrap_w;
|
2010-01-26 00:42:37 -08:00
|
|
|
}
|
2010-07-15 22:50:45 -07:00
|
|
|
|
|
|
|
EAPI void
|
2012-05-03 15:42:38 -07:00
|
|
|
elm_label_ellipsis_set(Evas_Object *obj,
|
|
|
|
Eina_Bool ellipsis)
|
2010-07-15 22:50:45 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
ELM_LABEL_CHECK(obj);
|
|
|
|
eo_do(obj, elm_obj_label_ellipsis_set(ellipsis));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ellipsis_set(Eo *obj, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_Bool ellipsis = va_arg(*list, int);
|
2011-06-09 06:56:09 -07:00
|
|
|
Eina_Strbuf *fontbuf = NULL;
|
|
|
|
int len, removeflag = 0;
|
2012-05-03 15:42:38 -07:00
|
|
|
const char *text;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-10-05 01:14:43 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2011-06-09 06:56:09 -07:00
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
if (sd->ellipsis == ellipsis) return;
|
|
|
|
sd->ellipsis = ellipsis;
|
|
|
|
|
|
|
|
text = elm_layout_text_get(obj, NULL);
|
|
|
|
if (!text) return;
|
|
|
|
|
|
|
|
len = strlen(text);
|
2011-06-09 06:56:09 -07:00
|
|
|
if (len <= 0) return;
|
|
|
|
|
|
|
|
if (ellipsis == EINA_FALSE) removeflag = 1; // remove fontsize tag
|
|
|
|
|
|
|
|
fontbuf = eina_strbuf_new();
|
|
|
|
eina_strbuf_append_printf(fontbuf, "%f", 1.0);
|
|
|
|
|
2012-05-03 15:42:38 -07:00
|
|
|
if (_stringshare_key_value_replace
|
|
|
|
(&sd->format, "ellipsis", eina_strbuf_string_get
|
|
|
|
(fontbuf), removeflag) == 0)
|
2011-06-09 06:56:09 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
_label_format_set(wd->resize_obj, sd->format);
|
2012-05-03 15:42:38 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-06-09 06:56:09 -07:00
|
|
|
}
|
|
|
|
eina_strbuf_free(fontbuf);
|
2010-07-15 22:50:45 -07:00
|
|
|
}
|
2010-12-20 00:55:06 -08:00
|
|
|
|
2012-02-16 03:39:07 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_label_ellipsis_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj) EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
|
|
|
eo_do((Eo *) obj, elm_obj_label_ellipsis_get(&ret));
|
|
|
|
return ret;
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_ellipsis_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
|
|
|
*ret = sd->ellipsis;
|
2012-02-16 03:39:07 -08:00
|
|
|
}
|
|
|
|
|
2010-12-20 00:55:06 -08:00
|
|
|
EAPI void
|
2013-01-04 02:47:51 -08:00
|
|
|
elm_label_slide_mode_set(Evas_Object *obj, Elm_Label_Slide_Mode mode)
|
2010-12-20 00:55:06 -08:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj);
|
2013-01-04 02:47:51 -08:00
|
|
|
eo_do(obj, elm_obj_label_slide_mode_set(mode));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-04 05:24:37 -08:00
|
|
|
_slide_mode_set(Eo *obj __UNUSED__, void *_pd, va_list *list)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-01-04 02:47:51 -08:00
|
|
|
Elm_Label_Slide_Mode mode = va_arg(*list, Elm_Label_Slide_Mode);
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-01-04 02:47:51 -08:00
|
|
|
sd->slide_mode = mode;
|
2010-12-20 00:55:06 -08:00
|
|
|
}
|
|
|
|
|
2013-01-04 02:47:51 -08:00
|
|
|
EAPI Elm_Label_Slide_Mode
|
|
|
|
elm_label_slide_mode_get(const Evas_Object *obj)
|
2010-12-20 00:55:06 -08:00
|
|
|
{
|
2013-01-04 02:47:51 -08:00
|
|
|
ELM_LABEL_CHECK(obj) ELM_LABEL_SLIDE_MODE_NONE;
|
|
|
|
Elm_Label_Slide_Mode ret = ELM_LABEL_SLIDE_MODE_NONE;
|
|
|
|
eo_do((Eo *) obj, elm_obj_label_slide_mode_get(&ret));
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2012-05-03 15:42:38 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2013-01-04 02:47:51 -08:00
|
|
|
_slide_mode_get(Eo *obj __UNUSED__, void *_pd, va_list *list)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-01-04 02:47:51 -08:00
|
|
|
Elm_Label_Slide_Mode *ret = va_arg(*list, Elm_Label_Slide_Mode *);
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2013-01-04 02:47:51 -08:00
|
|
|
*ret = sd->slide_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI void
|
|
|
|
elm_label_slide_set(Evas_Object *obj,
|
|
|
|
Eina_Bool slide)
|
|
|
|
{
|
|
|
|
if (slide)
|
|
|
|
elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
|
|
|
|
else
|
|
|
|
elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_NONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
|
|
|
elm_label_slide_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Eina_Bool ret = EINA_FALSE;
|
|
|
|
if (elm_label_slide_mode_get(obj) == ELM_LABEL_SLIDE_MODE_ALWAYS)
|
|
|
|
ret = EINA_TRUE;
|
|
|
|
return ret;
|
2010-12-20 00:55:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_label_slide_duration_set(Evas_Object *obj, double duration)
|
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj, elm_obj_label_slide_duration_set(duration));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-04 05:44:08 -08:00
|
|
|
_slide_duration_set(Eo *obj __UNUSED__, void *_pd, va_list *list)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
double duration = va_arg(*list, double);
|
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
2012-05-03 15:42:38 -07:00
|
|
|
sd->slide_duration = duration;
|
2010-12-20 00:55:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
2012-02-16 03:39:07 -08:00
|
|
|
elm_label_slide_duration_get(const Evas_Object *obj)
|
2010-12-20 00:55:06 -08:00
|
|
|
{
|
2012-05-03 15:42:38 -07:00
|
|
|
ELM_LABEL_CHECK(obj) 0.0;
|
2012-11-25 22:32:53 -08:00
|
|
|
double ret = 0.0;
|
|
|
|
eo_do((Eo *) obj, elm_obj_label_slide_duration_get(&ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-01-04 05:24:37 -08:00
|
|
|
EAPI void
|
|
|
|
elm_label_slide_go(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_LABEL_CHECK(obj);
|
|
|
|
eo_do((Eo *) obj, elm_obj_label_slide_go());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slide_go(Eo *obj, void *_pd __UNUSED__, va_list *list __UNUSED__)
|
|
|
|
{
|
|
|
|
_label_slide_change(obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_slide_duration_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|
|
|
{
|
|
|
|
double *ret = va_arg(*list, double *);
|
|
|
|
Elm_Label_Smart_Data *sd = _pd;
|
|
|
|
*ret = sd->slide_duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_label_smart_text_aliases_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
const Elm_Layout_Part_Alias_Description **aliases = va_arg(*list, const Elm_Layout_Part_Alias_Description **);
|
|
|
|
*aliases = _text_aliases;
|
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
|
|
|
_elm_label_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
|
|
*ret = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_label_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
|
|
|
{
|
|
|
|
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
|
|
*ret = EINA_FALSE;
|
2012-05-03 15:42:38 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_class_constructor(Eo_Class *klass)
|
|
|
|
{
|
|
|
|
const Eo_Op_Func_Description func_desc[] = {
|
|
|
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
|
|
|
|
|
|
|
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_label_smart_add),
|
|
|
|
|
|
|
|
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_label_smart_theme),
|
|
|
|
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATE), _elm_label_smart_translate),
|
|
|
|
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_label_smart_focus_next_manager_is),
|
|
|
|
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_label_smart_focus_direction_manager_is),
|
|
|
|
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_label_smart_sizing_eval),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_TEXT_SET), _elm_label_smart_text_set),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_TEXT_ALIASES_GET), _elm_label_smart_text_aliases_get),
|
|
|
|
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_LINE_WRAP_SET), _line_wrap_set),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_LINE_WRAP_GET), _line_wrap_get),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_SET), _wrap_width_set),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_GET), _wrap_width_get),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_SET), _ellipsis_set),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET), _ellipsis_get),
|
2013-01-04 02:47:51 -08:00
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET), _slide_mode_set),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET), _slide_mode_get),
|
2012-11-25 22:32:53 -08:00
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET), _slide_duration_set),
|
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), _slide_duration_get),
|
2013-01-04 05:24:37 -08:00
|
|
|
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO), _slide_go),
|
2012-11-25 22:32:53 -08:00
|
|
|
EO_OP_FUNC_SENTINEL
|
|
|
|
};
|
|
|
|
eo_class_funcs_set(klass, func_desc);
|
2013-02-09 23:52:31 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
static const Eo_Op_Description op_desc[] = {
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_LINE_WRAP_SET, "Set the wrapping behavior of the label."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_LINE_WRAP_GET, "Get the wrapping behavior of the label."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_SET, "Set wrap width of the label."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_GET, "Get wrap width of the label."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_SET, "Set the ellipsis behavior of the label."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET, "Get the ellipsis behavior of the label."),
|
2013-01-04 02:47:51 -08:00
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET, "Set slide effect mode of label widget."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET, "Get current slide effect mode."),
|
2012-11-25 22:32:53 -08:00
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, "Set the slide duration (speed) of the label."),
|
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, "Get the slide duration(speed) of the label."),
|
2013-01-04 05:24:37 -08:00
|
|
|
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO, "Start slide effect."),
|
2012-11-25 22:32:53 -08:00
|
|
|
EO_OP_DESCRIPTION_SENTINEL
|
|
|
|
};
|
|
|
|
static const Eo_Class_Description class_desc = {
|
|
|
|
EO_VERSION,
|
|
|
|
MY_CLASS_NAME,
|
|
|
|
EO_CLASS_TYPE_REGULAR,
|
|
|
|
EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_LABEL_BASE_ID, op_desc, ELM_OBJ_LABEL_SUB_ID_LAST),
|
|
|
|
NULL,
|
|
|
|
sizeof(Elm_Label_Smart_Data),
|
|
|
|
_class_constructor,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
EO_DEFINE_CLASS(elm_obj_label_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL);
|