#include <assert.h>
+#include <fnmatch.h>
#include <Elementary.h>
#include <Elementary_Cursor.h>
#include "elm_priv.h"
Eina_Bool swipe : 1;
Eina_Bool reorder_mode : 1;
Eina_Bool reorder_pan_move : 1;
- Eina_List *dragging_queue;
struct
{
Evas_Coord x, y;
Eina_Bool reorder_deleted : 1;
Eina_Bool effect_mode : 1;
Eina_Bool auto_scrolled : 1;
+ Eina_Bool pan_changed : 1;
+ Eina_Bool drag_started : 1;
int edit_mode;
Ecore_Animator *item_moving_effect_timer;
Evas_Object *alpha_bg;
Evas_Coord expand_item_gap;
int move_effect_mode;
Ecore_Job *changed_job;
- Elm_Genlist_Item *rename_it;
+ Elm_Genlist_Item *focused_rename_it;
+ Evas_Coord current_scrl_x;
+ Evas_Coord current_scrl_y;
};
struct _Item_Block
static const char SIG_DRAG_STOP[] = "drag,stop";
static const char SIG_DRAG[] = "drag";
static const char SIG_LONGPRESSED[] = "longpressed";
+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 char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
{SIG_DRAG_STOP, ""},
{SIG_DRAG, ""},
{SIG_LONGPRESSED, ""},
+ {SIG_SCROLL_ANIM_START, ""},
+ {SIG_SCROLL_ANIM_STOP, ""},
+ {SIG_SCROLL_DRAG_START, ""},
+ {SIG_SCROLL_DRAG_STOP, ""},
{SIG_SCROLL_EDGE_TOP, ""},
{SIG_SCROLL_EDGE_BOTTOM, ""},
{SIG_SCROLL_EDGE_LEFT, ""},
{
elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
evas_object_focus_set(wd->obj, EINA_TRUE);
- if ((wd->selected) && (!wd->last_selected_item))
+ if ((wd->items) && (wd->selected) && (!wd->last_selected_item))
wd->last_selected_item = eina_list_data_get(wd->selected);
}
else
if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
if (wd->mode_type) eina_stringshare_del(wd->mode_type);
if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
- if (wd->walking > 0)
- {
- wd->walking = 0;
- elm_genlist_clear(obj);
- }
free(wd);
}
{
Widget_Data *wd = elm_widget_data_get(data);
Evas_Coord x, y, w, h;
+ Evas_Coord px, py, pw, ph;
+ Evas_Coord new_x, new_y;
if (!wd) return;
elm_widget_show_region_get(obj, &x, &y, &w, &h);
+ evas_object_geometry_get(wd->pan_smart, &px, &py, &pw, &ph);
+
//x & y are screen coordinates, Add with pan coordinates
- x += wd->pan_x;
- y += wd->pan_y;
- elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
+ new_x = wd->current_scrl_x + x - pw + w;
+ new_y = wd->current_scrl_y + y - ph + h;
+
+ if (((new_y > 0) && wd->pan_changed && (y > ph)) || ((new_x > 0) && wd->pan_changed && (x > pw)))
+ elm_smart_scroller_child_pos_set(wd->scr, new_x, new_y);
+ else
+ elm_smart_scroller_child_pos_set(wd->scr, wd->current_scrl_x, wd->current_scrl_y);
}
static void
static void
_item_select(Elm_Genlist_Item *it)
{
+ Eina_List *l;
+ Evas_Object *obj;
+ Evas_Object *parent = it->base.widget;
if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
if (it->selected)
{
it->selected = EINA_TRUE;
it->wd->selected = eina_list_append(it->wd->selected, it);
call:
+ evas_object_ref(parent);
it->walking++;
it->wd->walking++;
- if (it->func.func)
+ if (it->wd->last_selected_item && (it != it->wd->last_selected_item))
{
- Evas_Object *baseobj = it->base.widget;
- const char *objtype = NULL;
- it->func.func((void *)it->func.data, it->base.widget, it);
- objtype = evas_object_type_get(baseobj);
- if ((!objtype) || (!strcmp(objtype,""))) return;
+ EINA_LIST_FOREACH(it->wd->last_selected_item->icon_objs, l, obj)
+ elm_widget_focused_object_clear(obj);
}
+ if (it->func.func) it->func.func((void *)it->func.data, parent, it);
if (!it->delete_me)
- evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
+ evas_object_smart_callback_call(parent, SIG_SELECTED, it);
it->walking--;
it->wd->walking--;
if ((it->wd->clear_me) && (!it->wd->walking))
{
- elm_genlist_clear(it->base.widget);
- return;
+ elm_genlist_clear(parent);
+ goto end;
}
else
{
if ((!it->walking) && (it->delete_me))
{
if (!it->relcount) _item_del(it);
+ goto end;
}
}
if (it && it->wd) it->wd->last_selected_item = it; // TODO: Remove 'if'?
+end:
+ evas_object_unref(parent);
}
static void
if ((adx > minw) || (ady > minh))
{
it->dragging = EINA_TRUE;
- it->wd->dragging_queue = eina_list_append(it->wd->dragging_queue, it);
if (it->long_timer)
{
ecore_timer_del(it->long_timer);
_item_unselect(it);
if (dy < 0)
{
- if (ady > adx)
+ if ((ady > adx) && (!it->wd->drag_started))
evas_object_smart_callback_call(it->base.widget,
SIG_DRAG_START_UP, it);
else
}
else
{
- if (ady > adx)
+ if ((ady > adx) && (!it->wd->drag_started))
evas_object_smart_callback_call(it->base.widget,
SIG_DRAG_START_DOWN, it);
else
{
Elm_Genlist_Item *it = data, *it_tmp;
Eina_List *list, *l;
- //static Eina_Bool contracted = EINA_FALSE;
it->long_timer = NULL;
- if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
+ if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->focused_rename_it))
return ECORE_CALLBACK_CANCEL;
it->wd->longpressed = EINA_TRUE;
evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
ecore_timer_del(it->long_timer);
it->long_timer = NULL;
}
- while (it->wd->dragging_queue)
+ if (it->dragging)
{
- Elm_Genlist_Item *dragging_it = NULL;
- dragging_it = eina_list_data_get(it->wd->dragging_queue);
- dragging_it->dragging = EINA_FALSE;
- evas_object_smart_callback_call(dragging_it->base.widget, SIG_DRAG_STOP, dragging_it);
- if (dragging_it->want_unrealize)
- {
- _item_unrealize(dragging_it, EINA_FALSE);
- if (dragging_it->block->want_unrealize)
- _item_block_unrealize(it->block);
- }
- it->wd->dragging_queue = eina_list_remove_list(it->wd->dragging_queue,it->wd->dragging_queue);
+ it->dragging = EINA_FALSE;
+ evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
dragged = 1;
}
if (it->swipe_timer)
it->wd->wasselected = EINA_FALSE;
return;
}
+ if (dragged)
+ {
+ if (it->want_unrealize)
+ {
+ _item_unrealize(it, EINA_FALSE);
+ if (it->block->want_unrealize)
+ _item_block_unrealize(it->block);
+ }
+ }
if ((it->disabled) || (dragged) || (it->display_only)) return;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if (it->wd->multi)
}
static void
+_mouse_down_scroller(void *data,
+ Evas *evas __UNUSED__,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+
+ if (!wd) return;
+ wd->drag_started = EINA_FALSE;
+}
+
+static void
+_mouse_up_scroller(void *data,
+ Evas *evas __UNUSED__,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+
+ if (!wd) return;
+ wd->drag_started = EINA_FALSE;
+}
+
+static void
+_mouse_move_scroller(void *data,
+ Evas *evas __UNUSED__,
+ Evas_Object *obj __UNUSED__,
+ void *event_info)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ Evas_Event_Mouse_Move *ev = event_info;
+ Evas_Coord minw = 0, minh = 0, dx, dy, adx, ady;
+
+ if (!wd) return;
+ if (wd->drag_started) return;
+
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ dx = ev->cur.canvas.x - ev->prev.canvas.x;
+ dy = ev->cur.canvas.y - ev->prev.canvas.y;
+ adx = dx;
+ ady = dy;
+ if (adx < 0) adx = -dx;
+ if (ady < 0) ady = -dy;
+ if (((ady < minh) && (ady > minh / 2)) && (ady > adx))
+ {
+ if (dy < 0)
+ {
+ evas_object_smart_callback_call(data, SIG_DRAG_START_UP, NULL);
+ wd->drag_started = EINA_TRUE;
+ }
+ else
+ {
+ evas_object_smart_callback_call(data, SIG_DRAG_START_DOWN, NULL);
+ wd->drag_started = EINA_TRUE;
+ }
+ }
+}
+
+static void
_signal_expand_toggle(void *data,
Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__,
evas_event_freeze(te);
it->nocache = EINA_FALSE;
_mode_item_unrealize(it);
+ if (it->group_item)
+ evas_object_raise(it->group_item->base.view);
snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
evas_event_thaw(te);
free(itc);
}
+static const char *
+_item_label_hook(Elm_Genlist_Item *it, const char *part)
+{
+ if (!it->itc->func.label_get) return NULL;
+ return edje_object_part_text_get(it->base.view, part);
+}
+
static void
_icon_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Elm_Genlist_Item *it = data;
if (it) it->defer_unrealize = EINA_TRUE;
+ if (it->renamed && (it->wd->focused_rename_it != it)) it->wd->focused_rename_it = it;
}
static void
{
Elm_Genlist_Item *it = data;
if (it) it->defer_unrealize = EINA_FALSE;
+ if (it->renamed && (it->wd->focused_rename_it == it)) it->wd->focused_rename_it = NULL;
+}
+
+static void
+_item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Genlist_Item *it = event_info;
+ if (!it) return;
+ if (it->wd->last_selected_item == it)
+ it->wd->last_selected_item = NULL;
+}
+
+static void
+_item_label_realize(Elm_Genlist_Item *it,
+ Evas_Object *target,
+ Eina_List **source,
+ const char *parts)
+{
+ if (it->itc->func.label_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
+ EINA_LIST_FOREACH(*source, l, key)
+ {
+ if (parts && fnmatch(parts, key, FNM_PERIOD))
+ continue;
+
+ char *s = it->itc->func.label_get
+ ((void *)it->base.data, it->base.widget, key);
+
+ if (s)
+ {
+ edje_object_part_text_set(target, key, s);
+ free(s);
+ }
+ else
+ {
+ edje_object_part_text_set(target, key, "");
+ }
+
+ }
+ }
+}
+
+static Eina_List *
+_item_icon_unrealize(Elm_Genlist_Item *it,
+ Evas_Object *target,
+ Eina_List **source,
+ const char *parts)
+{
+ Eina_List *res = it->icon_objs;
+
+ if (it->itc->func.icon_get)
+ {
+ const Eina_List *l;
+ const char *key;
+ Evas_Object *ic = NULL;
+
+ EINA_LIST_FOREACH(*source, l, key)
+ {
+ if (parts && fnmatch(parts, key, FNM_PERIOD))
+ continue;
+
+ ic = edje_object_part_swallow_get(target, key);
+ if (ic)
+ {
+ res = eina_list_remove(res, ic);
+ edje_object_part_unswallow(target, ic);
+ evas_object_del(ic);
+ }
+ }
+ }
+
+ return res;
+}
+
+static Eina_List *
+_item_icon_realize(Elm_Genlist_Item *it,
+ Evas_Object *target,
+ Eina_List **source,
+ const char *parts)
+{
+ Eina_List *res = NULL;
+
+ if (it->itc->func.icon_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
+ if (parts && (eina_list_count(*source) != eina_list_count(it->icon_objs)))
+ res = it->icon_objs;
+ EINA_LIST_FOREACH(*source, l, key)
+ {
+ if (parts && fnmatch(parts, key, FNM_PERIOD))
+ continue;
+
+ Evas_Object *ic = it->itc->func.icon_get
+ ((void *)it->base.data, it->base.widget, key);
+
+ if (ic)
+ {
+ res = eina_list_append(res, ic);
+ edje_object_part_swallow(target, key, ic);
+ evas_object_show(ic);
+ elm_widget_sub_object_add(it->base.widget, ic);
+ evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
+ if (it->disabled)
+ elm_widget_disabled_set(ic, EINA_TRUE);
+ }
+ }
+ }
+
+ return res;
+}
+
+static void
+_item_state_realize(Elm_Genlist_Item *it,
+ Evas_Object *target,
+ Eina_List **source,
+ const char *parts)
+{
+ if (it->itc->func.state_get)
+ {
+ const Eina_List *l;
+ const char *key;
+ char buf[4096];
+
+ *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
+ EINA_LIST_FOREACH(*source, l, key)
+ {
+ if (parts && fnmatch(parts, key, FNM_PERIOD))
+ continue;
+
+ Eina_Bool on = it->itc->func.state_get
+ ((void *)it->base.data, it->base.widget, key);
+
+ if (on)
+ {
+ snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
+ edje_object_signal_emit(target, buf, "elm");
+ }
+ else
+ {
+ snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
+ edje_object_signal_emit(target, buf, "elm");
+ }
+ }
+ }
}
static void
}
else
{
- if (it->itc->func.label_get)
- {
- const Eina_List *l;
- const char *key;
-
- it->labels =
- elm_widget_stringlist_get(edje_object_data_get(it->base.view,
- "labels"));
- EINA_LIST_FOREACH(it->labels, l, key)
- {
- char *s = it->itc->func.label_get
- ((void *)it->base.data, it->base.widget, l->data);
-
- if (s)
- {
- edje_object_part_text_set(it->base.view, l->data, s);
- free(s);
- }
- else if (itc)
- edje_object_part_text_set(it->base.view, l->data, "");
- }
- }
- if (it->itc->func.icon_get)
+ _item_label_realize(it, it->base.view, &it->labels, NULL);
+ it->icon_objs = _item_icon_realize(it, it->base.view, &it->icons, NULL);
+ _item_state_realize(it, it->base.view, &it->states, NULL);
+ if (it->itc->func.icon_get) // for rename mode
{
const Eina_List *l;
const char *key;
-
- it->icons =
- elm_widget_stringlist_get(edje_object_data_get(it->base.view,
- "icons"));
- EINA_LIST_FOREACH(it->icons, l, key)
- {
- Evas_Object *ic = it->itc->func.icon_get
- ((void *)it->base.data, it->base.widget, l->data);
-
- if (ic)
- {
- it->icon_objs = eina_list_append(it->icon_objs, ic);
- edje_object_part_swallow(it->base.view, key, ic);
- evas_object_show(ic);
- elm_widget_sub_object_add(it->base.widget, ic);
- evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
- if (it->disabled)
- elm_widget_disabled_set(ic, EINA_TRUE);
- }
- }
if (it->renamed)
{
+ edje_object_signal_emit(it->base.view, "elm,state,rename,enabled", "elm");
it->icons =
- elm_widget_stringlist_get(edje_object_data_get(it->base.view, "renames"));
+ elm_widget_stringlist_get(edje_object_data_get(it->base.view, "renames"));
EINA_LIST_FOREACH(it->icons, l, key)
{
Evas_Object *ic = it->itc->func.icon_get
- ((void *)it->base.data, it->base.widget, l->data);
+ ((void *)it->base.data, it->base.widget, l->data);
if (ic)
{
- it->icon_objs = eina_list_append(it->icon_objs, ic);
- edje_object_part_swallow(it->base.view, key, ic);
- evas_object_show(ic);
- elm_widget_sub_object_add(it->base.widget, ic);
- // FIXME: if entry calcuates its cursor position correctly and conformant works,
- // genlist does not need to handle this focus thing.
- evas_object_smart_callback_add(ic, "focused", _icon_focused, it);
- evas_object_smart_callback_add(ic, "unfocused", _icon_unfocused, it);
+ it->icon_objs = eina_list_append(it->icon_objs, ic);
+ edje_object_part_swallow(it->base.view, key, ic);
+ evas_object_show(ic);
+ elm_widget_sub_object_add(it->base.widget, ic);
+ // FIXME: if entry calcuates its cursor position correctly and conformant works,
+ // genlist does not need to handle this focus thing.
+ evas_object_smart_callback_add(ic, "focused", _icon_focused, it);
+ evas_object_smart_callback_add(ic, "unfocused", _icon_unfocused, it);
}
}
- }
- }
- if (it->itc->func.state_get)
- {
- const Eina_List *l;
- const char *key;
-
- it->states =
- elm_widget_stringlist_get(edje_object_data_get(it->base.view,
- "states"));
- EINA_LIST_FOREACH(it->states, l, key)
- {
- Eina_Bool on = it->itc->func.state_get
- ((void *)it->base.data, it->base.widget, l->data);
-
- if (on)
- {
- snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
- edje_object_signal_emit(it->base.view, buf, "elm");
- }
- else if (itc)
- {
- snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
- edje_object_signal_emit(it->base.view, buf, "elm");
- }
}
}
- if (!it->mincalcd || it->wd->pan_resize)
+ if (!it->mincalcd || it->wd->pan_resize || ((it->wd->height_for_width) && (it->w != it->minw)))
{
Evas_Coord mw = -1, mh = -1;
}
else
{
- edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget));
+ edje_object_mirrored_set(it->base.view,
+ elm_widget_mirrored_get(it->base.widget));
+ edje_object_scale_set(it->base.view,
+ elm_widget_scale_get(it->base.widget)
+ * _elm_config->scale);
_item_cache_add(it);
}
elm_widget_stringlist_free(it->labels);
}
static void
-_item_block_realize(Item_Block *itb,
- int in,
- int full)
+_item_block_realize(Item_Block *itb)
{
- const Eina_List *l;
- Elm_Genlist_Item *it;
-
if (itb->realized) return;
- evas_event_freeze(evas_object_evas_get(itb->wd->obj));
- EINA_LIST_FOREACH(itb->items, l, it)
- {
- if (it->delete_me) continue;
- if (full) _item_realize(it, in, EINA_FALSE);
- in++;
- }
itb->realized = EINA_TRUE;
itb->want_unrealize = EINA_FALSE;
- evas_event_thaw(evas_object_evas_get(itb->wd->obj));
- evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
}
static void
evas_event_freeze(evas_object_evas_get(itb->wd->obj));
EINA_LIST_FOREACH(itb->items, l, it)
{
- if (it->flags != ELM_GENLIST_ITEM_GROUP)
+ if (itb->must_recalc || it->flags != ELM_GENLIST_ITEM_GROUP)
{
if (it->dragging)
{
if (it->block->count == 1)
it->wd->reorder_rel = it;
}
- else if ((it->wd->reorder_start_y >= it->block->y) && (roy - oy + roh/2 <= it->block->y - it->wd->pan_y))
+ else if ((it->wd->reorder_start_y >= it->block->y) &&
+ (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y))
{
it->block->reorder_offset = it->wd->reorder_it->h;
}
if (vis)
{
if (!it->realized) _item_realize(it, in, EINA_FALSE);
- if (it->renamed)
- {
- if (it->wd->edit_mode) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
- edje_object_signal_emit(it->base.view, "elm,state,rename,enabled", "elm");
- }
}
}
if (it->realized)
}
else
{
- if (!it->dragging) _item_unrealize(it, EINA_FALSE);
+ if (!it->dragging && (!it->wd->item_moving_effect_timer)) _item_unrealize(it, EINA_FALSE);
}
}
in++;
Widget_Data *wd = data;
Item_Block *itb, *chb = NULL;
Evas_Coord minw = -1, minh = 0, y = 0, ow;
- int in = 0, minw_change = 0;
- Eina_Bool changed = EINA_FALSE;
+ int in = 0;
double t0, t;
+ Eina_Bool minw_change = EINA_FALSE;
Eina_Bool did_must_recalc = EINA_FALSE;
if (!wd) return;
{
if (itb->realized) _item_block_unrealize(itb);
}
- if ((itb->changed) || (changed) ||
- ((itb->must_recalc) && (!did_must_recalc)))
+ if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
{
- if ((changed) || (itb->must_recalc))
+ if (itb->must_recalc)
{
Eina_List *l;
Elm_Genlist_Item *it;
if (it->mincalcd) it->mincalcd = EINA_FALSE;
itb->changed = EINA_TRUE;
if (itb->must_recalc) did_must_recalc = EINA_TRUE;
- itb->must_recalc = EINA_FALSE;
if (itb->realized) _item_block_unrealize(itb);
+ itb->must_recalc = EINA_FALSE;
}
showme = _item_block_recalc(itb, in, EINA_FALSE);
chb = itb;
if (sd->resize_job) ecore_job_del(sd->resize_job);
sd->resize_job = ecore_job_add(_pan_resize_job, sd);
}
+ sd->wd->pan_changed = EINA_TRUE;
+ evas_object_smart_changed(obj);
if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
- sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
+ sd->wd->calc_job = NULL;
}
static void
Pan *sd = evas_object_smart_data_get(obj);
Item_Block *itb;
Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
+ Evas_Coord scr_x, scr_y;
int in = 0;
Elm_Genlist_Item *git;
Eina_List *l;
if (!sd) return;
evas_event_freeze(evas_object_evas_get(obj));
+ elm_smart_scroller_child_pos_get(sd->wd->scr, &scr_x, &scr_y);
+ sd->wd->current_scrl_x = scr_x;
+ sd->wd->current_scrl_y = scr_y;
+ if (sd->wd->pan_changed)
+ {
+ _calc_job(sd->wd);
+ sd->wd->pan_changed = EINA_FALSE;
+ }
+
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
sd->wd->prev_viewport_w = ow;
evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
cvx, cvy, cvw, cvh))
{
if ((!itb->realized) || (itb->changed))
- _item_block_realize(itb, in, 0);
+ _item_block_realize(itb);
_item_block_position(itb, in);
}
else
Pan *sd = evas_object_smart_data_get(obj);
if (!sd) return;
+
+ sd->wd->pan_changed = EINA_TRUE;
+ evas_object_smart_changed(obj);
if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
- sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
+ sd->wd->calc_job = NULL;
}
static void
}
static void
+_scr_anim_start(void *data,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
+}
+
+static void
+_scr_anim_stop(void *data,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
+}
+
+static void
+_scr_drag_start(void *data,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
+}
+
+static void
+_scr_drag_stop(void *data,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
+}
+
+static void
_scroll_edge_left(void *data,
Evas_Object *scr __UNUSED__,
void *event_info __UNUSED__)
_mouse_move, it);
/* label_get, icon_get, state_get */
- if (it->itc->func.label_get)
- {
- const Eina_List *l;
- const char *key;
-
- it->mode_labels =
- elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
- "labels"));
- EINA_LIST_FOREACH(it->mode_labels, l, key)
- {
- char *s = it->itc->func.label_get
- ((void *)it->base.data, it->base.widget, l->data);
-
- if (s)
- {
- edje_object_part_text_set(it->mode_view, l->data, s);
- free(s);
- }
- }
- }
+ _item_label_realize(it, it->mode_view, &it->mode_labels, NULL);
if (it->itc->func.icon_get)
{
const Eina_List *l;
}
}
}
- if (it->itc->func.state_get)
- {
- const Eina_List *l;
- const char *key;
-
- it->mode_states =
- elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
- "states"));
- EINA_LIST_FOREACH(it->mode_states, l, key)
- {
- Eina_Bool on = it->itc->func.state_get
- ((void *)it->base.data, it->base.widget, l->data);
-
- if (on)
- {
- snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
- edje_object_signal_emit(it->mode_view, buf, "elm");
- }
- }
- }
-
+ _item_state_realize(it, it->mode_view, &it->mode_states, NULL);
edje_object_part_swallow(it->mode_view,
edje_object_data_get(it->mode_view, "mode_part"),
it->base.view);
evas_event_freeze(evas_object_evas_get(it->wd->obj));
_mode_item_realize(it);
+ if (it->group_item)
+ evas_object_raise(it->group_item->base.view);
_item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
evas_event_thaw(evas_object_evas_get(it->wd->obj));
evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
wd->mode_item = NULL;
}
+
+static void
+_item_auto_scroll(void *data)
+{
+ Widget_Data *wd = data;
+ if (!wd) return;
+
+ if ((wd->expand_item) && (!wd->auto_scrolled))
+ {
+ Elm_Genlist_Item *it;
+ Eina_List *l;
+ Evas_Coord ox, oy, ow, oh;
+ evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
+
+ wd->auto_scrolled = EINA_TRUE;
+ if (wd->expand_item->scrl_y > (oh + oy) / 2)
+ {
+ EINA_LIST_FOREACH(wd->expand_item->items, l, it)
+ {
+ elm_genlist_item_bring_in(it);
+ }
+ }
+ }
+}
EAPI Evas_Object *
elm_genlist_add(Evas_Object *parent)
{
elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
wd->scr = elm_smart_scroller_add(e);
+ evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_DOWN,
+ _mouse_down_scroller, obj);
+ evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_UP,
+ _mouse_up_scroller, obj);
+ evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_move_scroller, obj);
elm_smart_scroller_widget_set(wd->scr, obj);
elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
elm_widget_style_get(obj));
_elm_config->thumbscroll_bounce_enable);
elm_widget_resize_object_set(obj, wd->scr);
+ evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
+ evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
+ evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
+ evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
obj);
it->func.data = func_data;
it->mouse_cursor = NULL;
it->expanded_depth = 0;
+ elm_widget_item_text_get_hook_set(it, _item_label_hook);
+ elm_widget_item_del_cb_set(it, _item_del_hook);
if (it->parent)
{
{
showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
it->block->changed = 0;
+ if(wd->pan_changed)
+ {
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = NULL;
+ _calc_job(wd);
+ wd->pan_changed = EINA_FALSE;
+ }
}
if (showme) it->block->showme = EINA_TRUE;
if (eina_inlist_count(wd->blocks) > 1)
if (!wd) return NULL;
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
func_data);
+
if (!it) return NULL;
if (!it->parent)
{
if (itb->items) eina_list_free(itb->items);
free(itb);
}
+ wd->pan_changed = EINA_TRUE;
if (wd->calc_job)
{
ecore_job_del(wd->calc_job);
Evas_Object *obj;
if (it->disabled == disabled) return;
if (it->delete_me) return;
- it->disabled = disabled;
+ it->disabled = !!disabled;
if (it->selected)
elm_genlist_item_selected_set(it, EINA_FALSE);
if (it->realized)
}
EAPI void
+elm_genlist_item_fields_update(Elm_Genlist_Item *it,
+ const char *parts,
+ Elm_Genlist_Item_Field_Flags itf)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
+ if (!it->block) return;
+ if (it->delete_me) return;
+
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
+ _item_label_realize(it, it->base.view, &it->labels, parts);
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_ICON))
+ {
+ it->icon_objs = _item_icon_unrealize(it, it->base.view,
+ &it->icons, parts);
+ it->icon_objs = _item_icon_realize(it, it->base.view,
+ &it->icons, parts);
+ }
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
+ _item_state_realize(it, it->base.view, &it->states, parts);
+}
+
+EAPI void
elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
const Elm_Genlist_Item_Class *itc)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
+ elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
}
EAPI void
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ if ((!wd) || (!wd->scr)) return;
if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
(policy_v >= ELM_SCROLLER_POLICY_LAST))
return;
- if (wd->scr)
- elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
+ elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
}
EAPI void
elm_genlist_item_update(it);
}
-/**
- * Set genlist item mode
- *
- * @param item The genlist item
- * @param mode Mode name
- * @param mode_set Boolean to define set or unset mode.
- *
- * @ingroup Genlist
- */
EAPI void
elm_genlist_item_mode_set(Elm_Genlist_Item *it,
const char *mode_type,
if (mode_set) _item_mode_set(it);
}
-/**
- * Get active genlist mode type
- *
- * @param obj The genlist object
- *
- * @ingroup Genlist
- */
EAPI const char *
elm_genlist_mode_get(const Evas_Object *obj)
{
return wd->mode_type;
}
-/**
- * Get active genlist mode item
- *
- * @param obj The genlist object
- *
- * @ingroup Genlist
- */
EAPI const Elm_Genlist_Item *
elm_genlist_mode_item_get(const Evas_Object *obj)
{
_item_auto_scroll(wd);
evas_object_lower(wd->alpha_bg);
evas_object_hide(wd->alpha_bg);
- if (wd->calc_job) ecore_job_del(wd->calc_job);
- wd->calc_job = ecore_job_add(_calc_job, wd);
elm_smart_scroller_bounce_animator_disabled_set(wd->scr, EINA_FALSE);
wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
evas_object_smart_callback_call(wd->obj, "effect_done", NULL);
+ evas_object_smart_changed(wd->pan_smart);
return ECORE_CALLBACK_CANCEL;
}
return ECORE_CALLBACK_RENEW;
const Eina_List *l;
const char *key;
+ if (it->renamed) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
EINA_LIST_FOREACH(it->icons, l, key)
{
{
_item_unrealize(it, EINA_FALSE);
it->renamed = EINA_TRUE;
- it->wd->rename_it = it;
it->nocache = EINA_TRUE;
if (it->selected) _item_unselect(it);
{
it->renamed = EINA_FALSE;
it->nocache = EINA_TRUE;
- it->wd->rename_it = NULL;
_item_cache_zero(it->wd);
elm_genlist_item_update(it);
}
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
return item->renamed;
}
-
-static void
-_item_auto_scroll(void *data)
-{
- Widget_Data *wd = data;
- if (!wd) return;
-
- if ((wd->expand_item) && (!wd->auto_scrolled))
- {
- Elm_Genlist_Item *it;
- Eina_List *l;
- Evas_Coord ox, oy, ow, oh;
- evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
-
- wd->auto_scrolled = EINA_TRUE;
- if (wd->expand_item->scrl_y > (oh + oy) / 2)
- {
- EINA_LIST_FOREACH(wd->expand_item->items, l, it)
- {
- elm_genlist_item_bring_in(it);
- }
- }
- }
-}