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}
};
wd->idler = ecore_idle_enterer_before_add(_move_scroller, data);
}
+static void
+_item_del(Elm_Diskselector_Item *item)
+{
+ if (!item) return;
+ eina_stringshare_del(item->label);
+ if (item->icon)
+ evas_object_del(item->icon);
+}
+
+static int
+_count_letter(const char *str)
+{
+ int pos = 0;
+ int code = 0, chnum;
+
+ for (chnum = 0; ; chnum++)
+ {
+ pos = evas_string_char_next_get(str, pos, &code);
+ if (code == 0) break;
+ }
+ return chnum;
+}
+
+static int
+_check_letter(const char *str, int length)
+{
+ int pos = 0;
+ int code = 0, chnum;
+
+ for (chnum = 0; ; chnum++)
+ {
+ if (chnum == length) break;
+ pos = evas_string_char_next_get(str, pos, &code);
+ if (code == 0) break;
+ }
+ return pos;
+}
+
+static Eina_Bool
+_check_string(void *data)
+{
+ int mid, steps, length, diff;
+ Elm_Diskselector_Item *it;
+ Eina_List *list, *l;
+ Evas_Coord ox, ow;
+ char buf[1024];
+ Widget_Data *wd = data;
+
+ evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL);
+ if (ow <= 0)
+ return EINA_FALSE;
+ if (!wd->init)
+ return EINA_FALSE;
+ if (!wd->round)
+ list = wd->items;
+ else
+ list = wd->r_items;
+
+ EINA_LIST_FOREACH(list, l, it)
+ {
+ Evas_Coord x, w;
+ int len;
+ evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL);
+ /* item not visible */
+ if ((x + w <= ox) || (x >= ox + ow))
+ continue;
+
+ len = _count_letter(it->label);
+// // FIXME: len should be # of ut8f letters. ie count using utf8 string walk, not stringshare len
+// len = eina_stringshare_strlen(it->label);
+
+ if (x <= ox + 5)
+ edje_object_signal_emit(VIEW(it), "elm,state,left_side",
+ "elm");
+ else if (x + w >= ox + ow - 5)
+ edje_object_signal_emit(VIEW(it), "elm,state,right_side",
+ "elm");
+ else
+ {
+ if ((wd->len_threshold) && (len > wd->len_threshold))
+ edje_object_signal_emit(VIEW(it), "elm,state,center_small",
+ "elm");
+ else
+ edje_object_signal_emit(VIEW(it), "elm,state,center",
+ "elm");
+ }
+
+ // if len is les that the limit len, skip anyway
+ if (len <= wd->len_side)
+ continue;
+
+ steps = len - wd->len_side + 1;
+ mid = x + w / 2;
+ if (mid <= ox + ow / 2)
+ diff = (ox + ow / 2) - mid;
+ else
+ diff = mid - (ox + ow / 2);
+
+ length = len - (int)(diff * steps / (ow / 3));
+ length = MAX(length, wd->len_side);
+ // limit string len to "length" ut8f chars
+ length = _check_letter(it->label, length);
+ // cut it off at byte mark returned form _check_letter
+ strncpy(buf, it->label, length);
+ buf[length] = '\0';
+ edje_object_part_text_escaped_set(VIEW(it), "elm.text", buf);
+ }
+
+ if (wd->check_idler)
+ ecore_idle_enterer_del(wd->check_idler);
+ wd->check_idler = NULL;
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+ Elm_Diskselector_Item *item, *item2, *dit;
+ Eina_List *l;
+ int i = 0;
+ Widget_Data *wd;
+ item = (Elm_Diskselector_Item *)it;
+ wd = elm_widget_data_get(WIDGET(item));
+ if (!wd) return EINA_FALSE;
+
+ elm_box_unpack(wd->main_box, VIEW(item));
+
+ if (wd->round)
+ wd->r_items = eina_list_remove(wd->r_items, item);
+
+ wd->items = eina_list_remove(wd->items, item);
+
+ if (wd->selected_item == item)
+ {
+ dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
+ if (dit != item)
+ wd->selected_item = dit;
+ else
+ wd->selected_item = eina_list_nth(wd->items, 1);
+
+ _selected_item_indicate(wd->selected_item);
+ }
+
+ _item_del(item);
+ wd->item_count -= 1;
+
+ if (wd->round)
+ {
+ if (!wd->item_count)
+ {
+ evas_object_hide(wd->VIEW(first));
+ evas_object_hide(wd->VIEW(second));
+ evas_object_hide(wd->VIEW(last));
+ evas_object_hide(wd->VIEW(s_last));
+
+ EINA_LIST_FOREACH(wd->under_items, l, item2)
+ evas_object_hide(VIEW(item2));
+
+ EINA_LIST_FOREACH(wd->over_items, l, item2)
+ evas_object_hide(VIEW(item2));
+ }
+ else
+ {
+ dit = eina_list_nth(wd->items, 0);
+ if (dit)
+ {
+ eina_stringshare_replace(&wd->first->label, dit->label);
+ 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_escaped_set(wd->VIEW(second), "elm.text",
+ wd->second->label);
+ }
+ // if more than 3 itmes should be displayed
+ for (i = 2; i < CEIL(wd->display_item_num); i++)
+ {
+ 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_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_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_escaped_set(wd->VIEW(s_last), "elm.text",
+ wd->s_last->label);
+ }
+ // if more than 3 itmes should be displayed
+ for (i = 3; i <= CEIL(wd->display_item_num); i++)
+ {
+ 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_escaped_set(VIEW(item2), "elm.text",
+ item2->label);
+ }
+ }
+ }
+ wd->check_idler = ecore_idle_enterer_before_add(_check_string, wd);
+ _sizing_eval(wd->self);
+
+ return EINA_TRUE;
+}
+
static Elm_Diskselector_Item *
_item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb func, const void *data)
{
it = elm_widget_item_new(obj, Elm_Diskselector_Item);
if (!it) return NULL;
+ elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
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)
}
static void
-_item_del(Elm_Diskselector_Item *item)
-{
- if (!item) return;
- eina_stringshare_del(item->label);
- if (item->icon)
- evas_object_del(item->icon);
- elm_widget_item_del(item);
-}
-
-static void
_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);
}
}
}
- EINA_LIST_FREE(wd->items, it) _item_del(it);
+ EINA_LIST_FREE(wd->items, it)
+ {
+ _item_del(it);
+ elm_widget_item_free(it);
+ }
eina_list_free(wd->r_items);
}
{
_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",
Evas_Event_Key_Down *ev = event_info;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
- if (elm_widget_disabled_get(obj)) return EINA_FALSE;
-
- Elm_Diskselector_Item *it = NULL;
- Eina_List *l;
-
- if (!wd->selected_item) {
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
- return EINA_TRUE;
- }
-
- if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")) ||
- (!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
- {
- 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")))
- {
- l = wd->selected_item->node->next;
- if ((!l) && (wd->round))
- l = wd->items;
- }
- else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
- l = wd->items;
- else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
- l = eina_list_last(wd->items);
- else return EINA_FALSE;
-
- if (l)
- it = eina_list_data_get(l);
-
- if (it)
- {
- wd->selected_item = it;
- if (!wd->idler)
- wd->idler = ecore_idle_enterer_before_add(_move_scroller, obj);
- }
-
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
- return EINA_TRUE;
-}
-
-static int
-_count_letter(const char *str)
-{
- int pos = 0;
- int code = 0, chnum;
-
- for (chnum = 0; ; chnum++)
- {
- pos = evas_string_char_next_get(str, pos, &code);
- if (code == 0) break;
- }
- return chnum;
-}
-
-static int
-_check_letter(const char *str, int length)
-{
- int pos = 0;
- int code = 0, chnum;
-
- for (chnum = 0; ; chnum++)
- {
- if (chnum == length) break;
- pos = evas_string_char_next_get(str, pos, &code);
- if (code == 0) break;
- }
- return pos;
-}
-
-static Eina_Bool
-_check_string(void *data)
-{
- int mid, steps, length, diff;
- Elm_Diskselector_Item *it;
- Eina_List *list, *l;
- Evas_Coord ox, ow;
- char buf[1024];
- Widget_Data *wd = data;
-
- evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL);
- if (ow <= 0)
- return EINA_FALSE;
- if (!wd->init)
- return EINA_FALSE;
- if (!wd->round)
- list = wd->items;
- else
- list = wd->r_items;
-
- EINA_LIST_FOREACH(list, l, it)
- {
- Evas_Coord x, w;
- int len;
- evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL);
- /* item not visible */
- if ((x + w <= ox) || (x >= ox + ow))
- continue;
-
- len = _count_letter(it->label);
-// // FIXME: len should be # of ut8f letters. ie count using utf8 string walk, not stringshare len
-// len = eina_stringshare_strlen(it->label);
-
- if (x <= ox + 5)
- edje_object_signal_emit(VIEW(it), "elm,state,left_side",
- "elm");
- else if (x + w >= ox + ow - 5)
- edje_object_signal_emit(VIEW(it), "elm,state,right_side",
- "elm");
- else
- {
- if ((wd->len_threshold) && (len > wd->len_threshold))
- edje_object_signal_emit(VIEW(it), "elm,state,center_small",
- "elm");
- else
- edje_object_signal_emit(VIEW(it), "elm,state,center",
- "elm");
- }
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+ if (elm_widget_disabled_get(obj)) return EINA_FALSE;
- // if len is les that the limit len, skip anyway
- if (len <= wd->len_side)
- continue;
+ Elm_Diskselector_Item *it = NULL;
+ Eina_List *l;
- steps = len - wd->len_side + 1;
- mid = x + w / 2;
- if (mid <= ox + ow / 2)
- diff = (ox + ow / 2) - mid;
- else
- diff = mid - (ox + ow / 2);
+ if (!wd->selected_item) {
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
+ }
- length = len - (int)(diff * steps / (ow / 3));
- length = MAX(length, wd->len_side);
- // limit string len to "length" ut8f chars
- length = _check_letter(it->label, length);
- // 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);
+ 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")) && (!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")) && (!ev->string)))
+ l = wd->items;
+ else if ((!strcmp(ev->keyname, "End")) ||
+ ((!strcmp(ev->keyname, "KP_End")) && (!ev->string)))
+ l = eina_list_last(wd->items);
+ else return EINA_FALSE;
- if (wd->check_idler)
- ecore_idle_enterer_del(wd->check_idler);
- wd->check_idler = NULL;
- return EINA_FALSE;
+ if (l)
+ it = eina_list_data_get(l);
+
+ if (it)
+ {
+ wd->selected_item = it;
+ if (!wd->idler)
+ wd->idler = ecore_idle_enterer_before_add(_move_scroller, obj);
+ }
+
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ return EINA_TRUE;
}
static void
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)
{
elm_box_unpack(wd->main_box, VIEW(it));
wd->r_items = eina_list_remove(wd->r_items, it);
eina_stringshare_del(it->label);
- evas_object_del(VIEW(it));
- free(it);
+ elm_widget_item_free(it);
}
static void
_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 *
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->items) return;
wd->selected_item = NULL;
- EINA_LIST_FREE(wd->items, it) _item_del(it);
+ EINA_LIST_FREE(wd->items, it)
+ {
+ _item_del(it);
+ elm_widget_item_free(it);
+ }
_round_items_del(wd);
_sizing_eval(obj);
}
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_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Diskselector_Item *item, *item2, *dit;
- Eina_List *l;
- int i = 0;
- Widget_Data *wd;
- item = (Elm_Diskselector_Item *) it;
- wd = elm_widget_data_get(WIDGET(item));
- if (!wd) return;
-
- elm_box_unpack(wd->main_box, VIEW(item));
-
- if (wd->round)
- wd->r_items = eina_list_remove(wd->r_items, item);
-
- wd->items = eina_list_remove(wd->items, item);
-
- if (wd->selected_item == item)
- {
- dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
- if (dit != item)
- wd->selected_item = dit;
- else
- wd->selected_item = eina_list_nth(wd->items, 1);
-
- _selected_item_indicate(wd->selected_item);
- }
-
- _item_del(item);
- wd->item_count -= 1;
-
- if (wd->round)
- {
- if (!wd->item_count)
- {
- evas_object_hide(wd->VIEW(first));
- evas_object_hide(wd->VIEW(second));
- evas_object_hide(wd->VIEW(last));
- evas_object_hide(wd->VIEW(s_last));
-
- EINA_LIST_FOREACH(wd->under_items, l, item2)
- evas_object_hide(VIEW(item2));
-
- EINA_LIST_FOREACH(wd->over_items, l, item2)
- evas_object_hide(VIEW(item2));
- }
- else
- {
- dit = eina_list_nth(wd->items, 0);
- if (dit)
- {
- eina_stringshare_replace(&wd->first->label, dit->label);
- edje_object_part_text_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",
- wd->second->label);
- }
- // if more than 3 itmes should be displayed
- for (i = 2; i < CEIL(wd->display_item_num); i++)
- {
- 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);
- }
-
- 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",
- 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",
- wd->s_last->label);
- }
- // if more than 3 itmes should be displayed
- for (i = 3; i <= CEIL(wd->display_item_num); i++)
- {
- 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",
- item2->label);
- }
- }
- }
- wd->check_idler = ecore_idle_enterer_before_add(_check_string, wd);
- _sizing_eval(wd->self);
-}
-
-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_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_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_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_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_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_tooltip_content_cb_set(it, func, data, del_cb);
-}
-
-EAPI void
-elm_diskselector_item_tooltip_unset(Elm_Object_Item *it)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_tooltip_unset(it);
-}
-
-EAPI void
-elm_diskselector_item_tooltip_style_set(Elm_Object_Item *it, const char *style)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_tooltip_style_set(it, style);
-}
-
-EAPI const char *
-elm_diskselector_item_tooltip_style_get(const Elm_Object_Item *it)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_tooltip_style_get(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_set(Elm_Object_Item *it, const char *cursor)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_cursor_set(it, cursor);
-}
-
-EAPI const char *
-elm_diskselector_item_cursor_get(const Elm_Object_Item *it)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_cursor_get(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_unset(Elm_Object_Item *it)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_cursor_unset(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_style_set(Elm_Object_Item *it, const char *style)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_cursor_style_set(it, style);
-}
-
-EAPI const char *
-elm_diskselector_item_cursor_style_get(const Elm_Object_Item *it)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_cursor_style_get(it);
-}
-
-EAPI void
-elm_diskselector_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_cursor_engine_only_set(it, engine_only);
-}
-
-EAPI Eina_Bool
-elm_diskselector_item_cursor_engine_only_get(const Elm_Object_Item *it)
-{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
- return elm_widget_item_cursor_engine_only_get(it);
-}
-
-EAPI void
elm_diskselector_display_item_num_set(Evas_Object *obj, int num)
{
ELM_CHECK_WIDTYPE(obj, widtype);