#include <Elementary.h>
#include "elm_priv.h"
-
+
/**
* @defgroup Genlist Genlist
+ * @ingroup Elementary
*
* The aim was to have more expansive list that the simple list in
* Elementary that could have more flexible items and allow many more entries
* details.
*
* An item in the genlist world can have 0 or more text labels (they can be
- * regular text or textblock – that's up to the style to determine), 0 or
+ * regular text or textblock ??that's up to the style to determine), 0 or
* more icons (which are simply objects swallowed into the genlist item) and
* 0 or more boolean states that can be used for check, radio or other
* indicators by the edje theme style. An item may be one of several styles
- * (Elementary provides 2 by default - “default” and “double_label”, but this
+ * (Elementary provides 2 by default - ?\9cdefault??and ?\9cdouble_label?? but this
* can be extended by system or application custom themes/overlays/extensions).
*
* In order to implement the ability to add and delete items on the fly,
* a structure with information about that type of item (genlist may contain
* multiple different items with different classes, states and styles).
* Genlist will call the functions in this struct (methods) when an item is
- * “realized” (that is created dynamically while scrolling). All objects will
+ * ?\9crealized??(that is created dynamically while scrolling). All objects will
* simply be deleted when no longer needed with evas_object_del(). The
* Elm_Genlist_Item_Class structure contains the following members:
*
* item_style - This is a constant string and simply defines the name of the
- * item style. It must be specified and the default should be “default”.
+ * item style. It must be specified and the default should be ?\9cdefault??
*
* func.label_get - This function is called when an actual item object is
* created. The data parameter is the data parameter passed to
* parameter is the genlist object and the part parameter is the string name
* of the state part in the edje design that is listed as one of the possible
* states that can be set. Return 0 for false or 1 for true. Genlist will
- * emit a signal to the edje object with “elm,state,XXX,active” “elm” when
+ * emit a signal to the edje object with ?\9celm,state,XXX,active???\9celm??when
* true (the default is false), where XXX is the name of the part.
*
* func.del - This is called when elm_genlist_item_del() is called on an
* viewport of the scroller. If it is ELM_LIST_LIMIT, Items will be expanded
* to the viewport width and limited to that size. This can be combined with
* a different style that uses edjes' ellipsis feature (cutting text off like
- * this: “tex...”).
+ * this: ?\9ctex...??.
*
* Items will only call their selection func and callback when first becoming
* selected. Any further clicks will do nothing, unless you enable always
typedef struct _Widget_Data Widget_Data;
typedef struct _Item_Block Item_Block;
typedef struct _Pan Pan;
+typedef struct _Edit_Data Edit_Data;
+#define GROUP_ALIGN_NORTH 1
+#define GROUP_ALIGN_WEST 2
struct _Widget_Data
{
Evas_Object *obj, *scr, *pan_smart;
- Eina_Inlist *items, *blocks;
+ Eina_Inlist *items, *blocks, *group_items;
Pan *pan;
Evas_Coord pan_x, pan_y, minw, minh;
Ecore_Job *calc_job, *update_job;
Ecore_Idler *queue_idler;
- Eina_List *queue, *selected;
+ Eina_List *queue, *selected, *menuopened;
Elm_Genlist_Item *show_item;
+ Elm_Genlist_Item *select_all_item;
Elm_List_Mode mode;
Eina_Bool on_hold : 1;
Eina_Bool multi : 1;
int item_height;
int max_items_per_block;
double longpress_timeout;
+ int edit_mode;
+ Eina_Bool animate_edit_controls :1;
+ Edit_Data *ed;
+
+ Evas_Coord td1_x, td1_y, tu1_x, tu1_y;
+ Evas_Coord td2_x, td2_y, tu2_x, tu2_y;
+ Evas_Coord d1_x, d1_y, d2_x, d2_y;
+ Evas_Coord acc_x1, acc_y1, acc_x2, acc_y2;
+ Evas_Coord prev_multi_x, prev_multi_y;
+ Eina_Bool multi_down : 1;
+ Eina_Bool multi_touch : 1;
+ Eina_List *edit_field;
+ Eina_Bool selct_all : 1;
+};
+struct _Edit_Data
+{
+ Elm_Genlist_Edit_Class *ec;
+ Elm_Genlist_Item *del_item;
+ Elm_Genlist_Item *reorder_item;
+ Elm_Genlist_Item *reorder_rel;
+ Evas_Object *del_confirm;
};
struct _Item_Block
Widget_Data *wd;
Eina_List *items;
Evas_Coord x, y, w, h, minw, minh;
+ Evas_Coord reoder_y;
Eina_Bool want_unrealize : 1;
Eina_Bool realized : 1;
Eina_Bool changed : 1;
Widget_Data *wd;
Item_Block *block;
Eina_List *items;
- Evas_Coord x, y, w, h, minw, minh;
+ Evas_Coord x, y, w, h, minw, minh, edx;
const Elm_Genlist_Item_Class *itc;
const void *data;
Elm_Genlist_Item *parent;
Elm_Genlist_Item_Flags flags;
- struct
+ Elm_Genlist_GroupItem *group_item;
+ struct
{
Evas_Smart_Cb func;
const void *data;
} func;
- Evas_Object *base, *spacer;
- Eina_List *labels, *icons, *states, *icon_objs;
- Ecore_Timer *long_timer;
- Evas_Coord dx, dy;
+ Evas_Object *base, *spacer, *edit_obj;
+ Eina_List *labels, *icons, *states, *icon_objs, *edit_icon_objs;
+ Ecore_Timer *long_timer, *edit_long_timer;
+ Evas_Coord dx, dy, scrl_x, scrl_y;
+ Evas_Coord reoder_cavas_x, reoder_cavas_y;
Elm_Genlist_Item *rel;
int relcount;
Eina_Bool queued : 1;
Eina_Bool showme : 1;
Eina_Bool delete_me : 1;
+ Eina_Bool delete_check : 1;
+ Eina_Bool del_confirm_state : 1;
Eina_Bool down : 1;
Eina_Bool dragging : 1;
Eina_Bool updateme : 1;
+ Eina_Bool reordering : 1;
+ Eina_Bool menuopened : 1;
+ Eina_Bool select_all_item : 1;
+ Eina_Bool reorder_check: 1;
+ Eina_Bool renamed : 1;
+
+ int pad_left, pad_right;
+ int depth;
+};
+
+
+struct _Elm_Genlist_GroupItem
+{
+ EINA_INLIST;
+ Widget_Data *wd;
+ Eina_List *items;
+ Evas_Coord x, y, w, h, minw, minh;
+ const Elm_Genlist_Item_Class *itc;
+ const void *data;
+ struct
+ {
+ Evas_Smart_Cb func;
+ const void *data;
+ } func;
+
+ Evas_Object *base;
+ Eina_List *labels, *icons, *states, *icon_objs;
+ int align;
+ Eina_Bool realized : 1;
+ Eina_Bool delete_me : 1;
+ Eina_Bool visible : 1;
+ Eina_Bool mincalcd : 1;
};
struct _Pan
static void _sizing_eval(Evas_Object *obj);
static void _item_unrealize(Elm_Genlist_Item *it);
static void _item_block_unrealize(Item_Block *itb);
+static void _groupitem_remove(Elm_Genlist_GroupItem *git, Eina_Bool update_items);
+static void _groupitem_unrealize(Elm_Genlist_GroupItem *git);
static void _calc_job(void *data);
+static Eina_Bool _edit_mode_reset(Widget_Data *wd);
+static void _edit_controls_eval( Elm_Genlist_Item *it );
+static void _move_edit_controls( Elm_Genlist_Item *it, int itx, int ity );
+
static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
{
Widget_Data *wd = elm_widget_data_get(obj);
Item_Block *itb;
+ Elm_Genlist_GroupItem *git;
if (!wd) return;
elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base", elm_widget_style_get(obj));
// edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
+ EINA_INLIST_FOREACH(wd->group_items, git)
+ {
+ _groupitem_unrealize(git);
+ }
EINA_INLIST_FOREACH(wd->blocks, itb)
{
Eina_List *l;
Elm_Genlist_Item *it;
-
+
if (itb->realized) _item_block_unrealize(itb);
EINA_LIST_FOREACH(itb->items, l, it)
it->mincalcd = EINA_FALSE;
else
{
Evas_Coord vmw, vmh, vw, vh;
-
+
minw = wd->minw;
maxw = -1;
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
_item_hilight(Elm_Genlist_Item *it)
{
const char *selectraise;
- if ((it->wd->no_select) || (it->delete_me) || (it->hilighted)) return;
- edje_object_signal_emit(it->base, "elm,state,selected", "elm");
+
+ if ((it->wd->no_select) || (it->delete_me) || (it->hilighted) ||
+ (it->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE)) return;
+ if( !it->menuopened )
+ edje_object_signal_emit(it->base, "elm,state,selected", "elm");
selectraise = edje_object_data_get(it->base, "selectraise");
if ((selectraise) && (!strcmp(selectraise, "on")))
- evas_object_raise(it->base);
+ {
+ evas_object_raise(it->base);
+ if( it->group_item && it->group_item->realized )
+ evas_object_raise(it->group_item->base);
+ }
it->hilighted = EINA_TRUE;
}
itbn->count++;
itbn->changed = EINA_TRUE;
}
- it->wd->blocks =
+ it->wd->blocks =
eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
free(itb);
}
if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
if (it->realized) _item_unrealize(it);
if (it->block) _item_block_del(it);
- if ((!it->delete_me) && (it->itc->func.del))
+ if ((!it->delete_me) && (it->itc->func.del))
it->itc->func.del(it->data, it->wd->obj);
it->delete_me = EINA_TRUE;
if (it->queued)
if (it->parent)
it->parent->items = eina_list_remove(it->parent->items, it);
if (it->long_timer) ecore_timer_del(it->long_timer);
+ if( it->group_item )
+ {
+ it->group_item->items = eina_list_remove(it->group_item->items,it);
+ }
free(it);
}
static void
_item_select(Elm_Genlist_Item *it)
{
- if ((it->wd->no_select) || (it->delete_me)) return;
+ if ((it->wd->no_select) || (it->delete_me) || (it->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE)) return;
if (it->selected)
{
if (it->wd->always_select) goto call;
const char *stacking, *selectraise;
if ((it->delete_me) || (!it->hilighted)) return;
- edje_object_signal_emit(it->base, "elm,state,unselected", "elm");
+ if( !it->menuopened )
+ edje_object_signal_emit(it->base, "elm,state,unselected", "elm");
stacking = edje_object_data_get(it->base, "stacking");
selectraise = edje_object_data_get(it->base, "selectraise");
if ((selectraise) && (!strcmp(selectraise, "on")))
}
static void
+_item_slide(Elm_Genlist_Item *it, Eina_Bool slide_to_right)
+{
+ const Eina_List *l, *l_next;
+ Elm_Genlist_Item *it2;
+ const char *allow_slide;
+
+ allow_slide = edje_object_data_get(it->base, "allow_slide");
+ if (!allow_slide)
+ return;
+
+ if (atoi(allow_slide) != 1)
+ return;
+
+ if (slide_to_right)
+ {
+ if (!it->menuopened)
+ edje_object_signal_emit(it->base, "elm,state,slide,right", "elm");
+ it->wd->menuopened = eina_list_append(it->wd->menuopened, it);
+
+ EINA_LIST_FOREACH(it->wd->menuopened, l, it2)
+ {
+ if (it2 != it)
+ {
+ it2->menuopened = EINA_FALSE;
+ edje_object_signal_emit(it2->base, "elm,state,slide,left", "elm");
+ it2->wd->menuopened = eina_list_remove(it2->wd->menuopened, it2);
+ }
+ }
+ }
+ else
+ {
+ if (it->menuopened)
+ edje_object_signal_emit(it->base, "elm,state,slide,left", "elm");
+ it->wd->menuopened = eina_list_remove(it->wd->menuopened, it);
+ }
+
+ it->menuopened = slide_to_right;
+}
+
+static void
_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
{
Elm_Genlist_Item *it = data;
Evas_Event_Mouse_Move *ev = event_info;
Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
+ Evas_Coord acc_x, acc_y;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
{
- if (!it->wd->on_hold)
- {
- it->wd->on_hold = EINA_TRUE;
+ if (!it->wd->on_hold)
+ {
+ it->wd->on_hold = EINA_TRUE;
if (!it->wd->wasselected)
- _item_unselect(it);
- }
+ _item_unselect(it);
+ }
}
if ((it->dragging) && (it->down))
{
}
return;
}
+
+ if (it->wd->multi_down)
+ {
+ acc_x = ev->prev.canvas.x - ev->cur.canvas.x;
+ if (acc_x < 0)
+ it->wd->acc_x1 = it->wd->acc_x1 - acc_x;
+ else
+ it->wd->acc_x1 = it->wd->acc_x1 + acc_x;
+
+ acc_y = ev->prev.canvas.y - ev->cur.canvas.y;
+ if (acc_y < 0)
+ it->wd->acc_y1 = it->wd->acc_y1 - acc_y;
+ else
+ it->wd->acc_y1 = it->wd->acc_y1 + acc_y;
+
+ return;
+ }
+
if (!it->display_only)
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
else
{
if (dx < 0)
- evas_object_smart_callback_call(it->wd->obj,
- "drag,start,left", it);
+ {
+ evas_object_smart_callback_call(it->wd->obj,
+ "drag,start,left", it);
+ _item_slide( it, 0 );
+ }
else
- evas_object_smart_callback_call(it->wd->obj,
- "drag,start,right", it);
+ {
+ evas_object_smart_callback_call(it->wd->obj,
+ "drag,start,right", it);
+ _item_slide( it, 1 );
+ }
}
}
else
{
if (ady > adx)
- evas_object_smart_callback_call(it->wd->obj,
- "drag,start,down", it);
+ evas_object_smart_callback_call(it->wd->obj,
+ "drag,start,down", it);
else
{
if (dx < 0)
- evas_object_smart_callback_call(it->wd->obj,
- "drag,start,left", it);
+ {
+ evas_object_smart_callback_call(it->wd->obj,
+ "drag,start,left", it);
+ _item_slide( it, 0 );
+ }
else
- evas_object_smart_callback_call(it->wd->obj,
- "drag,start,right", it);
+ {
+ evas_object_smart_callback_call(it->wd->obj,
+ "drag,start,right", it);
+ _item_slide( it, 1 );
+ }
}
}
}
return ECORE_CALLBACK_CANCEL;
}
+static int
+_edit_long_press(void *data)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Coord x, y;
+
+ it->edit_long_timer = NULL;
+ if ((it->disabled) || (it->dragging)) return 0;
+ edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
+
+ evas_object_geometry_get(it->base, &x, &y, NULL, NULL);
+
+ it->dx = it->reoder_cavas_x - x;
+ it->dy = it->reoder_cavas_y - y;
+
+ evas_object_raise(it->base);
+ evas_object_raise( it->edit_obj );
+
+ it->wd->ed->reorder_item = it;
+ it->wd->ed->reorder_item->reordering = 1;
+ it->wd->ed->reorder_rel = NULL;
+ elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
+
+ return 0;
+}
+
+static void
+_multi_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Event_Multi_Down *ev = event_info;
+ Evas_Coord dx, dy, adx, ady;
+
+ if (it->long_timer)
+ {
+ ecore_timer_del(it->long_timer);
+ it->long_timer = NULL;
+ }
+
+ dx = it->wd->td1_x - ev->canvas.x;
+ adx = dx;
+ if (adx < 0) adx = -dx;
+ dy = it->wd->td1_y - ev->canvas.y;
+ ady = dy;
+ if (ady < 0) ady = -dy;
+
+ if (adx < 60 && ady < 60)
+ return;
+
+ it->wd->multi_down = 1;
+ it->wd->td2_x = ev->canvas.x;
+ it->wd->td2_y = ev->canvas.y;
+
+ fprintf(stderr, "\n MULTI_DOWN - BUTTON ID = %d, x= %d, y= %d\n", ev->device, it->wd->td2_x, it->wd->td2_y);
+}
+
+static void
+_multi_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Event_Multi_Up *ev = event_info;
+ Evas_Coord dy, uy, ady, auy;
+
+ fprintf(stderr, "\n MULTI_UP - x= %d, y= %d down= %d multi_down= %d\n", ev->canvas.x, ev->canvas.y, it->down, it->wd->multi_down);
+
+ if (!it->wd->multi_down)
+ return;
+
+ it->wd->multi_down = 0;
+ it->wd->tu2_x = ev->canvas.x;
+ it->wd->tu2_y = ev->canvas.y;
+ it->wd->d2_x = ev->canvas.x - it->wd->td2_x;
+ it->wd->d2_y = ev->canvas.y - it->wd->td2_y;
+
+ if (it->down)
+ {
+ it->wd->multi_touch = EINA_TRUE;
+ }
+ else
+ {
+ fprintf(stderr, "CHECK d1_x= %d, d2_x= %d, d1_y= %d, d2_y= %d\n", it->wd->d1_x, it->wd->d2_x, it->wd->d1_y, it->wd->d2_y);
+
+ if ( (it->wd->d1_x > 180) && (it->wd->d2_x > 180) )
+ {
+ // Two finger : Left -> Right
+ fprintf(stderr, "L->R acc_y1= %d, acc_y2= %d\n", it->wd->acc_y1, it->wd->acc_y2);
+ if (it->wd->acc_y1 < 200 && it->wd->acc_y2 < 200)
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,left,right", it);
+ }
+ else if ( (it->wd->d1_y > 180) && (it->wd->d2_y > 180) )
+ {
+ // Two finger : Top -> Bottom
+ fprintf(stderr, "T->B acc_x1= %d, acc_x2= %d\n", it->wd->acc_x1, it->wd->acc_x2);
+ if (it->wd->acc_x1 < 200 && it->wd->acc_x2 < 200)
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,top,bottom", it);
+ }
+ else
+ {
+ dy = it->wd->td1_y - it->wd->td2_y;
+ if (dy < 0)
+ ady = -dy;
+ else
+ ady = dy;
+
+ uy = it->wd->tu1_y - it->wd->tu2_y;
+ if (uy < 0)
+ auy = -uy;
+ else
+ auy = uy;
+
+ if (auy < ady)
+ {
+ if (auy < ady*0.4)
+ {
+ // Two finger : Pinch Out
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,pinch,out", it);
+ }
+ }
+ else
+ {
+ if (ady < auy*0.4)
+ {
+ // Two finger : Pinch In
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,pinch,in", it);
+ }
+ }
+ }
+
+ it->wd->acc_x1 = 0;
+ it->wd->acc_y1 = 0;
+ it->wd->acc_x2 = 0;
+ it->wd->acc_y2 = 0;
+ it->wd->prev_multi_x = 0;
+ it->wd->prev_multi_y = 0;
+ }
+}
+
+static void
+_multi_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Event_Multi_Move *ev = event_info;
+ Evas_Coord acc_x, acc_y;
+
+ if (it->wd->prev_multi_x == 0)
+ {
+ it->wd->prev_multi_x = ev->cur.canvas.x;
+ it->wd->prev_multi_y = ev->cur.canvas.y;
+ return;
+ }
+
+ acc_x = it->wd->prev_multi_x - ev->cur.canvas.x;
+ if (acc_x < 0)
+ it->wd->acc_x2 = it->wd->acc_x2 - acc_x;
+ else
+ it->wd->acc_x2 = it->wd->acc_x2 + acc_x;
+
+ acc_y = it->wd->prev_multi_y - ev->cur.canvas.y;
+ if (acc_y < 0)
+ it->wd->acc_y2 = it->wd->acc_y2 - acc_y;
+ else
+ it->wd->acc_y2 = it->wd->acc_y2 + acc_y;
+
+ it->wd->prev_multi_x = ev->cur.canvas.x;
+ it->wd->prev_multi_y = ev->cur.canvas.y;
+}
+
static void
_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
Evas_Coord x, y;
+ if( it->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE )
+ (void)_edit_mode_reset( it->wd );
if (ev->button != 1) return;
+ if(it->wd->edit_field && !it->renamed)
+ elm_genlist_item_rename_mode_set(it, 0);
+
it->down = 1;
it->dragging = 0;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
it->dx = ev->canvas.x - x;
it->dy = ev->canvas.y - y;
+ it->wd->td1_x = ev->canvas.x;
+ it->wd->td1_y = ev->canvas.y;
it->wd->longpressed = EINA_FALSE;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
else it->wd->on_hold = EINA_FALSE;
Elm_Genlist_Item *it = data;
Evas_Event_Mouse_Up *ev = event_info;
Eina_Bool dragged = EINA_FALSE;
+ Evas_Coord dy, uy, ady, auy;
if (ev->button != 1) return;
it->down = 0;
+ it->wd->acc_x1 = 0;
+ it->wd->acc_y1 = 0;
+
+ it->wd->tu1_x = ev->canvas.x;
+ it->wd->tu1_y = ev->canvas.y;
+ it->wd->d1_x = ev->canvas.x - it->wd->td1_x;
+ it->wd->d1_y = ev->canvas.y - it->wd->td1_y;
+
+ if (it->wd->multi_down == 0 && it->wd->multi_touch == EINA_TRUE)
+ {
+ if ( (it->wd->d1_x > 180) && (it->wd->d2_x > 180) )
+ {
+ // Two finger : Left -> Right
+ fprintf(stderr, "L->R acc_y1= %d, acc_y2= %d\n", it->wd->acc_y1, it->wd->acc_y2);
+ if (it->wd->acc_y1 < 200 && it->wd->acc_y2 < 200)
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,left,right", it);
+ }
+ else if ( (it->wd->d1_y > 180) && (it->wd->d2_y > 180) )
+ {
+ // Two finger : Top -> Bottom
+ fprintf(stderr, "T->B acc_x1= %d, acc_x2= %d\n", it->wd->acc_x1, it->wd->acc_x2);
+ if (it->wd->acc_x1 < 200 && it->wd->acc_x2 < 200)
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,top,bottom", it);
+ }
+ else
+ {
+ dy = it->wd->td1_y - it->wd->td2_y;
+ if (dy < 0) ady = -dy;
+ else ady = dy;
+
+ uy = it->wd->tu1_y - it->wd->tu2_y;
+ if (uy < 0) auy = -uy;
+ else auy = uy;
+
+ if (auy < ady)
+ {
+ if (auy < ady*0.4)
+ {
+ // Two finger : Pinch Out
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,pinch,out", it);
+ }
+ }
+ else
+ {
+ if (ady < auy*0.4)
+ {
+ // Two finger : Pinch In
+ evas_object_smart_callback_call(it->wd->obj, "multi_touch,pinch,in", it);
+ }
+ }
+
+ }
+
+ it->wd->acc_x1 = 0;
+ it->wd->acc_y1 = 0;
+ it->wd->acc_x2 = 0;
+ it->wd->acc_y2 = 0;
+ it->wd->prev_multi_x = 0;
+ it->wd->prev_multi_y = 0;
+ it->wd->multi_down = 0;
+ }
+
+ it->wd->multi_touch = EINA_FALSE;
+
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
else it->wd->on_hold = EINA_FALSE;
if (it->long_timer)
{
- ecore_timer_del(it->long_timer);
- it->long_timer = NULL;
+ ecore_timer_del(it->long_timer);
+ it->long_timer = NULL;
}
if (it->dragging)
{
- it->dragging = 0;
- evas_object_smart_callback_call(it->wd->obj, "drag,stop", it);
- dragged = 1;
+ it->dragging = 0;
+ evas_object_smart_callback_call(it->wd->obj, "drag,stop", it);
+ dragged = 1;
}
if (it->wd->on_hold)
{
- it->wd->longpressed = EINA_FALSE;
+ it->wd->longpressed = EINA_FALSE;
it->wd->on_hold = EINA_FALSE;
return;
}
if (it->wd->longpressed)
{
- it->wd->longpressed = EINA_FALSE;
- if (!it->wd->wasselected)
- _item_unselect(it);
- it->wd->wasselected = 0;
- return;
+ it->wd->longpressed = EINA_FALSE;
+ if (!it->wd->wasselected)
+ _item_unselect(it);
+ it->wd->wasselected = 0;
+ return;
}
if (dragged)
{
- if (it->want_unrealize)
- {
- _item_unrealize(it);
- if (it->block->want_unrealize)
- _item_block_unrealize(it->block);
- }
+ if (it->want_unrealize)
+ {
+ _item_unrealize(it);
+ if (it->block->want_unrealize)
+ _item_block_unrealize(it->block);
+ }
}
if ((it->disabled) || (dragged)) return;
if (it->wd->multi)
{
- if (!it->selected)
+ if (!it->selected && !it->menuopened)
{
_item_hilight(it);
_item_select(it);
if (!it->selected)
{
Widget_Data *wd = it->wd;
- if (wd)
- {
- while (wd->selected) _item_unselect(wd->selected->data);
- }
+ if (wd)
+ {
+ while (wd->selected) _item_unselect(wd->selected->data);
+ }
}
else
{
Elm_Genlist_Item *it2;
EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
- if (it2 != it) _item_unselect(it2);
-// _item_hilight(it);
-// _item_select(it);
+ if (it2 != it) _item_unselect(it2);
+ // _item_hilight(it);
+ // _item_select(it);
+ }
+ if (!it->menuopened)
+ {
+ _item_hilight(it);
+ _item_select(it);
}
- _item_hilight(it);
- _item_select(it);
}
}
}
static void
+_set_groupitem( Elm_Genlist_Item *it, Elm_Genlist_GroupItem *git)
+{
+ if(it && git )
+ {
+ it->group_item = git;
+ git->items = eina_list_append(git->items, it);
+ }
+}
+
+static void
+_groupitem_realize(Elm_Genlist_GroupItem *git)
+{
+ char buf[1024];
+ const char *align;
+
+ if ((git->realized) || (git->delete_me)) return;
+ git->base = edje_object_add(evas_object_evas_get(git->wd->obj));
+ edje_object_scale_set(git->base, elm_widget_scale_get(git->wd->obj) *
+ _elm_config->scale);
+ evas_object_smart_member_add(git->base, git->wd->pan_smart);
+ elm_widget_sub_object_add(git->wd->obj, git->base);
+
+ strncpy(buf, "item/", sizeof(buf));
+ strncat(buf, git->itc->item_style, sizeof(buf) - strlen(buf));
+ _elm_theme_object_set(git->wd->obj, git->base, "genlist", buf, elm_widget_style_get(git->wd->obj));
+
+ align = edje_object_data_get(git->base, "orientation");
+ git->align = GROUP_ALIGN_NORTH;
+ if(align)
+ {
+ if( !strcmp(align, "top") )
+ git->align = GROUP_ALIGN_NORTH;
+ else if( !strcmp(align, "left") )
+ git->align = GROUP_ALIGN_WEST;
+ else git->align = GROUP_ALIGN_NORTH;
+ }
+
+ if (git->itc->func.label_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ git->labels = _elm_stringlist_get(edje_object_data_get(git->base, "labels"));
+ EINA_LIST_FOREACH(git->labels, l, key)
+ {
+ char *s = git->itc->func.label_get(git->data, git->wd->obj, l->data);
+
+ if (s)
+ {
+ edje_object_part_text_set(git->base, l->data, s);
+ free(s);
+ }
+ }
+ }
+
+ if (git->itc->func.icon_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ git->icons = _elm_stringlist_get(edje_object_data_get(git->base, "icons"));
+ EINA_LIST_FOREACH(git->icons, l, key)
+ {
+ Evas_Object *ic = git->itc->func.icon_get(git->data, git->wd->obj, l->data);
+
+ if (ic)
+ {
+ git->icon_objs = eina_list_append(git->icon_objs, ic);
+ edje_object_part_swallow(git->base, key, ic);
+ evas_object_show(ic);
+ elm_widget_sub_object_add(git->wd->obj, ic);
+ }
+ }
+
+ }
+ if (git->itc->func.state_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ git->states = _elm_stringlist_get(edje_object_data_get(git->base, "states"));
+ EINA_LIST_FOREACH(git->states, l, key)
+ {
+ Eina_Bool on = git->itc->func.state_get(git->data, git->wd->obj, l->data);
+
+ if (on)
+ {
+ snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
+ edje_object_signal_emit(git->base, buf, "elm");
+ }
+ }
+ }
+ if (!git->mincalcd)
+ {
+ Evas_Coord mw = -1, mh = -1;
+
+ edje_object_size_min_restricted_calc(git->base, &mw, &mh, mw, mh);
+
+ git->w = git->minw = mw;
+ git->h = git->minh = mh;
+ git->mincalcd = EINA_TRUE;
+ }
+ git->y = git->y = -1;
+ evas_object_show(git->base);
+
+ git->realized = EINA_TRUE;
+}
+
+
+static void
+_groupitem_unrealize(Elm_Genlist_GroupItem *git)
+{
+ Evas_Object *icon;
+
+ if (!git->realized) return;
+ evas_object_del(git->base);
+ git->base = NULL;
+ _elm_stringlist_free(git->labels);
+ git->labels = NULL;
+ _elm_stringlist_free(git->icons);
+ git->icons = NULL;
+ _elm_stringlist_free(git->states);
+
+ EINA_LIST_FREE(git->icon_objs, icon)
+ evas_object_del(icon);
+
+ git->states = NULL;
+ git->realized = EINA_FALSE;
+}
+
+static void
+_groupitem_remove(Elm_Genlist_GroupItem *git, Eina_Bool update_items)
+{
+ Elm_Genlist_Item *it;
+ const Eina_List *l;
+
+ if (!git) return;
+
+ if( git->realized )
+ _groupitem_unrealize( git );
+
+ git->wd->group_items = eina_inlist_remove(git->wd->group_items,EINA_INLIST_GET(git));
+
+ if( update_items )
+ {
+ EINA_LIST_FOREACH(git->items,l, it)
+ {
+ it->group_item = NULL;
+ elm_genlist_item_update(it);
+ }
+ }
+
+ if (git->itc->func.del) git->itc->func.del(git->data, git->wd->obj);
+ free(git);
+}
+
+static void
_item_realize(Elm_Genlist_Item *it, int in, int calc)
{
Elm_Genlist_Item *it2;
if ((it->realized) || (it->delete_me)) return;
it->base = edje_object_add(evas_object_evas_get(it->wd->obj));
- edje_object_scale_set(it->base, elm_widget_scale_get(it->wd->obj) *
+ edje_object_scale_set(it->base, elm_widget_scale_get(it->wd->obj) *
_elm_config->scale);
evas_object_smart_member_add(it->base, it->wd->pan_smart);
elm_widget_sub_object_add(it->wd->obj, it->base);
if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
strncat(buf, "/", sizeof(buf) - strlen(buf));
strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
-
+
_elm_theme_object_set(it->wd->obj, it->base, "genlist", buf, elm_widget_style_get(it->wd->obj));
it->spacer = evas_object_rectangle_add(evas_object_evas_get(it->wd->obj));
evas_object_color_set(it->spacer, 0, 0, 0, 0);
elm_widget_sub_object_add(it->wd->obj, it->spacer);
for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) depth += 1;
+ it->depth = depth;
treesize = edje_object_data_get(it->base, "treesize");
if (treesize) tsize = atoi(treesize);
evas_object_size_hint_min_set(it->spacer,
_mouse_up, it);
evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_MOVE,
_mouse_move, it);
- if (it->selected)
+ evas_object_event_callback_add(it->base, EVAS_CALLBACK_MULTI_DOWN,
+ _multi_down, it);
+ evas_object_event_callback_add(it->base, EVAS_CALLBACK_MULTI_UP,
+ _multi_up, it);
+ evas_object_event_callback_add(it->base, EVAS_CALLBACK_MULTI_MOVE,
+ _multi_move, it);
+ if (it->selected && !it->menuopened)
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
if (it->disabled)
edje_object_signal_emit(it->base, "elm,state,disabled", "elm");
}
else
{
+ if(!strcmp(it->itc->item_style, "select_all")) {
+ const Eina_List *l;
+ const char *key;
+
+ it->labels = _elm_stringlist_get(edje_object_data_get(it->base, "labels"));
+ EINA_LIST_FOREACH(it->labels, l, key) {
+ edje_object_part_text_set(it->base, l->data, "Select all");
+ }
+ }
+
if (it->itc->func.label_get)
{
const Eina_List *l;
if (!it->mincalcd)
{
Evas_Coord mw = -1, mh = -1;
-
+
if (!it->display_only)
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base, &mw, &mh, mw, mh);
}
it->realized = EINA_TRUE;
it->want_unrealize = EINA_FALSE;
+ if(it->group_item && !it->group_item->realized)
+ _groupitem_realize(it->group_item);
+ if( ELM_GENLIST_EDIT_MODE_NONE != it->wd->edit_mode )
+ _edit_controls_eval(it);
}
static void
Evas_Object *icon;
if (!it->realized) return;
+ it->menuopened = EINA_FALSE;
+ it->wd->menuopened = eina_list_remove(it->wd->menuopened, it);
if (it->long_timer)
{
- ecore_timer_del(it->long_timer);
- it->long_timer = NULL;
+ ecore_timer_del(it->long_timer);
+ it->long_timer = NULL;
}
evas_object_del(it->base);
it->base = NULL;
evas_object_del(it->spacer);
it->spacer = NULL;
+ if(it->edit_obj)
+ evas_object_del(it->edit_obj);
+ it->edit_obj = NULL;
_elm_stringlist_free(it->labels);
it->labels = NULL;
_elm_stringlist_free(it->icons);
it->icons = NULL;
_elm_stringlist_free(it->states);
- EINA_LIST_FREE(it->icon_objs, icon)
- evas_object_del(icon);
+ EINA_LIST_FREE(it->icon_objs, icon)
+ evas_object_del(icon);
+
+ EINA_LIST_FREE(it->edit_icon_objs, icon)
+ evas_object_del(icon);
it->states = NULL;
it->realized = EINA_FALSE;
{
const Eina_List *l;
Elm_Genlist_Item *it;
+ Elm_Genlist_GroupItem *git = NULL;
Evas_Coord minw = 0, minh = 0;
int showme = 0, changed = 0;
Evas_Coord y = 0;
it->x = 0;
it->y = y;
y += it->h;
+ if( git != it->group_item )
+ {
+ git = it->group_item;
+ if( git && git->align == GROUP_ALIGN_NORTH && git->items->data == it) //Add Place holder for Group title
+ {
+ minh += git->minh;
+ it->y += git->minh;
+ y += git->minh;
+ }
+ }
}
itb->minw = minw;
itb->minh = minh;
if (!itb->realized) return;
EINA_LIST_FOREACH(itb->items, l, it)
{
- if (it->dragging)
+ if (it->dragging || it->reordering)
{
dragging = 1;
it->want_unrealize = EINA_TRUE;
}
static void
+_delete_confirm_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Widget_Data *wd = data;
+ evas_object_hide( wd->ed->del_confirm );
+ if( wd->ed->ec && wd->ed->ec->remove )
+ wd->ed->ec->remove(wd->obj, wd->ed->del_item);
+ wd->ed->del_item = NULL;
+}
+
+static void
+_hide_delete_confirm_object (void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ const char *del_icon_part;
+ Elm_Genlist_Item *it = data;
+ del_icon_part = edje_object_data_get(it->edit_obj, "del_confirm");
+ if (del_icon_part)
+ edje_object_part_unswallow( it->edit_obj, it->wd->ed->del_confirm );
+
+ evas_object_hide( it->wd->ed->del_confirm );
+}
+
+static void
+_remove_item_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ const char *del_icon_part, *del_conf_style;
+ Elm_Genlist_Item *it = data;
+ if(_edit_mode_reset( it->wd ))
+ return;
+
+ if (it->edit_long_timer)
+ {
+ ecore_timer_del(it->edit_long_timer);
+ it->edit_long_timer = NULL;
+ }
+
+ if( it->del_confirm_state )
+ {
+ it->del_confirm_state = 0;
+ it->delete_check = 0;
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,animated,enable", "elm");
+ it->wd->selct_all = 0;
+ if(it->wd->select_all_item)
+ edje_object_signal_emit(it->wd->select_all_item->base, "elm,state,del,animated,enable", "elm");
+
+ if (!it->wd->selct_all && it->wd->ed->ec->item_selected)
+ {
+ it->wd->ed->ec->item_selected(it->data, it, it->delete_check);
+ }
+ return;
+ }
+
+ it->del_confirm_state = 1;
+ it->delete_check = 1;
+
+ it->wd->ed->del_item = it;
+
+ if (!it->wd->selct_all && it->wd->ed->ec->item_selected)
+ {
+ it->wd->ed->ec->item_selected(it->data, it, it->delete_check);
+ }
+
+ del_conf_style = edje_object_data_get(it->edit_obj, "del_button_style");
+ if(del_conf_style )
+ elm_object_style_set( it->wd->ed->del_confirm, del_conf_style);
+
+/*
+ del_icon_part = edje_object_data_get(it->edit_obj, "del_confirm");
+ if (del_icon_part)
+ edje_object_part_swallow(it->edit_obj, del_icon_part, it->wd->ed->del_confirm);
+ evas_object_show( it->wd->ed->del_confirm );
+*/
+ edje_object_signal_emit(it->edit_obj, "elm,state,del_confirm", "elm");
+}
+
+static void
+_insert_new_item_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ Elm_Genlist_Item *it = data;
+
+ if(_edit_mode_reset( it->wd ))
+ return;
+
+ if( it->wd->ed->ec && it->wd->ed->ec->insert_new )
+ it->wd->ed->ec->insert_new(it->wd->obj, it);
+}
+
+static Eina_Bool
+_edit_mode_reset(Widget_Data *wd)
+{
+ /*
+ if(wd->ed->del_confirm_state)
+ {
+ //edje_object_signal_emit(wd->ed->del_item->edit_obj, "elm,state,delete", "elm");
+ //wd->ed->del_confirm_state = 0;
+ //wd->ed->del_item = NULL;
+ return EINA_TRUE;
+ }
+ */
+ return EINA_FALSE;
+}
+
+static void
+_reorder_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Event_Mouse_Down *ev = event_info;
+ Evas_Coord x, y;
+
+ if(!elm_genlist_item_next_get(it))
+ return;
+
+ if(it->wd->edit_field && !it->renamed)
+ elm_genlist_item_rename_mode_set(it, 0);
+
+ if(!(it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_REORDER))
+ return;
+
+ if(_edit_mode_reset( it->wd ) )
+ return;
+
+ it->dragging = 0;
+ it->down = 1;
+
+ it->reoder_cavas_x = ev->canvas.x;
+ it->reoder_cavas_y = ev->canvas.y;
+
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ it->dx = ev->canvas.x - x;
+ it->dy = ev->canvas.y - y;
+
+ if (it->edit_long_timer)
+ {
+ ecore_timer_del(it->edit_long_timer);
+ it->edit_long_timer = NULL;
+ }
+
+ if (it->realized) {
+ it->edit_long_timer = ecore_timer_add(0.3,_edit_long_press, it);
+ }
+ else
+ it->edit_long_timer = NULL;
+
+}
+
+static void
+_reorder_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Event_Mouse_Up *ev = event_info;
+
+ Item_Block *itb;
+ EINA_INLIST_FOREACH(it->wd->blocks, itb)
+ {
+ itb->reoder_y = 0;
+ }
+
+ if (it->edit_long_timer)
+ {
+ ecore_timer_del(it->edit_long_timer);
+ it->edit_long_timer = NULL;
+ }
+
+ it->down = 0;
+ if( it->reordering && it->wd->ed->reorder_item )
+ {
+ it->wd->ed->reorder_item->reordering = 0;
+ edje_object_signal_emit(it->wd->ed->reorder_item->edit_obj, "elm,action,item,reorder_end", "elm");
+ elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
+
+ if( (!it->wd->ed->reorder_rel) || (!it->wd->ed->ec->move) ||
+ (!it->wd->ed->ec->move(it->wd->obj, it->wd->ed->reorder_item, it->wd->ed->reorder_rel, EINA_TRUE ) ) )
+ {
+ evas_object_move(it->wd->ed->reorder_item->base, it->wd->ed->reorder_item->scrl_x+it->pad_left, it->wd->ed->reorder_item->scrl_y);
+ _move_edit_controls( it,it->wd->ed->reorder_item->scrl_x, it->wd->ed->reorder_item->scrl_y );
+ }
+ it->wd->ed->reorder_item = NULL;
+ it->wd->ed->reorder_rel = NULL;
+ return;
+ }
+}
+
+static void
+_reorder_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Genlist_Item *it = data;
+ Evas_Event_Mouse_Move *ev = event_info;
+
+ if ((it->dragging) && (it->down))
+ {
+ if (it->edit_long_timer)
+ {
+ ecore_timer_del(it->edit_long_timer);
+ it->edit_long_timer = NULL;
+ }
+
+ evas_object_smart_callback_call(it->wd->obj, "drag", it);
+// return;
+ }
+
+
+ Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
+
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ x = ev->cur.canvas.x - x;
+ y = ev->cur.canvas.y - y;
+ dx = x - it->dx;
+ adx = dx;
+ if (adx < 0) adx = -dx;
+ dy = y - it->dy;
+ ady = dy;
+ if (ady < 0) ady = -dy;
+ minw /= 2;
+ minh /= 2;
+ if ((adx > minw) || (ady > minh))
+ {
+ it->dragging = 1;
+ if (it->edit_long_timer)
+ {
+ ecore_timer_del(it->edit_long_timer);
+ it->edit_long_timer = NULL;
+ }
+ }
+
+ if( it->reordering && it->wd->ed->reorder_item )
+ {
+ int y = ev->cur.canvas.y - it->wd->ed->reorder_item->dy;
+ evas_object_raise(it->wd->ed->reorder_item->base);
+ evas_object_move(it->wd->ed->reorder_item->base, it->wd->ed->reorder_item->scrl_x+it->pad_left, y);
+ evas_object_show(it->wd->ed->reorder_item->base);
+ _move_edit_controls( it,it->wd->ed->reorder_item->scrl_x, y );
+
+ it->block->updateme = 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);
+
+ return;
+ }
+}
+
+static void
+_select_all_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Item_Block *itb;
+ Elm_Genlist_Item *it = data;
+ Eina_List *l;
+ Widget_Data *wd = it->wd;
+ if (!wd) return;
+
+ Eina_List *realized_list = elm_genlist_realized_items_get(wd->obj);
+
+ if(!wd->selct_all)
+ edje_object_signal_emit(it->base, "elm,state,del_confirm", "elm");
+ else
+ edje_object_signal_emit(it->base, "elm,state,del,animated,enable", "elm");
+
+
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+
+ if(!wd->selct_all)
+ {
+ it->delete_check = 1;
+ it->del_confirm_state = 1;
+ edje_object_signal_emit(it->edit_obj, "elm,state,del_confirm", "elm");
+ }
+ else
+ {
+ it->delete_check = 0;
+ it->del_confirm_state = 0;
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,animated,enable", "elm");
+ }
+ }
+ }
+
+ wd->selct_all ^= 0xFF;
+
+ if (wd->ed->ec->item_selected)
+ {
+ wd->ed->ec->item_selected(NULL, it, wd->selct_all);
+ }
+
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+}
+
+static void
+_move_edit_controls( Elm_Genlist_Item *it, int itx, int ity )
+{
+ if(it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE )
+ return;
+
+ evas_object_resize(it->edit_obj,it->w, it->h );
+ evas_object_move(it->edit_obj, itx, ity );
+ evas_object_raise( it->edit_obj );
+}
+
+static void
+_edit_controls_eval( Elm_Genlist_Item *it )
+{
+ int itmode = 0;
+ const char *pad_str;
+ int pad = 0;
+ it->pad_left = 0;
+ it->pad_right = 0;
+ Evas_Object *icon;
+ if( it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE && !it->edit_obj )
+ return;
+
+
+ if( it->itc->func.editmode_get )
+ itmode = it->itc->func.editmode_get( it->data, it->wd->obj, it->wd->edit_mode );
+ itmode &= it->wd->edit_mode;
+
+ if(itmode & ELM_GENLIST_EDIT_MODE_SELECTALL)
+ itmode |= ELM_GENLIST_EDIT_MODE_SELECT;
+
+ if( !it->edit_obj )
+ {
+ it->edit_obj = edje_object_add(evas_object_evas_get(it->wd->obj));
+ edje_object_scale_set(it->edit_obj, elm_widget_scale_get(it->wd->obj) *
+ _elm_config->scale);
+ evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
+ elm_widget_sub_object_add(it->wd->obj, it->edit_obj);
+ _elm_theme_object_set(it->wd->obj, it->edit_obj, "genlist", "item/edit_control", elm_widget_style_get(it->wd->obj));
+
+ edje_object_signal_callback_add(it->edit_obj, "elm,action,edit,reset",
+ "elm", _edit_mode_reset, it);
+ }
+
+ pad_str = edje_object_data_get(it->edit_obj, "icon_width");
+ if (pad_str) pad = atoi(pad_str);
+
+ if( (itmode & ELM_GENLIST_EDIT_MODE_INSERT) )
+ {
+ if(it->wd->animate_edit_controls)
+ edje_object_signal_emit(it->edit_obj, "elm,state,ins,animated,enable", "elm");
+ else
+ edje_object_signal_emit(it->edit_obj, "elm,state,ins,enable", "elm");
+
+ edje_object_signal_callback_add(it->edit_obj, "elm,action,item,insert",
+ "elm", _insert_new_item_cb, it);
+ it->pad_left += pad;
+ }
+ else
+ {
+ if(it->wd->animate_edit_controls)
+ edje_object_signal_emit(it->edit_obj, "elm,state,ins,animated,disable", "elm");
+ else
+ edje_object_signal_emit(it->edit_obj, "elm,state,ins,disable", "elm");
+
+ edje_object_signal_callback_del(it->edit_obj, "elm,action,item,insert",
+ "elm", _insert_new_item_cb );
+ }
+
+ if( (itmode & ELM_GENLIST_EDIT_MODE_DELETE) || (itmode & ELM_GENLIST_EDIT_MODE_SELECT) )
+ {
+ if(it->wd->animate_edit_controls)
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,animated,enable", "elm");
+ else
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,enable", "elm");
+
+ edje_object_signal_callback_add(it->edit_obj, "elm,action,item,delete",
+ "elm", _remove_item_cb, it);
+
+ edje_object_signal_callback_add(it->edit_obj, "elm,action,hide,del_confirm",
+ "elm", _hide_delete_confirm_object, it );
+ it->pad_left += pad;
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _reorder_mouse_down, it);
+ }
+ else
+ {
+ if(it->wd->animate_edit_controls)
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,animated,disable", "elm");
+ else
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,disable", "elm");
+
+ edje_object_signal_callback_del(it->edit_obj, "elm,action,item,delete",
+ "elm", _remove_item_cb );
+ edje_object_signal_callback_del(it->edit_obj, "elm,action,hide,del_confirm",
+ "elm", _hide_delete_confirm_object );
+
+ }
+
+ if( (itmode & ELM_GENLIST_EDIT_MODE_REORDER) )
+ {
+ Evas_Object *reorder_icon;
+ const char* reorder_part;
+
+ reorder_part = edje_object_data_get(it->edit_obj, "reorder");
+ if( reorder_part && edje_object_part_exists(it->edit_obj, reorder_part ) )
+ {
+ reorder_icon = edje_object_part_object_get(it->edit_obj, reorder_part );
+
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _reorder_mouse_down, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_UP,
+ _reorder_mouse_up, it);
+ evas_object_event_callback_add(it->edit_obj, EVAS_CALLBACK_MOUSE_MOVE,
+ _reorder_mouse_move, it);
+ }
+ // it->pad_right += pad;
+ }
+ else
+ {
+ Evas_Object *reorder_icon;
+ const char* reorder_part;
+
+ reorder_part = edje_object_data_get(it->edit_obj, "reorder");
+ if( reorder_part && edje_object_part_exists(it->edit_obj, reorder_part ) )
+ {
+ reorder_icon = edje_object_part_object_get(it->edit_obj, reorder_part );
+
+ if(itmode == ELM_GENLIST_EDIT_MODE_NONE)
+ {
+ evas_object_event_callback_del(it->edit_obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _reorder_mouse_down);
+ evas_object_event_callback_del(it->edit_obj, EVAS_CALLBACK_MOUSE_UP,
+ _reorder_mouse_up);
+ evas_object_event_callback_del(it->edit_obj, EVAS_CALLBACK_MOUSE_MOVE,
+ _reorder_mouse_move);
+ }
+ }
+ }
+
+ if( it->wd->edit_mode != 0xF0) {
+ if( it->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE)
+ {
+ if (it->itc->func.icon_get)
+ {
+ edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,enable", "elm");
+
+ const Eina_List *l;
+ const char *key;
+
+ it->icons = _elm_stringlist_get(edje_object_data_get(it->edit_obj, "icons"));
+ EINA_LIST_FOREACH(it->icons, l, key)
+ {
+ Evas_Object *ic = it->itc->func.icon_get(it->data, it->wd->obj, l->data);
+
+ if (ic)
+ {
+ it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
+ edje_object_part_swallow(it->edit_obj, key, ic);
+ evas_object_show(ic);
+ // elm_widget_sub_object_add(it->wd->obj, ic);
+ }
+ }
+ }
+ }
+ else
+ {
+ edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
+ EINA_LIST_FREE(it->edit_icon_objs, icon)
+ evas_object_del(icon);
+
+ Evas_Object *editfield;
+ EINA_LIST_FREE(it->wd->edit_field, editfield)
+ evas_object_del(editfield);
+
+
+ }
+ }
+
+ if( it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE )//Unrealize
+ {
+ evas_object_del(it->edit_obj);
+ it->edit_obj = NULL;
+ return;
+ }
+ _move_edit_controls(it,it->scrl_x, it->scrl_y );
+ evas_object_show( it->edit_obj );
+}
+
+static void
+_notify_item_position( Elm_Genlist_Item *it )
+{
+ const Eina_List *l;
+ if( it->parent )
+ {
+ l = eina_list_last(it->parent->items);
+
+ //Check if the Item is First Node or Last node of its Parent & raise signal.
+ if( it->parent->items->data != it && l->data != it )
+ {
+ edje_object_signal_emit(it->base, "normal_item", "elm");
+ }
+ else
+ {
+ if(it->parent->items->data == it )
+ edje_object_signal_emit(it->base, "first_item", "elm");
+
+ if(l->data == it )
+ edje_object_signal_emit(it->base, "last_item", "elm");
+ }
+ }
+}
+
+
+static int
+_get_space_for_reorder_item( Elm_Genlist_Item *it )
+{
+ int top=0;
+ Evas_Coord rox, roy, row, roh;
+ if(!it->wd->ed)
+ return 0;
+
+ if( !(it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_REORDER ) || !it->wd->ed->reorder_item )
+ return 0;
+
+ evas_object_geometry_get(it->wd->ed->reorder_item->base, &rox, &roy, &row, &roh);
+
+ top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
+ rox, roy+roh/2, row, 1));
+
+ if( top )
+ {
+ it->wd->ed->reorder_rel = it;
+ it->scrl_y+=it->wd->ed->reorder_item->h;
+ return it->wd->ed->reorder_item->h;
+ }
+
+ return 0;
+}
+
+static void
_item_block_position(Item_Block *itb, int in)
{
const Eina_List *l;
- Elm_Genlist_Item *it;
+ Elm_Genlist_Item *it, *select_all_item;
+ Elm_Genlist_GroupItem *git = NULL;
Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
- int vis;
+ int vis=0;
+ int is_reorder = 0;
evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy, &cvw, &cvh);
+
+ if(itb->wd->select_all_item) {
+ select_all_item = itb->wd->select_all_item;
+
+ evas_object_resize(select_all_item->base, itb->w, select_all_item->h);
+ evas_object_move(select_all_item->base, 0, oy);
+ evas_object_raise(select_all_item->base);
+ evas_object_show(select_all_item->base);
+
+ y = select_all_item->h;
+ }
+
EINA_LIST_FOREACH(itb->items, l, it)
{
if (it->delete_me) continue;
_item_realize(it, in, 0);
if (!was_realized)
- evas_object_smart_callback_call(it->wd->obj,
+ evas_object_smart_callback_call(it->wd->obj,
"realized", it);
}
}
if (it->realized)
{
+ _notify_item_position( it );
if (vis)
{
- evas_object_resize(it->base, it->w, it->h);
- evas_object_move(it->base,
- ox + itb->x + it->x - itb->wd->pan_x,
- oy + itb->y + it->y - itb->wd->pan_y);
- evas_object_show(it->base);
- }
+ it->scrl_x = ox + itb->x + it->x - itb->wd->pan_x;
+ it->scrl_y = oy + itb->y + it->y - itb->wd->pan_y + itb->reoder_y;;
+ if( git != it->group_item )
+ {
+ git = it->group_item;
+ if( git )
+ {
+ git->visible = EINA_TRUE; //Mark Group Item to make it visible
+ if( git->items->data == it)
+ git->y = it->scrl_y;
+ if( GROUP_ALIGN_NORTH == git->align )
+ {
+ git->w = itb->w;
+ if( git->items->data == it)
+ {
+ it->scrl_y += git->minh;
+ y += git->minh;
+ }
+ }
+ }
+ }
+ if( git )
+ {
+ git->x = ox + itb->x - itb->wd->pan_x;
+
+ if( git->y < oy )
+ git->y = oy;
+
+ if( git->align == GROUP_ALIGN_WEST )
+ {
+ it->w -= git->w;
+ it->scrl_x += git->x + git->w;
+ git->h = (it->scrl_y + it->h) - git->y ;
+ if( git->h < it->h )
+ {
+ git->y = it->scrl_y;
+ git->h = it->h;
+ }
+ }
+ if( git->align == GROUP_ALIGN_NORTH )
+ {
+ git->h = git->minh;
+ if( (git->y + git->h) > (it->scrl_y + it->h) )
+ git->y = (it->scrl_y + it->h) - git->minh;
+
+ }
+ }
+
+ is_reorder = _get_space_for_reorder_item( it );
+
+ if(is_reorder)
+ it->reorder_check = 1;
+ else
+ it->reorder_check = 0;
+
+ if(it->wd->ed) {
+ if(it != it->wd->ed->reorder_item && is_reorder && in > 0 && in % it->wd->max_items_per_block == 0 && !itb->reoder_y) {
+ itb->reoder_y -= it->h;
+ it->scrl_y = oy + itb->y + it->y - itb->wd->pan_y + itb->reoder_y;
+ }
+ else if(it != it->wd->ed->reorder_item && is_reorder && in > 0 && in % it->wd->max_items_per_block == 0 && itb->reoder_y) {
+ itb->reoder_y = 0;
+ }
+ }
+ y += is_reorder;
+
+ if(!it->reordering )
+ {
+ _move_edit_controls( it,it->scrl_x, it->scrl_y );
+ evas_object_resize(it->base, it->w-(it->pad_left+it->pad_right), it->h);
+
+ evas_object_move(it->base, it->scrl_x+it->pad_left, it->scrl_y);
+
+ if(it->delete_check) {
+ edje_object_signal_emit(it->edit_obj, "elm,state,del_confirm", "elm");
+ edje_object_signal_emit(it->base, "elm,state,del_confirm", "elm");
+ }
+ evas_object_show(it->base);
+ }
+ }
else
{
if (!it->dragging)
_item_unrealize(it);
}
}
- y += it->h;
+
+ if(!it->reordering )
+ y += it->h;
+
in++;
}
+
+ if(itb->wd->select_all_item)
+ evas_object_raise(select_all_item->base);
+
+ if( vis )
+ {
+ itb->wd->animate_edit_controls = 0;
+ if(git)
+ git->visible = EINA_TRUE;
+ }
}
static void
{
_item_unrealize(it);
_item_realize(it, num, 0);
- evas_object_smart_callback_call(it->wd->obj,
+ evas_object_smart_callback_call(it->wd->obj,
"realized", it);
}
else
{
Pan *sd = evas_object_smart_data_get(obj);
Item_Block *itb;
+ Elm_Genlist_GroupItem *git;
Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
int in = 0;
+ if( sd->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE )
+ (void)_edit_mode_reset( sd->wd );
+ EINA_INLIST_FOREACH(sd->wd->group_items, git)
+ {
+ git->visible = EINA_FALSE;
+ }
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
}
in += itb->count;
}
+ EINA_INLIST_FOREACH(sd->wd->group_items, git)
+ {
+ if( git->visible )
+ {
+ evas_object_raise(git->base);
+ evas_object_resize( git->base, git->w, git->h-1 );
+ evas_object_move(git->base, git->x, git->y );
+ evas_object_show(git->base);
+ }
+ else
+ evas_object_hide(git->base);
+ }
+ if( (sd->wd->edit_mode & ELM_GENLIST_EDIT_MODE_REORDER ) && (sd->wd->ed->reorder_item ) )
+ {
+ evas_object_raise(sd->wd->ed->reorder_item->base);
+ evas_object_raise(sd->wd->ed->reorder_item->edit_obj);
+ }
}
static void
it->flags = flags;
it->func.func = func;
it->func.data = func_data;
+ it->depth = 0;
return it;
}
itb->wd = wd;
if (!it->rel->block)
{
- wd->blocks =
+ it->rel->block = itb;
+ wd->blocks =
eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
itb->items = eina_list_append(itb->items, it);
}
{
if (it->before)
{
- wd->blocks =
- eina_inlist_prepend_relative(wd->blocks,
- EINA_INLIST_GET(itb),
+ wd->blocks =
+ eina_inlist_prepend_relative(wd->blocks,
+ EINA_INLIST_GET(itb),
EINA_INLIST_GET(it->rel->block));
- itb->items =
+ itb->items =
eina_list_prepend_relative(itb->items, it, it->rel);
}
else
{
- wd->blocks =
- eina_inlist_append_relative(wd->blocks,
- EINA_INLIST_GET(itb),
+ wd->blocks =
+ eina_inlist_append_relative(wd->blocks,
+ EINA_INLIST_GET(itb),
EINA_INLIST_GET(it->rel->block));
- itb->items =
+ itb->items =
eina_list_append_relative(itb->items, it, it->rel);
}
}
itb = calloc(1, sizeof(Item_Block));
if (!itb) return;
itb->wd = wd;
- wd->blocks =
- eina_inlist_prepend(wd->blocks,
+ wd->blocks =
+ eina_inlist_prepend(wd->blocks,
EINA_INLIST_GET(itb));
}
}
itb = calloc(1, sizeof(Item_Block));
if (!itb) return;
itb->wd = wd;
- wd->blocks =
+ wd->blocks =
eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
}
itb->items = eina_list_prepend(itb->items, it);
itb = calloc(1, sizeof(Item_Block));
if (!itb) return;
itb->wd = wd;
- wd->blocks =
- eina_inlist_append(wd->blocks,
+ wd->blocks =
+ eina_inlist_append(wd->blocks,
EINA_INLIST_GET(itb));
}
}
itb = calloc(1, sizeof(Item_Block));
if (!itb) return;
itb->wd = wd;
- wd->blocks =
+ wd->blocks =
eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
}
itb->items = eina_list_append(itb->items, it);
itb->count++;
itb->changed = EINA_TRUE;
it->block = itb;
+
+ if(!itb->wd)
+ itb->wd = wd;
+
if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
if (it->rel)
itb2 = calloc(1, sizeof(Item_Block));
if (!itb2) return;
itb2->wd = wd;
- wd->blocks =
- eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
+ wd->blocks =
+ eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
EINA_INLIST_GET(itb));
itb2->changed = EINA_TRUE;
while ((itb->count > newc) && (itb->items))
}
}
+#if 1
+
static int
_queue_proecess(Widget_Data *wd, int norender)
{
_item_idler(void *data)
{
Widget_Data *wd = data;
-
+
if (_queue_proecess(wd, 1) > 0)
{
if (wd->calc_job) ecore_job_del(wd->calc_job);
static void
_item_queue(Widget_Data *wd, Elm_Genlist_Item *it)
{
- if (it->queued) return;
- it->queued = EINA_TRUE;
- wd->queue = eina_list_append(wd->queue, it);
- while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
+ while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
{
if (wd->queue_idler)
{
}
_queue_proecess(wd, 0);
}
+
+ if (it->queued) return;
if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_item_idler, wd);
+ it->queued = EINA_TRUE;
+ wd->queue = eina_list_append(wd->queue, it);
+}
+#else
+
+static int
+_item_idler(void *data)
+{
+ Widget_Data *wd = data;
+ int n, showme = 0;
+ double t0, t;
+
+ t0 = ecore_time_get();
+ for (n = 0; (wd->queue) && (n < 128); n++)
+ {
+ Elm_Genlist_Item *it;
+
+ it = wd->queue->data;
+ wd->queue = eina_list_remove_list(wd->queue, wd->queue);
+ it->queued = EINA_FALSE;
+ _item_block_add(wd, it);
+ t = ecore_time_get();
+ if (it->block->changed)
+ {
+ showme = _item_block_recalc(it->block, it->block->num, 1, 1);
+ it->block->changed = 0;
+ }
+ if (showme) it->block->showme = 1;
+ if (eina_inlist_count(wd->blocks) > 1)
+ {
+ if ((t - t0) > (ecore_animator_frametime_get())) break;
+ }
+ }
+ if (n > 0)
+ {
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+ }
+ if (!wd->queue)
+ {
+ wd->queue_idler = NULL;
+ return 0;
+ }
+ return 1;
+}
+
+static void
+_item_queue(Widget_Data *wd, Elm_Genlist_Item *it)
+{
+ Item_Block *itb;
+
+ // Add the initial set of Items directly to the Blocks, to show the genlist
+ // without empty screen.
+ itb = (Item_Block *)(wd->blocks);
+ if( (NULL == itb) || (itb->count < wd->max_items_per_block) )
+ {
+ _item_block_add(wd, it);
+ }
+ else
+ {
+ if (it->queued) return;
+ if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_item_idler, wd);
+ it->queued = EINA_TRUE;
+ wd->queue = eina_list_append(wd->queue, it);
+ }
+}
+
+#endif
+
+/**
+ * Add Group Item to the genlist
+ *
+ * @param obj The genlist object
+ * @param itc The item class for the item
+ * @param data The group item data
+ */
+EAPI Elm_Genlist_GroupItem *
+elm_genlist_groupitem_add(Evas_Object *obj, const Elm_Genlist_Item_Class *itc,
+ const void *data)
+{
+ Elm_Genlist_GroupItem *git;
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ git = calloc(1, sizeof(Elm_Genlist_GroupItem));
+ if (!git) return NULL;
+ git->wd = wd;
+ git->itc = itc;
+ git->data = data;
+
+ wd->group_items = eina_inlist_append(wd->group_items, EINA_INLIST_GET(git) );
+ return git;
+}
+
+/**
+ * Delete a given groupitem
+ *
+ * This deletes the group item from genlist and calls the genlist group item del class
+ * callback defined in the item class, if it is set.
+ *
+ * @param git The group item
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_groupitem_del(Elm_Genlist_GroupItem *git)
+{
+ _groupitem_remove( git, EINA_TRUE);
}
/**
if (ll) it2 = ll->data;
it->parent->items = eina_list_append(it->parent->items, it);
if (!it2) it2 = it->parent;
- wd->items =
- eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
+ wd->items =
+ eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
EINA_INLIST_GET(it2));
+ if( it->parent->group_item)
+ _set_groupitem( it, it->parent->group_item );
it->rel = it2;
it->rel->relcount++;
it->before = 0;
}
/**
+ * Append item to the end of the genlist with Group Item
+ *
+ * This appends the given item to the end of the list or the end of the
+ * children if the parent is given.
+ *
+ * @param obj The genlist object
+ * @param itc The item class for the item
+ * @param data The item data
+ * @param parent The parent item, or NULL if none
+ * @param flags Item flags
+ * @param git Group Item
+ * @param func Convenience function called when item selected
+ * @param func_data Data passed to @p func above.
+ * @return A handle to the item added or NULL if not possible
+ *
+ * @ingroup Genlist
+ */
+EAPI Elm_Genlist_Item *
+elm_genlist_item_append_with_group(Evas_Object *obj, const Elm_Genlist_Item_Class *itc,
+ const void *data, Elm_Genlist_Item *parent,
+ Elm_Genlist_Item_Flags flags, Elm_Genlist_GroupItem *git,
+ Evas_Smart_Cb func, const void *func_data)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func, func_data);
+ if (!wd) return NULL;
+ if (!it) return NULL;
+ if (!it->parent)
+ {
+ wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
+ it->rel = NULL;
+ it->before = 0;
+ }
+ else
+ {
+ Elm_Genlist_Item *it2 = NULL;
+ Eina_List *ll = eina_list_last(it->parent->items);
+ if (ll) it2 = ll->data;
+ it->parent->items = eina_list_append(it->parent->items, it);
+ if (!it2) it2 = it->parent;
+ wd->items =
+ eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
+ EINA_INLIST_GET(it2));
+ if( it->parent->group_item)
+ _set_groupitem( it, it->parent->group_item );
+ it->rel = it2;
+ it->rel->relcount++;
+ it->before = 0;
+ }
+ _set_groupitem( it, git );
+ _item_queue(wd, it);
+ return it;
+}
+
+/**
* Prepend item at start of the genlist
*
* This adds an item to the beginning of the list or beginning of the children
if (!wd) return NULL;
if (!it) return NULL;
if (!it->parent)
- wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
+ wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
EINA_INLIST_GET(before));
else
{
if (!wd) return NULL;
if (!it) return NULL;
if (!it->parent)
- wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
+ wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
EINA_INLIST_GET(after));
else
{
}
/**
+ * Moves the Genlist Item
+ */
+EAPI void
+elm_genlist_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after )
+{
+ if (!it) return;
+
+ Elm_Genlist_Item *next_item = elm_genlist_item_next_get(after);
+
+ if(it->y == after->y && after->reorder_check && it->reorder_check) {
+ if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
+ it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
+ return;
+ }
+
+ it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
+ _item_block_del(it);
+
+ if(!next_item && after->reorder_check == 0 || next_item && after->reorder_check == 0 )
+ {
+
+ if(next_item && after->reorder_check == 0 && it == after) {
+ it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it),
+ EINA_INLIST_GET(next_item));
+ it->rel = next_item;
+ }
+ else {
+ it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it),
+ EINA_INLIST_GET(after));
+ it->rel = after;
+ }
+
+ it->rel->relcount++;
+ it->before = 0;
+ }
+ else
+ {
+ if( after)
+ {
+ it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it),
+ EINA_INLIST_GET(after));
+ it->rel = after;
+ it->rel->relcount++;
+ }
+ else
+ {
+ it->wd->items = eina_inlist_prepend(it->wd->items, EINA_INLIST_GET(it));
+ }
+
+ it->before = 1;
+ }
+
+ _item_queue(it->wd, it);
+}
+
+/**
* Clear the genlist
*
* This clears all items in the list, leaving it empty.
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
+
+ while (wd->group_items)
+ {
+ _groupitem_remove((Elm_Genlist_GroupItem *)wd->group_items, EINA_FALSE);
+ }
+
if (wd->walking > 0)
{
Elm_Genlist_Item *it;
return;
}
wd->clear_me = 0;
+
while (wd->items)
{
Elm_Genlist_Item *it = (Elm_Genlist_Item *)(wd->items);
{
Eina_List *l;
Elm_Genlist_Item *it;
-
+
done = 1;
EINA_LIST_FOREACH(itb->items, l, it)
{
if (it->realized)
edje_object_signal_emit(it->base, "elm,state,expanded", "elm");
evas_object_smart_callback_call(it->wd->obj, "expanded", it);
+
}
else
{
/**
* Set bounce mode
*
- * This will enable or disable the scroller bounce mode for the genlist. See
+ * This will enable or disable the scroller bounce mode for the genlist. See
* elm_scroller_bounce_set() for details
*
* @param obj The genlist object
}
/**
+ * Set the Genlist Internal scroller scrollbar policy
+ *
+ * This sets the Genlist Internal scrollbar visibility policy.
+ * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it
+ * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
+ * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
+ * This applies respectively for the horizontal and vertical scrollbars.
+ *
+ * @param obj The Genlist object
+ * @param policy_h Horizontal scrollbar policy
+ * @param policy_v Vertical scrollbar policy
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ const Elm_Scroller_Policy map[3] =
+ {
+ ELM_SMART_SCROLLER_POLICY_AUTO,
+ ELM_SMART_SCROLLER_POLICY_ON,
+ ELM_SMART_SCROLLER_POLICY_OFF
+ };
+ if ((policy_h < 0) || (policy_h >= 3) || (policy_v < 0) || (policy_v >= 3))
+ return;
+
+ elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
+}
+
+EAPI void
+elm_genlist_set_edit_mode(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *edit_class)
+{
+ fprintf(stderr, "=================> Caution!!! <========================\n");
+ fprintf(stderr, "==> elm_genlist_set_edit_mode() is deprecated. <=======\n");
+ fprintf(stderr, "==> Please use elm_genlist_edit_mode_set() instead. <==\n");
+ fprintf(stderr, "=======================================================\n");
+
+ elm_genlist_edit_mode_set(obj, emode, edit_class);
+}
+
+/**
+ * Set Genlist edit mode
+ *
+ * This sets Genlist edit mode.
+ *
+ * @param obj The Genlist object
+ * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
+ * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_edit_mode_set(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *edit_class)
+{
+ Eina_List * realized_list;
+ Elm_Genlist_Item *it;
+ Eina_List *l;
+ Item_Block *itb;
+
+ Elm_Genlist_Item *it_new;
+ static Elm_Genlist_Item_Class itc;
+
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->edit_mode == emode) return;
+
+ wd->edit_mode = emode;
+
+ wd->animate_edit_controls = 1;
+
+ if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL)
+ wd->edit_mode |= ELM_GENLIST_EDIT_MODE_SELECT;
+
+ if (wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
+ {
+ if (wd->ed) free (wd->ed);
+ wd->ed = NULL;
+ }
+ else
+ {
+ if (!wd->ed)
+ wd->ed = calloc(1, sizeof(Edit_Data));
+
+ wd->ed->ec = edit_class;
+
+ if (((wd->edit_mode & ELM_GENLIST_EDIT_MODE_DELETE) || (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECT)) && !wd->ed->del_confirm)
+ {
+ wd->ed->del_confirm = elm_button_add(wd->obj);
+ elm_button_label_set(wd->ed->del_confirm, "Delete");
+ evas_object_smart_member_add(wd->ed->del_confirm, wd->pan_smart);
+ edje_object_scale_set( wd->ed->del_confirm, elm_widget_scale_get(wd->ed->del_confirm) *
+ _elm_config->scale);
+ evas_object_smart_callback_add(wd->ed->del_confirm, "clicked", _delete_confirm_cb, wd );
+ }
+ }
+
+ realized_list = elm_genlist_realized_items_get(obj);
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ it->delete_check = 0;
+ it->del_confirm_state = 0;
+ _item_unselect(it);
+ _edit_controls_eval(it);
+ }
+ }
+
+ if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL)
+ {
+ itc.item_style = "select_all";
+ itc.func.label_get = NULL;
+ itc.func.icon_get = NULL;
+ itc.func.del = NULL;
+ itc.func.editmode_get = NULL;
+
+ wd->select_all_item = _item_new(wd, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ if (!wd) return NULL;
+ if (!wd->select_all_item) return NULL;
+
+ _item_realize(wd->select_all_item, 0, 0);
+ edje_object_signal_callback_add(wd->select_all_item->base, "elm,action,select,press", "elm", _select_all_down, wd->select_all_item);
+
+ wd->select_all_item->rel = NULL;
+ wd->select_all_item->selected = 0;
+ wd->select_all_item->before = 1;
+ wd->select_all_item->block = NULL;
+
+ }
+ else
+ {
+ if (wd->select_all_item)
+ {
+ if (wd->select_all_item->realized) _item_unrealize(wd->select_all_item);
+ free(wd->select_all_item);
+ }
+ wd->select_all_item = NULL;
+
+ }
+ edje_object_signal_emit(wd->scr, "elm,state,edit,animated,enable", "elm");
+
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+}
+
+/**
+ * Get expanded depth.
+ *
+ * @param it The genlist item object
+ *
+ * @ingroup Genlist
+ */
+EAPI int
+elm_genlist_item_expanded_depth_get(Elm_Genlist_Item *it)
+{
+ if (!it) return;
+
+ return it->depth;
+}
+
+
+/**
+ * Delete selected items in genlist edit mode.
+ *
+ * @param obj The genlist object
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_edit_selected_items_del(Evas_Object *obj)
+{
+ Elm_Genlist_Item *it;
+ Eina_List *l, *realized_list;
+ Item_Block *itb;
+
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+ if (itb->realized)
+ {
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ if (it->delete_check)
+ elm_genlist_item_del( it );
+ }
+ }
+ }
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+}
+
+EAPI void
+elm_genlist_selected_items_del(Evas_Object *obj)
+{
+ fprintf(stderr, "=================> Caution!!! <========================\n");
+ fprintf(stderr, "==> elm_genlist_selected_items_del() is deprecated. <=======\n");
+ fprintf(stderr, "==> Please use elm_genlist_edit_selected_items_del() instead. <==\n");
+ fprintf(stderr, "=======================================================\n");
+ elm_genlist_edit_selected_items_del(obj);
+}
+
+/**
+ * Get a list of selected items in genlist
+ *
+ * This returns a list of the selected items in the genlist. The list
+ * contains Elm_Genlist_Item pointers. The list must be freed by the
+ * caller when done with eina_list_free(). The item pointers in the list
+ * are only vallid so long as those items are not deleted or the genlist is
+ * not deleted.
+ *
+ * @param obj The genlist object
+ * @return The list of selected items, nor NULL if none are selected.
+ *
+ * @ingroup Genlist
+ */
+EAPI Eina_List *
+elm_genlist_edit_selected_items_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_List *list = NULL;
+ Item_Block *itb;
+ Eina_Bool done = EINA_FALSE;
+ if (!wd) return NULL;
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+ if (itb->realized)
+ {
+ Eina_List *l;
+ Elm_Genlist_Item *it;
+
+ done = 1;
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ if (it->delete_check) list = eina_list_append(list, it);
+ }
+ }
+ else
+ {
+ if (done) break;
+ }
+ }
+ return list;
+}
+
+/**
+ * Set a given item's rename mode
+ *
+ * This renames the item's label from genlist
+ *
+ * @param it The item
+ * @param emode set if emode is EINA_TRUE, unset if emode is EINA_FALSE
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, int emode)
+{
+ if (!it) return;
+
+ const Eina_List *l, *list, *l2;
+ const char *label, *rename_swallow_part, *s;
+ Eina_Bool done = EINA_FALSE;
+ int label_cnt = 0 , swallow_part_cnt = 0;
+
+ Item_Block *itb;
+ Evas_Object *editfield;
+ Evas_Object *entry;
+ int edit_field_cnt = 0;
+
+ if (it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
+ {
+ it->wd->edit_mode = 0xF0;
+ _edit_controls_eval(it);
+ }
+
+ EINA_INLIST_FOREACH(it->wd->blocks, itb)
+ {
+ if (itb->realized)
+ {
+ Eina_List *l;
+ Elm_Genlist_Item *it;
+
+ done = EINA_TRUE;
+ EINA_LIST_FOREACH(itb->items, l, it)
+ {
+ if (it->renamed)
+ {
+ it->renamed = EINA_FALSE;
+
+
+ EINA_LIST_FOREACH(it->wd->edit_field, l2, editfield)
+ {
+ entry = elm_editfield_entry_get(editfield);
+ char *text = elm_entry_entry_get(entry);
+
+ if (it->itc->func.label_changed)
+ it->itc->func.label_changed( it->data, it, text, edit_field_cnt++);
+ }
+ Ecore_IMF_Context *imf = elm_entry_imf_context_get(entry);
+ ecore_imf_context_input_panel_hide(imf);
+
+ Evas_Object *editfield;
+ EINA_LIST_FREE(it->wd->edit_field, editfield)
+ evas_object_del(editfield);
+
+ if (it->wd->edit_mode)
+ {
+ if ((it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_INSERT))
+ edje_object_signal_emit(it->edit_obj, "elm,state,ins,enable", "elm");
+
+ if ((it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_DELETE) || (it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECT))
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,enable", "elm");
+
+ if ((it->wd->edit_mode & ELM_GENLIST_EDIT_MODE_REORDER))
+ edje_object_signal_emit(it->edit_obj, "elm,state,rename,disable", "elm");
+ }
+ if (it->edit_obj)
+ {
+ evas_object_del(it->edit_obj);
+ it->edit_obj = NULL;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (done) break;
+ }
+ }
+
+ // if (emode != ELM_GENLIST_RENAME_MODE_NONE)
+ if (emode != 0)
+ {
+ it->renamed = EINA_TRUE;
+
+ it->labels = _elm_stringlist_get(edje_object_data_get(it->base, "labels"));
+ EINA_LIST_FOREACH(it->labels, list, label)
+ {
+ edje_object_signal_emit(it->edit_obj, "elm,state,rename,enable", "elm");
+ edje_object_signal_emit(it->edit_obj, "elm,state,ins,disable", "elm");
+ edje_object_signal_emit(it->edit_obj, "elm,state,del,disable", "elm");
+ edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
+
+ if (it->itc->func.label_get)
+ {
+ it->renamed = EINA_TRUE;
+ swallow_part_cnt = 0;
+
+ Eina_List *rename = _elm_stringlist_get(edje_object_data_get(it->edit_obj, "rename"));
+ EINA_LIST_FOREACH(rename, l, rename_swallow_part)
+ {
+ if (label_cnt == swallow_part_cnt)
+ {
+ editfield = elm_editfield_add(it->wd->obj);
+ it->wd->edit_field = eina_list_append(it->wd->edit_field, editfield);
+
+
+ elm_editfield_entry_single_line_set(editfield, EINA_TRUE);
+ elm_editfield_eraser_set(editfield, EINA_TRUE);
+ edje_object_part_swallow(it->edit_obj, rename_swallow_part, editfield);
+
+ evas_object_show(editfield);
+
+ s = it->itc->func.label_get(it->data, it->wd->obj, list->data);
+
+ if (s)
+ {
+ Evas_Object *entry = elm_editfield_entry_get(editfield);
+ elm_entry_entry_set(entry,s);
+
+ free(s);
+ }
+ else
+ elm_editfield_guide_text_set(editfield, "Text Input");
+ }
+ swallow_part_cnt++;
+ }
+ label_cnt++;
+ }
+ }
+ }
+
+ if (it->wd->edit_mode == 0xF0)
+ {
+ it->wd->edit_mode = 0;
+ }
+}
+
+/**
* Set the timeout in seconds for the longpress event
*
* @param obj The genlist object
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return wd->longpress_timeout;
-}
+}
\ No newline at end of file