const char *part);
static const char SIG_SELECTED[] = "selected";
+static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
+static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
+static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
+static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
+
static const Evas_Smart_Cb_Description _signals[] = {
{SIG_SELECTED, ""},
+ {SIG_SCROLL_ANIM_START, ""},
+ {SIG_SCROLL_ANIM_STOP, ""},
+ {SIG_SCROLL_DRAG_START, ""},
+ {SIG_SCROLL_DRAG_STOP, ""},
{NULL, NULL}
};
// cut it off at byte mark returned form _check_letter
strncpy(buf, it->label, length);
buf[length] = '\0';
- edje_object_part_text_set(VIEW(it), "elm.text", buf);
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", buf);
}
if (wd->check_idler)
if (dit)
{
eina_stringshare_replace(&wd->first->label, dit->label);
- edje_object_part_text_set(wd->VIEW(first), "elm.text",
+ edje_object_part_text_escaped_set(wd->VIEW(first), "elm.text",
wd->first->label);
}
dit = eina_list_nth(wd->items, 1);
if (dit)
{
eina_stringshare_replace(&wd->second->label, dit->label);
- edje_object_part_text_set(wd->VIEW(second), "elm.text",
+ edje_object_part_text_escaped_set(wd->VIEW(second), "elm.text",
wd->second->label);
}
// if more than 3 itmes should be displayed
dit = eina_list_nth(wd->items, i);
item2 = eina_list_nth(wd->over_items, i - 2);
eina_stringshare_replace(&item2->label, dit->label);
- edje_object_part_text_set(VIEW(item2), "elm.text", item2->label);
+ edje_object_part_text_escaped_set(VIEW(item2), "elm.text", item2->label);
}
dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
if (dit)
{
eina_stringshare_replace(&wd->last->label, dit->label);
- edje_object_part_text_set(wd->VIEW(last), "elm.text",
+ edje_object_part_text_escaped_set(wd->VIEW(last), "elm.text",
wd->last->label);
}
dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 2);
if (dit)
{
eina_stringshare_replace(&wd->s_last->label, dit->label);
- edje_object_part_text_set(wd->VIEW(s_last), "elm.text",
+ edje_object_part_text_escaped_set(wd->VIEW(s_last), "elm.text",
wd->s_last->label);
}
// if more than 3 itmes should be displayed
dit = eina_list_nth(wd->items, wd->item_count - i);
item2 = eina_list_nth(wd->under_items, i - 3);
eina_stringshare_replace(&item2->label, dit->label);
- edje_object_part_text_set(VIEW(item2), "elm.text",
+ edje_object_part_text_escaped_set(VIEW(item2), "elm.text",
item2->label);
}
}
if (it->label)
{
- edje_object_part_text_set(VIEW(it), "elm.text", it->label);
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
edje_object_signal_callback_add(VIEW(it), "elm,action,click", "", _item_click_cb, it);
}
if (it->icon)
_theme_data_get(Widget_Data *wd)
{
const char* str;
+ Evas_Object *parent;
str = edje_object_data_get(wd->right_blank, "len_threshold");
if (str) wd->len_threshold = MAX(0, atoi(str));
else wd->len_threshold = 0;
}
str = edje_object_data_get(wd->right_blank, "min_width");
- if (str) wd->minw = MAX(-1, atoi(str));
- else wd->minw = -1;
+ if (str) wd->minw = MAX(-1, atoi(str)) * elm_scale_get();
+ else
+ {
+ parent = elm_widget_parent_widget_get(wd->self);
+ if (!parent) wd->minw = -1;
+ else evas_object_geometry_get(parent, NULL, NULL, &wd->minw, NULL);
+ }
str = edje_object_data_get(wd->right_blank, "min_height");
- if (str) wd->minh = MAX(-1, atoi(str));
+ if (str) wd->minh = MAX(-1, atoi(str)) * elm_scale_get();
else wd->minh = -1;
}
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
+ if (wd->idler)
+ {
+ ecore_idle_enterer_del(wd->idler);
+ wd->idler = NULL;
+ }
free(wd);
}
{
_elm_theme_object_set(obj, VIEW(it), "diskselector", "item",
elm_widget_style_get(obj));
- edje_object_part_text_set(VIEW(it), "elm.text", it->label);
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
}
}
else
{
_elm_theme_object_set(obj, VIEW(it), "diskselector", "item",
elm_widget_style_get(obj));
- edje_object_part_text_set(VIEW(it), "elm.text", it->label);
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label);
}
}
_elm_theme_object_set(obj, wd->right_blank, "diskselector", "item",
return EINA_TRUE;
}
- if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")) ||
- (!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
+ if ((!strcmp(ev->keyname, "Left")) ||
+ ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)) ||
+ (!strcmp(ev->keyname, "Up")) ||
+ ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
{
l = wd->selected_item->node->prev;
if ((!l) && (wd->round))
l = eina_list_last(wd->items);
}
- else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")) ||
- (!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
+ else if ((!strcmp(ev->keyname, "Right")) ||
+ ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)) ||
+ (!strcmp(ev->keyname, "Down")) ||
+ ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
{
l = wd->selected_item->node->next;
if ((!l) && (wd->round))
l = wd->items;
}
- else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
+ else if ((!strcmp(ev->keyname, "Home")) ||
+ ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string)))
l = wd->items;
- else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
+ else if ((!strcmp(ev->keyname, "End")) ||
+ ((!strcmp(ev->keyname, "KP_End")) && (!ev->string)))
l = eina_list_last(wd->items);
else return EINA_FALSE;
wd = elm_widget_data_get(WIDGET(it));
if (!wd) return;
+ if (!it->label) return;
EINA_LIST_FOREACH(wd->r_items, l, item)
{
- if (!strcmp(item->label, it->label)) edje_object_signal_emit(VIEW(item), "elm,state,selected", "elm");
+ if (item->label && !strcmp(item->label, it->label))
+ edje_object_signal_emit(VIEW(item), "elm,state,selected", "elm");
else
edje_object_signal_emit(VIEW(item), "elm,state,default", "elm");
}
_scroller_stop_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Elm_Diskselector_Item *it;
- Widget_Data *wd = data;
+ Widget_Data *wd = elm_widget_data_get(data);
Evas_Coord x, w, ow;
Eina_List *l, *list;
if (!it) return;
_select_item(it);
+ evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, it);
+}
+
+static void
+_scroller_start_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START,
+ elm_diskselector_selected_item_get(data));
+}
+
+static void
+_drag_start_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START,
+ elm_diskselector_selected_item_get(data));
+}
+
+static void
+_drag_stop_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP,
+ elm_diskselector_selected_item_get(data));
}
static Eina_Bool
}
evas_object_geometry_get(wd->scroller, NULL, &y, &w, &h);
- elm_smart_scroller_child_region_show(wd->scroller, w / wd->display_item_num * i, y, w, h);
+ //move scroller in two steps for getting smooth launching effect.
+ if (i > 2)
+ elm_smart_scroller_child_region_show(wd->scroller, w / wd->display_item_num * (i-2), y, w, h);
+ elm_smart_scroller_region_bring_in(wd->scroller, w / wd->display_item_num * i, y, w, h);
+
_select_item(dit);
if (wd->idler)
{
_item_icon_set(Elm_Diskselector_Item *it, Evas_Object *icon)
{
if (it->icon == icon) return;
- if (it->icon)
- evas_object_del(it->icon);
+ if (it->icon) evas_object_del(it->icon);
it->icon = icon;
if (VIEW(it))
{
idx - ic + (2 * ac));
}
- if(dit) _item_icon_set(dit, icon);
+ if (dit) _item_icon_set(dit, icon);
_sizing_eval(wd->self);
}
}
if (part && strcmp(part, "default")) return;
item = (Elm_Diskselector_Item *)it;
eina_stringshare_replace(&item->label, label);
- edje_object_part_text_set(VIEW(item), "elm.text", item->label);
+ edje_object_part_text_escaped_set(VIEW(item), "elm.text", item->label);
}
static const char *
return ((Elm_Diskselector_Item *)it)->icon;
}
-
EAPI Evas_Object *
elm_diskselector_add(Evas_Object *parent)
{
evas_object_smart_callback_add(wd->scroller, "scroll", _scroller_move_cb,
wd);
evas_object_smart_callback_add(wd->scroller, "animate,stop",
- _scroller_stop_cb, wd);
+ _scroller_stop_cb, obj);
+ evas_object_smart_callback_add(wd->scroller, "animate,start",
+ _scroller_start_cb, obj);
+ evas_object_smart_callback_add(wd->scroller, "drag,stop",
+ _drag_stop_cb, obj);
+ evas_object_smart_callback_add(wd->scroller, "drag,start",
+ _drag_start_cb, obj);
+
_elm_theme_object_set(obj, wd->scroller, "diskselector", "base",
"default");
evas_object_event_callback_add(wd->scroller, EVAS_CALLBACK_RESIZE,
}
EAPI Eina_Bool
-elm_diskselector_round_get(const Evas_Object *obj)
+elm_diskselector_round_enabled_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
}
EAPI void
-elm_diskselector_round_set(Evas_Object * obj, Eina_Bool round)
+elm_diskselector_round_enabled_set(Evas_Object * obj, Eina_Bool enabled)
{
Eina_List *elist;
Elm_Diskselector_Item *it;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->round == round)
+ if (wd->round == enabled)
return;
- wd->round = round;
- if (round)
+ wd->round = !!enabled;
+ if (enabled)
{
wd->r_items = eina_list_clone(wd->items);
elm_box_unpack(wd->main_box, wd->left_blank);
}
EAPI int
-elm_diskselector_side_label_length_get(const Evas_Object *obj)
+elm_diskselector_side_text_max_length_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
}
EAPI void
-elm_diskselector_side_label_length_set(Evas_Object *obj, int len)
+elm_diskselector_side_text_max_length_set(Evas_Object *obj, int len)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);