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)
static Eina_Bool
_item_del_pre_hook(Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
Elm_Diskselector_Item *item, *item2, *dit;
Eina_List *l;
int i = 0;
Widget_Data *wd;
- item = (Elm_Diskselector_Item *) it;
+ item = (Elm_Diskselector_Item *)it;
wd = elm_widget_data_get(WIDGET(item));
if (!wd) return EINA_FALSE;
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);
}
}
static void
_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_Diskselector_Item *item;
if (part && strcmp(part, "default")) return;
- item = (Elm_Diskselector_Item *) it;
+ 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 *
_item_text_get_hook(const Elm_Object_Item *it, const char *part)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
if (part && strcmp(part, "default")) return NULL;
- return ((Elm_Diskselector_Item *) it)->label;
+ return ((Elm_Diskselector_Item *)it)->label;
}
static void
const char *part,
Evas_Object *content)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
if (part && strcmp(part, "icon")) return;
- _item_icon_set((Elm_Diskselector_Item *) it, content);
- _check_identical_item((Elm_Diskselector_Item *) it, content);
+ _item_icon_set((Elm_Diskselector_Item *)it, content);
+ _check_identical_item((Elm_Diskselector_Item *)it, content);
}
static Evas_Object *
_item_content_get_hook(const Elm_Object_Item *it, const char *part)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
if (part && strcmp(part, "icon")) return NULL;
- return ((Elm_Diskselector_Item *) it)->icon;
+ 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);
}
EAPI void
-elm_diskselector_side_label_lenght_set(Evas_Object *obj, int len)
-{
- return elm_diskselector_side_label_length_set(obj, len);
-}
-
-EAPI int
-elm_diskselector_side_label_lenght_get(const Evas_Object *obj)
-{
- return elm_diskselector_side_label_length_get(obj);
-}
-
-EAPI void
elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
{
ELM_CHECK_WIDTYPE(obj, widtype);
if (!wd->idler)
wd->idler = ecore_idle_enterer_before_add(_move_scroller, obj);
_sizing_eval(obj);
- return (Elm_Object_Item *) it;
-}
-
-EAPI void
-elm_diskselector_item_del(Elm_Object_Item * it)
-{
- elm_object_item_del(it);
-}
-
-EAPI const char *
-elm_diskselector_item_label_get(const Elm_Object_Item * it)
-{
- return _item_text_get_hook(it, NULL);
-}
-
-EAPI void
-elm_diskselector_item_label_set(Elm_Object_Item * it, const char *label)
-{
- _item_text_set_hook(it, NULL, label);
+ return (Elm_Object_Item *)it;
}
EAPI Elm_Object_Item *
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Widget_Data *wd;
- Elm_Diskselector_Item *item = (Elm_Diskselector_Item *) it;
+ Elm_Diskselector_Item *item = (Elm_Diskselector_Item *)it;
wd = elm_widget_data_get(WIDGET(item));
if (!wd) return;
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
Widget_Data *wd = elm_widget_data_get(WIDGET(it));
if (!wd) return EINA_FALSE;
- return (wd->selected_item == ((Elm_Diskselector_Item *) it));
-}
-
-EAPI void
-elm_diskselector_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
-{
- elm_object_item_del_cb_set(it, func);
-}
-
-EAPI void *
-elm_diskselector_item_data_get(const Elm_Object_Item *it)
-{
- return elm_object_item_data_get(it);
-}
-
-EAPI Evas_Object *
-elm_diskselector_item_icon_get(const Elm_Object_Item *it)
-{
- return _item_content_get_hook(it, NULL);
-}
-
-EAPI void
-elm_diskselector_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
-{
- _item_content_set_hook(it, NULL, icon);
+ return (wd->selected_item == ((Elm_Diskselector_Item *)it));
}
EAPI Elm_Object_Item *
elm_diskselector_item_prev_get(const Elm_Object_Item *it)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Diskselector_Item *item = (Elm_Diskselector_Item *) it;
+ Elm_Diskselector_Item *item = (Elm_Diskselector_Item *)it;
if (item->node->prev) return item->node->prev->data;
else return NULL;
}
elm_diskselector_item_next_get(const Elm_Object_Item *it)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Diskselector_Item *item = (Elm_Diskselector_Item *) it;
+ Elm_Diskselector_Item *item = (Elm_Diskselector_Item *)it;
if (item->node->next) return item->node->next->data;
else return NULL;
}
}
EAPI void
-elm_diskselector_item_tooltip_text_set(Elm_Object_Item *it, const char *text)
-{
- elm_object_item_tooltip_text_set(it, text);
-}
-
-EAPI void
-elm_diskselector_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
-{
- elm_object_item_tooltip_content_cb_set(it, func, data, del_cb);
-}
-
-EAPI void
-elm_diskselector_item_tooltip_unset(Elm_Object_Item *it)
-{
- elm_object_item_tooltip_unset(it);
-}
-
-EAPI void
-elm_diskselector_item_tooltip_style_set(Elm_Object_Item *it, const char *style)
-{
- elm_object_item_tooltip_style_set(it, style);
-}
-
-EAPI const char *
-elm_diskselector_item_tooltip_style_get(const Elm_Object_Item *it)
-{
- return elm_object_item_tooltip_style_get(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_set(Elm_Object_Item *it, const char *cursor)
-{
- elm_object_item_cursor_set(it, cursor);
-}
-
-EAPI const char *
-elm_diskselector_item_cursor_get(const Elm_Object_Item *it)
-{
- return elm_object_item_cursor_get(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_unset(Elm_Object_Item *it)
-{
- elm_object_item_cursor_unset(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_style_set(Elm_Object_Item *it, const char *style)
-{
- elm_object_item_cursor_style_set(it, style);
-}
-
-EAPI const char *
-elm_diskselector_item_cursor_style_get(const Elm_Object_Item *it)
-{
- return elm_object_item_cursor_style_get(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only)
-{
- elm_object_item_cursor_engine_only_set(it, engine_only);
-}
-
-EAPI Eina_Bool
-elm_diskselector_item_cursor_engine_only_get(const Elm_Object_Item *it)
-{
- return elm_object_item_cursor_engine_only_get(it);
-}
-
-EAPI void
elm_diskselector_display_item_num_set(Evas_Object *obj, int num)
{
ELM_CHECK_WIDTYPE(obj, widtype);