#include <Elementary_Cursor.h>
#include "elm_priv.h"
#include "els_scroller.h"
-#include "elm_genlist.h"
+#include "elm_gen_common.h"
+
+// internally allocated
+#define CLASS_ALLOCATED 0x3a70f11f
#define MAX_ITEMS_PER_BLOCK 32
#define REORDER_EFFECT_TIME 0.5
(it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
(it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
+#define ELM_GENLIST_CHECK_ITC_VER(itc) \
+ do \
+ { \
+ if (!itc) \
+ { \
+ ERR("Genlist_Item_Class(itc) is NULL"); \
+ return; \
+ } \
+ if ((itc->version != ELM_GENLIST_ITEM_CLASS_VERSION) && \
+ (itc->version != CLASS_ALLOCATED)) \
+ { \
+ ERR("Genlist_Item_Class version mismatched! current = (%d), required = (%d) or (%d)", itc->version, ELM_GENLIST_ITEM_CLASS_VERSION, CLASS_ALLOCATED); \
+ return; \
+ } \
+ } \
+ while(0)
+
typedef struct _Item_Block Item_Block;
typedef struct _Item_Cache Item_Cache;
Eina_List *items;
Evas_Coord w, h, minw, minh;
Elm_Gen_Item *group_item;
- Elm_Genlist_Item_Flags flags;
+ Elm_Genlist_Item_Type type;
Eina_List *mode_texts, *mode_contents, *mode_states, *mode_content_objs;
+ Eina_List *edit_texts, *edit_contents, *edit_states, *edit_content_objs;
Ecore_Timer *swipe_timer;
Evas_Coord scrl_x, scrl_y, old_scrl_y;
Eina_Bool queued : 1;
Eina_Bool showme : 1;
Eina_Bool updateme : 1;
- Eina_Bool nocache : 1;
+ Eina_Bool nocache : 1; /* do not use cache for this item */
+ Eina_Bool nocache_once : 1; /* do not use cache for this item only once */
Eina_Bool stacking_even : 1;
Eina_Bool nostacking : 1;
Eina_Bool move_effect_enabled : 1;
+ Eina_Bool edit_mode_item_realized : 1;
+ Eina_Bool tree_effect_finished : 1; /* tree effect */
};
struct _Item_Block
Widget_Data *wd;
Eina_List *items;
Evas_Coord x, y, w, h, minw, minh;
+ int position;
+ int item_position_stamp;
+
+ Eina_Bool position_update : 1;
Eina_Bool want_unrealize : 1;
Eina_Bool realized : 1;
Eina_Bool changed : 1;
Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _item_realize(Elm_Gen_Item *it,
- int in,
- Eina_Bool calc);
+ int in,
+ Eina_Bool calc);
static void _item_unrealize_cb(Elm_Gen_Item *it);
static void _item_block_unrealize(Item_Block *itb);
static void _calc_job(void *data);
Evas_Callback_Type type,
void *event_info);
static void _signal_emit_hook(Evas_Object *obj,
- const char *emission,
- const char *source);
+ const char *emission,
+ const char *source);
static Eina_Bool _deselect_all_items(Widget_Data *wd);
static void _pan_calculate(Evas_Object *obj);
static void _pan_max_get(Evas_Object *obj,
Evas_Coord *x,
Evas_Coord *y);
static void _item_position(Elm_Gen_Item *it,
- Evas_Object *obj,
- Evas_Coord it_x,
- Evas_Coord it_y);
+ Evas_Object *obj,
+ Evas_Coord it_x,
+ Evas_Coord it_y);
static void _mode_item_realize(Elm_Gen_Item *it);
static void _mode_item_unrealize(Elm_Gen_Item *it);
static void _item_mode_set(Elm_Gen_Item *it);
static void _item_mode_unset(Widget_Data *wd);
+static void _edit_mode_item_position(Elm_Gen_Item *it, int itx, int ity);
+static void _edit_mode_item_realize(Elm_Gen_Item *it, Eina_Bool effect_on);
+static void _edit_mode_item_unrealize(Elm_Gen_Item *it);
static void _group_items_recalc(void *data);
static void _item_move_after(Elm_Gen_Item *it,
Elm_Gen_Item *after);
static void _item_move_before(Elm_Gen_Item *it,
Elm_Gen_Item *before);
static void _item_auto_scroll(Widget_Data *wd);
-static void _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby);
+static void _elm_genlist_clear(Evas_Object *obj,
+ Eina_Bool standby);
static void _pan_child_size_get(Evas_Object *obj,
Evas_Coord *w,
Evas_Coord *h);
+static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
+static void _item_contract_emit(Elm_Gen_Item *it);
+static int _item_tree_effect_before(Elm_Gen_Item *it);
+static void _item_tree_effect(Widget_Data *wd, int y);
+static void _item_tree_effect_finish(Widget_Data *wd);
+static Eina_Bool _item_moving_effect_timer_cb(void *data);
static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
static const char SIG_SWIPE[] = "swipe";
static const char SIG_MOVED[] = "moved";
+static const char SIG_INDEX_UPDATE[] = "index,update";
+static const char SIG_TREE_EFFECT_FINISHED [] = "tree,effect,finished";
static const Evas_Smart_Cb_Description _signals[] = {
{SIG_CLICKED_DOUBLE, ""},
{SIG_MULTI_PINCH_IN, ""},
{SIG_SWIPE, ""},
{SIG_MOVED, ""},
+ {SIG_TREE_EFFECT_FINISHED, ""},
{NULL, NULL}
};
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
- Elm_Gen_Item *it = NULL;
+ Elm_Object_Item *it = NULL;
Evas_Coord x = 0;
Evas_Coord y = 0;
Evas_Coord step_x = 0;
else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
{
it = elm_genlist_first_item_get(obj);
- elm_genlist_item_bring_in(it);
+ elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
+ elm_genlist_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE;
}
else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
{
it = elm_genlist_last_item_get(obj);
- elm_genlist_item_bring_in(it);
+ elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
+ elm_genlist_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE;
}
if (!wd->selected) return EINA_FALSE;
if (!wd->multi) return EINA_FALSE;
- Elm_Gen_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
+ Elm_Object_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
if (!prev) return EINA_TRUE;
if (elm_genlist_item_selected_get(prev))
{
elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
wd->last_selected_item = prev;
- elm_genlist_item_show(wd->last_selected_item);
+ elm_genlist_item_show(wd->last_selected_item, ELM_GENLIST_ITEM_SCROLLTO_IN);
}
else
{
elm_genlist_item_selected_set(prev, EINA_TRUE);
- elm_genlist_item_show(prev);
+ elm_genlist_item_show(prev, ELM_GENLIST_ITEM_SCROLLTO_IN);
}
return EINA_TRUE;
}
if (!wd->selected) return EINA_FALSE;
if (!wd->multi) return EINA_FALSE;
- Elm_Gen_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
+ Elm_Object_Item *next;
+ next = elm_genlist_item_next_get(wd->last_selected_item);
if (!next) return EINA_TRUE;
if (elm_genlist_item_selected_get(next))
{
elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
wd->last_selected_item = next;
- elm_genlist_item_show(wd->last_selected_item);
+ elm_genlist_item_show(wd->last_selected_item, ELM_GENLIST_ITEM_SCROLLTO_IN);
}
else
{
elm_genlist_item_selected_set(next, EINA_TRUE);
- elm_genlist_item_show(next);
+ elm_genlist_item_show(next, ELM_GENLIST_ITEM_SCROLLTO_IN);
}
return EINA_TRUE;
}
while ((prev) && (prev->generation < wd->generation))
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
}
- else prev = elm_genlist_item_prev_get(wd->last_selected_item);
+ else prev = (Elm_Gen_Item *) elm_genlist_item_prev_get(wd->last_selected_item);
if (!prev) return EINA_FALSE;
_deselect_all_items(wd);
- elm_genlist_item_selected_set(prev, EINA_TRUE);
- elm_genlist_item_show(prev);
+ elm_genlist_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE);
+ elm_genlist_item_show((Elm_Object_Item *) prev, ELM_GENLIST_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
while ((next) && (next->generation < wd->generation))
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
}
- else next = elm_genlist_item_next_get(wd->last_selected_item);
+ else next = (Elm_Gen_Item *) elm_genlist_item_next_get(wd->last_selected_item);
if (!next) return EINA_FALSE;
_deselect_all_items(wd);
- elm_genlist_item_selected_set(next, EINA_TRUE);
- elm_genlist_item_show(next);
+ elm_genlist_item_selected_set((Elm_Object_Item *) next, EINA_TRUE);
+ elm_genlist_item_show((Elm_Object_Item *) next, ELM_GENLIST_ITEM_SCROLLTO_IN);
return EINA_TRUE;
}
{
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;
minw = wd->realminw;
maxw = -1;
+ elm_smart_scroller_child_viewport_size_get(wd->scr, &vmw, &vmh);
edje_object_size_min_calc
(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
minw = vmw + minw;
_item_highlight(Elm_Gen_Item *it)
{
const char *selectraise;
- if ((it->wd->no_select) || (it->generation < it->wd->generation) || (it->highlighted) ||
- (it->disabled) || (it->display_only) || (it->item->mode_view))
+ if ((it->wd->select_mode == ELM_OBJECT_NO_SELECT) ||
+ (it->wd->no_highlight) ||
+ (it->generation < it->wd->generation) ||
+ (it->highlighted) || elm_widget_item_disabled_get(it) ||
+ (it->display_only) || (it->item->mode_view))
return;
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
+ if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,selected", "elm");
selectraise = edje_object_data_get(VIEW(it), "selectraise");
if ((selectraise) && (!strcmp(selectraise, "on")))
{
- evas_object_raise(VIEW(it));
+ if (it->edit_obj) evas_object_raise(it->edit_obj);
+ else evas_object_raise(VIEW(it));
if ((it->item->group_item) && (it->item->group_item->realized))
evas_object_raise(it->item->VIEW(group_item));
}
{
if ((it->generation < it->wd->generation) || (!it->highlighted)) return;
edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
+ if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,unselected", "elm");
if (!it->item->nostacking)
{
- if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
- else evas_object_raise(VIEW(it));
+ if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
+ {
+ if (it->edit_obj) evas_object_lower(it->edit_obj);
+ else evas_object_lower(VIEW(it));
+ }
+ else
+ {
+ if (it->edit_obj) evas_object_raise(it->edit_obj);
+ else evas_object_raise(VIEW(it));
+ }
}
it->highlighted = EINA_FALSE;
}
static void
+_item_block_position_update(Eina_Inlist *list, int idx)
+{
+ Item_Block *tmp;
+
+ EINA_INLIST_FOREACH(list, tmp)
+ {
+ tmp->position = idx++;
+ tmp->position_update = EINA_TRUE;
+ }
+}
+
+static void
+_item_position_update(Eina_List *list, int idx)
+{
+ Elm_Gen_Item *it;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(list, l, it)
+ {
+ it->position = idx++;
+ it->position_update = EINA_TRUE;
+ }
+}
+
+static void
_item_block_del(Elm_Gen_Item *it)
{
Eina_Inlist *il;
if (it->parent)
it->parent->item->items = eina_list_remove(it->parent->item->items, it);
else
- it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
+ {
+ _item_block_position_update(il->next, itb->position);
+ it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
+ }
free(itb);
if (itbn) itbn->changed = EINA_TRUE;
}
itbp->count++;
itbp->changed = EINA_TRUE;
}
+ _item_block_position_update(EINA_INLIST_GET(itb)->next,
+ itb->position);
it->wd->blocks = eina_inlist_remove(it->wd->blocks,
EINA_INLIST_GET(itb));
free(itb);
itbn->count++;
itbn->changed = EINA_TRUE;
}
+ _item_block_position_update(EINA_INLIST_GET(itb)->next,
+ itb->position);
it->wd->blocks =
eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
free(itb);
}
static void
+_item_subitems_clear(Elm_Gen_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Eina_List *tl = NULL, *l;
+ Elm_Object_Item *it2;
+
+ EINA_LIST_FOREACH(it->item->items, l, it2)
+ tl = eina_list_append(tl, it2);
+ EINA_LIST_FREE(tl, it2)
+ elm_object_item_del(it2);
+}
+
+static void
_item_del(Elm_Gen_Item *it)
{
Evas_Object *obj = WIDGET(it);
evas_event_freeze(evas_object_evas_get(obj));
- elm_genlist_item_subitems_clear(it);
+ elm_genlist_item_subitems_clear((Elm_Object_Item *)it);
if (it->wd->show_item == it) it->wd->show_item = NULL;
if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE);
+ if (it->item->edit_mode_item_realized) _edit_mode_item_unrealize(it);
if (it->item->block) _item_block_del(it);
if (it->item->queued)
it->wd->queue = eina_list_remove(it->wd->queue, it);
if (!it->wd->anchor_item)
it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
}
+ if (it->wd->expanded_item == it) it->wd->expanded_item = NULL;
if (it->parent)
it->parent->item->items = eina_list_remove(it->parent->item->items, it);
if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
_elm_genlist_item_del_serious(it);
+ elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc);
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
}
if (!it->wd->on_hold)
{
it->wd->on_hold = EINA_TRUE;
- if (!it->wd->wasselected)
+ if ((!it->wd->wasselected) && (!it->flipped))
{
_item_unhighlight(it);
_item_unselect(it);
else
y_pos = it_scrl_y;
+ if (it->edit_obj)
+ _item_position(it, it->edit_obj, it->item->scrl_x, y_pos);
+ else
_item_position(it, VIEW(it), it->item->scrl_x, y_pos);
if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
Eina_List *list, *l;
it->long_timer = NULL;
- if ((it->disabled) || (it->dragging) || (it->display_only))
+ if (elm_widget_item_disabled_get(it) || (it->dragging) || (it->display_only))
return ECORE_CALLBACK_CANCEL;
it->wd->longpressed = EINA_TRUE;
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
{
it->wd->reorder_it = it;
it->wd->reorder_start_y = 0;
+ if (it->edit_obj)
+ evas_object_raise(it->edit_obj);
+ else
+ evas_object_raise(VIEW(it));
- evas_object_raise(VIEW(it));
elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
{
if (it != it_tmp) _item_unselect(it_tmp);
}
- if (elm_genlist_item_expanded_get(it))
+ if (elm_genlist_item_expanded_get((Elm_Object_Item *)it))
{
- elm_genlist_item_expanded_set(it, EINA_FALSE);
+ elm_genlist_item_expanded_set((Elm_Object_Item *)it, EINA_FALSE);
return ECORE_CALLBACK_RENEW;
}
- edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
+
+ if (!it->wd->edit_mode)
+ edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
}
return ECORE_CALLBACK_CANCEL;
}
int i, sum = 0;
if (!it) return;
- if ((it->display_only) || (it->disabled)) return;
+ if ((it->display_only) || elm_widget_item_disabled_get(it)) return;
it->wd->swipe = EINA_FALSE;
for (i = 0; i < it->wd->movements; i++)
{
it->wd->wasselected = it->selected;
_item_highlight(it);
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- if ((!it->disabled) && (!it->display_only))
+ if ((!elm_widget_item_disabled_get(it)) && (!it->display_only))
{
evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
if (it->wd->longpressed)
{
it->wd->longpressed = EINA_FALSE;
- if (!it->wd->wasselected)
+ if ((!it->wd->wasselected) && (!it->flipped))
{
_item_unhighlight(it);
_item_unselect(it);
_item_block_unrealize(it->item->block);
}
}
- if ((it->disabled) || (dragged) || (it->display_only)) return;
+ if (elm_widget_item_disabled_get(it) || (dragged) || (it->display_only))
+ return;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if (it->wd->multi)
{
Evas *te = evas_object_evas_get(obj);
evas_event_freeze(te);
- it->item->nocache = EINA_FALSE;
+ it->item->nocache_once = EINA_FALSE;
_mode_item_unrealize(it);
if (it->item->group_item)
evas_object_raise(it->item->VIEW(group_item));
wd->item_cache_count--;
if (itc->spacer) evas_object_del(itc->spacer);
if (itc->base_view) evas_object_del(itc->base_view);
- if (itc->item_style) eina_stringshare_del(itc->item_style);
+ eina_stringshare_del(itc->item_style);
free(itc);
}
evas_event_thaw(evas_object_evas_get(wd->obj));
it->wd->item_cache_count++;
itc = calloc(1, sizeof(Item_Cache));
+ if (!itc)
+ {
+ evas_event_thaw(evas_object_evas_get(it->wd->obj));
+ evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
+ return;
+ }
it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
EINA_INLIST_GET(itc));
itc->spacer = it->spacer;
it->spacer = NULL;
itc->base_view = VIEW(it);
VIEW(it) = NULL;
+ edje_object_signal_emit(itc->base_view, "elm,state,unselected", "elm");
evas_object_hide(itc->base_view);
evas_object_move(itc->base_view, -9999, -9999);
itc->item_style = eina_stringshare_add(it->itc->item_style);
- if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
+ if (it->item->type & ELM_GENLIST_ITEM_TREE) itc->tree = 1;
itc->compress = (it->wd->compress);
itc->selected = it->selected;
- itc->disabled = it->disabled;
+ itc->disabled = elm_widget_item_disabled_get(it);
itc->expanded = it->item->expanded;
if (it->long_timer)
{
Item_Cache *itc;
Eina_Bool tree = 0;
- if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
+ if (it->item->type & ELM_GENLIST_ITEM_TREE) tree = 1;
EINA_INLIST_FOREACH(it->wd->item_cache, itc)
{
if ((itc->selected) || (itc->disabled) || (itc->expanded))
continue;
if ((itc->tree == tree) &&
(itc->compress == it->wd->compress) &&
- (!strcmp(it->itc->item_style, itc->item_style)))
+ (((!it->itc->item_style) && (!itc->item_style)) ||
+ (it->itc->item_style && itc->item_style &&
+ (!strcmp(it->itc->item_style, itc->item_style)))))
{
it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
EINA_INLIST_GET(itc));
}
static void
+_elm_genlist_item_index_update(Elm_Gen_Item *it)
+{
+ if (it->position_update || it->item->block->position_update)
+ {
+ evas_object_smart_callback_call(WIDGET(it), SIG_INDEX_UPDATE, it);
+ it->position_update = EINA_FALSE;
+ }
+}
+
+static void
_elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
{
if (!it->item->nostacking)
{
if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
- evas_object_lower(VIEW(it));
+ {
+ if (it->edit_obj) evas_object_lower(it->edit_obj);
+ else evas_object_lower(VIEW(it));
+ }
else
- evas_object_raise(VIEW(it));
+ {
+ if (it->edit_obj) evas_object_raise(it->edit_obj);
+ else evas_object_raise(VIEW(it));
+ }
}
if (it->item->order_num_in & 0x1)
- edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
+ {
+ edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
+ if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,odd", "elm");
+ }
else
- edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
+ {
+ edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
+ if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,even", "elm");
+ }
}
static void
if (it->selected)
edje_object_signal_emit(VIEW(it),
"elm,state,selected", "elm");
+
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj,
+ "elm,state,selected", "elm");
}
- if (it->disabled != itc->disabled)
+ if (elm_widget_item_disabled_get(it) != itc->disabled)
{
- if (it->disabled)
+ if (elm_widget_item_disabled_get(it))
edje_object_signal_emit(VIEW(it),
"elm,state,disabled", "elm");
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj,
+ "elm,state,disabled", "elm");
}
if (it->item->expanded != itc->expanded)
{
if (it->item->expanded)
edje_object_signal_emit(VIEW(it),
"elm,state,expanded", "elm");
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj,
+ "elm,state,expanded", "elm");
}
}
else
{
if (it->selected)
- edje_object_signal_emit(VIEW(it),
- "elm,state,selected", "elm");
- if (it->disabled)
- edje_object_signal_emit(VIEW(it),
- "elm,state,disabled", "elm");
+ {
+ edje_object_signal_emit(VIEW(it),
+ "elm,state,selected", "elm");
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj,
+ "elm,state,selected", "elm");
+ }
+
+ if (elm_widget_item_disabled_get(it))
+ {
+ edje_object_signal_emit(VIEW(it),
+ "elm,state,disabled", "elm");
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj,
+ "elm,state,disabled", "elm");
+ }
if (it->item->expanded)
- edje_object_signal_emit(VIEW(it),
- "elm,state,expanded", "elm");
+ {
+ edje_object_signal_emit(VIEW(it),
+ "elm,state,expanded", "elm");
+ if (it->edit_obj)
+ edje_object_signal_emit(it->edit_obj,
+ "elm,state,expanded", "elm");
+ }
}
}
{
if (itc->spacer) evas_object_del(itc->spacer);
if (itc->base_view) evas_object_del(itc->base_view);
- if (itc->item_style) eina_stringshare_del(itc->item_style);
+ eina_stringshare_del(itc->item_style);
free(itc);
}
static void
-_item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Elm_Gen_Item *it = event_info;
- if (!it) return;
- if (it->wd->last_selected_item == it)
- it->wd->last_selected_item = NULL;
-}
-
-static void
_item_text_realize(Elm_Gen_Item *it,
Evas_Object *target,
Eina_List **source,
edje_object_part_swallow(target, key, ic);
evas_object_show(ic);
elm_widget_sub_object_add(WIDGET(it), ic);
- if (it->disabled)
+ if (elm_widget_item_disabled_get(it))
elm_widget_disabled_set(ic, EINA_TRUE);
}
}
}
}
+static Eina_List *
+_item_flips_realize(Elm_Gen_Item *it,
+ Evas_Object *target,
+ Eina_List **source)
+{
+ Eina_List *res = NULL;
+
+ if (it->itc->func.content_get)
+ {
+ const Eina_List *l;
+ const char *key;
+ Evas_Object *ic = NULL;
+
+ *source = elm_widget_stringlist_get(edje_object_data_get(target, "flips"));
+
+ EINA_LIST_FOREACH(*source, l, key)
+ {
+ if (it->itc->func.content_get)
+ ic = it->itc->func.content_get
+ ((void *)it->base.data, WIDGET(it), 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(WIDGET(it), ic);
+ if (elm_widget_item_disabled_get(it))
+ elm_widget_disabled_set(ic, EINA_TRUE);
+ }
+ }
+ }
+
+ return res;
+}
+
static void
_item_realize(Elm_Gen_Item *it,
int in,
it->item->order_num_in = in;
_elm_genlist_item_odd_even_update(it);
_elm_genlist_item_state_update(it, NULL);
+ _elm_genlist_item_index_update(it);
}
//evas_event_thaw(evas_object_evas_get(it->wd->obj));
//evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
}
it->item->order_num_in = in;
- if (it->item->nocache)
- it->item->nocache = EINA_FALSE;
- else
+ if (it->item->nocache_once)
+ it->item->nocache_once = EINA_FALSE;
+ else if (!it->item->nocache)
itc = _item_cache_find(it);
- if (itc)
+ if (itc && (!it->wd->tree_effect_enabled))
{
VIEW(it) = itc->base_view;
itc->base_view = NULL;
evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
elm_widget_sub_object_add(WIDGET(it), VIEW(it));
- if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
- strncpy(buf, "tree", sizeof(buf));
- else strncpy(buf, "item", sizeof(buf));
- if (it->wd->compress)
- strncat(buf, "_compress", sizeof(buf) - strlen(buf));
-
- strncat(buf, "/", sizeof(buf) - strlen(buf));
- strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
+ if (it->item->type & ELM_GENLIST_ITEM_TREE)
+ snprintf(buf, sizeof(buf), "tree%s/%s", it->wd->compress ? "_compress" : "", it->itc->item_style ?: "default");
+ else
+ snprintf(buf, sizeof(buf), "item%s/%s", it->wd->compress ? "_compress" : "", it->itc->item_style ?: "default");
_elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
elm_widget_style_get(WIDGET(it)));
evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
_multi_move, it);
+ if ((it->wd->edit_mode) && (!it->edit_obj) &&
+ (it->item->type != ELM_GENLIST_ITEM_GROUP) && (it->itc->edit_item_style))
+ _edit_mode_item_realize(it, EINA_FALSE);
+
_elm_genlist_item_state_update(it, itc);
+ _elm_genlist_item_index_update(it);
}
if ((calc) && (it->wd->homogeneous) &&
_item_text_realize(it, VIEW(it), &it->texts, NULL);
it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, NULL);
_item_state_realize(it, VIEW(it), &it->states, NULL);
+ if (it->flipped)
+ {
+ edje_object_signal_emit(VIEW(it), "elm,state,flip,enabled", "elm");
+ it->content_objs = _item_flips_realize(it, VIEW(it), &it->contents);
+ }
if (!it->item->mincalcd)
{
it->wd->group_item_width = mw;
it->wd->group_item_height = mh;
}
- else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
+ else if ((!it->wd->item_width) && (it->item->type == ELM_GENLIST_ITEM_NONE))
{
it->wd->item_width = mw;
it->wd->item_height = mh;
//evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
if (!calc)
evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
+
+ if ((!calc) && (it->wd->edit_mode) && (it->item->type != ELM_GENLIST_ITEM_GROUP))
+ {
+ if (it->itc->edit_item_style)
+ {
+ if (!it->edit_obj) _edit_mode_item_realize(it, EINA_FALSE);
+ edje_object_message_signal_process(it->edit_obj);
+ }
+ }
edje_object_message_signal_process(VIEW(it));
}
static void
_item_unrealize_cb(Elm_Gen_Item *it)
{
- if (it->item->nocache)
+ if (it->item->nocache_once || it->item->nocache)
{
evas_object_del(VIEW(it));
VIEW(it) = NULL;
it->states = NULL;
it->realized = EINA_FALSE;
it->want_unrealize = EINA_FALSE;
+ if (it->wd->edit_mode) _edit_mode_item_unrealize(it);
}
static Eina_Bool
itb->minw = minw;
itb->minh = minh;
itb->changed = EINA_FALSE;
+ itb->position_update = EINA_FALSE;
//evas_event_thaw(evas_object_evas_get(itb->wd->obj));
//evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
return showme;
evas_event_freeze(evas_object_evas_get(itb->wd->obj));
EINA_LIST_FOREACH(itb->items, l, it)
{
- if (!it->group)
+ if (itb->must_recalc || !it->group)
{
if (it->dragging)
{
it->item->old_scrl_y -= y;
down = EINA_FALSE;
}
- _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
+
+ if (it->edit_obj)
+ _item_position(it, it->edit_obj, it->item->scrl_x, it->item->old_scrl_y);
+ else
+ _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
_group_items_recalc(it->wd);
if ((it->wd->reorder_pan_move) ||
}
if (it->realized)
{
- if (vis)
+ if (vis || it->dragging)
{
if (it->wd->reorder_mode)
y += _get_space_for_reorder_item(it);
}
if (!it->item->move_effect_enabled)
{
- if (it->item->mode_view)
- _item_position(it, it->item->mode_view, it->item->scrl_x,
- it->item->scrl_y);
+ if ((it->wd->edit_mode) && (it->itc->edit_item_style))
+ _edit_mode_item_position(it, it->item->scrl_x,
+ it->item->scrl_y);
else
- _item_position(it, VIEW(it), it->item->scrl_x,
- it->item->scrl_y);
+ {
+ if (it->item->mode_view)
+ _item_position(it, it->item->mode_view,
+ it->item->scrl_x,
+ it->item->scrl_y);
+ else
+ _item_position(it, VIEW(it), it->item->scrl_x,
+ it->item->scrl_y);
+ }
it->item->old_scrl_y = it->item->scrl_y;
}
}
else
{
- if (!it->dragging) _elm_genlist_item_unrealize(it, EINA_FALSE);
+ if (!it->wd->item_moving_effect_timer)
+ _elm_genlist_item_unrealize(it, EINA_FALSE);
}
}
in++;
static void
_scroll_item(Widget_Data *wd)
{
- Elm_Genlist_Item *it = NULL;
+ Elm_Gen_Item *it = NULL;
Evas_Coord gith = 0;
Evas_Coord ow, oh, dx = 0, dy = 0, dw = 0, dh = 0;
{
Widget_Data *wd = data;
Item_Block *itb, *chb = NULL;
- Evas_Coord minw = -1, minh = 0, y = 0, ow, dy = 0;
+ Evas_Coord minw = -1, minh = 0, y = 0, ow, dy = 0, vw;
Evas_Coord pan_w = 0, pan_h = 0;
int in = 0;
Eina_Bool minw_change = EINA_FALSE;
if (!wd) return;
evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
+ elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, NULL);
+
if (wd->w != ow)
wd->w = ow;
if (it->item->mincalcd) it->item->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;
}
minw = itb->minw;
minw_change = EINA_TRUE;
}
+ if (minw > vw)
+ {
+ minw = vw;
+ minw_change = EINA_TRUE;
+ }
itb->w = minw;
itb->h = itb->minh;
y += itb->h;
sd->wd->reorder_old_pan_y = sd->wd->pan_y;
sd->wd->start_time = ecore_loop_time_get();
}
- _item_auto_scroll(sd->wd);
+
+ if (sd->wd->tree_effect_enabled && (sd->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_NONE))
+ {
+ if (!sd->wd->item_moving_effect_timer)
+ {
+ _item_tree_effect_before(sd->wd->expanded_item);
+ evas_object_raise(sd->wd->alpha_bg);
+ evas_object_show(sd->wd->alpha_bg);
+ sd->wd->start_time = ecore_time_get();
+ sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
+ }
+ }
+ else
+ _item_auto_scroll(sd->wd);
+
evas_event_thaw(evas_object_evas_get(obj));
evas_event_thaw_eval(evas_object_evas_get(obj));
}
if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
strncat(buf, "/", sizeof(buf) - strlen(buf));
- strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
+ strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
_elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
elm_widget_style_get(WIDGET(it)));
char buf[1024];
wd->mode_item = it;
- it->item->nocache = EINA_TRUE;
+ it->item->nocache_once = EINA_TRUE;
if (wd->scr_hold_timer)
{
Elm_Gen_Item *it;
it = wd->mode_item;
- it->item->nocache = EINA_TRUE;
+ it->item->nocache_once = EINA_TRUE;
snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
}
static void
+_edit_mode_item_position(Elm_Gen_Item *it, int itx, int ity)
+{
+ if ((!it) || (!it->wd->edit_mode)) return;
+ evas_object_resize(it->edit_obj, it->item->w, it->item->h);
+ evas_object_move(it->edit_obj, itx, ity);
+}
+
+static void
+_edit_mode_item_realize(Elm_Gen_Item *it, Eina_Bool effect_on)
+{
+ char buf[1024];
+ const char *stacking_even;
+ const char *stacking;
+
+ if ((!it) || (it->item->edit_mode_item_realized) ||
+ (it->generation < it->wd->generation))
+ return;
+
+ it->edit_obj = edje_object_add(evas_object_evas_get(WIDGET(it)));
+ edje_object_scale_set(it->edit_obj, elm_widget_scale_get(WIDGET(it)) *
+ _elm_config->scale);
+ evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
+ elm_widget_sub_object_add(WIDGET(it), it->edit_obj);
+
+ if (it->item->type & ELM_GENLIST_ITEM_TREE)
+ strncpy(buf, "tree", sizeof(buf));
+ else strncpy(buf, "item", sizeof(buf));
+ if (it->wd->compress)
+ strncat(buf, "_compress", sizeof(buf) - strlen(buf));
+
+ strncat(buf, "/", sizeof(buf) - strlen(buf));
+ strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
+
+ _elm_theme_object_set(WIDGET(it), it->edit_obj, "genlist", buf,
+ elm_widget_style_get(WIDGET(it)));
+
+ stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
+ if (!stacking_even) stacking_even = "above";
+ it->item->stacking_even = !!strcmp("above", stacking_even);
+
+ stacking = edje_object_data_get(VIEW(it), "stacking");
+ if (!stacking) stacking = "yes";
+ it->item->nostacking = !!strcmp("yes", stacking);
+
+ edje_object_mirrored_set(it->edit_obj,
+ elm_widget_mirrored_get(WIDGET(it)));
+
+ _elm_genlist_item_odd_even_update(it);
+ _elm_genlist_item_state_update(it, NULL);
+
+ if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,edit,enabled,effect", "elm");
+ else edje_object_signal_emit(it->edit_obj, "elm,state,edit,enabled", "elm");
+
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _mouse_down, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_UP,
+ _mouse_up, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_move, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MULTI_DOWN,
+ _multi_down, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MULTI_UP,
+ _multi_up, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MULTI_MOVE,
+ _multi_move, it);
+
+ _item_text_realize(it, it->edit_obj, &it->item->edit_texts, NULL);
+ if (it->flipped) edje_object_signal_emit(it->edit_obj, "elm,state,flip,enabled", "elm");
+ it->item->edit_content_objs =
+ _item_content_realize(it, it->edit_obj, &it->item->edit_contents, NULL);
+ _item_state_realize(it, it->edit_obj, &it->item->edit_states, NULL);
+ edje_object_part_swallow(it->edit_obj, "elm.swallow.edit.content", VIEW(it));
+
+ _edit_mode_item_position(it, it->item->scrl_x, it->item->scrl_y);
+ evas_object_show(it->edit_obj);
+
+ it->item->edit_mode_item_realized = EINA_TRUE;
+ it->want_unrealize = EINA_FALSE;
+}
+
+static void
+_edit_mode_item_unrealize(Elm_Gen_Item *it)
+{
+ Evas_Object *icon;
+ if ((!it) || (!it->item->edit_mode_item_realized)) return;
+
+ edje_object_part_unswallow(it->edit_obj, VIEW(it));
+ evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
+ elm_widget_sub_object_add(WIDGET(it), VIEW(it));
+ _elm_genlist_item_odd_even_update(it);
+ _elm_genlist_item_state_update(it, NULL);
+
+ evas_object_del(it->edit_obj);
+ it->edit_obj = NULL;
+ elm_widget_stringlist_free(it->item->edit_texts);
+ it->item->edit_texts = NULL;
+ elm_widget_stringlist_free(it->item->edit_contents);
+ it->item->edit_contents = NULL;
+ elm_widget_stringlist_free(it->item->edit_states);
+ it->item->edit_states = NULL;
+ EINA_LIST_FREE(it->item->edit_content_objs, icon)
+ evas_object_del(icon);
+ edje_object_message_signal_process(it->edit_obj);
+
+ evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _mouse_down, it);
+ evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MOUSE_UP,
+ _mouse_up, it);
+ evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_move, it);
+ evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MULTI_DOWN,
+ _multi_down, it);
+ evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MULTI_UP,
+ _multi_up, it);
+ evas_object_event_callback_del_full(it->edit_obj, EVAS_CALLBACK_MULTI_MOVE,
+ _multi_move, it);
+ it->item->edit_mode_item_realized = EINA_FALSE;
+}
+
+static void
_item_auto_scroll(Widget_Data *wd)
{
if (!wd) return;
void
_item_select(Elm_Gen_Item *it)
{
- if ((it->wd->no_select) || (it->generation < it->wd->generation) || (it->mode_set)) return;
+ if ((it->generation < it->wd->generation) || (it->mode_set) ||
+ (it->wd->select_mode == ELM_OBJECT_NO_SELECT))
+ return;
if (!it->selected)
{
it->selected = EINA_TRUE;
it->wd->selected = eina_list_append(it->wd->selected, it);
}
- else if (!it->wd->always_select) return;
+ else if (it->wd->select_mode == ELM_OBJECT_ALWAYS_SELECT) return;
evas_object_ref(WIDGET(it));
it->walking++;
{
if ((!it->walking) && (it->generation < it->wd->generation))
{
- if (!it->relcount) it->del_cb(it);
+ if (!it->relcount)
+ {
+ it->del_cb(it);
+ elm_widget_item_free(it);
+ }
}
else
- it->wd->last_selected_item = it;
+ it->wd->last_selected_item = (Elm_Object_Item *)it;
}
}
static void
_item_content_set_hook(Elm_Gen_Item *it, const char *part, Evas_Object *content)
{
- edje_object_part_swallow(VIEW(it), part, content);
+ if (content && part)
+ {
+ it->content_objs = eina_list_append(it->content_objs, content);
+ edje_object_part_swallow(VIEW(it), part, content);
+ }
}
static Evas_Object *
_item_content_unset_hook(Elm_Gen_Item *it, const char *part)
{
Evas_Object *obj;
-
obj = edje_object_part_swallow_get(VIEW(it), part);
if (!obj) return NULL;
+ it->content_objs = eina_list_remove(it->content_objs, obj);
edje_object_part_unswallow(VIEW(it), obj);
return obj;
}
return edje_object_part_text_get(VIEW(it), part);
}
+static void
+_item_disable_hook(Elm_Object_Item *it)
+{
+ Eina_List *l;
+ Evas_Object *obj;
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (_it->generation < _it->wd->generation) return;
+
+ if (_it->selected)
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ if (_it->realized)
+ {
+ if (elm_widget_item_disabled_get(it))
+ {
+ edje_object_signal_emit(VIEW(_it), "elm,state,disabled", "elm");
+ if (_it->edit_obj)
+ edje_object_signal_emit(_it->edit_obj, "elm,state,disabled", "elm");
+ }
+ else
+ {
+ edje_object_signal_emit(VIEW(_it), "elm,state,enabled", "elm");
+ if (_it->edit_obj)
+ edje_object_signal_emit(_it->edit_obj, "elm,state,enabled", "elm");
+ }
+ EINA_LIST_FOREACH(_it->content_objs, l, obj)
+ elm_widget_disabled_set(obj, elm_widget_item_disabled_get(_it));
+ }
+}
+
+static Eina_Bool
+_item_del_pre_hook(Elm_Object_Item *it)
+{
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if ((_it->relcount > 0) || (_it->walking > 0))
+ {
+ elm_genlist_item_subitems_clear(it);
+ if (_it->wd->show_item == _it) _it->wd->show_item = NULL;
+ _elm_genlist_item_del_notserious(_it);
+ if (_it->item->block)
+ {
+ if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE);
+ _it->item->block->changed = 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);
+ }
+ if (_it->parent)
+ {
+ _it->parent->item->items =
+ eina_list_remove(_it->parent->item->items, it);
+ _it->parent = NULL;
+ }
+ return EINA_FALSE;
+ }
+ _item_del(_it);
+ return EINA_TRUE;
+}
+
Elm_Gen_Item *
_elm_genlist_item_new(Widget_Data *wd,
const Elm_Gen_Item_Class *itc,
it->wd = wd;
it->generation = wd->generation;
it->itc = itc;
+ elm_genlist_item_class_ref((Elm_Genlist_Item_Class *)itc);
it->base.data = data;
it->parent = parent;
it->func.func = func;
elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
+ elm_widget_item_text_get_hook_set(it, _item_text_hook);
+ elm_widget_item_disable_hook_set(it, _item_disable_hook);
+ elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
/* TEMPORARY */
it->sel_cb = (Ecore_Cb)_item_select;
- elm_widget_item_text_get_hook_set(it, _item_text_hook);
return it;
}
const Elm_Genlist_Item_Class *itc,
const void *data,
Elm_Gen_Item *parent,
- Elm_Genlist_Item_Flags flags,
+ Elm_Genlist_Item_Type type,
Evas_Smart_Cb func,
const void *func_data)
{
it = _elm_genlist_item_new(wd, itc, data, parent, func, func_data);
if (!it) return NULL;
it->item = ELM_NEW(Elm_Gen_Item_Type);
- it->item->flags = flags;
- if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
+ it->item->type = type;
+ if (type & ELM_GENLIST_ITEM_GROUP) it->group++;
it->item->expanded_depth = 0;
- elm_widget_item_del_cb_set(it, _item_del_hook);
ELM_GEN_ITEM_SETUP(it);
if (it->parent)
{
if (!it2->parent->group) depth += 1;
}
it->item->expanded_depth = depth;
+ wd->item_count++;
return it;
}
if (!itb) return NULL;
itb->wd = wd;
if (prepend)
- wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
+ {
+ wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
+ _item_block_position_update(wd->blocks, 0);
+ }
else
- wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
+ {
+ wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
+ itb->position_update = EINA_TRUE;
+ if (wd->blocks != EINA_INLIST_GET(itb))
+ {
+ itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1;
+ }
+ else
+ {
+ itb->position = 0;
+ }
+ }
return itb;
}
wd->blocks =
eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
itb->items = eina_list_append(itb->items, it);
+ itb->position_update = EINA_TRUE;
+ it->position = eina_list_count(itb->items);
+ it->position_update = EINA_TRUE;
+
+ if (wd->blocks != EINA_INLIST_GET(itb))
+ {
+ itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1;
+ }
+ else
+ {
+ itb->position = 0;
+ }
}
else
{
+ Eina_List *tmp;
+
+ tmp = eina_list_data_find_list(itb->items, it->item->rel);
if (it->item->before)
{
wd->blocks = eina_inlist_prepend_relative
(wd->blocks, EINA_INLIST_GET(itb),
EINA_INLIST_GET(it->item->rel->item->block));
itb->items =
- eina_list_prepend_relative(itb->items, it, it->item->rel);
+ eina_list_prepend_relative_list(itb->items, it, tmp);
+
+ /* Update index from where we prepended */
+ _item_position_update(eina_list_prev(tmp), it->item->rel->position);
+ _item_block_position_update(EINA_INLIST_GET(itb),
+ it->item->rel->item->block->position);
}
else
{
(wd->blocks, EINA_INLIST_GET(itb),
EINA_INLIST_GET(it->item->rel->item->block));
itb->items =
- eina_list_append_relative(itb->items, it, it->item->rel);
+ eina_list_append_relative_list(itb->items, it, tmp);
+
+ /* Update block index from where we appended */
+ _item_position_update(eina_list_next(tmp), it->item->rel->position + 1);
+ _item_block_position_update(EINA_INLIST_GET(itb),
+ it->item->rel->item->block->position + 1);
}
}
}
if (!itb) return EINA_FALSE;
}
itb->items = eina_list_prepend(itb->items, it);
+
+ _item_position_update(itb->items, 0);
}
else
{
if (!itb) return EINA_FALSE;
}
itb->items = eina_list_append(itb->items, it);
+ it->position = eina_list_count(itb->items);
}
}
}
else
{
+ Eina_List *tmp;
+
if (it->item->rel->item->queued)
{
/* NOTE: for a strange reason eina_list and eina_inlist don't have the same property
}
itb = it->item->rel->item->block;
if (!itb) goto newblock;
+ tmp = eina_list_data_find_list(itb->items, it->item->rel);
if (it->item->before)
- itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
+ {
+ itb->items = eina_list_prepend_relative_list(itb->items, it, tmp);
+ _item_position_update(eina_list_prev(tmp), it->item->rel->position);
+ }
else
- itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
+ {
+ itb->items = eina_list_append_relative_list(itb->items, it, tmp);
+ _item_position_update(eina_list_next(tmp), it->item->rel->position + 1);
+ }
}
itb->count++;
itb->changed = EINA_TRUE;
{
it->item->rel->relcount--;
if ((it->item->rel->generation < it->wd->generation) && (!it->item->rel->relcount))
- _item_del(it->item->rel);
+ {
+ _item_del(it->item->rel);
+ elm_widget_item_free(it->item->rel);
+ }
it->item->rel = NULL;
}
if (itb->count > itb->wd->max_items_per_block)
{
showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
it->item->block->changed = 0;
- if(wd->pan_changed)
+ if (wd->pan_changed)
{
if (wd->calc_job) ecore_job_del(wd->calc_job);
wd->calc_job = NULL;
}
}
if (showme) it->item->block->showme = EINA_TRUE;
- if (eina_inlist_count(wd->blocks) > 1)
+ /* same as eina_inlist_count > 1 */
+ if (wd->blocks && wd->blocks->next)
{
if ((t - t0) > (ecore_animator_frametime_get())) break;
}
}
static int
-_elm_genlist_item_compare_data(const void *data, const void *data1)
-{
- const Elm_Gen_Item *it = data;
- const Elm_Gen_Item *item1 = data1;
-
- return it->wd->item_compare_data_cb(it->base.data, item1->base.data);
-}
-
-static int
_elm_genlist_item_compare(const void *data, const void *data1)
{
const Elm_Gen_Item *it, *item1;
evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
}
-EAPI Elm_Gen_Item *
-elm_genlist_item_append(Evas_Object *obj,
+EAPI unsigned int
+elm_genlist_items_count(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+ return wd->item_count;
+}
+
+EAPI Elm_Object_Item *
+elm_genlist_item_append(Evas_Object *obj,
const Elm_Genlist_Item_Class *itc,
const void *data,
- Elm_Gen_Item *parent,
- Elm_Genlist_Item_Flags flags,
+ Elm_Object_Item *parent,
+ Elm_Genlist_Item_Type type,
Evas_Smart_Cb func,
const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
- func_data);
+ Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type,
+ func, func_data);
if (!it) return NULL;
if (!it->parent)
{
}
it->item->before = EINA_FALSE;
_item_queue(wd, it, NULL);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_item_prepend(Evas_Object *obj,
const Elm_Genlist_Item_Class *itc,
const void *data,
- Elm_Gen_Item *parent,
- Elm_Genlist_Item_Flags flags,
+ Elm_Object_Item *parent,
+ Elm_Genlist_Item_Type type,
Evas_Smart_Cb func,
const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
- func_data);
+ Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type,
+ func, func_data);
if (!it) return NULL;
if (!it->parent)
{
}
it->item->before = EINA_TRUE;
_item_queue(wd, it, NULL);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_item_insert_after(Evas_Object *obj,
const Elm_Genlist_Item_Class *itc,
const void *data,
- Elm_Gen_Item *parent,
- Elm_Gen_Item *after,
- Elm_Genlist_Item_Flags flags,
+ Elm_Object_Item *parent,
+ Elm_Object_Item *after,
+ Elm_Genlist_Item_Type type,
Evas_Smart_Cb func,
const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
+ Elm_Gen_Item *_after = (Elm_Gen_Item *) after;
if (!wd) return NULL;
/* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
- Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
- func_data);
+ Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type,
+ func, func_data);
if (!it) return NULL;
if (!it->parent)
{
- if ((it->group) &&
- (after->group))
+ if ((it->group) && (_after->group))
wd->group_items = eina_list_append_relative(wd->group_items, it,
- after);
+ _after);
}
else
{
- it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
- after);
+ it->parent->item->items =
+ eina_list_append_relative(it->parent->item->items, it, _after);
}
wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
- EINA_INLIST_GET(after));
- it->item->rel = after;
+ EINA_INLIST_GET(_after));
+ it->item->rel = _after;
it->item->rel->relcount++;
it->item->before = EINA_FALSE;
_item_queue(wd, it, NULL);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_item_insert_before(Evas_Object *obj,
const Elm_Genlist_Item_Class *itc,
const void *data,
- Elm_Gen_Item *parent,
- Elm_Gen_Item *before,
- Elm_Genlist_Item_Flags flags,
+ Elm_Object_Item *parent,
+ Elm_Object_Item *before,
+ Elm_Genlist_Item_Type type,
Evas_Smart_Cb func,
const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
Widget_Data *wd = elm_widget_data_get(obj);
+ Elm_Gen_Item *_before = (Elm_Gen_Item *) before;
if (!wd) return NULL;
/* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
- Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
- func_data);
+ Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type,
+ func, func_data);
if (!it) return NULL;
if (!it->parent)
{
- if (it->group && before->group)
+ if (it->group && _before->group)
wd->group_items = eina_list_prepend_relative(wd->group_items, it,
- before);
+ _before);
}
else
{
- it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
- before);
+ it->parent->item->items =
+ eina_list_prepend_relative(it->parent->item->items, it, _before);
}
wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
- EINA_INLIST_GET(before));
- it->item->rel = before;
+ EINA_INLIST_GET(_before));
+ it->item->rel = _before;
it->item->rel->relcount++;
it->item->before = EINA_TRUE;
_item_queue(wd, it, NULL);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
-elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
- const Elm_Genlist_Item_Class *itc,
- const void *data,
- Elm_Gen_Item *parent,
- Elm_Genlist_Item_Flags flags,
- Eina_Compare_Cb comp,
- Evas_Smart_Cb func,
- const void *func_data)
+EAPI Elm_Object_Item *
+elm_genlist_item_sorted_insert(Evas_Object *obj,
+ const Elm_Genlist_Item_Class *itc,
+ const void *data,
+ Elm_Object_Item *parent,
+ Elm_Genlist_Item_Type type,
+ Eina_Compare_Cb comp,
+ Evas_Smart_Cb func,
+ const void *func_data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
Elm_Gen_Item *rel = NULL;
- Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
- func_data);
+ Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, type,
+ func, func_data);
if (!it) return NULL;
wd->item_compare_cb = comp;
int cmp_result;
l = eina_list_search_sorted_near_list(it->parent->item->items,
- _elm_genlist_item_list_compare, it,
+ _elm_genlist_item_list_compare,
+ it,
&cmp_result);
if (l)
rel = eina_list_data_get(l);
_item_queue(wd, it, _elm_genlist_item_list_compare);
- return it;
-}
-
-EAPI Elm_Gen_Item *
-elm_genlist_item_sorted_insert(Evas_Object *obj,
- const Elm_Genlist_Item_Class *itc,
- const void *data,
- Elm_Gen_Item *parent,
- Elm_Genlist_Item_Flags flags,
- Eina_Compare_Cb comp,
- Evas_Smart_Cb func,
- const void *func_data)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- wd->item_compare_data_cb = comp;
-
- return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
- _elm_genlist_item_compare_data, func, func_data);
+ return (Elm_Object_Item *)it;
}
static void
if (wd->walking > 0)
{
- wd->clear_me = 1;
+ wd->clear_me = EINA_TRUE;
return;
}
evas_event_freeze(evas_object_evas_get(wd->obj));
if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next);
if (itn) itn->walking++; /* prevent early death of subitem */
it->del_cb(it);
+ elm_widget_item_free(it);
if (itn) itn->walking--;
}
}
- wd->clear_me = 0;
+ wd->clear_me = EINA_FALSE;
wd->pan_changed = EINA_TRUE;
if (wd->calc_job)
{
wd->pan_y = 0;
wd->minw = 0;
wd->minh = 0;
- wd->count = 0;
+
+ if (wd->alpha_bg) evas_object_del(wd->alpha_bg);
+ wd->alpha_bg = NULL;
+
if (wd->pan_smart)
{
evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->multi = multi;
+ wd->multi = !!multi;
}
EAPI Eina_Bool
return wd->multi;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_selected_item_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Eina_List *l;
Elm_Gen_Item *it;
- done = 1;
+ done = EINA_TRUE;
EINA_LIST_FOREACH(itb->items, l, it)
{
if (it->realized) list = eina_list_append(list, it);
return list;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_at_xy_item_get(const Evas_Object *obj,
Evas_Coord x,
Evas_Coord y,
*posret = 1;
else *posret = 0;
}
- return it;
+ return (Elm_Object_Item *)it;
}
lasty = ity + it->item->h;
}
return NULL;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_first_item_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
while ((it) && (it->generation < wd->generation))
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
+EAPI Elm_Object_Item *
elm_genlist_last_item_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
while ((it) && (it->generation < wd->generation))
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
- return it;
+ return (Elm_Object_Item *)it;
}
-EAPI Elm_Gen_Item *
-elm_genlist_item_next_get(const Elm_Gen_Item *it)
+EAPI Elm_Object_Item *
+elm_genlist_item_next_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- while (it)
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ while (_it)
{
- it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
- if ((it) && (it->generation == it->wd->generation)) break;
+ _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->next);
+ if ((_it) && (_it->generation == _it->wd->generation)) break;
}
- return (Elm_Gen_Item *)it;
+ return (Elm_Object_Item *) _it;
}
-EAPI Elm_Gen_Item *
-elm_genlist_item_prev_get(const Elm_Gen_Item *it)
+EAPI Elm_Object_Item *
+elm_genlist_item_prev_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- while (it)
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ while (_it)
{
- it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
- if ((it) && (it->generation == it->wd->generation)) break;
+ _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->prev);
+ if ((_it) && (_it->generation == _it->wd->generation)) break;
}
- return (Elm_Gen_Item *)it;
-}
-
-EAPI Evas_Object *
-elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
-{
- return _elm_genlist_item_widget_get(it);
+ return (Elm_Object_Item *) _it;
}
-EAPI Elm_Gen_Item *
-elm_genlist_item_parent_get(const Elm_Gen_Item *it)
+EAPI Elm_Object_Item *
+elm_genlist_item_parent_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return it->parent;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ return (Elm_Object_Item *) ((Elm_Gen_Item *)it)->parent;
}
EAPI void
-elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
+elm_genlist_item_subitems_clear(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Eina_List *tl = NULL, *l;
- Elm_Gen_Item *it2;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Widget_Data *wd = elm_widget_data_get(WIDGET(it));
+ if (!wd) return;
+ Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
- EINA_LIST_FOREACH(it->item->items, l, it2)
- tl = eina_list_append(tl, it2);
- EINA_LIST_FREE(tl, it2)
- elm_genlist_item_del(it2);
+ if (!wd->tree_effect_enabled || !wd->move_effect_mode)
+ _item_subitems_clear(_it);
+ else
+ {
+ if (!wd->item_moving_effect_timer)
+ {
+ wd->expanded_item = _it;
+ _item_tree_effect_before(_it);
+ evas_object_raise(wd->alpha_bg);
+ evas_object_show(wd->alpha_bg);
+ wd->start_time = ecore_time_get();
+ wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, wd);
+ }
+ else
+ _item_subitems_clear(_it);
+ }
}
EAPI void
-elm_genlist_item_selected_set(Elm_Gen_Item *it,
- Eina_Bool selected)
+elm_genlist_item_selected_set(Elm_Object_Item *it,
+ Eina_Bool selected)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Widget_Data *wd = it->wd;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ Widget_Data *wd = _it->wd;
if (!wd) return;
- if ((it->generation < wd->generation) || (it->disabled)) return;
+ if ((_it->generation < wd->generation) || elm_widget_item_disabled_get(_it))
+ return;
selected = !!selected;
- if (it->selected == selected) return;
+ if (_it->selected == selected) return;
if (selected)
{
{
while (wd->selected)
{
- if (it->unhighlight_cb) it->unhighlight_cb(wd->selected->data);
- it->unsel_cb(wd->selected->data);
+ if (_it->unhighlight_cb) _it->unhighlight_cb(wd->selected->data);
+ _it->unsel_cb(wd->selected->data);
}
}
- it->highlight_cb(it);
- _item_select(it);
+ _it->highlight_cb(_it);
+ _item_select(_it);
return;
}
- if (it->unhighlight_cb) it->unhighlight_cb(it);
- it->unsel_cb(it);
+ if (_it->unhighlight_cb) _it->unhighlight_cb(_it);
+ _it->unsel_cb(_it);
}
EAPI Eina_Bool
-elm_genlist_item_selected_get(const Elm_Gen_Item *it)
+elm_genlist_item_selected_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- return it->selected;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ return ((Elm_Gen_Item *)it)->selected;
}
-EAPI void
-elm_genlist_item_expanded_set(Elm_Gen_Item *it,
- Eina_Bool expanded)
+Elm_Gen_Item *
+_elm_genlist_expanded_next_item_get(Elm_Gen_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (it->item->expanded == expanded) return;
- it->item->expanded = expanded;
- it->wd->expanded_item = it;
+ Elm_Gen_Item *it2;
if (it->item->expanded)
{
- if (it->realized)
- edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
- evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
- it->wd->auto_scroll_enabled = EINA_TRUE;
+ it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it);
}
else
{
- if (it->realized)
- edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
- evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
- it->wd->auto_scroll_enabled = EINA_FALSE;
+ it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it);
+ while (it2)
+ {
+ if (it->item->expanded_depth >= it2->item->expanded_depth) break;
+ it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it2);
+ }
}
+ return it2;
}
-EAPI Eina_Bool
-elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
+static void
+_elm_genlist_move_items_set(Elm_Gen_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- return it->item->expanded;
-}
+ Eina_List *l;
+ Elm_Gen_Item *it2 = NULL;
+ Evas_Coord ox, oy, ow, oh, dh = 0;
-EAPI int
-elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
- return it->item->expanded_depth;
+ it->wd->expanded_next_item = _elm_genlist_expanded_next_item_get(it);
+
+ if (it->item->expanded)
+ {
+ it->wd->move_items = elm_genlist_realized_items_get(it->wd->obj);
+ EINA_LIST_FOREACH(it->wd->move_items, l, it2)
+ {
+ if (it2 == it->wd->expanded_next_item) break;
+ it->wd->move_items = eina_list_remove(it->wd->move_items, it2);
+ }
+ }
+ else
+ {
+ evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
+ it2 = it->wd->expanded_next_item;
+ while (it2 && (dh < oy + oh))
+ {
+ dh += it2->item->h;
+ it->wd->move_items = eina_list_append(it->wd->move_items, it2);
+ it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it2);
+ }
+ }
}
EAPI void
-elm_genlist_item_disabled_set(Elm_Gen_Item *it,
- Eina_Bool disabled)
+elm_genlist_item_expanded_set(Elm_Object_Item *it,
+ Eina_Bool expanded)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Eina_List *l;
- Evas_Object *obj;
- if (it->disabled == disabled) return;
- if (it->generation < it->wd->generation) return;
- it->disabled = !!disabled;
- if (it->selected)
- elm_genlist_item_selected_set(it, EINA_FALSE);
- if (it->realized)
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ expanded = !!expanded;
+ if (_it->item->expanded == expanded) return;
+ _it->item->expanded = expanded;
+ _it->wd->expanded_item = _it;
+ _elm_genlist_move_items_set(_it);
+
+ if (_it->wd->tree_effect_enabled && !_it->wd->alpha_bg)
+ _it->wd->alpha_bg = _create_tray_alpha_bg(WIDGET(_it));
+
+ if (_it->item->expanded)
{
- if (it->disabled)
- edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
- else
- edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
- EINA_LIST_FOREACH(it->content_objs, l, obj)
- elm_widget_disabled_set(obj, disabled);
+ _it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
+ if (_it->realized)
+ edje_object_signal_emit(VIEW(_it), "elm,state,expanded", "elm");
+ evas_object_smart_callback_call(WIDGET(_it), SIG_EXPANDED, _it);
+ _it->wd->auto_scroll_enabled = EINA_TRUE;
+ }
+ else
+ {
+ _it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
+ if (_it->realized)
+ edje_object_signal_emit(VIEW(_it), "elm,state,contracted", "elm");
+ evas_object_smart_callback_call(WIDGET(_it), SIG_CONTRACTED, _it);
+ _it->wd->auto_scroll_enabled = EINA_FALSE;
}
}
EAPI Eina_Bool
-elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
+elm_genlist_item_expanded_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- if (it->generation < it->wd->generation) return EINA_FALSE;
- return it->disabled;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ return ((Elm_Gen_Item *)it)->item->expanded;
+}
+
+EAPI int
+elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0);
+ return ((Elm_Gen_Item *)it)->item->expanded_depth;
}
EAPI void
-elm_genlist_item_display_only_set(Elm_Gen_Item *it,
+elm_genlist_item_display_only_set(Elm_Object_Item *it,
Eina_Bool display_only)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (it->display_only == display_only) return;
- if (it->generation < it->wd->generation) return;
- it->display_only = display_only;
- it->item->mincalcd = EINA_FALSE;
- it->item->updateme = EINA_TRUE;
- if (it->item->block) it->item->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);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ display_only = !!display_only;
+ if (_it->display_only == display_only) return;
+ if (_it->generation < _it->wd->generation) return;
+ _it->display_only = display_only;
+ _it->item->mincalcd = EINA_FALSE;
+ _it->item->updateme = EINA_TRUE;
+ if (_it->item->block) _it->item->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);
}
EAPI Eina_Bool
-elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
+elm_genlist_item_display_only_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- if (it->generation < it->wd->generation) return EINA_FALSE;
- return it->display_only;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (_it->generation < _it->wd->generation) return EINA_FALSE;
+ return _it->display_only;
}
-EAPI void
-elm_genlist_item_show(Elm_Gen_Item *it)
+static Eina_Bool _elm_genlist_item_compute_coordinates(
+ Elm_Object_Item *it,
+ Elm_Genlist_Item_Scrollto_Type type,
+ Evas_Coord *x,
+ Evas_Coord *y,
+ Evas_Coord *w,
+ Evas_Coord *h)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
Evas_Coord gith = 0;
- if (it->generation < it->wd->generation) return;
- if ((it->item->queued) || (!it->item->mincalcd))
+ if (_it->generation < _it->wd->generation) return EINA_FALSE;
+ if ((_it->item->queued) || (!_it->item->mincalcd))
{
- it->wd->show_item = it;
- it->wd->bring_in = EINA_FALSE;
- it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
- it->item->showme = EINA_TRUE;
- return;
+ _it->wd->show_item = _it;
+ _it->wd->bring_in = EINA_FALSE;
+ _it->wd->scrollto_type = type;
+ _it->item->showme = EINA_TRUE;
+ return EINA_FALSE;
}
- if (it->wd->show_item)
+ if (_it->wd->show_item)
{
- it->wd->show_item->item->showme = EINA_FALSE;
- it->wd->show_item = NULL;
+ _it->wd->show_item->item->showme = EINA_FALSE;
+ _it->wd->show_item = NULL;
}
- if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
- gith = it->item->group_item->item->h;
- elm_smart_scroller_child_region_show(it->wd->scr,
- it->x + it->item->block->x,
- it->y + it->item->block->y - gith,
- it->item->block->w, it->item->h);
-}
-
-EAPI void
-elm_genlist_item_promote(Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (it->generation < it->wd->generation) return;
- _item_move_before(it, elm_genlist_first_item_get(WIDGET(it)));
-}
-EAPI void
-elm_genlist_item_demote(Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (it->generation < it->wd->generation) return;
- _item_move_after(it, elm_genlist_last_item_get(WIDGET(it)));
-}
+ evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, w, h);
+ if (type==ELM_GENLIST_ITEM_SCROLLTO_IN)
+ {
+ if ((_it->item->group_item) &&
+ (_it->wd->pan_y > (_it->y + _it->item->block->y)))
+ gith = _it->item->group_item->item->h;
-EAPI void
-elm_genlist_item_bring_in(Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Evas_Coord gith = 0;
- if (it->generation < it->wd->generation) return;
- if ((it->item->queued) || (!it->item->mincalcd))
+ *h = _it->item->h;
+ *y = _it->y + _it->item->block->y - gith;
+ }
+ else if (type==ELM_GENLIST_ITEM_SCROLLTO_TOP)
{
- it->wd->show_item = it;
- it->wd->bring_in = EINA_TRUE;
- it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
- it->item->showme = EINA_TRUE;
- return;
+ if (_it->item->group_item) gith = _it->item->group_item->item->h;
+ *y = _it->y + _it->item->block->y - gith;
}
- if (it->wd->show_item)
+ else if (type==ELM_GENLIST_ITEM_SCROLLTO_MIDDLE)
{
- it->wd->show_item->item->showme = EINA_FALSE;
- it->wd->show_item = NULL;
+ *y = _it->y + _it->item->block->y - *h / 2 + _it->item->h / 2;
}
- if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
- gith = it->item->group_item->item->h;
- elm_smart_scroller_region_bring_in(it->wd->scr,
- it->x + it->item->block->x,
- it->y + it->item->block->y - gith,
- it->item->block->w, it->item->h);
+ else
+ return EINA_FALSE;
+
+ *x = _it->x + _it->item->block->x;
+ *w = _it->item->block->w;
+ return EINA_TRUE;
}
EAPI void
-elm_genlist_item_top_show(Elm_Gen_Item *it)
+elm_genlist_item_promote(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Evas_Coord ow, oh;
- Evas_Coord gith = 0;
-
- if (it->generation < it->wd->generation) return;
- if ((it->item->queued) || (!it->item->mincalcd))
- {
- it->wd->show_item = it;
- it->wd->bring_in = EINA_FALSE;
- it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
- it->item->showme = EINA_TRUE;
- return;
- }
- if (it->wd->show_item)
- {
- it->wd->show_item->item->showme = EINA_FALSE;
- it->wd->show_item = NULL;
- }
- evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
- if (it->item->group_item) gith = it->item->group_item->item->h;
- elm_smart_scroller_child_region_show(it->wd->scr,
- it->x + it->item->block->x,
- it->y + it->item->block->y - gith,
- it->item->block->w, oh);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (_it->generation < _it->wd->generation) return;
+ _item_move_before(_it,
+ (Elm_Gen_Item *) elm_genlist_first_item_get(WIDGET(_it)));
}
EAPI void
-elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
+elm_genlist_item_demote(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Evas_Coord ow, oh;
- Evas_Coord gith = 0;
-
- if (it->generation < it->wd->generation) return;
- if ((it->item->queued) || (!it->item->mincalcd))
- {
- it->wd->show_item = it;
- it->wd->bring_in = EINA_TRUE;
- it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
- it->item->showme = EINA_TRUE;
- return;
- }
- if (it->wd->show_item)
- {
- it->wd->show_item->item->showme = EINA_FALSE;
- it->wd->show_item = NULL;
- }
- evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
- if (it->item->group_item) gith = it->item->group_item->item->h;
- elm_smart_scroller_region_bring_in(it->wd->scr,
- it->x + it->item->block->x,
- it->y + it->item->block->y - gith,
- it->item->block->w, oh);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (_it->generation < _it->wd->generation) return;
+ _item_move_after(_it,
+ (Elm_Gen_Item *) elm_genlist_last_item_get(WIDGET(_it)));
}
EAPI void
-elm_genlist_item_middle_show(Elm_Gen_Item *it)
+elm_genlist_item_show(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Evas_Coord ow, oh;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Evas_Coord x, y, w, h;
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- if (it->generation < it->wd->generation) return;
- if ((it->item->queued) || (!it->item->mincalcd))
- {
- it->wd->show_item = it;
- it->wd->bring_in = EINA_FALSE;
- it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
- it->item->showme = EINA_TRUE;
- return;
- }
- if (it->wd->show_item)
- {
- it->wd->show_item->item->showme = EINA_FALSE;
- it->wd->show_item = NULL;
- }
- evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
- elm_smart_scroller_child_region_show(it->wd->scr,
- it->x + it->item->block->x,
- it->y + it->item->block->y - oh / 2 +
- it->item->h / 2, it->item->block->w, oh);
+ if (_elm_genlist_item_compute_coordinates(it, type, &x, &y, &w, &h))
+ elm_smart_scroller_child_region_show(_it->wd->scr, x, y, w, h);
}
EAPI void
-elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
+elm_genlist_item_bring_in(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Evas_Coord ow, oh;
- if (it->generation < it->wd->generation) return;
- if ((it->item->queued) || (!it->item->mincalcd))
- {
- it->wd->show_item = it;
- it->wd->bring_in = EINA_TRUE;
- it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
- it->item->showme = EINA_TRUE;
- return;
- }
- if (it->wd->show_item)
- {
- it->wd->show_item->item->showme = EINA_FALSE;
- it->wd->show_item = NULL;
- }
- evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
- elm_smart_scroller_region_bring_in(it->wd->scr,
- it->x + it->item->block->x,
- it->y + it->item->block->y - oh / 2 + it->item->h / 2,
- it->item->block->w, oh);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Evas_Coord x, y, w, h;
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (_elm_genlist_item_compute_coordinates(it, type, &x, &y, &w, &h))
+ elm_smart_scroller_region_bring_in(_it->wd->scr,x, y, w, h);
}
-EAPI void
-elm_genlist_item_del(Elm_Gen_Item *it)
+EINA_DEPRECATED EAPI void
+elm_genlist_item_top_show(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if ((it->relcount > 0) || (it->walking > 0))
- {
- elm_genlist_item_subitems_clear(it);
- if (it->wd->show_item == it) it->wd->show_item = NULL;
- _elm_genlist_item_del_notserious(it);
- if (it->item->block)
- {
- if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE);
- it->item->block->changed = 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);
- }
- if (it->parent)
- {
- it->parent->item->items = eina_list_remove(it->parent->item->items, it);
- it->parent = NULL;
- }
- return;
- }
- _item_del(it);
+ elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_TOP);
}
-EAPI void
-elm_genlist_item_data_set(Elm_Gen_Item *it,
- const void *data)
+EINA_DEPRECATED EAPI void
+elm_genlist_item_top_bring_in(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- elm_widget_item_data_set(it, data);
+ elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_TOP);
}
-EAPI void *
-elm_genlist_item_data_get(const Elm_Gen_Item *it)
+EINA_DEPRECATED EAPI void
+elm_genlist_item_middle_show(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_data_get(it);
+ elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
}
-EAPI void
-elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
+EINA_DEPRECATED EAPI void
+elm_genlist_item_middle_bring_in(Elm_Object_Item *it)
+{
+ elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
+}
+
+EINA_DEPRECATED EAPI void
+elm_genlist_item_contents_orphan(Elm_Object_Item *it)
{
- elm_genlist_item_contents_orphan(it);
+ elm_genlist_item_all_contents_unset(it, NULL);
}
EAPI void
-elm_genlist_item_contents_orphan(Elm_Gen_Item *it)
+elm_genlist_item_all_contents_unset(Elm_Object_Item *it, Eina_List **l)
{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
Evas_Object *content;
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- EINA_LIST_FREE(it->content_objs, content)
+ EINA_LIST_FREE(((Elm_Gen_Item *)it)->content_objs, content)
{
elm_widget_sub_object_del(WIDGET(it), content);
evas_object_smart_member_del(content);
evas_object_hide(content);
+ if (l)
+ *l = eina_list_append(*l, content);
}
}
-EAPI const Evas_Object *
-elm_genlist_item_object_get(const Elm_Gen_Item *it)
+EINA_DEPRECATED EAPI const Evas_Object *
+elm_genlist_item_object_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return VIEW(it);
}
EAPI void
-elm_genlist_item_update(Elm_Gen_Item *it)
+elm_genlist_item_update(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->item->block) return;
- if (it->generation < it->wd->generation) return;
- it->item->mincalcd = EINA_FALSE;
- it->item->updateme = EINA_TRUE;
- it->item->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);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (!_it->item->block) return;
+ if (_it->generation < _it->wd->generation) return;
+ _it->item->mincalcd = EINA_FALSE;
+ _it->item->updateme = EINA_TRUE;
+ _it->item->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);
}
EAPI void
-elm_genlist_item_fields_update(Elm_Genlist_Item *it,
+elm_genlist_item_fields_update(Elm_Object_Item *it,
const char *parts,
- Elm_Genlist_Item_Field_Flags itf)
+ Elm_Genlist_Item_Field_Type itf)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->item->block) return;
- if (it->generation < it->wd->generation) return;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (!_it->item->block) return;
+ if (_it->generation < _it->wd->generation) return;
- if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
- _item_text_realize(it, it->base.view, &it->texts, parts);
+ if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_TEXT))
+ _item_text_realize(_it, VIEW(_it), &_it->texts, parts);
if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT))
{
- it->content_objs = _item_content_unrealize(it, it->base.view,
- &it->contents, parts);
- it->content_objs = _item_content_realize(it, it->base.view,
- &it->contents, parts);
+ _it->content_objs = _item_content_unrealize(_it, VIEW(_it),
+ &_it->contents, parts);
+ _it->content_objs = _item_content_realize(_it, VIEW(_it),
+ &_it->contents, parts);
}
if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
- _item_state_realize(it, it->base.view, &it->states, parts);
+ _item_state_realize(_it, VIEW(_it), &_it->states, parts);
}
EAPI void
-elm_genlist_item_item_class_update(Elm_Gen_Item *it,
+elm_genlist_item_item_class_update(Elm_Object_Item *it,
const Elm_Genlist_Item_Class *itc)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->item->block) return;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (!_it->item->block) return;
EINA_SAFETY_ON_NULL_RETURN(itc);
- if (it->generation < it->wd->generation) return;
- it->itc = itc;
- it->item->nocache = EINA_TRUE;
+ if (_it->generation < _it->wd->generation) return;
+ _it->itc = itc;
+ _it->item->nocache_once = EINA_TRUE;
elm_genlist_item_update(it);
}
EAPI const Elm_Genlist_Item_Class *
-elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
+elm_genlist_item_item_class_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- if (it->generation < it->wd->generation) return NULL;
- return it->itc;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ if (_it->generation < _it->wd->generation) return NULL;
+ return _it->itc;
}
static Evas_Object *
}
EAPI void
-elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
- const char *text)
+elm_genlist_item_tooltip_text_set(Elm_Object_Item *it,
+ const char *text)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
text = eina_stringshare_add(text);
elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
text,
}
EAPI void
-elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
+elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it,
Elm_Tooltip_Item_Content_Cb func,
const void *data,
Evas_Smart_Cb del_cb)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
+ ELM_OBJ_ITEM_CHECK_OR_GOTO(it, error);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
+ if ((_it->tooltip.content_cb == func) && (_it->tooltip.data == data))
return;
- if (it->tooltip.del_cb)
- it->tooltip.del_cb((void *)it->tooltip.data,
- WIDGET(it), it);
+ if (_it->tooltip.del_cb)
+ _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(it), it);
- it->tooltip.content_cb = func;
- it->tooltip.data = data;
- it->tooltip.del_cb = del_cb;
+ _it->tooltip.content_cb = func;
+ _it->tooltip.data = data;
+ _it->tooltip.del_cb = del_cb;
- if (VIEW(it))
+ if (VIEW(_it))
{
- elm_widget_item_tooltip_content_cb_set(it,
- it->tooltip.content_cb,
- it->tooltip.data, NULL);
- elm_widget_item_tooltip_style_set(it, it->tooltip.style);
- elm_widget_item_tooltip_window_mode_set(it, it->tooltip.free_size);
+ elm_widget_item_tooltip_content_cb_set(_it,
+ _it->tooltip.content_cb,
+ _it->tooltip.data, NULL);
+ elm_widget_item_tooltip_style_set(_it, _it->tooltip.style);
+ elm_widget_item_tooltip_window_mode_set(_it, _it->tooltip.free_size);
}
return;
}
EAPI void
-elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
+elm_genlist_item_tooltip_unset(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if ((VIEW(it)) && (it->tooltip.content_cb))
- elm_widget_item_tooltip_unset(it);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- if (it->tooltip.del_cb)
- it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
- it->tooltip.del_cb = NULL;
- it->tooltip.content_cb = NULL;
- it->tooltip.data = NULL;
- it->tooltip.free_size = EINA_FALSE;
- if (it->tooltip.style)
+ if ((VIEW(_it)) && (_it->tooltip.content_cb))
+ elm_widget_item_tooltip_unset(_it);
+
+ if (_it->tooltip.del_cb)
+ _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(_it), _it);
+ _it->tooltip.del_cb = NULL;
+ _it->tooltip.content_cb = NULL;
+ _it->tooltip.data = NULL;
+ _it->tooltip.free_size = EINA_FALSE;
+ if (_it->tooltip.style)
elm_genlist_item_tooltip_style_set(it, NULL);
}
EAPI void
-elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
+elm_genlist_item_tooltip_style_set(Elm_Object_Item *it,
const char *style)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- eina_stringshare_replace(&it->tooltip.style, style);
- if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ eina_stringshare_replace(&_it->tooltip.style, style);
+ if (VIEW(_it)) elm_widget_item_tooltip_style_set(_it, style);
}
EAPI const char *
-elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
+elm_genlist_item_tooltip_style_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return it->tooltip.style;
+ return elm_object_item_tooltip_style_get(it);
}
EAPI Eina_Bool
-elm_genlist_item_tooltip_window_mode_set(Elm_Gen_Item *it, Eina_Bool disable)
+elm_genlist_item_tooltip_window_mode_set(Elm_Object_Item *it,
+ Eina_Bool disable)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- it->tooltip.free_size = disable;
- if (VIEW(it)) return elm_widget_item_tooltip_window_mode_set(it, disable);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ _it->tooltip.free_size = disable;
+ if (VIEW(_it)) return elm_widget_item_tooltip_window_mode_set(_it, disable);
return EINA_TRUE;
}
EAPI Eina_Bool
-elm_genlist_item_tooltip_window_mode_get(const Elm_Gen_Item *it)
+elm_genlist_item_tooltip_window_mode_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- return it->tooltip.free_size;
+ return elm_object_tooltip_window_mode_get(VIEW(it));
}
EAPI void
-elm_genlist_item_cursor_set(Elm_Gen_Item *it,
+elm_genlist_item_cursor_set(Elm_Object_Item *it,
const char *cursor)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- eina_stringshare_replace(&it->mouse_cursor, cursor);
- if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ eina_stringshare_replace(&_it->mouse_cursor, cursor);
+ if (VIEW(_it)) elm_widget_item_cursor_set(_it, cursor);
}
EAPI const char *
-elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
+elm_genlist_item_cursor_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
return elm_widget_item_cursor_get(it);
}
EAPI void
-elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
+elm_genlist_item_cursor_unset(Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->mouse_cursor)
- return;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
- if (VIEW(it))
- elm_widget_item_cursor_unset(it);
+ if (!_it->mouse_cursor) return;
- eina_stringshare_del(it->mouse_cursor);
- it->mouse_cursor = NULL;
+ if (VIEW(_it)) elm_widget_item_cursor_unset(_it);
+
+ eina_stringshare_del(_it->mouse_cursor);
+ _it->mouse_cursor = NULL;
}
EAPI void
-elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
+elm_genlist_item_cursor_style_set(Elm_Object_Item *it,
const char *style)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
elm_widget_item_cursor_style_set(it, style);
}
EAPI const char *
-elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
+elm_genlist_item_cursor_style_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
return elm_widget_item_cursor_style_get(it);
}
EAPI void
-elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
- Eina_Bool engine_only)
+elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *it,
+ Eina_Bool engine_only)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
elm_widget_item_cursor_engine_only_set(it, engine_only);
}
EAPI Eina_Bool
-elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
+elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
return elm_widget_item_cursor_engine_only_get(it);
}
+EAPI int
+elm_genlist_item_index_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ if (_it->item->block)
+ return _it->position + _it->item->block->position;
+ return -1;
+}
+
EAPI void
-elm_genlist_horizontal_set(Evas_Object *obj,
- Elm_List_Mode mode)
+elm_genlist_mode_set(Evas_Object *obj,
+ Elm_List_Mode mode)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
_sizing_eval(obj);
}
-EAPI void
-elm_genlist_horizontal_mode_set(Evas_Object *obj,
- Elm_List_Mode mode)
-{
- elm_genlist_horizontal_set(obj, mode);
-}
EAPI Elm_List_Mode
-elm_genlist_horizontal_get(const Evas_Object *obj)
+elm_genlist_mode_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
Widget_Data *wd = elm_widget_data_get(obj);
return wd->mode;
}
-EAPI Elm_List_Mode
-elm_genlist_horizontal_mode_get(const Evas_Object *obj)
-{
- return elm_genlist_horizontal_get(obj);
-}
-
-EAPI void
+EINA_DEPRECATED EAPI void
elm_genlist_always_select_mode_set(Evas_Object *obj,
Eina_Bool always_select)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->always_select = always_select;
+ if (always_select)
+ elm_genlist_select_mode_set(obj, ELM_OBJECT_ALWAYS_SELECT);
+ else
+ {
+ Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
+ if (oldmode == ELM_OBJECT_ALWAYS_SELECT)
+ elm_genlist_select_mode_set(obj, ELM_OBJECT_NORMAL_SELECT);
+ }
}
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
elm_genlist_always_select_mode_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
- return wd->always_select;
+ Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
+ if (oldmode == ELM_OBJECT_ALWAYS_SELECT)
+ return EINA_TRUE;
+ return EINA_FALSE;
}
-EAPI void
+EINA_DEPRECATED EAPI void
elm_genlist_no_select_mode_set(Evas_Object *obj,
Eina_Bool no_select)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->no_select = no_select;
+ if (no_select)
+ elm_genlist_select_mode_set(obj, ELM_OBJECT_NO_SELECT);
+ else
+ {
+ Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
+ if (oldmode == ELM_OBJECT_NO_SELECT)
+ elm_genlist_select_mode_set(obj, ELM_OBJECT_NORMAL_SELECT);
+ }
}
-EAPI Eina_Bool
+EINA_DEPRECATED EAPI Eina_Bool
elm_genlist_no_select_mode_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
- return wd->no_select;
+ Elm_Object_Select_Mode_Type oldmode = elm_genlist_select_mode_get(obj);
+ if (oldmode == ELM_OBJECT_NO_SELECT)
+ return EINA_TRUE;
+ return EINA_FALSE;
}
EAPI void
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->compress = compress;
+ wd->compress = !!compress;
if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
- wd->h_bounce = h_bounce;
- wd->v_bounce = v_bounce;
+ wd->h_bounce = !!h_bounce;
+ wd->v_bounce = !!v_bounce;
+ elm_smart_scroller_bounce_allow_set(wd->scr, wd->h_bounce, wd->v_bounce);
}
EAPI void
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
- wd->homogeneous = homogeneous;
+ wd->homogeneous = !!homogeneous;
}
EAPI Eina_Bool
EAPI void
elm_genlist_block_count_set(Evas_Object *obj,
- int n)
+ int count)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->max_items_per_block = n;
+ wd->max_items_per_block = count;
wd->item_cache_max = wd->max_items_per_block * 2;
_item_cache_clean(wd);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Eina_List *list, *l;
- Elm_Gen_Item *it;
+ Elm_Object_Item *it;
list = elm_genlist_realized_items_get(obj);
EINA_LIST_FOREACH(list, l, it)
}
EAPI void
-elm_genlist_item_mode_set(Elm_Gen_Item *it,
+elm_genlist_item_mode_set(Elm_Object_Item *it,
const char *mode_type,
Eina_Bool mode_set)
{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Widget_Data *wd = it->wd;
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ Widget_Data *wd = _it->wd;
Eina_List *l;
- Elm_Gen_Item *it2;
+ Elm_Object_Item *it2;
if (!wd) return;
if (!mode_type) return;
- if ((it->generation < it->wd->generation) || (it->disabled)) return;
+ if ((_it->generation < _it->wd->generation) ||
+ elm_widget_item_disabled_get(_it)) return;
+ if (wd->edit_mode) return;
- if ((wd->mode_item == it) &&
+ if ((wd->mode_item == _it) &&
(!strcmp(mode_type, wd->mode_type)) &&
(mode_set))
return;
- if (!wd->mode_item_style) return;
- it->mode_set = mode_set;
+ if (!_it->itc->mode_item_style) return;
+ _it->mode_set = mode_set;
if (wd->multi)
{
EINA_LIST_FOREACH(wd->selected, l, it2)
- if (it2->realized)
+ if (((Elm_Gen_Item *)it2)->realized)
elm_genlist_item_selected_set(it2, EINA_FALSE);
}
else
{
it2 = elm_genlist_selected_item_get(wd->obj);
- if ((it2) && (it2->realized))
+ if ((it2) && (((Elm_Gen_Item *)it2)->realized))
elm_genlist_item_selected_set(it2, EINA_FALSE);
}
if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
(mode_set) ||
- ((it == wd->mode_item) && (!mode_set)))
+ ((_it == wd->mode_item) && (!mode_set)))
_item_mode_unset(wd);
eina_stringshare_replace(&wd->mode_type, mode_type);
- if (mode_set) _item_mode_set(it);
+ if (mode_set) _item_mode_set(_it);
}
-
EAPI const char *
-elm_genlist_mode_item_style_get(const Evas_Object *obj)
+elm_genlist_mode_type_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- return wd->mode_item_style;
+ return wd->mode_type;
}
-EAPI void
-elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
+EAPI const Elm_Object_Item *
+elm_genlist_mode_item_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
- (!strcmp(style, wd->mode_item_style))))
- return;
- eina_stringshare_replace(&wd->mode_item_style, style);
- elm_genlist_realized_items_update(obj);
+ if (!wd) return NULL;
+ return (Elm_Object_Item *) wd->mode_item;
}
-EAPI const char *
-elm_genlist_mode_get(const Evas_Object *obj)
+EAPI Eina_Bool
+elm_genlist_edit_mode_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->mode_type;
+ if (!wd) return EINA_FALSE;
+
+ return wd->edit_mode;
}
-EAPI const Elm_Gen_Item *
-elm_genlist_mode_item_get(const Evas_Object *obj)
+EAPI void
+elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Eina_List *list, *l;
+ Elm_Gen_Item *it;
+
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->mode_item;
+ if (!wd) return;
+ edit_mode = !!edit_mode;
+ if (wd->edit_mode == edit_mode) return;
+ wd->edit_mode = edit_mode;
+
+ list = elm_genlist_realized_items_get(obj);
+ if (!wd->edit_mode)
+ {
+ EINA_LIST_FOREACH(list, l, it)
+ {
+ if (it->item->type != ELM_GENLIST_ITEM_GROUP)
+ _edit_mode_item_unrealize(it);
+ }
+ _item_cache_zero(wd);
+ }
+ else
+ {
+ EINA_LIST_FOREACH(list, l, it)
+ {
+ if (it->item->type != ELM_GENLIST_ITEM_GROUP)
+ {
+ if (it->selected) _item_unselect(it);
+ if (it->itc->edit_item_style)
+ _edit_mode_item_realize(it, EINA_TRUE);
+ }
+ }
+ }
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
}
EAPI void
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- wd->reorder_mode = reorder_mode;
+ wd->reorder_mode = !!reorder_mode;
}
EAPI Eina_Bool
return wd->reorder_mode;
}
+EAPI Elm_Genlist_Item_Type
+elm_genlist_item_type_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ELM_GENLIST_ITEM_MAX);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ return _it->item->type;
+}
+
+EINA_DEPRECATED EAPI Elm_Genlist_Item_Type
+elm_genlist_item_flags_get(const Elm_Object_Item *it)
+{
+ return elm_genlist_item_type_get(it);
+}
+
+EAPI Elm_Genlist_Item_Class *
+elm_genlist_item_class_new(void)
+{
+ Elm_Genlist_Item_Class *itc;
+
+ itc = calloc(1, sizeof(Elm_Genlist_Item_Class));
+ if (!itc)
+ return NULL;
+ itc->version = CLASS_ALLOCATED;
+ itc->refcount = 1;
+ itc->delete_me = EINA_FALSE;
+
+ return itc;
+}
+
+EAPI void
+elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
+{
+ if (itc && (itc->version == CLASS_ALLOCATED))
+ {
+ if (!itc->delete_me) itc->delete_me = EINA_TRUE;
+ if (itc->refcount > 0) elm_genlist_item_class_unref(itc);
+ else
+ {
+ itc->version = 0;
+ free(itc);
+ }
+ }
+}
+
+EAPI void
+elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc)
+{
+ if (itc && (itc->version == CLASS_ALLOCATED))
+ {
+ itc->refcount++;
+ if (itc->refcount == 0) itc->refcount--;
+ }
+}
+
+EAPI void
+elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
+{
+ if (itc && (itc->version == CLASS_ALLOCATED))
+ {
+ if (itc->refcount > 0) itc->refcount--;
+ if (itc->delete_me && (!itc->refcount))
+ elm_genlist_item_class_free(itc);
+ }
+}
+
+void _flip_job(void *data)
+{
+ Elm_Gen_Item *it = (Elm_Gen_Item *) data;
+ _elm_genlist_item_unrealize(it, EINA_FALSE);
+ if (it->selected) _item_unselect(it);
+ it->flipped = EINA_TRUE;
+ it->item->nocache = EINA_TRUE;
+}
+
+EAPI void
+elm_genlist_item_flip_set(Elm_Object_Item *it,
+ Eina_Bool flip)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+
+ flip = !!flip;
+ if (_it->flipped == flip) return;
+
+ if (flip)
+ {
+ ecore_job_add(_flip_job, _it);
+ if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job);
+ _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd);
+ }
+ else
+ {
+ _it->flipped = flip;
+ _item_cache_zero(_it->wd);
+ elm_genlist_item_update(it);
+ _it->item->nocache = EINA_FALSE;
+ }
+}
+
+EAPI Eina_Bool
+elm_genlist_item_flip_get(const Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
+ Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
+ return _it->flipped;
+}
+
+EAPI void
+elm_genlist_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode_Type mode)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
+ return;
+ if (wd->select_mode != mode)
+ wd->select_mode = mode;
+}
+
+EAPI Elm_Object_Select_Mode_Type
+elm_genlist_select_mode_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) ELM_OBJECT_SELECT_MODE_MAX;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return ELM_OBJECT_SELECT_MODE_MAX;
+ return wd->select_mode;
+}
+
+EAPI void
+elm_genlist_hilight_mode_set(Evas_Object *obj,
+ Eina_Bool hilight)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ hilight = !!hilight;
+ wd->no_highlight = !hilight;
+}
+
+EAPI Eina_Bool
+elm_genlist_hilight_mode_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ return !wd->no_highlight;
+}
+
/* for gengrid as of now */
void
_elm_genlist_page_relative_set(Evas_Object *obj,
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber);
+ elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber);
}
/* for gengrid as of now */
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber);
+ elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber);
}
/* for gengrid as of now */
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber);
+ elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber);
}
/* for gengrid as of now */
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
-}
-
-Evas_Object *
-_elm_genlist_item_widget_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return WIDGET(it);
+ elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
}
void
if (!it->realized) return;
if (it->wd->reorder_it == it) return;
+
evas_event_freeze(evas_object_evas_get(WIDGET(it)));
if (!calc)
evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
if (it->group)
it->wd->group_items = eina_list_remove(it->wd->group_items, it);
+ if (it->wd->state)
+ {
+ eina_inlist_sorted_state_free(it->wd->state);
+ it->wd->state = NULL;
+ }
if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd);
free(it->item);
+
it->item = NULL;
- elm_widget_item_del(it);
+ if (it->wd->last_selected_item == (Elm_Object_Item *)it)
+ it->wd->last_selected_item = NULL;
+ it->wd->item_count--;
+}
+
+EAPI void
+elm_genlist_tree_effect_enabled_set(Evas_Object *obj, Eina_Bool enabled)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->tree_effect_enabled = !!enabled;
+}
+
+EAPI Eina_Bool
+elm_genlist_tree_effect_enabled_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ return wd->tree_effect_enabled;
+}
+
+static Evas_Object*
+_create_tray_alpha_bg(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+
+ Evas_Object *bg = NULL;
+ Evas_Coord ox, oy, ow, oh;
+
+ evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
+ bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
+ evas_object_color_set(bg,0,0,0,0);
+ evas_object_resize(bg , ow, oh);
+ evas_object_move(bg , ox, oy);
+ return bg ;
+}
+
+static void
+_item_contract_emit(Elm_Gen_Item *it)
+{
+ Elm_Gen_Item *it2;
+ Eina_List *l;
+
+ edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", "");
+ it->item->tree_effect_finished = EINA_FALSE;
+
+ EINA_LIST_FOREACH(it->item->items, l, it2)
+ if (it2) _item_contract_emit(it2);
+}
+
+static int
+_item_tree_effect_before(Elm_Gen_Item *it)
+{
+ Elm_Gen_Item *it2;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(it->item->items, l, it2)
+ {
+ if (it2->parent && (it == it2->parent))
+ {
+ if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
+ edje_object_signal_emit(VIEW(it2), "elm,state,hide", "");
+ else if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
+ _item_contract_emit(it2);
+ }
+ }
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_item_tree_effect(Widget_Data *wd, int y)
+{
+ Elm_Gen_Item *it = NULL, *expanded_next_it;
+
+ expanded_next_it = wd->expanded_next_item;
+
+ if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
+ {
+ it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) expanded_next_it);
+ while (it)
+ {
+ if (it->item->expanded_depth <= expanded_next_it->item->expanded_depth) break;
+ if (it->item->scrl_y && (it->item->scrl_y < expanded_next_it->item->old_scrl_y + y) &&
+ (it->item->expanded_depth > expanded_next_it->item->expanded_depth))
+ {
+ if (!it->item->tree_effect_finished)
+ {
+ edje_object_signal_emit(VIEW(it), "flip_item", "");
+ evas_object_show(VIEW(it));
+ it->item->tree_effect_finished = EINA_TRUE;
+ }
+ }
+ it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) it);
+ }
+ }
+ else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
+ {
+ it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) expanded_next_it);
+ while (it)
+ {
+ if ((it->item->scrl_y > expanded_next_it->item->old_scrl_y + y) &&
+ (it->item->expanded_depth > expanded_next_it->item->expanded_depth))
+ {
+ if (!it->item->tree_effect_finished)
+ {
+ edje_object_signal_emit(VIEW(it), "elm,state,hide", "");
+ it->item->tree_effect_finished = EINA_TRUE;
+ }
+ }
+ else
+ break;
+ it = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) it);
+ }
+ }
+}
+
+static void
+_item_tree_effect_finish(Widget_Data *wd)
+{
+ Item_Block *itb;
+ Elm_Gen_Item *it = NULL;
+ const Eina_List *l;
+
+ if (wd->item_moving_effect_timer)
+ {
+ if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
+ _item_subitems_clear(wd->expanded_item);
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ it->item->tree_effect_finished = EINA_TRUE;
+ it->item->old_scrl_y = it->item->scrl_y;
+ }
+ }
+ }
+ _item_auto_scroll(wd);
+ evas_object_lower(wd->alpha_bg);
+ evas_object_hide(wd->alpha_bg);
+ wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
+ if (wd->move_items) wd->move_items = eina_list_free(wd->move_items);
+
+ evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
+ evas_object_smart_callback_call(wd->obj, SIG_TREE_EFFECT_FINISHED, NULL);
+ evas_object_smart_changed(wd->pan_smart);
+
+ wd->item_moving_effect_timer = NULL;
+}
+
+static Eina_Bool
+_item_moving_effect_timer_cb(void *data)
+{
+ Widget_Data *wd = data;
+ if (!wd) return EINA_FALSE;
+ Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
+ Elm_Gen_Item *it = NULL, *it2, *expanded_next_it;
+ const Eina_List *l;
+ double effect_duration = 0.5, t;
+ int y = 0, dy = 0, dh = 0;
+ Eina_Bool end = EINA_FALSE, vis = EINA_TRUE;
+ int in = 0;
+
+ t = ((0.0 > (t = ecore_time_get() - wd->start_time)) ? 0.0 : t);
+ evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
+ evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
+ if (t > effect_duration) end = EINA_TRUE;
+
+ // Below while statement is needed, when the genlist is resized.
+ it2 = wd->expanded_item;
+ while (it2 && vis)
+ {
+ evas_object_move(VIEW(it2), it2->item->scrl_x, it2->item->scrl_y);
+ vis = (ELM_RECTS_INTERSECT(it2->item->scrl_x, it2->item->scrl_y, it2->item->w, it2->item->h,
+ cvx, cvy, cvw, cvh));
+ it2 = (Elm_Gen_Item *) elm_genlist_item_prev_get((Elm_Object_Item *) it2);
+ }
+
+ if (wd->expanded_next_item)
+ {
+ expanded_next_it = wd->expanded_next_item;
+
+ /* move items */
+ EINA_LIST_FOREACH(wd->move_items, l, it)
+ {
+ if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
+ {
+ expanded_next_it->item->old_scrl_y = wd->expanded_item->item->old_scrl_y + wd->expanded_item->item->h;
+ if (expanded_next_it->item->scrl_y < expanded_next_it->item->old_scrl_y) //did not calculate next item position
+ expanded_next_it->item->scrl_y = cvy + cvh;
+
+ dy = ((expanded_next_it->item->scrl_y >= (cvy + cvh)) ?
+ cvy + cvh : expanded_next_it->item->scrl_y) -
+ expanded_next_it->item->old_scrl_y;
+ }
+ else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
+ {
+ if (expanded_next_it->item->scrl_y > expanded_next_it->item->old_scrl_y) //did not calculate next item position
+ expanded_next_it->item->old_scrl_y = cvy + cvh;
+
+ if (expanded_next_it->item->old_scrl_y > (cvy + cvh))
+ {
+ dy = (wd->expanded_item->item->scrl_y + wd->expanded_item->item->h) -
+ cvy + cvh;
+ expanded_next_it->item->old_scrl_y = cvy + cvh;
+ }
+ else
+ {
+ dy = (wd->expanded_item->item->scrl_y + wd->expanded_item->item->h) -
+ expanded_next_it->item->old_scrl_y;
+ }
+ }
+
+ if (t <= effect_duration)
+ {
+ y = ((1 - (1 - (t / effect_duration)) * (1 - (t /effect_duration))) * dy);
+ }
+ else
+ {
+ end = EINA_TRUE;
+ y = dy;
+ }
+
+ if (!it->realized)
+ {
+ _item_realize(it, in, 0);
+ }
+ in++;
+
+ if (it != expanded_next_it)
+ {
+ it->item->old_scrl_y = expanded_next_it->item->old_scrl_y + expanded_next_it->item->h + dh;
+ dh += it->item->h;
+ }
+
+ if ((it->item->old_scrl_y + y) < (cvy + cvh))
+ _item_position(it, VIEW(it),it->item->scrl_x, it->item->old_scrl_y + y);
+ }
+ /* tree effect */
+ _item_tree_effect(wd, y);
+ }
+ else
+ {
+ int expanded_item_num = 0;
+ int num = 0;
+
+ if (wd->expanded_item)
+ it = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) wd->expanded_item);
+
+ it2 = it;
+ while (it2)
+ {
+ expanded_item_num++;
+ it2 = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it2);
+ }
+
+ while (it)
+ {
+ num++;
+ if (wd->expanded_item->item->expanded_depth >= it->item->expanded_depth) break;
+ if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
+ {
+ if (!it->item->tree_effect_finished)
+ {
+ if (t >= (((num - 1) * effect_duration) / expanded_item_num))
+ {
+ edje_object_signal_emit(VIEW(it), "flip_item", "");
+ evas_object_show(VIEW(it));
+ it->item->tree_effect_finished = EINA_TRUE;
+ }
+ }
+ }
+ it = (Elm_Gen_Item *) elm_genlist_item_next_get((Elm_Object_Item *) it);
+ }
+ }
+
+ if (end)
+ {
+ _item_tree_effect_finish(wd);
+ return ECORE_CALLBACK_CANCEL;
+ }
+ return ECORE_CALLBACK_RENEW;
}