* details.
*
* An item in the genlist world can have 0 or more text labels (they can be
- * regular text or textblock ??that's up to the style to determine), 0 or
+ * regular text or textblock - that's up to the style to determine), 0 or
* more icons (which are simply objects swallowed into the genlist item) and
* 0 or more boolean states that can be used for check, radio or other
* indicators by the edje theme style. An item may be one of several styles
- * (Elementary provides 4 by default - ?\9cdefault?? ?\9cdouble_label?? "group_index"
+ * (Elementary provides 4 by default - "default", "double_label", "group_index"
* and "icon_top_text_bottom", but this can be extended by system or
* application custom themes/overlays/extensions).
*
* a structure with information about that type of item (genlist may contain
* multiple different items with different classes, states and styles).
* Genlist will call the functions in this struct (methods) when an item is
- * ?\9crealized??(that is created dynamically while scrolling). All objects will
+ * "realized" (that is created dynamically while scrolling). All objects will
* simply be deleted when no longer needed with evas_object_del(). The
* Elm_Genlist_Item_Class structure contains the following members:
*
* item_style - This is a constant string and simply defines the name of the
- * item style. It must be specified and the default should be ?\9cdefault??
+ * item style. It must be specified and the default should be "default".
*
* func.label_get - This function is called when an actual item object is
* created. The data parameter is the data parameter passed to
* parameter is the genlist object and the part parameter is the string name
* of the state part in the edje design that is listed as one of the possible
* states that can be set. Return 0 for false or 1 for true. Genlist will
- * emit a signal to the edje object with ?\9celm,state,XXX,active???\9celm??when
+ * emit a signal to the edje object with "elm,state,XXX,active" "elm" when
* true (the default is false), where XXX is the name of the part.
*
* func.del - This is called when elm_genlist_item_del() is called on an
* handle that is an internal member inside the genlist. They all take a data
* parameter that is meant to be used for a handle to the applications
* internal data (eg the struct with the original item data). The parent
- * parameter is the parent genlist item this belongs to if it is a tree or
+ * parameter is the parent genlist item this belongs to if it is a tree or
* an indexed group, and NULL if there is no parent. The flags can be a bitmask
* of ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_SUBITEMS and
* ELM_GENLIST_ITEM_GROUP. If ELM_GENLIST_ITEM_SUBITEMS is set then this item
* viewport of the scroller. If it is ELM_LIST_LIMIT, items will be expanded
* to the viewport width and limited to that size. This can be combined with
* a different style that uses edjes' ellipsis feature (cutting text off like
- * this: ?\9ctex...??.
+ * this: "tex...").
*
* Items will only call their selection func and callback when first becoming
* selected. Any further clicks will do nothing, unless you enable always
int walking;
int item_width;
int item_height;
+ int group_item_width;
+ int group_item_height;
int max_items_per_block;
double longpress_timeout;
Eina_Bool reorder_pan_move : 1;
Eina_Bool reorder_deleted : 1;
Eina_Bool effect_mode : 1;
- Eina_Bool select_all_check : 1;
Eina_Bool auto_scrolled : 1;
+ Eina_Bool contracting : 1;
int edit_mode;
- Edit_Data *ed;
- Eina_List *edit_field;
- Elm_Genlist_Item *select_all_item;
Eina_List *sweeped_items;
Ecore_Timer *scr_hold_timer;
int total_num;
- int group_item_width;
- int group_item_height;
Elm_Genlist_Item *reorder_it, *reorder_rel;
Evas_Coord reorder_start_y;
Ecore_Animator *item_moving_effect_timer;
Evas_Coord expand_item_gap;
int move_effect_mode;
unsigned int start_time;
+ Ecore_Job *changed_job;
+ Elm_Genlist_Item *rename_it;
};
struct _Item_Block
Eina_Bool want_realize : 1;
Eina_Bool realized : 1;
Eina_Bool selected : 1;
- Eina_Bool hilighted : 1;
+ Eina_Bool highlighted : 1;
Eina_Bool expanded : 1;
Eina_Bool disabled : 1;
Eina_Bool display_only : 1;
// TODO: refactoring
Eina_Bool move_effect_me : 1;
- Eina_Bool effect_done : 1;
+ Eina_Bool effect_done : 1;
Eina_Bool reordering : 1;
- Eina_Bool edit_select_check: 1;
- Eina_Bool renamed : 1;
- Eina_Bool effect_item_realized : 1;
+ Eina_Bool renamed : 1;
+ Eina_Bool effect_item_realized : 1;
Eina_Bool sweeped : 1;
Eina_Bool wassweeped : 1;
- Eina_List *edit_icon_objs;
+ Eina_List *edit_icon_objs;
Evas_Object *edit_obj;
Eina_List *sweep_labels, *sweep_icons, *sweep_icon_objs;
int num;
Ecore_Animator *item_moving_effect_timer;
Evas_Coord old_scrl_x, old_scrl_y;
- Evas_Coord pad_left, pad_right;
- int list_expanded;
};
struct _Item_Cache
Eina_Bool expanded : 1; // it->expanded
};
-struct _Edit_Data
-{
- Elm_Genlist_Edit_Class *ec;
- Elm_Genlist_Item *del_item;
- Elm_Genlist_Item *reorder_item;
- Elm_Genlist_Item *reorder_rel;
- Evas_Object *del_confirm;
-};
-
#define ELM_GENLIST_ITEM_FROM_INLIST(item) \
((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
static const char *widtype = NULL;
static void _item_cache_zero(Widget_Data *wd);
static void _del_hook(Evas_Object *obj);
+static void _mirrored_set(Evas_Object *obj,
+ Eina_Bool rtl);
static void _theme_hook(Evas_Object *obj);
-static void _show_region_hook(void *data, Evas_Object *obj);
+static void _show_region_hook(void *data,
+ Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _item_unrealize(Elm_Genlist_Item *it);
static void _item_block_unrealize(Item_Block *itb);
static void _calc_job(void *data);
static void _on_focus_hook(void *data,
Evas_Object *obj);
+static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _changed_job(void *data);
static Eina_Bool _item_multi_select_up(Widget_Data *wd);
static Eina_Bool _item_multi_select_down(Widget_Data *wd);
static Eina_Bool _item_single_select_up(Widget_Data *wd);
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 _group_items_recalc(void *data);
-static void _select_all_down_process(Elm_Genlist_Item *select_all_it, Eina_Bool checked, Eina_Bool update_items);
-static void _checkbox_item_select_process(Elm_Genlist_Item *it);
static void _item_auto_scroll(void *data);
static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
_item_cache_zero(wd);
if (wd->calc_job) ecore_job_del(wd->calc_job);
if (wd->update_job) ecore_job_del(wd->update_job);
+ if (wd->changed_job) ecore_job_del(wd->changed_job);
if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
+ if (wd->edit_mode) elm_genlist_edit_mode_set(wd->obj, EINA_FALSE);
evas_object_del(wd->pan_smart);
wd->pan_smart = NULL;
elm_genlist_clear(obj);
}
static void
+_mirrored_set(Evas_Object *obj,
+ Eina_Bool rtl)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ _item_cache_zero(wd);
+ // TODO: uncomment this after upstream merge
+ //elm_smart_scroller_mirrored_set(wd->scr, rtl);
+}
+
+static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Item_Block *itb;
if (!wd) return;
_item_cache_zero(wd);
+ // TODO: uncomment this after upstream merge
+ //_elm_widget_mirrored_reload(obj);
+ //_mirrored_set(obj, elm_widget_mirrored_get(obj));
elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
elm_widget_style_get(obj));
// edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
wd->item_width = wd->item_height = 0;
+ wd->group_item_width = wd->group_item_height = 0;
wd->minw = wd->minh = wd->realminw = 0;
EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- Eina_List *l;
- Elm_Genlist_Item *it;
+ {
+ Eina_List *l;
+ Elm_Genlist_Item *it;
- if (itb->realized) _item_block_unrealize(itb);
- EINA_LIST_FOREACH(itb->items, l, it)
- it->mincalcd = EINA_FALSE;
+ if (itb->realized) _item_block_unrealize(itb);
+ EINA_LIST_FOREACH(itb->items, l, it)
+ it->mincalcd = EINA_FALSE;
- itb->changed = EINA_TRUE;
- }
+ itb->changed = EINA_TRUE;
+ }
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
_sizing_eval(obj);
}
static void
-_show_region_hook(void *data, Evas_Object *obj)
+_show_region_hook(void *data,
+ Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(data);
Evas_Coord x, y, w, h;
if (!wd) return;
elm_widget_show_region_get(obj, &x, &y, &w, &h);
+ //x & y are screen coordinates, Add with pan coordinates
x += wd->pan_x;
y += wd->pan_y;
if (y > 0) elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
wd->prev_viewport_w = vw;
EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- itb->must_recalc = EINA_TRUE;
- }
+ {
+ itb->must_recalc = EINA_TRUE;
+ }
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
}
}
static void
-_item_hilight(Elm_Genlist_Item *it)
+_item_highlight(Elm_Genlist_Item *it)
{
const char *selectraise;
- if ((it->wd->no_select) || (it->delete_me) || (it->hilighted) ||
- (it->disabled)) return;
+ if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) || (it->disabled) || (it->display_only)) return;
if ((!it->sweeped) && (!it->wd->edit_mode))
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
selectraise = edje_object_data_get(it->base.view, "selectraise");
if ((it->group_item) && (it->group_item->realized))
evas_object_raise(it->group_item->base.view);
}
- it->hilighted = EINA_TRUE;
- if (it->wd->select_all_item) evas_object_raise(it->wd->select_all_item->base.view);
+ it->highlighted = EINA_TRUE;
}
static void
if (!it) return;
Eina_List *tl = NULL, *l;
Elm_Genlist_Item *it2;
-
+
EINA_LIST_FOREACH(it->items, l, it2)
tl = eina_list_append(tl, it2);
_item_select(Elm_Genlist_Item *it)
{
if ((it->wd->no_select) || (it->delete_me)) return;
- if (it == it->wd->select_all_item)
- {
- if(it->wd->select_all_check)
- _select_all_down_process(it->wd->select_all_item, EINA_FALSE, EINA_TRUE);
- else
- _select_all_down_process(it->wd->select_all_item, EINA_TRUE, EINA_TRUE);
- return;
- }
if (it->selected)
{
if (it->wd->always_select) goto call;
_item_unselect(Elm_Genlist_Item *it)
{
const char *stacking, *selectraise;
-
- if (it == it->wd->select_all_item) return;
- if ((it->delete_me) || (!it->hilighted)) return;
+
+ if ((it->delete_me) || (!it->highlighted)) return;
if (!it->sweeped)
edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
stacking = edje_object_data_get(it->base.view, "stacking");
if ((stacking) && (!strcmp(stacking, "below")))
evas_object_lower(it->base.view);
}
- it->hilighted = EINA_FALSE;
+ it->highlighted = EINA_FALSE;
if (it->selected)
{
it->selected = EINA_FALSE;
}
if (it->wd->reorder_mode && it->wd->reorder_it)
{
- Evas_Coord ox,oy,oh,ow, sel_all_h = 0;
+ 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;
- evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
- if (it->wd->select_all_item)
- sel_all_h = it->wd->select_all_item->h;
- if (it_y < oy + sel_all_h) _effect_item_controls(it, it->scrl_x, oy + sel_all_h);
+ evas_object_resize(it->base.view, it->w, it->h);
+ 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);
Elm_Genlist_Item *it_tmp;
static Eina_Bool done = EINA_FALSE;
//static Eina_Bool contracted = EINA_FALSE;
- Eina_List *l;
- Item_Block *itb;
+ Eina_List *l;
+ Item_Block *itb;
it->long_timer = NULL;
- if ((it->disabled) || (it->dragging) || (it->display_only))
- return ECORE_CALLBACK_CANCEL;
+ if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
+ return ECORE_CALLBACK_CANCEL;
it->wd->longpressed = EINA_TRUE;
evas_object_smart_callback_call(it->base.widget, "longpressed", it);
- if ((it->wd->reorder_mode) && (it != it->wd->select_all_item) && (it->flags != ELM_GENLIST_ITEM_GROUP))
+ if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
{
it->wd->reorder_it = it;
it->wd->reorder_start_y = 0;
{
EINA_LIST_FOREACH(it->items, l, it_tmp)
{
- if (elm_genlist_item_expanded_get(it_tmp))
+ if (elm_genlist_item_expanded_get(it_tmp))
{
elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
return ECORE_CALLBACK_RENEW;
- }
+ }
}
}
if (elm_genlist_item_expanded_get(it)) {
elm_genlist_item_expanded_set(it, EINA_FALSE);
return ECORE_CALLBACK_RENEW;
}
- if (it->wd->edit_field && it->renamed)
- elm_genlist_item_rename_mode_set(it, EINA_FALSE);
}
return ECORE_CALLBACK_CANCEL;
int i, sum = 0;
if (!it) return;
+ if ((it->display_only) || (it->disabled)) return;
it->wd->swipe = EINA_FALSE;
for (i = 0; i < it->wd->movements; i++)
{
}
if (it->wd->multi_timeout)
{
- it->wd->multi_timeout = EINA_FALSE;
- return;
+ it->wd->multi_timeout = EINA_FALSE;
+ return;
}
Evas_Coord minw = 0, minh = 0;
"multi,pinch,in", it);
}
}
- it->wd->multi_timeout = EINA_FALSE;
+ it->wd->multi_timeout = EINA_FALSE;
}
static void
-_multi_down(void *data,
- Evas *evas __UNUSED__,
+_multi_down(void *data,
+ Evas *evas __UNUSED__,
Evas_Object *obj __UNUSED__,
- void *event_info)
+ void *event_info)
{
Elm_Genlist_Item *it = data;
Evas_Event_Multi_Down *ev = event_info;
}
static void
-_multi_up(void *data,
- Evas *evas __UNUSED__,
+_multi_up(void *data,
+ Evas *evas __UNUSED__,
Evas_Object *obj __UNUSED__,
- void *event_info)
+ void *event_info)
{
Elm_Genlist_Item *it = data;
Evas_Event_Multi_Up *ev = event_info;
}
static void
-_multi_move(void *data,
- Evas *evas __UNUSED__,
+_multi_move(void *data,
+ Evas *evas __UNUSED__,
Evas_Object *obj __UNUSED__,
- void *event_info)
+ void *event_info)
{
Elm_Genlist_Item *it = data;
Evas_Event_Multi_Move *ev = event_info;
{
it->wd->on_hold = EINA_TRUE;
}
-
- if (it->wd->edit_field && !it->renamed)
- elm_genlist_item_rename_mode_set(it, EINA_FALSE);
it->down = EINA_TRUE;
it->dragging = EINA_FALSE;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
else it->wd->on_hold = EINA_FALSE;
if (it->wd->on_hold) return;
it->wd->wasselected = it->selected;
- _item_hilight(it);
+ _item_highlight(it);
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- evas_object_smart_callback_call(it->base.widget, "clicked", it);
+ if ((!it->disabled) && (!it->display_only))
+ evas_object_smart_callback_call(it->base.widget, "clicked", it);
if (it->long_timer) ecore_timer_del(it->long_timer);
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
}
if (it->wd->reorder_mode)
{
- Evas_Coord rox, roy, row, roh, sel_all_h = 0;
+ Evas_Coord rox, roy, row, roh;
Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
if (reorder_it)
{
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->select_all_item) sel_all_h = it->wd->select_all_item->h;
if (it->wd->reorder_rel)
- {
+ {
if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent) // todo : refactoring
{
- if (roy + oy - sel_all_h <= it->wd->reorder_rel->scrl_y)
+ if (roy + oy <= it->wd->reorder_rel->scrl_y)
_effect_item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
else
_effect_item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
{
if ((!it->selected) && (!it->sweeped))
{
- _item_hilight(it);
+ _item_highlight(it);
_item_select(it);
}
else _item_unselect(it);
EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
if (it2 != it) _item_unselect(it2);
- //_item_hilight(it);
+ //_item_highlight(it);
//_item_select(it);
}
if (!it->sweeped)
{
- _item_hilight(it);
+ _item_highlight(it);
_item_select(it);
}
}
if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
odd = (it->order_num_in & 0x1);
EINA_INLIST_FOREACH(it->wd->item_cache, itc)
- {
- if ((itc->selected) || (itc->disabled) || (itc->expanded))
- continue;
- if ((itc->tree == tree) &&
- (itc->odd == odd) &&
- (itc->compress == it->wd->compress) &&
- (!strcmp(it->itc->item_style, itc->item_style)))
- {
- it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
- EINA_INLIST_GET(itc));
- it->wd->item_cache_count--;
- return itc;
- }
- }
+ {
+ if ((itc->selected) || (itc->disabled) || (itc->expanded))
+ continue;
+ if ((itc->tree == tree) &&
+ (itc->odd == odd) &&
+ (itc->compress == it->wd->compress) &&
+ (!strcmp(it->itc->item_style, itc->item_style)))
+ {
+ it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
+ EINA_INLIST_GET(itc));
+ it->wd->item_cache_count--;
+ return itc;
+ }
+ }
return NULL;
}
static void
_item_realize(Elm_Genlist_Item *it,
int in,
- int calc)
+ Eina_Bool calc)
{
Elm_Genlist_Item *it2;
const char *stacking;
if ((it->realized) || (it->delete_me)) return;
it->order_num_in = in;
if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) calc = EINA_FALSE;
- if (it->nocache)
- it->nocache = EINA_FALSE;
+ if (it->nocache && !it->renamed)
+ it->nocache = EINA_FALSE;
else
itc = _item_cache_find(it);
if ((!it->wd->effect_mode) && (itc))
_elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
elm_widget_style_get(it->base.widget));
+ // TODO: uncomment this after upstream merge
+ //edje_object_mirrored_set(it->base.view,
+ // elm_widget_mirrored_get(it->base.widget));
it->spacer =
evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
evas_object_color_set(it->spacer, 0, 0, 0, 0);
}
}
- if ((calc) && (it->wd->homogeneous) && (it->wd->item_width) && it->wd->group_item_width )
+ if ((calc) && (it->wd->homogeneous) && ((it->wd->item_width) || ((it->wd->item_width) && (it->wd->group_item_width))))
{
/* homogenous genlist shortcut */
- if ((it->flags & ELM_GENLIST_ITEM_GROUP) && (!it->mincalcd))
- {
- it->w = it->minw = it->wd->group_item_width;
- it->h = it->minh = it->wd->group_item_height;
- it->mincalcd = EINA_TRUE;
- }
- else if (!it->mincalcd)
- {
- it->w = it->minw = it->wd->item_width;
- it->h = it->minh = it->wd->item_height;
- it->mincalcd = EINA_TRUE;
- }
+ if (!it->mincalcd)
+ {
+ if (it->flags & ELM_GENLIST_ITEM_GROUP)
+ {
+ it->w = it->minw = it->wd->group_item_width;
+ it->h = it->minh = it->wd->group_item_height;
+ }
+ else
+ {
+ it->w = it->minw = it->wd->item_width;
+ it->h = it->minh = it->wd->item_height;
+ }
+ it->mincalcd = EINA_TRUE;
+ }
}
else
{
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->wd->rename_it && it->renamed)
+ {
+ it->icons =
+ 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);
+ 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);
+ }
+ }
+ }
}
if (it->itc->func.state_get)
{
it->h = it->minh = mh;
it->mincalcd = EINA_TRUE;
- if ((it->wd->homogeneous) && (it->flags & ELM_GENLIST_ITEM_GROUP))
- {
- it->wd->group_item_width = mw;
- it->wd->group_item_height = mh;
- }
- else if ((it->wd->homogeneous))
- // if ((!in) && (it->wd->homogeneous))
+ if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
+ {
+ it->wd->group_item_width = mw;
+ it->wd->group_item_height = mh;
+ }
+ else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
{
it->wd->item_width = mw;
it->wd->item_height = mh;
}
- if ((!in) && (it->wd->homogeneous) && (!it->wd->group_item_width))
- {
- if (it->flags & ELM_GENLIST_ITEM_GROUP)
- {
- it->wd->group_item_width = mw;
- it->wd->group_item_height = mh;
- }
- }
}
if (!calc) evas_object_show(it->base.view);
}
if (itc) _item_cache_free(itc);
evas_object_smart_callback_call(it->base.widget, "realized", it);
- if ((it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP) && ((!it->wd->select_all_item) || ((it->wd->select_all_item) && (it != it->wd->select_all_item))))
+ if ((!calc) && (it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
{
- _effect_item_realize(it, EINA_FALSE);
- edje_object_message_signal_process(it->edit_obj);
+ if (it->itc->edit_item_style )
+ {
+ _effect_item_realize(it, EINA_FALSE);
+ edje_object_message_signal_process(it->edit_obj);
+ }
}
}
if (!it->realized) return;
if (it->wd->reorder_it && it->wd->reorder_it == it) return;
- if (!it->wd->edit_mode && it->hilighted) return;
evas_object_smart_callback_call(it->base.widget, "unrealized", it);
if (it->long_timer)
{
it->spacer = NULL;
}
else
- _item_cache_add(it);
+ {
+ // TODO: uncomment this after upstream merge
+ //edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget));
+ _item_cache_add(it);
+ }
elm_widget_stringlist_free(it->labels);
it->labels = NULL;
elm_widget_stringlist_free(it->icons);
it->states = NULL;
it->realized = EINA_FALSE;
it->want_unrealize = EINA_FALSE;
- if (it->wd->edit_field && it->renamed)
- elm_genlist_item_rename_mode_set(it, EINA_FALSE);
- if (it->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE) _effect_item_unrealize(it);
+ if (it->wd->edit_mode) _effect_item_unrealize(it);
}
-static Eina_Bool
+static Eina_Bool
_item_block_recalc(Item_Block *itb,
int in,
int qadd,
if (!it->mincalcd) changed = EINA_TRUE;
if (changed)
{
- _item_realize(it, in, 1);
+ _item_realize(it, in, EINA_TRUE);
_item_unrealize(it);
}
}
else
{
- _item_realize(it, in, 1);
- _item_unrealize(it);
+ _item_realize(it, in, EINA_TRUE);
+ if (!it->wd->contracting) _item_unrealize(it);
}
}
else
- _item_realize(it, in, 0);
+ _item_realize(it, in, EINA_FALSE);
minh += it->minh;
if (minw < it->minw) minw = it->minw;
in++;
EINA_LIST_FOREACH(itb->items, l, it)
{
if (it->delete_me) continue;
- if (full) _item_realize(it, in, 0);
+ if (full) _item_realize(it, in, EINA_FALSE);
in++;
}
itb->realized = EINA_TRUE;
it->want_unrealize = EINA_TRUE;
}
else
- _item_unrealize(it);
+ if (!it->wd->contracting) _item_unrealize(it);
}
}
if (!dragging)
{
it->block->reorder_offset = it->wd->reorder_it->h;
}
- else
+ else
it->block->reorder_offset = 0;
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));
if (top)
double time = 0.4, t;
int y, dy = 4;
t = ((0.0 > (t = current_time_get() - it->wd->start_time)) ? 0.0 : t) / 1000;
-
+
if (t <= time)
y = (1 * sin((t / time) * (M_PI / 2)) * dy);
else
it->old_scrl_y += y;
down = EINA_TRUE;
}
- else if (it->old_scrl_y > it->scrl_y)
+ else 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);
Elm_Genlist_Item *git;
Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
int vis = 0;
- int sel_all_h = 0;
- Elm_Genlist_Item *select_all_item = NULL;
evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
&cvw, &cvh);
- if (itb->wd->select_all_item &&
- (itb->wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECT || itb->wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL))
- {
- if (itb->wd->select_all_check)
- edje_object_signal_emit(itb->wd->select_all_item->base.view, "elm,state,sel_check", "elm");
- else
- edje_object_signal_emit(itb->wd->select_all_item->base.view, "elm,state,sel_uncheck", "elm");
-
- select_all_item = itb->wd->select_all_item;
-
- evas_object_resize(select_all_item->base.view, itb->w, select_all_item->h);
- evas_object_move(select_all_item->base.view, ox, oy);
- evas_object_raise(select_all_item->base.view);
-
- y = select_all_item->h;
- sel_all_h = select_all_item->h;
- }
-
EINA_LIST_FOREACH(itb->items, l, it)
{
if (it->delete_me) continue;
{
if ((itb->realized) && (!it->realized))
{
- if (vis) _item_realize(it, in, 0);
+ if (vis)
+ {
+ _item_realize(it, in, 0);
+ 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 (git)
{
git->scrl_x = it->scrl_x;
- if (git->scrl_y < oy + sel_all_h)
- git->scrl_y = oy + sel_all_h;
+ if (git->scrl_y < oy)
+ git->scrl_y = oy;
if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
- git->scrl_y = (it->scrl_y + it->h) - git->h;
+ 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->move_effect_me )
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 != ELM_GENLIST_EDIT_MODE_NONE)
- {
+ if (it->wd->edit_mode && it->itc->edit_item_style)
+ {
_effect_item_controls(it, it->scrl_x, it->scrl_y);
}
else
{
- evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
- evas_object_move(it->base.view, it->scrl_x+it->pad_left, it->scrl_y);
+ evas_object_resize(it->base.view, it->w, it->h);
+ evas_object_move(it->base.view, it->scrl_x, it->scrl_y);
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)))
evas_object_show(it->base.view);
else
}
static void
+_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Elm_Genlist_Item *it = data;
+ if (!it) return;
+ it->mincalcd = EINA_FALSE;
+ it->block->updateme = EINA_TRUE;
+ if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
+ it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
+}
+
+static void
_group_items_recalc(void *data)
{
Widget_Data *wd = data;
EINA_LIST_FOREACH(wd->group_items, l, git)
{
- if (git->want_realize)
+ if (git->want_realize)
{
if (!git->realized)
- _item_realize(git, 0, 0);
+ _item_realize(git, 0, EINA_FALSE);
evas_object_resize(git->base.view, wd->minw, git->h);
evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
evas_object_show(git->base.view);
}
else if (!git->want_realize && git->realized)
{
- if (!git->dragging)
- _item_unrealize(git);
+ if (!git->dragging)
+ _item_unrealize(git);
}
}
}
}
EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- Eina_Bool showme = EINA_FALSE;
+ {
+ Eina_Bool showme = EINA_FALSE;
itb->num = in;
showme = itb->showme;
if (minw_change)
{
EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- itb->minw = minw;
- itb->w = itb->minw;
- }
+ {
+ itb->minw = minw;
+ itb->w = itb->minw;
+ }
}
if ((chb) && (EINA_INLIST_GET(chb)->next))
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
- {
- if (itb->realized) _item_block_unrealize(itb);
- }
+ {
+ if (itb->realized) _item_block_unrealize(itb);
+ }
}
wd->realminw = minw;
if (minw < wd->w) minw = wd->w;
- if ((minw != wd->minw) || (minh != wd->minh) || (wd->select_all_item))
+ if ((minw != wd->minw) || (minh != wd->minh))
{
wd->minw = minw;
wd->minh = minh;
- if (wd->select_all_item)
- wd->minh += wd->select_all_item->h;
if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
_sizing_eval(wd->obj);
{
if (it->updateme)
{
- itminw = it->w;
- itminh = it->h;
+ itminw = it->minw;
+ itminh = it->minh;
it->updateme = EINA_FALSE;
if (it->realized)
}
static void
+_changed_job(void *data)
+{
+ Widget_Data *wd = data; Eina_List *l2;
+ Item_Block *itb;
+ int num, num0, position = 0, recalc = 0;
+ if (!wd) return;
+ wd->changed_job = NULL;
+ num = 0;
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+ Evas_Coord itminw, itminh;
+ Elm_Genlist_Item *it;
+
+ if (!itb->updateme)
+ {
+ num += itb->count;
+ if (position)
+ _item_block_position(itb, num);
+ continue;
+ }
+ num0 = num;
+ recalc = 0;
+ EINA_LIST_FOREACH(itb->items, l2, it)
+ {
+ if (!it->mincalcd)
+ {
+ Evas_Coord mw = -1, mh = -1;
+ itminw = it->w;
+ itminh = it->h;
+
+ if (it->wd->height_for_width) mw = it->wd->w;
+ if (!it->display_only)
+ elm_coords_finger_size_adjust(1, &mw, 1, &mh);
+ if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
+ edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
+ if (!it->display_only)
+ elm_coords_finger_size_adjust(1, &mw, 1, &mh);
+ it->w = it->minw = mw;
+ it->h = it->minh = mh;
+ it->mincalcd = EINA_TRUE;
+
+ //if ((it->minw != itminw) || (it->minh != itminh))
+ if ((it->minh != itminh))
+ recalc = 1;
+ }
+ num++;
+ }
+ itb->updateme = EINA_FALSE;
+ if (recalc)
+ {
+ position = 1;
+ itb->changed = EINA_TRUE;
+ _item_block_recalc(itb, num0, 0, 1);
+ _item_block_position(itb, num0);
+ }
+ }
+ if (position)
+ {
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+ }
+}
+
+static void
_pan_set(Evas_Object *obj,
Evas_Coord x,
Evas_Coord y)
}
}
done:
-#endif
+#endif
if(!sd->wd->item_moving_effect_timer) evas_object_smart_changed(obj);
}
old_pan_y = sd->wd->pan_y;
}
- if (sd->wd->effect_mode &&
+ if (sd->wd->effect_mode &&
((sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) ||
(sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) ||
(sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)))
}
}
else _item_auto_scroll(sd->wd);
- if (sd->wd->select_all_item) evas_object_raise(sd->wd->select_all_item->base.view);
+ sd->wd->contracting = EINA_FALSE;
}
static void
&minw, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
+ // TODO: uncomment this after upstream merge
+ //_mirrored_set(obj, elm_widget_mirrored_get(obj));
_sizing_eval(obj);
return obj;
}
it->func.data = func_data;
it->mouse_cursor = NULL;
it->expanded_depth = 0;
- if ((it->parent) && (it->parent->edit_select_check)) it->edit_select_check = EINA_TRUE;
- if ((!it->parent) && (it->wd->select_all_item))
- _select_all_down_process(it->wd->select_all_item, EINA_FALSE, EINA_FALSE);
it->num = ++wd->total_num; // todo : remov
return it;
}
}
static int
-_queue_proecess(Widget_Data *wd,
- int norender)
+_queue_process(Widget_Data *wd,
+ int norender)
{
int n;
Eina_Bool showme = EINA_FALSE;
//if (q_start == 0.0) q_start = ecore_time_get();
//xxx
- if (_queue_proecess(wd, 1) > 0)
+ if (_queue_process(wd, 1) > 0)
{
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
ecore_idler_del(wd->queue_idler);
wd->queue_idler = NULL;
}
- _queue_proecess(wd, 0);
+ _queue_process(wd, 0);
}
if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_item_idler, wd);
}
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
func_data);
- if (!wd) return NULL;
if (!it) return NULL;
if (!it->parent)
{
if (flags & ELM_GENLIST_ITEM_GROUP)
- wd->group_items = eina_list_append(wd->group_items, it);
+ wd->group_items = eina_list_append(wd->group_items, it);
wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
it->rel = NULL;
}
if (ll) it2 = ll->data;
it->parent->items = eina_list_append(it->parent->items, it);
if (!it2) it2 = it->parent;
+ if (it2->delete_me)
+ it2 = elm_genlist_item_prev_get(it2);
wd->items =
eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
EINA_INLIST_GET(it2));
it->rel = it2;
it->rel->relcount++;
- if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
- it->group_item = parent;
+ if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
+ it->group_item = parent;
else if (it->parent->group_item)
- it->group_item = it->parent->group_item;
+ it->group_item = it->parent->group_item;
}
it->before = EINA_FALSE;
_item_queue(wd, it);
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
func_data);
- if (!wd) return NULL;
if (!it) return NULL;
if (!it->parent)
{
if (flags & ELM_GENLIST_ITEM_GROUP)
- wd->group_items = eina_list_prepend(wd->group_items, it);
+ wd->group_items = eina_list_prepend(wd->group_items, it);
wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
it->rel = NULL;
}
if (ll) it2 = ll->data;
it->parent->items = eina_list_prepend(it->parent->items, it);
if (!it2) it2 = it->parent;
+ if (it2->delete_me)
+ it2 = elm_genlist_item_next_get(it2);
wd->items =
- eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
- EINA_INLIST_GET(it2));
+ eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
+ EINA_INLIST_GET(it2));
it->rel = it2;
it->rel->relcount++;
}
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
func_data);
- if (!wd) return NULL;
if (!it) return NULL;
if (it->parent)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
func_data);
- if (!wd) return NULL;
if (!it) return NULL;
wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
EINA_INLIST_GET(after));
wd->clear_me = EINA_TRUE;
EINA_INLIST_FOREACH(wd->items, it)
- {
- it->delete_me = EINA_TRUE;
- }
+ {
+ it->delete_me = EINA_TRUE;
+ }
return;
}
- wd->clear_me = EINA_FALSE;
while (wd->items)
{
Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
it->nocache = EINA_TRUE;
- it->hilighted = EINA_FALSE;
-#ifdef ANCHOR_ITEM
+ it->highlighted = EINA_FALSE;
+#ifdef ANCHOR_ITEM
if (wd->anchor_item == it)
{
wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
wd->anchor_item =
ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
}
-#endif
+#endif
wd->items = eina_inlist_remove(wd->items, wd->items);
if (it->flags & ELM_GENLIST_ITEM_GROUP)
it->wd->group_items = eina_list_remove(it->wd->group_items, it);
elm_widget_item_pre_notify_del(it);
- if (it->effect_item_realized) _effect_item_unrealize(it);
+ if (it->effect_item_realized) _effect_item_unrealize(it);
if (it->realized) _item_unrealize(it);
- if (it->itc->func.del)
- it->itc->func.del((void *)it->base.data, it->base.widget);
+ if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
+ it->itc->func.del((void *)it->base.data, it->base.widget);
if (it->long_timer) ecore_timer_del(it->long_timer);
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
elm_widget_item_del(it);
}
+ wd->clear_me = EINA_FALSE;
wd->anchor_item = NULL;
while (wd->blocks)
{
eina_list_free(wd->selected);
wd->selected = NULL;
}
- if (wd->edit_field)
- {
- Evas_Object *editfield;
- EINA_LIST_FREE(wd->edit_field, editfield)
- evas_object_del(editfield);
- wd->edit_field = NULL;
- }
if (wd->item_moving_effect_timer)
{
ecore_animator_del(wd->item_moving_effect_timer);
- wd->item_moving_effect_timer = NULL;
- }
- if (wd->edit_mode)
- {
- wd->edit_mode = ELM_GENLIST_EDIT_MODE_NONE;
- elm_genlist_edit_mode_set(wd->obj, ELM_GENLIST_EDIT_MODE_NONE, NULL);
+ wd->item_moving_effect_timer = NULL;
}
wd->show_item = NULL;
wd->pan_x = 0;
/**
* Enable or disable multi-select in the genlist
*
- * This enables (EINA_TRUE) or disableds (EINA_FALSE) multi-select in
+ * This enables (EINA_TRUE) or disables (EINA_FALSE) multi-select in
* the list. This allows more than 1 item to be selected.
*
* @param obj The genlist object
Eina_Bool done = EINA_FALSE;
if (!wd) return NULL;
EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- if (itb->realized)
- {
- Eina_List *l;
- Elm_Genlist_Item *it;
+ {
+ if (itb->realized)
+ {
+ Eina_List *l;
+ Elm_Genlist_Item *it;
- done = 1;
- EINA_LIST_FOREACH(itb->items, l, it)
- {
- if (it->realized) list = eina_list_append(list, it);
- }
- }
- else
- {
- if (done) break;
- }
- }
+ done = 1;
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ if (it->realized) list = eina_list_append(list, it);
+ }
+ }
+ else
+ {
+ if (done) break;
+ }
+ }
return list;
}
evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
lasty = oy;
EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- Eina_List *l;
- Elm_Genlist_Item *it;
+ {
+ Eina_List *l;
+ Elm_Genlist_Item *it;
- if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
- oy + itb->y - itb->wd->pan_y,
- itb->w, itb->h, x, y, 1, 1))
- continue;
- EINA_LIST_FOREACH(itb->items, l, it)
- {
- Evas_Coord itx, ity;
+ if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
+ oy + itb->y - itb->wd->pan_y,
+ itb->w, itb->h, x, y, 1, 1))
+ continue;
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ Evas_Coord itx, ity;
- itx = ox + itb->x + it->x - itb->wd->pan_x;
- ity = oy + itb->y + it->y - itb->wd->pan_y;
- if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
- {
- if (posret)
- {
- if (y <= (ity + (it->h / 4))) *posret = -1;
- else if (y >= (ity + it->h - (it->h / 4)))
- *posret = 1;
- else *posret = 0;
- }
- return it;
- }
- lasty = ity + it->h;
- }
- }
+ itx = ox + itb->x + it->x - itb->wd->pan_x;
+ ity = oy + itb->y + it->y - itb->wd->pan_y;
+ if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
+ {
+ if (posret)
+ {
+ if (y <= (ity + (it->h / 4))) *posret = -1;
+ else if (y >= (ity + it->h - (it->h / 4)))
+ *posret = 1;
+ else *posret = 0;
+ }
+ return it;
+ }
+ lasty = ity + it->h;
+ }
+ }
if (posret)
{
if (y > lasty) *posret = 1;
while (wd->selected)
_item_unselect(wd->selected->data);
}
- _item_hilight(it);
+ _item_highlight(it);
_item_select(it);
}
else
if(it->wd->effect_mode && !it->wd->alpha_bg)
it->wd->alpha_bg = _create_tray_alpha_bg(it->base.widget);
-
+
if (it->expanded)
{
it->wd->auto_scrolled = EINA_FALSE;
}
else
{
+ it->wd->contracting = EINA_TRUE;
it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
if (it->realized)
edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
Eina_Bool display_only)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->block) return;
if (it->display_only == display_only) return;
if (it->delete_me) return;
it->display_only = display_only;
it->mincalcd = EINA_FALSE;
it->updateme = EINA_TRUE;
- it->block->updateme = EINA_TRUE;
+ if (it->block) 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->wd->show_item = NULL;
}
if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
- gith = it->group_item->h;
+ gith = it->group_item->h;
elm_smart_scroller_child_region_show(it->wd->scr,
it->x + it->block->x,
it->y + it->block->y - gith,
elm_genlist_item_bring_in(Elm_Genlist_Item *it)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Evas_Coord gith = 0;
+ Evas_Coord gith = 0;
if (it->delete_me) return;
if ((it->queued) || (!it->mincalcd))
{
it->wd->show_item = NULL;
}
if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
- gith = it->group_item->h;
+ gith = it->group_item->h;
elm_smart_scroller_region_bring_in(it->wd->scr,
it->x + it->block->x,
it->y + it->block->y - gith,
if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
}
-// if (it->itc->func.del)
-// it->itc->func.del((void *)it->base.data, it->base.widget);
+ if (it->itc->func.del)
+ it->itc->func.del((void *)it->base.data, it->base.widget);
return;
}
_item_del(it);
if (!it) return;
if (!after) return;
- if (it->wd->ed->ec->move)
- it->wd->ed->ec->move(it->base.widget, it, after, EINA_TRUE);
-
-// printf("MOVE AFTER : %d after = %d \n", (int)elm_genlist_item_data_get(it)+1, (int)elm_genlist_item_data_get(after)+1);
+// 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->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
if (!it) return;
if (!before) return;
- if (it->wd->ed->ec->move)
- it->wd->ed->ec->move(it->base.widget, it, before, EINA_FALSE);
-
-// printf("MOVE BEFORE : %d before = %d \n", (int)elm_genlist_item_data_get(it)+1, (int)elm_genlist_item_data_get(before)+1);
+// 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->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
wd->effect_mode = emode;
// wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
// evas_object_resize(wd->point_rect, 10, 25);
- // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
+ // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
// evas_object_show(wd->point_rect);
// evas_object_hide(wd->point_rect);
}
}
static unsigned int
-current_time_get()
+current_time_get()
{
struct timeval timev;
if (wd->edit_mode) _effect_item_controls(it, it->scrl_x, it->old_scrl_y + y);
else
{
- evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
- evas_object_move(it->base.view, it->scrl_x+it->pad_left, it->old_scrl_y + y);
+ evas_object_resize(it->base.view, it->w, it->h);
+ evas_object_move(it->base.view, it->scrl_x, it->old_scrl_y + y);
evas_object_show(it->base.view);
evas_object_raise(it->base.view);
}
- if(wd->select_all_item) evas_object_raise(wd->select_all_item->base.view);
if (it->group_item) evas_object_raise(it->group_item->base.view);
}
EINA_LIST_FOREACH(itb->items, l, it)
{
it->effect_done = EINA_TRUE;
- it->list_expanded = 0;
it->old_scrl_y = it->scrl_y;
}
}
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);
+ 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;
static void
_elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
{
- printf("!!! NOW FIXING \n");
+ printf("!!! NOW FIXING \n");
}
*/
/**
* Set pinch zoom mode
- *
+ *
* @param obj The genlist object
- * @param emode
+ * @param emode
* (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
- *
+ *
* @ingroup Genlist
*/
EAPI void
elm_genlist_pinch_zoom_mode_set(Evas_Object *obj, Eina_Bool emode)
{
- printf("!!! NOW FIXING \n");
+ printf("!!! NOW FIXING \n");
}
/**
* Get pinch zoom mode
- *
+ *
* @param obj The genlist object
* @return The pinch mode
* (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
- *
+ *
* @ingroup Genlist
*/
EAPI Eina_Bool
elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj)
{
- printf("!!! NOW FIXING \n");
+ printf("!!! NOW FIXING \n");
return EINA_FALSE;
}
EAPI void
elm_genlist_pinch_zoom_set(Evas_Object *obj, Eina_Bool emode)
{
- printf("!!! NOW FIXING \n");
+ printf("!!! NOW FIXING \n");
}
////////////////////////////////////////////////////////////////////////
-// EDIT MODE
+// EDIT MODE
////////////////////////////////////////////////////////////////////////
-EAPI void
-_effect_item_update(Elm_Genlist_Item *it)
-{
- if (it->edit_select_check)
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_check", "elm");
- }
- else
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_uncheck", "elm");
- }
-}
-
-EAPI void
-_edit_item_checkbox_set(Elm_Genlist_Item *it, Eina_Bool edit_select_check_state)
-{
- if (!it) return;
- if (edit_select_check_state)
- {
- it->edit_select_check = EINA_TRUE;
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_check", "elm");
- }
- else
- {
- it->edit_select_check = EINA_FALSE;
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_uncheck", "elm");
- }
- if (it->wd->ed && it->wd->ed->ec && it->wd->ed->ec->item_selected)
- it->wd->ed->ec->item_selected(it->base.data, it, it->edit_select_check);
-}
-
-EAPI void
-_edit_subitems_checkbox_set(Elm_Genlist_Item *it)
-{
- if (!it) return;
- Eina_List *tl = NULL, *l;
- Elm_Genlist_Item *it2;
-
- EINA_LIST_FOREACH(it->items, l, it2)
- tl = eina_list_append(tl, it2);
- EINA_LIST_FREE(tl, it2)
- if(it2->parent) _edit_item_checkbox_set(it2, it2->parent->edit_select_check);
-}
-
-EAPI void
-_edit_parent_items_checkbox_set(Elm_Genlist_Item *it)
-{
- if (!it) return;
- Elm_Genlist_Item *tmp_it;
- Eina_Bool parent_check = EINA_TRUE;
-
- EINA_INLIST_FOREACH(it->wd->items, tmp_it)
- {
- if (tmp_it->parent && it->parent)
- if(tmp_it->parent == it->parent && tmp_it->edit_select_check == EINA_FALSE) parent_check = EINA_FALSE;
- }
- if (it->parent)
- {
- if (parent_check) it->parent->edit_select_check = EINA_TRUE;
- else it->parent->edit_select_check = EINA_FALSE;
- }
-
- if (it->parent)
- {
- _effect_item_update(it->parent);
- return _edit_parent_items_checkbox_set(it->parent);
- }
-}
-
-static void
-_select_all_down_process(Elm_Genlist_Item *select_all_it, Eina_Bool checked, Eina_Bool update_items)
-{
- if (!select_all_it || !select_all_it->wd) return;
-
- Eina_Bool old_check_state;
- Elm_Genlist_Item *it;
- Widget_Data *wd = select_all_it->wd;
-
- wd->select_all_check = checked;
- if (wd->select_all_check)
- edje_object_signal_emit(select_all_it->base.view, "elm,state,sel_check", "elm");
- else
- edje_object_signal_emit(select_all_it->base.view, "elm,state,sel_uncheck", "elm");
-
- if (update_items)
- {
- EINA_INLIST_FOREACH(wd->items, it)
- {
- old_check_state = it->edit_select_check;
- if (wd->select_all_check) it->edit_select_check = EINA_TRUE;
- else it->edit_select_check = EINA_FALSE;
-
- // TODO : check this
- // if (old_check_state != it->edit_select_check && it->wd->ed && it->wd->ed->ec && it->wd->ed->ec->item_selected)
- // it->wd->ed->ec->item_selected(it->base.data, it, it->edit_select_check);
- }
- }
-
- if (wd->ed->ec->item_selected)
- wd->ed->ec->item_selected(select_all_it->base.data, select_all_it, wd->select_all_check);
-
- if (wd->calc_job) ecore_job_del(wd->calc_job);
- wd->calc_job = ecore_job_add(_calc_job, wd);
-}
-
-static void
-_checkbox_item_select_process(Elm_Genlist_Item *it)
-{
- Elm_Genlist_Item *tmp_it;
- Eina_Bool old_check_state;
- int check_cnt = 0, total_cnt = 0;
- if (!it) return;
-
- _edit_item_checkbox_set(it, it->edit_select_check);
- _edit_subitems_checkbox_set(it);
- _edit_parent_items_checkbox_set(it);
-
- if (it->wd->ed) it->wd->ed->del_item = it;
-
- EINA_INLIST_FOREACH(it->wd->items, tmp_it)
- {
- if (tmp_it->edit_select_check) check_cnt++;
- total_cnt++;
- }
-
- if (it->wd->select_all_item)
- {
- old_check_state = it->wd->select_all_check;
- if (check_cnt == total_cnt) it->wd->select_all_check = EINA_TRUE;
- else it->wd->select_all_check = EINA_FALSE;
-
- if (check_cnt == total_cnt)
- {
- it->wd->select_all_check = EINA_TRUE;
- edje_object_signal_emit(it->wd->select_all_item->base.view, "elm,state,sel_check", "elm");
- }
- else
- {
- it->wd->select_all_check = EINA_FALSE;
- edje_object_signal_emit(it->wd->select_all_item->base.view, "elm,state,sel_uncheck", "elm");
- }
- }
-}
-
-static void
-_checkbox_item_select_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- Elm_Genlist_Item *it = data;
- if (!it) return;
- it->edit_select_check = !it->edit_select_check;
- _checkbox_item_select_process(it);
-}
-
-static void
-_select_all_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- Elm_Genlist_Item *select_all_it = data;
- Widget_Data *wd = select_all_it->wd;
- if (!wd) return;
-
- _select_all_down_process(select_all_it, !wd->select_all_check, EINA_TRUE);
-}
-
static void
_effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
{
- if (it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
- return;
+ if (!it->wd->edit_mode) return;
evas_object_resize(it->edit_obj,it->w, it->h);
evas_object_move(it->edit_obj, itx, ity);
-
- if (it->wd->select_all_check)
- it->edit_select_check = EINA_TRUE;
- if (!it->renamed)
- {
- if (it->edit_select_check)
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_check", "elm");
- }
- else
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_uncheck", "elm");
- }
- }
}
static void
_effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on)
{
if ((it->effect_item_realized) || (it->delete_me)) return;
- int itmode = 0, pad = 0;
- const char *pad_str;
char buf[1024];
- it->pad_left = it->pad_right = 0;
-
- if (it->itc->func.editmode_get)
- itmode = it->itc->func.editmode_get(it->base.data, it->base.widget, it->wd->edit_mode);
- itmode &= it->wd->edit_mode;
-
- if (itmode & ELM_GENLIST_EDIT_MODE_SELECTALL)
- itmode |= ELM_GENLIST_EDIT_MODE_SELECT;
it->edit_obj = edje_object_add(evas_object_evas_get(it->base.widget));
edje_object_scale_set(it->edit_obj, elm_widget_scale_get(it->base.widget) *
strncat(buf, "/", sizeof(buf) - strlen(buf));
- if (it->wd->ed && it->wd->ed->ec->item_style && strcmp(it->wd->ed->ec->item_style, "default"))
+ if (it->itc->edit_item_style && strcmp(it->itc->edit_item_style, "default"))
{
- strncat(buf, it->wd->ed->ec->item_style, sizeof(buf) - strlen(buf));
+ strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
_elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", buf, elm_widget_style_get(it->base.widget));
}
else
{
- _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", "item/edit_control", elm_widget_style_get(it->base.widget));
+ _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", "item/edit_default", elm_widget_style_get(it->base.widget));
}
- pad_str = edje_object_data_get(it->edit_obj, "icon_width");
- if (pad_str) pad = atoi(pad_str);
-
- if ((itmode & ELM_GENLIST_EDIT_MODE_DELETE) || (itmode & ELM_GENLIST_EDIT_MODE_SELECT))
+ if (it->wd->reorder_mode)
{
- if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,sel,enable_effect", "elm");
- else edje_object_signal_emit(it->edit_obj, "elm,state,sel,enable", "elm");
-
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_uncheck", "elm");
- edje_object_signal_callback_del(it->edit_obj, "elm,action,item,select",
- "elm", _checkbox_item_select_cb);
-
- edje_object_signal_callback_add(it->edit_obj, "elm,action,item,select",
- "elm", _checkbox_item_select_cb, it);
- it->pad_left += pad * _elm_config->scale;
+ if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled_effect", "elm");
+ else edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled", "elm");
}
- else
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
+ if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled_effect", "elm");
+ else edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled", "elm");
- edje_object_signal_callback_del(it->edit_obj, "elm,action,item,select",
- "elm", _checkbox_item_select_cb);
- }
+ if (it->disabled) edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
+ else edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
- if (effect_on && itmode & ELM_GENLIST_EDIT_MODE_REORDER)
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enable_effect", "elm");
- edje_object_signal_emit(it->edit_obj, "elm,state,sel,enable", "elm");
- }
- else if (itmode & ELM_GENLIST_EDIT_MODE_REORDER)
- edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enable", "elm");
- if ((it->wd->edit_mode) || (!it->wd->edit_mode && it->renamed))
+ if ((it->wd->edit_mode))
{
if (it->itc->func.icon_get)
{
const Eina_List *l;
const char *key;
- it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "icons"));
+ it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
EINA_LIST_FOREACH(it->icons, l, key)
{
Evas_Object *ic = it->itc->func.icon_get
elm_widget_sub_object_add(it->base.widget, ic);
}
}
- }
+ }
}
edje_object_part_swallow(it->edit_obj, "original_edc", it->base.view);
_effect_item_controls(it,it->scrl_x, it->scrl_y);
if (!it->effect_item_realized) return;
if (it->wd->reorder_it && it->wd->reorder_it == it) return;
- it->pad_left = it->pad_right = 0;
edje_object_signal_emit(it->edit_obj, "elm,state,reorder_disable_effect", "elm");
edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
edje_object_message_signal_process(it->edit_obj);
it->effect_item_realized = EINA_FALSE;
}
-EAPI void
-elm_genlist_set_edit_mode(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *edit_class)
-{
- fprintf(stderr, "=================> Caution!!! <========================\n");
- fprintf(stderr, "==> elm_genlist_set_edit_mode() is deprecated. <=======\n");
- fprintf(stderr, "==> Please use elm_genlist_edit_mode_set() instead. <==\n");
- fprintf(stderr, "=======================================================\n");
-
- elm_genlist_edit_mode_set(obj, emode, edit_class);
-}
-
/**
* Get Genlist edit mode
*
EAPI Eina_Bool
elm_genlist_edit_mode_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
* @ingroup Genlist
*/
EAPI void
-elm_genlist_edit_mode_set(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *edit_class)
+elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Item_Block *itb;
- Eina_Bool done = EINA_FALSE;
- static Elm_Genlist_Item_Class itc;
Eina_List *l;
Elm_Genlist_Item *it;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->edit_mode == emode) return;
-
- wd->edit_mode = emode;
+ if (wd->edit_mode == edit_mode) return;
- if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL)
- wd->edit_mode |= ELM_GENLIST_EDIT_MODE_SELECT;
-
-
- if (wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
+ wd->edit_mode = edit_mode;
+ if (!wd->edit_mode)
{
EINA_INLIST_FOREACH(wd->blocks, itb)
{
if (itb->realized)
{
- done = 1;
EINA_LIST_FOREACH(itb->items, l, it)
{
- if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
+ if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
{
- it->pad_left = it->pad_right = 0;
_effect_item_unrealize(it);
}
}
}
- else
- {
- if (done) break;
- }
- }
-
- EINA_INLIST_FOREACH(wd->items, it)
- {
- it->edit_select_check = EINA_FALSE;
- }
- if (wd->ed) free (wd->ed);
- wd->ed = NULL;
- wd->reorder_mode = EINA_FALSE;
- if (wd->select_all_item)
- {
- wd->select_all_check = EINA_FALSE;
- edje_object_signal_callback_del(wd->select_all_item->base.view, "elm,action,select,click", "elm", _select_all_down);
- elm_widget_item_pre_notify_del(wd->select_all_item);
- _item_unrealize(wd->select_all_item);
- elm_widget_item_del(wd->select_all_item);
- }
- wd->select_all_item = NULL;
- if (wd->edit_field)
- {
- Evas_Object *editfield;
- EINA_LIST_FREE(wd->edit_field, editfield)
- evas_object_del(editfield);
- wd->edit_field = NULL;
}
_item_cache_zero(wd);
}
else
{
- if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_REORDER)
- wd->reorder_mode = EINA_TRUE;
-
- if (!wd->ed)
- wd->ed = calloc(1, sizeof(Edit_Data));
-
- wd->ed->ec = edit_class;
EINA_INLIST_FOREACH(wd->blocks, itb)
{
if (itb->realized)
{
- done = 1;
EINA_LIST_FOREACH(itb->items, l, it)
{
if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
{
if(it->selected) _item_unselect(it);
- _effect_item_realize(it, EINA_TRUE);
+ if (it->itc->edit_item_style) _effect_item_realize(it, EINA_TRUE);
}
}
- }
- else
- {
- if (done) break;
- }
- }
-
- if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL)
- {
- if (edit_class->select_all_item_style && strcmp(edit_class->select_all_item_style, "default"))
- itc.item_style = edit_class->select_all_item_style;
- else
- itc.item_style = "select_all";
- itc.func.label_get = NULL;
- itc.func.icon_get = NULL;
- itc.func.del = NULL;
- itc.func.editmode_get = NULL;
- wd->select_all_item = _item_new(wd, &itc, (void *)(edit_class->select_all_data), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
-
- if (!wd) return;
- if (!wd->select_all_item) return;
-
- _item_realize(wd->select_all_item, 0, 0);
- edje_object_signal_callback_add(wd->select_all_item->base.view, "elm,action,select,click", "elm", _select_all_down, wd->select_all_item);
-
- wd->select_all_item->rel = NULL;
- wd->select_all_item->block = NULL;
- }
- }
+ }
+ }
+ }
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = ecore_job_add(_calc_job, wd);
EAPI void
elm_genlist_edit_selected_items_del(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (!wd->blocks) return;
- Elm_Genlist_Item *it;
- Eina_List *edit_selected_list, *l;
- int cnt = 0;
- Item_Block *itb;
-
- Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
- int vis = 0;
-
- if (wd->edit_field) return;
- evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
- evas_output_viewport_get(evas_object_evas_get(wd->obj), &cvx, &cvy,&cvw, &cvh);
- EINA_INLIST_FOREACH(wd->blocks, itb)
- {
- if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
- itb->y - wd->pan_y + oy,
- itb->w, itb->h,
- cvx, cvy, cvw, cvh))
- EINA_LIST_FOREACH(itb->items, l, it)
- {
- it->old_scrl_y =itb->y + it->y - it->wd->pan_y + oy;
- }
- }
- edit_selected_list = elm_genlist_edit_selected_items_get(obj);
- cnt = eina_list_count(edit_selected_list);
- // printf("elm_genlist_edit_selected_items_del items selected counts = %d \n", cnt);
-
- wd->expand_item_gap = wd->expand_item_end = 0;
- EINA_LIST_FOREACH(edit_selected_list, l, it)
- {
- if (it->flags != ELM_GENLIST_ITEM_GROUP)
- {
- it->wd->expand_item_gap += it->h * -1;
- vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
- cvx, cvy, cvw, cvh));
- if (!it->wd->expand_item_end && vis ) it->wd->expand_item_end = it->old_scrl_y;
- it->wd->expand_item = elm_genlist_item_prev_get(it);
- elm_genlist_item_del(it);
- }
- }
- wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE;
- eina_list_free(edit_selected_list);
-
- evas_render(evas_object_evas_get(wd->obj));
- if (wd->calc_job) ecore_job_del(wd->calc_job);
- wd->calc_job = ecore_job_add(_calc_job, wd);
+ fprintf(stderr, "=================> Caution!!! <========================\n");
+ fprintf(stderr, "==> elm_genlist_edit_selected_items_del() is deprecated. <=======\n");
+ fprintf(stderr, "=======================================================\n");
}
EAPI void
fprintf(stderr, "==> elm_genlist_selected_items_del() is deprecated. <=======\n");
fprintf(stderr, "==> Please use elm_genlist_edit_selected_items_del() instead. <==\n");
fprintf(stderr, "=======================================================\n");
- elm_genlist_edit_selected_items_del(obj);
}
/**
EAPI Eina_List *
elm_genlist_edit_selected_items_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *list = NULL;
- Elm_Genlist_Item *it;
- if (!wd) return NULL;
-
- EINA_INLIST_FOREACH(wd->items, it)
- {
- if (it->edit_select_check && it->flags != ELM_GENLIST_ITEM_GROUP) list = eina_list_append(list, it);
- }
-
- return list;
+ fprintf(stderr, "========================> Caution!!! <==========================\n");
+ fprintf(stderr, "==> elm_genlist_edit_selected_items_get() is deprecated. <=======\n");
+ fprintf(stderr, "================================================================\n");
+ return NULL;
}
// TODO : add comment
elm_genlist_edit_item_selected_set(Elm_Genlist_Item *it,
Eina_Bool selected)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Widget_Data *wd = elm_widget_data_get(it->base.widget);
- if (!wd) return;
- selected = !!selected;
- if (it->edit_select_check == selected) return;
-
- it->edit_select_check = selected;
- _checkbox_item_select_process(it);
+ fprintf(stderr, "========================> Caution!!! <==========================\n");
+ fprintf(stderr, "==> elm_genlist_edit_item_selected_set() is deprecated. <=======\n");
+ fprintf(stderr, "================================================================\n");
}
-// TODO : add comment
-EAPI const Eina_Bool
+// TODO : add comment
+EAPI Eina_Bool
elm_genlist_edit_item_selected_get(const Elm_Genlist_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- return it->edit_select_check;
+ fprintf(stderr, "========================> Caution!!! <==========================\n");
+ fprintf(stderr, "==> elm_genlist_edit_item_selected_get() is deprecated. <=======\n");
+ fprintf(stderr, "================================================================\n");
+ return EINA_FALSE;
}
/**
* Set a given item's rename mode
*
- * This renames the item's label from genlist
+ * This renames the item's label from genlist
*
* @param it The item
- * @param emode set if emode is EINA_TRUE, unset if emode is EINA_FALSE
+ * @param renamed set if emode is EINA_TRUE, unset if emode is EINA_FALSE
*
* @ingroup Genlist
*/
-EAPI Evas_Object *
-elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, int emode)
-{
- if (!it) return NULL;
- if (it->wd->queue_idler) return NULL;
-
- const Eina_List *l, *list, *l2;
- const char *label, *rename_swallow_part;
- char *s;
- Eina_Bool done = EINA_FALSE;
- int label_cnt = 0 , swallow_part_cnt = 0;
-
- Item_Block *itb;
- Evas_Object *editfield;
- Evas_Object *entry = NULL;
- int edit_field_cnt = 0;
-
- EINA_INLIST_FOREACH(it->wd->blocks, itb)
- {
- if (itb->realized)
+EAPI void
+elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed)
{
- Eina_List *l;
- Elm_Genlist_Item *it;
+ if (!it) return;
- EINA_LIST_FOREACH(itb->items, l, it)
- {
- if (it->renamed)
+ if (renamed)
{
- it->renamed = EINA_FALSE;
+ _item_unrealize(it);
+ it->renamed = EINA_TRUE;
+ it->wd->rename_it = it;
+ it->nocache = EINA_TRUE;
if (it->selected) _item_unselect(it);
- EINA_LIST_FOREACH(it->wd->edit_field, l2, editfield)
- {
- entry = elm_editfield_entry_get(editfield);
- const char *text = elm_entry_entry_get(entry);
- if (it->itc->func.label_changed)
- it->itc->func.label_changed(it->base.data, it, text, edit_field_cnt++);
- }
- EINA_LIST_FREE(it->wd->edit_field, editfield)
- evas_object_del(editfield);
- it->wd->edit_field = NULL;
-
- if (it->wd->edit_mode)
- {
- edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,enable", "elm");
- edje_object_signal_emit(it->edit_obj, "elm,state,rename,disable", "elm");
- if (it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECT)
- edje_object_signal_emit(it->edit_obj, "elm,state,sel_uncheck", "elm");
- }
- if(!it->wd->edit_mode) _effect_item_unrealize(it);
- done = EINA_TRUE;
- }
- }
+ if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
+ it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
}
else
{
- if (done) break;
- }
- }
-
- if (emode)
- {
- it->renamed = EINA_TRUE;
- if (it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
- {
- it->wd->edit_mode = 0xF0;
- _effect_item_realize(it, EINA_TRUE);
- it->wd->edit_mode = ELM_GENLIST_EDIT_MODE_NONE;
- }
-
- edje_object_signal_emit(it->edit_obj, "elm,state,rename,enable", "elm");
- EINA_LIST_FOREACH(it->labels, list, label)
- {
- if (it->itc->func.label_get)
- {
- swallow_part_cnt = 0;
-
- Eina_List *rename = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "rename"));
- EINA_LIST_FOREACH(rename, l, rename_swallow_part)
- {
- if (label_cnt == swallow_part_cnt)
- {
- editfield = elm_editfield_add(it->base.widget);
- it->wd->edit_field = eina_list_append(it->wd->edit_field, editfield);
-
- elm_editfield_entry_single_line_set(editfield, EINA_TRUE);
- elm_editfield_eraser_set(editfield, EINA_TRUE);
- edje_object_part_swallow(it->edit_obj, rename_swallow_part, editfield);
- elm_widget_sub_object_add(it->edit_obj, editfield);
-
- evas_object_show(editfield);
-
- s = it->itc->func.label_get((void *)it->base.data, it->base.widget, list->data);
- if (s)
+ if (it->renamed)
{
- entry = elm_editfield_entry_get(editfield);
- elm_entry_entry_set(entry,s);
- elm_entry_cursor_end_set(entry);
- free(s);
- }
- else
- elm_editfield_guide_text_set(editfield, "Text Input");
- }
- swallow_part_cnt++;
- }
- label_cnt++;
+ 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_focused_object_clear(elm_widget_focused_object_get(it->wd->obj));
- elm_widget_focus_set(editfield, EINA_TRUE);
}
-
- return entry;
+
+EAPI Eina_Bool
+elm_genlist_item_rename_mode_get(Elm_Genlist_Item *item)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
+ return item->renamed;
}
static void _sweep_finish(void *data, Evas_Object *o, const char *emission, const char *source)
{
Widget_Data *wd = data;
if (!wd) return;
-
- if ((wd->expand_item) && (!wd->auto_scrolled))
+
+ 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)
{
{
elm_genlist_item_bring_in(it);
}
- }
+ }
}
-}
\ No newline at end of file
+}
+
+EAPI void
+elm_genlist_realized_items_update(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Eina_List *list, *l;
+ Elm_Genlist_Item *it;
+
+ list = elm_genlist_realized_items_get(obj);
+ EINA_LIST_FOREACH(list, l, it)
+ elm_genlist_item_update(it);
+}