forked from enlightenment/efl
efl_ui_tags: Fixed bug when setting format string.
Summary: efl_ui_format_string_set was not working well. Changed default format text. ("++++ %d" text for test only.) @fix Reviewers: Jaehyun_Cho, cedric, woohyun Reviewed By: Jaehyun_Cho Subscribers: zmike, cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D6044
This commit is contained in:
parent
976b9d877e
commit
428d74ebc1
|
@ -289,34 +289,22 @@ group { "efl/tags/btn";
|
|||
}
|
||||
|
||||
group { "efl/tags/number";
|
||||
styles {
|
||||
style { name: "textblock_style_efl_tags_default";
|
||||
base: "font="FNBD" font_size=10 text_class=tags_closed style=glow color=#3399ffff glow_color=#3399ff18 align=center glow2_color=#3399ff12 wrap=char";
|
||||
tag: "br" "\n";
|
||||
tag: "ps" "ps";
|
||||
tag: "hilight" "+ font="FNBD;
|
||||
tag: "b" "+ font="FNBD;
|
||||
tag: "tab" "\t";
|
||||
}
|
||||
}
|
||||
parts {
|
||||
rect { "bg";
|
||||
desc { "default";
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
textblock { "efl.text";
|
||||
text { "efl.text";
|
||||
nomouse;
|
||||
effect: GLOW;
|
||||
scale;
|
||||
desc { "default";
|
||||
rel1.offset: 2 2;
|
||||
rel1.to: "bg";
|
||||
rel2.offset: -3 -3;
|
||||
rel2.to: "bg";
|
||||
text { style: "textblock_style_tags_default";
|
||||
color: FN_COL_HIGHLIGHT;
|
||||
color_class: "tags_number";
|
||||
text { font: FNBD; size: 10;
|
||||
min: 1 1;
|
||||
ellipsis: -1;
|
||||
align: 0.5 0.5;
|
||||
text_class: "tags_number";
|
||||
}
|
||||
rel1.offset: 2 2;
|
||||
rel2.offset: -5 -5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,22 @@ _item_deleted_cb(void *data, const Efl_Event *ev)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||
{
|
||||
Eo *tags = data;
|
||||
|
||||
if (efl_ui_tags_expanded_get(tags))
|
||||
efl_ui_tags_expanded_set(tags, EINA_FALSE);
|
||||
else
|
||||
efl_ui_tags_expanded_set(tags, EINA_TRUE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
test_ui_tags(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Eo *win, *bx;
|
||||
Eo *win, *layout, *tags;
|
||||
|
||||
const char* strs[] = {
|
||||
"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"
|
||||
|
@ -44,26 +56,34 @@ test_ui_tags(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
|
|||
|
||||
Eina_Array *array;
|
||||
unsigned int i;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
||||
efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
|
||||
efl_text_set(efl_added, "Efl.Ui.Tags"),
|
||||
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", elm_app_data_dir_get());
|
||||
layout = efl_add(EFL_UI_LAYOUT_OBJECT_CLASS, win,
|
||||
elm_layout_file_set(efl_added, buf, "multibuttonentry_test"),
|
||||
elm_win_resize_object_add(win, efl_added));
|
||||
|
||||
array = eina_array_new(10);
|
||||
for (i = 0; i < 9; i++)
|
||||
eina_array_push(array, strs[i]);
|
||||
|
||||
bx = efl_add(EFL_UI_BOX_CLASS, win,
|
||||
efl_content_set(win, efl_added),
|
||||
efl_ui_direction_set(efl_added, EFL_UI_DIR_DOWN));
|
||||
tags = efl_add(EFL_UI_TAGS_CLASS, layout,
|
||||
efl_ui_tags_items_set(efl_added, array),
|
||||
efl_event_callback_add(efl_added, EFL_UI_TAGS_EVENT_ITEM_ADDED, _item_added_cb, array),
|
||||
efl_event_callback_add(efl_added, EFL_UI_TAGS_EVENT_ITEM_DELETED, _item_deleted_cb, array),
|
||||
efl_text_set(efl_added, "To :"),
|
||||
efl_ui_format_string_set(efl_added, "+ %d items"),
|
||||
elm_object_part_content_set(layout, "multibuttonentry", efl_added));
|
||||
|
||||
efl_add(EFL_UI_TAGS_CLASS, bx,
|
||||
efl_ui_tags_items_set(efl_added, array),
|
||||
efl_event_callback_add(efl_added, EFL_UI_TAGS_EVENT_ITEM_ADDED, _item_added_cb, array),
|
||||
efl_event_callback_add(efl_added, EFL_UI_TAGS_EVENT_ITEM_DELETED, _item_deleted_cb, array),
|
||||
efl_text_set(efl_added, "To :"),
|
||||
efl_pack(bx, efl_added));
|
||||
efl_add(EFL_UI_BUTTON_CLASS, layout,
|
||||
efl_text_set(efl_added, "Change mode"),
|
||||
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _clicked, tags),
|
||||
elm_object_part_content_set(layout, "box", efl_added));
|
||||
|
||||
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 480));
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ _shrink_mode_set(Eo *obj,
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "+++++ %d", count);
|
||||
snprintf(buf, sizeof(buf), "+ %d", count);
|
||||
edje_object_part_text_escaped_set(sd->end, "efl.text", buf);
|
||||
}
|
||||
|
||||
|
@ -119,14 +119,14 @@ _shrink_mode_set(Eo *obj,
|
|||
if (sd->format_cb)
|
||||
{
|
||||
eina_strbuf_reset(sd->format_strbuf);
|
||||
|
||||
eina_value_set(&val, count);
|
||||
sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
|
||||
edje_object_part_text_escaped_set(sd->end, "efl.text",
|
||||
eina_strbuf_string_get(sd->format_strbuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "+++++ %d", count);
|
||||
snprintf(buf, sizeof(buf), "+ %d", count);
|
||||
edje_object_part_text_escaped_set(sd->end, "efl.text", buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ static const Elm_Color_Class _elm_color_classes[] = {
|
|||
{"datetime_text", "Datetime Text"},
|
||||
{"multibuttonentry_label", "Multibuttonentry Text"},
|
||||
{"tags_label", "Tags Text"},
|
||||
{"tags_number", "Tags Number Text"},
|
||||
{"spinner", "Spinner Text"},
|
||||
{"spinner_disabled", "Spinner Disabled Text"},
|
||||
{NULL, NULL}
|
||||
|
|
Loading…
Reference in New Issue