#include <assert.h>
+#include <fnmatch.h>
#include <Elementary.h>
#include <Elementary_Cursor.h>
#include "elm_priv.h"
Eina_Inlist *items, *blocks;
Eina_List *group_items;
Pan *pan;
- Evas_Coord pan_x, pan_y, w, h, minw, minh, realminw, prev_viewport_w;
+ Evas_Coord pan_x, pan_y, old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
Ecore_Job *calc_job, *update_job;
Ecore_Idle_Enterer *queue_idle_enterer;
Ecore_Idler *must_recalc_idler;
Evas_Coord anchor_y, reorder_start_y;
Elm_List_Mode mode;
Ecore_Timer *multi_timer, *scr_hold_timer;
+ Ecore_Animator *reorder_move_animator;
const char *mode_type;
unsigned int start_time;
Evas_Coord prev_x, prev_y, prev_mx, prev_my;
Eina_Bool bring_in : 1;
Eina_Bool compress : 1;
Eina_Bool height_for_width : 1;
+ Eina_Bool pan_resize : 1;
Eina_Bool homogeneous : 1;
Eina_Bool clear_me : 1;
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
Eina_Bool dragging : 1;
Eina_Bool updateme : 1;
Eina_Bool nocache : 1;
+ Eina_Bool move_effect_enabled : 1;
+ Eina_Bool defer_unrealize : 1;
// TODO: refactoring
- Eina_Bool move_effect_me : 1;
Eina_Bool effect_done : 1;
Eina_Bool reordering : 1;
Eina_Bool renamed : 1;
const char *source);
static Eina_Bool _deselect_all_items(Widget_Data *wd);
static void _pan_calculate(Evas_Object *obj);
-static void _item_position(Elm_Genlist_Item *it, Evas_Object *obj);
+static void _pan_max_get(Evas_Object *obj,
+ Evas_Coord *x,
+ Evas_Coord *y);
+static void _item_position(Elm_Genlist_Item *it,
+ Evas_Object *obj,
+ Evas_Coord it_x,
+ Evas_Coord it_y);
static void _mode_item_realize(Elm_Genlist_Item *it);
static void _mode_item_unrealize(Elm_Genlist_Item *it);
static void _item_mode_set(Elm_Genlist_Item *it);
static void _item_mode_unset(Widget_Data *wd);
static void _group_items_recalc(void *data);
+static void _item_move_after(Elm_Genlist_Item *it,
+ Elm_Genlist_Item *after);
+static void _item_move_before(Elm_Genlist_Item *it,
+ Elm_Genlist_Item *before);
// TODO : refactoring
static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
static void _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity);
static void _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on);
static void _effect_item_unrealize(Elm_Genlist_Item *it);
-static void _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after);
-static void _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before);
static void _item_auto_scroll(void *data);
static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
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, ""},
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
Evas_Event_Key_Down *ev = event_info;
Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Coord pan_max_x = 0, pan_max_y = 0;
if (!wd) return EINA_FALSE;
if (!wd->items) return EINA_FALSE;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
else return EINA_FALSE;
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
+ if (x < 0) x = 0;
+ if (x > pan_max_x) x = pan_max_x;
+ if (y < 0) y = 0;
+ if (y > pan_max_y) y = pan_max_y;
elm_smart_scroller_child_pos_set(wd->scr, x, y);
return EINA_TRUE;
}
{
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(obj);
if (!wd) return;
if (wd->edit_mode) elm_genlist_edit_mode_set(wd->obj, EINA_FALSE);
+ elm_genlist_clear(obj);
evas_object_del(wd->pan_smart);
wd->pan_smart = NULL;
- elm_genlist_clear(obj);
}
static void
{
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
Elm_Genlist_Item *it = data;
Evas_Event_Mouse_Move *ev = event_info;
Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
+ Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
{
}
if ((it->wd->reorder_mode) && (it->wd->reorder_it))
{
- Evas_Coord ox,oy,oh,ow;
evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
- int it_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
- if (!it->wd->reorder_start_y) it->wd->reorder_start_y = it->block->y + it->y;
+ it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
+
+ if (!it->wd->reorder_start_y)
+ it->wd->reorder_start_y = it->block->y + it->y;
- if (it_y < oy) _effect_item_controls(it, it->scrl_x, oy);
- else if (it_y + it->wd->reorder_it->h > oy+oh) _effect_item_controls(it, it->scrl_x, oy + oh - it->wd->reorder_it->h);
- else _effect_item_controls(it, it->scrl_x, it_y);
+ if (it_scrl_y < oy)
+ y_pos = oy;
+ else if (it_scrl_y + it->wd->reorder_it->h > oy + oh)
+ y_pos = oy + oh - it->wd->reorder_it->h;
+ else
+ y_pos = it_scrl_y;
+ if (it->edit_obj)
+ _item_position(it, it->edit_obj, it->scrl_x, y_pos);
+ else
+ _item_position(it, it->base.view, it->scrl_x, y_pos);
if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
}
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
static Eina_Bool
_long_press(void *data)
{
- Elm_Genlist_Item *it = data;
- Elm_Genlist_Item *it_tmp;
- static Eina_Bool done = EINA_FALSE;
- //static Eina_Bool contracted = EINA_FALSE;
- Eina_List *l;
- Item_Block *itb;
+ Elm_Genlist_Item *it = data, *it_tmp;
+ Eina_List *list, *l;
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);
{
it->wd->reorder_it = it;
it->wd->reorder_start_y = 0;
- evas_object_raise(it->edit_obj);
+ if (it->edit_obj)
+ evas_object_raise(it->edit_obj);
+ else
+ evas_object_raise(it->base.view);
elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
- edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
+ elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
- EINA_INLIST_FOREACH(it->wd->blocks, itb)
+ list = elm_genlist_realized_items_get(it->wd->obj);
+ EINA_LIST_FOREACH(list, l, it_tmp)
{
- if (itb->realized)
- {
- done = 1;
- EINA_LIST_FOREACH(itb->items, l, it_tmp)
- {
- if (it_tmp->flags != ELM_GENLIST_ITEM_GROUP && it_tmp->realized)
- {
- _item_unselect(it_tmp);
- }
- }
- }
- else
- {
- if (done) break;
- }
+ if (it != it_tmp) _item_unselect(it_tmp);
}
-
if (it->items)
{
EINA_LIST_FOREACH(it->items, l, it_tmp)
}
}
}
- if (elm_genlist_item_expanded_get(it)) {
+ if (elm_genlist_item_expanded_get(it))
+ {
elm_genlist_item_expanded_set(it, EINA_FALSE);
return ECORE_CALLBACK_RENEW;
- }
+ }
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
+ else
+ edje_object_signal_emit(it->base.view, "elm,state,reorder,enabled", "elm");
}
-
return ECORE_CALLBACK_CANCEL;
}
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->on_hold = EINA_FALSE;
return;
}
- if (it->wd->reorder_mode)
+ if ((it->wd->reorder_mode) && (it->wd->reorder_it))
{
- Evas_Coord rox, roy, row, roh;
- Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
- if (reorder_it)
+ Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
+
+ if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
{
- Evas_Coord ox,oy,oh,ow;
- evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
- evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
- if (it->wd->reorder_rel)
- {
- if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent) // todo : refactoring
- {
- if (roy + oy <= it->wd->reorder_rel->scrl_y)
- _effect_item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
- else
- _effect_item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
- }
- }
- it->wd->reorder_deleted = EINA_FALSE;
- it->wd->reorder_it = it->wd->reorder_rel = NULL;
- elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
- edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
- }
- }
+ if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
+ _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
+ else
+ _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
+ }
+ else
+ {
+ if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
+ it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
+ }
+ it->wd->reorder_deleted = EINA_FALSE;
+ edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
+ it->wd->reorder_it = it->wd->reorder_rel = NULL;
+ elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
+ elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_TRUE);
+
+ }
if (it->wd->longpressed)
{
it->wd->longpressed = EINA_FALSE;
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
+_icon_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ 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
_item_realize(Elm_Genlist_Item *it,
int in,
}
else
{
- if (it->itc->func.label_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->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)
- {
- 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);
+ 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)
+ if (!it->mincalcd || it->wd->pan_resize || ((it->wd->height_for_width) && (it->w != it->minw)))
{
Evas_Coord mw = -1, mh = -1;
if (!it->realized) return;
if (it->wd->reorder_it == it) return;
+ if (it->defer_unrealize && !it->updateme) return;
evas_event_freeze(evas_object_evas_get(it->wd->obj));
if (!calc)
evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
}
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)
{
static int
_get_space_for_reorder_item(Elm_Genlist_Item *it)
{
- Evas_Coord rox, roy, row, roh;
+ Evas_Coord rox, roy, row, roh, oy, oh;
Eina_Bool top = EINA_FALSE;
Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
if (!reorder_it) return 0;
- Evas_Coord ox,oy,oh,ow;
- evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
+ evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
- if ((it->wd->reorder_start_y < it->block->y) && (roy - oy + roh/2 >= it->block->y - it->wd->pan_y))
+ 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 * -1;
if (it->block->count == 1)
- it->wd->reorder_rel = it;
+ 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;
}
it->scrl_y += it->block->reorder_offset;
top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
- rox, roy+roh/2, row, 1));
+ rox, roy + (roh / 2), row, 1));
if (top)
{
it->wd->reorder_rel = it;
- it->scrl_y+=it->wd->reorder_it->h;
+ it->scrl_y += it->wd->reorder_it->h;
return it->wd->reorder_it->h;
}
else
}
static Eina_Bool
-_reorder_item_moving_effect_timer_cb(void *data)
+_reorder_move_animator_cb(void *data)
{
Elm_Genlist_Item *it = data;
- Eina_Bool down = EINA_FALSE;
- double time = 0.4, t;
- int y, dy = 4;
- t = ((0.0 > (t = current_time_get() - it->wd->start_time)) ? 0.0 : t) / 1000;
+ Eina_Bool down = EINA_FALSE;
+ double t;
+ int y, dy = it->h / 10 * _elm_config->scale, diff;
- if (t <= time)
- y = (1 * sin((t / time) * (M_PI / 2)) * dy);
- else
- y = dy;
+ t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
+ if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
+ else y = dy;
+
+ diff = abs(it->old_scrl_y - it->scrl_y);
+ if (diff > it->h) y = diff / 2;
if (it->old_scrl_y < it->scrl_y)
{
it->old_scrl_y += y;
down = EINA_FALSE;
}
- _effect_item_controls(it, it->scrl_x, it->old_scrl_y);
-
+ if (it->edit_obj)
+ _item_position(it, it->edit_obj, it->scrl_x, it->old_scrl_y);
+ else
+ _item_position(it, it->base.view, it->scrl_x, it->old_scrl_y);
_group_items_recalc(it->wd);
- if (!it->wd->reorder_it || it->wd->reorder_pan_move)
- {
- it->old_scrl_y = it->scrl_y;
- it->move_effect_me = EINA_FALSE;
- it->wd->item_moving_effect_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
- if ((down && it->old_scrl_y >= it->scrl_y) || (!down && it->old_scrl_y <= it->scrl_y))
+ if ((it->wd->reorder_pan_move) ||
+ (down && it->old_scrl_y >= it->scrl_y) ||
+ (!down && it->old_scrl_y <= it->scrl_y))
{
it->old_scrl_y = it->scrl_y;
- it->move_effect_me = EINA_FALSE;
- it->wd->item_moving_effect_timer = NULL;
+ it->move_effect_enabled = EINA_FALSE;
+ it->wd->reorder_move_animator = NULL;
return ECORE_CALLBACK_CANCEL;
}
return ECORE_CALLBACK_RENEW;
}
static void
-_item_position(Elm_Genlist_Item *it, Evas_Object *view)
+_item_position(Elm_Genlist_Item *it,
+ Evas_Object *view,
+ Evas_Coord it_x,
+ Evas_Coord it_y)
{
if (!it) return;
if (!view) return;
evas_event_freeze(evas_object_evas_get(it->wd->obj));
evas_object_resize(view, it->w, it->h);
- evas_object_move(view, it->scrl_x, it->scrl_y);
+ evas_object_move(view, it_x, it_y);
evas_object_show(view);
evas_event_thaw(evas_object_evas_get(it->wd->obj));
evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
Elm_Genlist_Item *it;
Elm_Genlist_Item *git;
Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
+ Evas_Coord minh = 0;
int vis = 0;
evas_event_freeze(evas_object_evas_get(itb->wd->obj));
vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
cvx, cvy, cvw, cvh));
- if (it->flags != ELM_GENLIST_ITEM_GROUP || (it->wd->reorder_it ))
+ if (it->flags != ELM_GENLIST_ITEM_GROUP)
{
if ((itb->realized))
{
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)
if (vis)
{
if (it->wd->reorder_mode)
- y += _get_space_for_reorder_item(it);
+ y += _get_space_for_reorder_item(it);
git = it->group_item;
if (git)
{
git->scrl_y = (it->scrl_y + it->h) - git->h;
git->want_realize = EINA_TRUE;
}
- if (it->wd->reorder_it && !it->wd->reorder_pan_move && it->old_scrl_y && it->old_scrl_y != it->scrl_y)
+ if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
{
- if (!it->move_effect_me)
+ if (!it->move_effect_enabled)
{
- it->move_effect_me = EINA_TRUE;
- it->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
+ it->move_effect_enabled = EINA_TRUE;
+ it->wd->reorder_move_animator =
+ ecore_animator_add(
+ _reorder_move_animator_cb, it);
}
-
}
- if (!it->move_effect_me )
+ if (!it->move_effect_enabled)
if (!it->wd->effect_mode || it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_NONE || ((it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) && it->parent == it->wd->expand_item))
{
if (it->wd->edit_mode && it->itc->edit_item_style)
{
- _effect_item_controls(it, it->scrl_x, it->scrl_y);
+ _item_position(it, it->edit_obj, it->scrl_x, it->scrl_y);
}
else
{
if((!it->wd->effect_mode || it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_NONE) || ((it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_NONE) && (it->old_scrl_y == it->scrl_y)))
{
if (it->mode_view)
- _item_position(it, it->mode_view);
+ _item_position(it, it->mode_view, it->scrl_x,
+ it->scrl_y);
else
- _item_position(it, it->base.view);
+ _item_position(it, it->base.view, it->scrl_x,
+ it->scrl_y);
}
else
{
}
else
{
- if (!it->dragging) _item_unrealize(it, EINA_FALSE);
+ if (!it->dragging && (!it->wd->item_moving_effect_timer)) _item_unrealize(it, EINA_FALSE);
}
}
in++;
it->old_scrl_y = it->scrl_y;
}
y += it->h;
+ minh += it->minh;
}
+ if (!itb->wd->reorder_it) itb->minh = minh;
evas_event_thaw(evas_object_evas_get(itb->wd->obj));
evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
}
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;
+ if (itb->realized) _item_block_unrealize(itb);
itb->must_recalc = EINA_FALSE;
}
- if (itb->realized) _item_block_unrealize(itb);
showme = _item_block_recalc(itb, in, EINA_FALSE);
chb = itb;
}
itminw = it->minw;
itminh = it->minh;
- it->updateme = EINA_FALSE;
if (it->realized)
{
_item_unrealize(it, EINA_FALSE);
}
if ((it->minw != itminw) || (it->minh != itminh))
recalc = EINA_TRUE;
+ it->updateme = EINA_FALSE;
}
num++;
}
Item_Block *itb;
#endif
+ if (!sd) return;
// Evas_Coord ow, oh;
// evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
// ow = sd->wd->minw - ow;
}
done:
#endif
- if(!sd->wd->item_moving_effect_timer) evas_object_smart_changed(obj);
+ if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
}
static void
{
Pan *sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
if (x) *x = sd->wd->pan_x;
if (y) *y = sd->wd->pan_y;
}
Pan *sd = evas_object_smart_data_get(obj);
Evas_Coord ow, oh;
+ if (!sd) return;
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
ow = sd->wd->minw - ow;
if (ow < 0) ow = 0;
{
Pan *sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
if (w) *w = sd->wd->minw;
if (h) *h = sd->wd->minh;
}
_pan_resize_job(void *data)
{
Pan *sd = data;
+ if (!sd) return;
_sizing_eval(sd->wd->obj);
sd->resize_job = NULL;
}
Pan *sd = evas_object_smart_data_get(obj);
Evas_Coord ow, oh;
+ if (!sd) return;
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
if ((ow == w) && (oh == h)) return;
if ((sd->wd->height_for_width) && (ow != w))
{
+ sd->wd->pan_resize = EINA_TRUE;
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;
- static Evas_Coord old_pan_y = 0;
+ 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);
EINA_LIST_FOREACH(sd->wd->group_items, l, git)
{
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
if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
{
- if (sd->wd->pan_y != old_pan_y) sd->wd->reorder_pan_move = EINA_TRUE;
+ if (sd->wd->pan_y != sd->wd->old_pan_y)
+ sd->wd->reorder_pan_move = EINA_TRUE;
else sd->wd->reorder_pan_move = EINA_FALSE;
evas_object_raise(sd->wd->reorder_it->edit_obj);
- old_pan_y = sd->wd->pan_y;
+ sd->wd->old_pan_y = sd->wd->pan_y;
+ sd->wd->start_time = ecore_loop_time_get();
}
if (sd->wd->effect_mode &&
}
}
else _item_auto_scroll(sd->wd);
+ sd->wd->pan_resize = EINA_FALSE;
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
}
{
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);
- _item_position(it, it->mode_view);
+ 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)
wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
}
+static void
+_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
+{
+ if (!it) return;
+ if (!after) return;
+
+ it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
+ it->wd->reorder_deleted = EINA_TRUE;
+ _item_block_del(it);
+
+ it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
+ it->rel = after;
+ it->rel->relcount++;
+ it->before = EINA_FALSE;
+ if (after->group_item) it->group_item = after->group_item;
+ _item_queue(it->wd, it);
+
+ // TODO: change this to smart callback
+ if (it->itc->func.moved)
+ it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
+}
+
+static void
+_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
+{
+ if (!it) return;
+ if (!before) return;
+
+ it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
+ it->wd->reorder_deleted = EINA_TRUE;
+ _item_block_del(it);
+ it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
+ it->rel = before;
+ it->rel->relcount++;
+ it->before = EINA_TRUE;
+ if (before->group_item) it->group_item = before->group_item;
+ _item_queue(it->wd, it);
+
+ // TODO: change this to smart callback
+ if (it->itc->func.moved)
+ it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
+}
+
EAPI Elm_Genlist_Item *
elm_genlist_item_append(Evas_Object *obj,
const Elm_Genlist_Item_Class *itc,
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);
eina_list_free(wd->selected);
wd->selected = NULL;
}
- if (wd->item_moving_effect_timer)
+ if (wd->reorder_move_animator)
{
- ecore_animator_del(wd->item_moving_effect_timer);
- wd->item_moving_effect_timer = NULL;
+ ecore_animator_del(wd->reorder_move_animator);
+ wd->reorder_move_animator = NULL;
}
wd->show_item = NULL;
wd->pan_x = 0;
wd->pan_y = 0;
+ wd->old_pan_y = 0;
wd->minw = 0;
wd->minh = 0;
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
}
_sizing_eval(obj);
+ elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
evas_event_thaw(evas_object_evas_get(wd->obj));
evas_event_thaw_eval(evas_object_evas_get(wd->obj));
}
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)
it->block->updateme = EINA_TRUE;
if (it->wd->update_job) ecore_job_del(it->wd->update_job);
it->wd->update_job = ecore_job_add(_update_job, it->wd);
+ it->defer_unrealize = EINA_FALSE;
+}
+
+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_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)
{
return wd->mode_item;
}
-/**
- * Set reorder mode
- *
- * @param obj The genlist object
- * @param reorder_mode The reorder mode
- * (EINA_TRUE = on, EINA_FALSE = off)
- *
- * @ingroup Genlist
- */
EAPI void
elm_genlist_reorder_mode_set(Evas_Object *obj,
Eina_Bool reorder_mode)
wd->reorder_mode = reorder_mode;
}
-/**
- * Get the reorder mode
- *
- * @param obj The genlist object
- * @return The reorder mode
- * (EINA_TRUE = on, EINA_FALSE = off)
- *
- * @ingroup Genlist
- */
EAPI Eina_Bool
elm_genlist_reorder_mode_get(const Evas_Object *obj)
{
return;
}
-static void
-_effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
-{
- if (!it) return;
- if (!after) return;
-
-// printf("MOVE AFTER : it = %d after = %d \n", it->num, after->num);
- it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
- it->wd->reorder_deleted = EINA_TRUE;
- _item_block_del(it);
-
- it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
- it->rel = after;
- it->rel->relcount++;
- it->before = EINA_FALSE;
- _item_queue(it->wd, it);
-
- if (it->itc->func.moved)
- it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
-}
-
-static void
-_effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
-{
- if (!it) return;
- if (!before) return;
-
-// printf("MOVE BEFORE : it = %d before = %d \n", it->num, before->num);
- it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
- it->wd->reorder_deleted = EINA_TRUE;
- _item_block_del(it);
- it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
- it->rel = before;
- it->rel->relcount++;
- it->before = EINA_TRUE;
- _item_queue(it->wd, it);
-
- if (it->itc->func.moved)
- it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
-}
-
EAPI void
elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
{
_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);
- }
- }
- }
-}