forked from enlightenment/efl
more genlist/gengrid merging: select+clear are now abstracted
SVN revision: 64275
This commit is contained in:
parent
136032470c
commit
5852948858
|
@ -7901,6 +7901,7 @@ extern "C" {
|
|||
* @}
|
||||
*/
|
||||
|
||||
/* TEMPORARY: DOCS WILL BE FILLED IN WITH CNP/SED */
|
||||
typedef struct Elm_Gen_Item Elm_Gen_Item;
|
||||
typedef struct _Elm_Gen_Item_Class Elm_Gen_Item_Class;
|
||||
typedef struct _Elm_Gen_Item_Class_Func Elm_Gen_Item_Class_Func; /**< Class functions for gen item classes. */
|
||||
|
@ -7908,13 +7909,6 @@ extern "C" {
|
|||
typedef Evas_Object *(*Elm_Gen_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for gen item classes. */
|
||||
typedef Eina_Bool (*Elm_Gen_Item_State_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gen item classes. */
|
||||
typedef void (*Elm_Gen_Item_Del_Cb) (void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */
|
||||
|
||||
/**
|
||||
* @struct _Elm_Gen_Item_Class
|
||||
*
|
||||
* Gen item class definition. See @ref Gen_Item_Class for
|
||||
* field details.
|
||||
*/
|
||||
struct _Elm_Gen_Item_Class
|
||||
{
|
||||
const char *item_style;
|
||||
|
@ -7925,7 +7919,9 @@ extern "C" {
|
|||
Elm_Gen_Item_State_Get_Cb state_get;
|
||||
Elm_Gen_Item_Del_Cb del;
|
||||
} func;
|
||||
}; /**< #Elm_Gen_Item_Class member definitions */
|
||||
};
|
||||
EAPI void elm_gen_clear(Evas_Object *obj);
|
||||
EAPI void elm_gen_item_selected_set(Elm_Gen_Item *it, Eina_Bool selected);
|
||||
|
||||
/**
|
||||
* @defgroup Gengrid Gengrid (Generic grid)
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
#include <Elementary.h>
|
||||
#include <Elementary_Cursor.h>
|
||||
#include "elm_priv.h"
|
||||
#include "els_scroller.h"
|
||||
#include "elm_gen.h"
|
||||
|
||||
/* TEMPORARY */
|
||||
#undef ELM_CHECK_WIDTYPE
|
||||
#define ELM_CHECK_WIDTYPE(obj, widtype) \
|
||||
if ((!obj) || (!elm_gen_type_check((obj), __func__))) return
|
||||
#undef ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN
|
||||
#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
|
||||
ELM_CHECK_WIDTYPE(WIDGET((it)), widtype) __VA_ARGS__;
|
||||
|
||||
static const char *_gengrid = NULL;
|
||||
static const char *_genlist = NULL;
|
||||
|
||||
struct _Widget_Data
|
||||
{
|
||||
Eina_Inlist_Sorted_State *state;
|
||||
|
@ -19,6 +32,8 @@ struct _Widget_Data
|
|||
int walking;
|
||||
int item_width, item_height;
|
||||
int group_item_width, group_item_height;
|
||||
int minw, minh;
|
||||
long count;
|
||||
Evas_Coord pan_x, pan_y;
|
||||
Eina_Bool reorder_mode : 1;
|
||||
Eina_Bool on_hold : 1;
|
||||
|
@ -26,8 +41,77 @@ struct _Widget_Data
|
|||
Eina_Bool no_select : 1;
|
||||
Eina_Bool wasselected : 1;
|
||||
Eina_Bool always_select : 1;
|
||||
Eina_Bool clear_me : 1;
|
||||
Ecore_Cb del_cb, calc_cb, sizing_cb;
|
||||
Ecore_Cb clear_cb;
|
||||
};
|
||||
|
||||
static const char SIG_ACTIVATED[] = "activated";
|
||||
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
||||
static const char SIG_SELECTED[] = "selected";
|
||||
static const char SIG_UNSELECTED[] = "unselected";
|
||||
static const char SIG_EXPANDED[] = "expanded";
|
||||
static const char SIG_CONTRACTED[] = "contracted";
|
||||
static const char SIG_EXPAND_REQUEST[] = "expand,request";
|
||||
static const char SIG_CONTRACT_REQUEST[] = "contract,request";
|
||||
static const char SIG_REALIZED[] = "realized";
|
||||
static const char SIG_UNREALIZED[] = "unrealized";
|
||||
static const char SIG_DRAG_START_UP[] = "drag,start,up";
|
||||
static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
|
||||
static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
|
||||
static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
|
||||
static const char SIG_DRAG_STOP[] = "drag,stop";
|
||||
static const char SIG_DRAG[] = "drag";
|
||||
static const char SIG_LONGPRESSED[] = "longpressed";
|
||||
static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
|
||||
static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
|
||||
static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
|
||||
static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
|
||||
static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
|
||||
static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
|
||||
static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
|
||||
static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
|
||||
static const char SIG_EDGE_TOP[] = "edge,top";
|
||||
static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
|
||||
static const char SIG_EDGE_LEFT[] = "edge,left";
|
||||
static const char SIG_EDGE_RIGHT[] = "edge,right";
|
||||
static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
|
||||
static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
|
||||
static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
|
||||
static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
|
||||
static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
|
||||
static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
|
||||
static const char SIG_SWIPE[] = "swipe";
|
||||
static const char SIG_MOVED[] = "moved";
|
||||
|
||||
/* THIS FUNCTION IS HACKY AND TEMPORARY!!! */
|
||||
Eina_Bool
|
||||
elm_gen_type_check(const Evas_Object *obj,
|
||||
const char *func)
|
||||
{
|
||||
const char *provided, *expected = "(unknown)";
|
||||
static int abort_on_warn = -1;
|
||||
provided = elm_widget_type_get(obj);
|
||||
if (!_genlist) _genlist = eina_stringshare_add("genlist");
|
||||
if (!_gengrid) _gengrid = eina_stringshare_add("gengrid");
|
||||
if (EINA_LIKELY(provided == _genlist) || EINA_LIKELY(provided == _gengrid))
|
||||
return EINA_TRUE;
|
||||
if ((!provided) || (!provided[0]))
|
||||
{
|
||||
provided = evas_object_type_get(obj);
|
||||
if ((!provided) || (!provided[0]))
|
||||
provided = "(unknown)";
|
||||
}
|
||||
ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected);
|
||||
if (abort_on_warn == -1)
|
||||
{
|
||||
if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
|
||||
else abort_on_warn = 0;
|
||||
}
|
||||
if (abort_on_warn == 1) abort();
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_item_label_hook(Elm_Gen_Item *it, const char *part)
|
||||
{
|
||||
|
@ -228,11 +312,44 @@ _item_single_select_right(Widget_Data *wd)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
_item_select(Elm_Gen_Item *it)
|
||||
{
|
||||
if ((it->wd->no_select) || (it->delete_me) || (it->mode_set)) 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;
|
||||
|
||||
evas_object_ref(WIDGET(it));
|
||||
it->walking++;
|
||||
it->wd->walking++;
|
||||
if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
|
||||
if (!it->delete_me)
|
||||
evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
|
||||
it->walking--;
|
||||
it->wd->walking--;
|
||||
if ((it->wd->clear_me) && (!it->wd->walking))
|
||||
elm_gen_clear(WIDGET(it));
|
||||
else
|
||||
{
|
||||
if ((!it->walking) && (it->delete_me))
|
||||
{
|
||||
if (!it->relcount) it->del_cb(it);
|
||||
}
|
||||
else
|
||||
it->wd->last_selected_item = it;
|
||||
}
|
||||
evas_object_unref(WIDGET(it));
|
||||
}
|
||||
/******************************************************************************/
|
||||
void
|
||||
elm_gen_item_unrealize(Elm_Gen_Item *it,
|
||||
Eina_Bool calc,
|
||||
Ecore_Cb extra_cb)
|
||||
Eina_Bool calc)
|
||||
{
|
||||
Evas_Object *icon;
|
||||
|
||||
|
@ -240,7 +357,7 @@ elm_gen_item_unrealize(Elm_Gen_Item *it,
|
|||
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), "unrealized", it);
|
||||
evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
|
||||
if (it->long_timer)
|
||||
{
|
||||
ecore_timer_del(it->long_timer);
|
||||
|
@ -257,7 +374,7 @@ elm_gen_item_unrealize(Elm_Gen_Item *it,
|
|||
EINA_LIST_FREE(it->icon_objs, icon)
|
||||
evas_object_del(icon);
|
||||
|
||||
if (extra_cb) extra_cb(it);
|
||||
it->unrealize_cb(it);
|
||||
|
||||
it->realized = EINA_FALSE;
|
||||
it->want_unrealize = EINA_FALSE;
|
||||
|
@ -277,13 +394,9 @@ elm_gen_item_del_notserious(Elm_Gen_Item *it)
|
|||
}
|
||||
|
||||
void
|
||||
elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job)
|
||||
elm_gen_item_del_serious(Elm_Gen_Item *it)
|
||||
{
|
||||
elm_widget_item_pre_notify_del(it);
|
||||
if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
|
||||
it->delete_me = EINA_TRUE;
|
||||
if ((!it->delete_me) && (it->itc->func.del))
|
||||
it->itc->func.del((void *)it->base.data, WIDGET(it));
|
||||
elm_gen_item_del_notserious(it);
|
||||
it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
|
||||
if (it->tooltip.del_cb)
|
||||
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
||||
|
@ -293,7 +406,7 @@ elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job)
|
|||
it->wd->group_items = eina_list_remove(it->wd->group_items, it);
|
||||
|
||||
if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
|
||||
it->wd->calc_job = ecore_job_add(job, it->wd);
|
||||
it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd);
|
||||
free(it->item);
|
||||
it->item = NULL;
|
||||
elm_widget_item_del(it);
|
||||
|
@ -317,8 +430,90 @@ elm_gen_item_new(Widget_Data *wd,
|
|||
it->parent = parent;
|
||||
it->func.func = func;
|
||||
it->func.data = func_data;
|
||||
/* TEMPORARY */
|
||||
it->sel_cb = (Ecore_Cb)_item_select;
|
||||
|
||||
elm_widget_item_text_get_hook_set(it, _item_label_hook);
|
||||
return it;
|
||||
}
|
||||
/******************************************************************************/
|
||||
|
||||
EAPI void
|
||||
elm_gen_item_selected_set(Elm_Gen_Item *it,
|
||||
Eina_Bool selected)
|
||||
{
|
||||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
|
||||
Widget_Data *wd = it->wd;
|
||||
if (!wd) return;
|
||||
if ((it->delete_me) || (it->disabled)) return;
|
||||
selected = !!selected;
|
||||
if (it->selected == selected) return;
|
||||
|
||||
if (selected)
|
||||
{
|
||||
if (!wd->multi)
|
||||
{
|
||||
while (wd->selected)
|
||||
{
|
||||
if (it->unhighlight_cb) it->unhighlight_cb(wd->selected->data);
|
||||
it->unsel_cb(wd->selected->data);
|
||||
}
|
||||
}
|
||||
it->highlight_cb(it);
|
||||
_item_select(it);
|
||||
return;
|
||||
}
|
||||
if (it->unhighlight_cb) it->unhighlight_cb(it);
|
||||
it->unsel_cb(it);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_gen_clear(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
|
||||
if (wd->state)
|
||||
{
|
||||
eina_inlist_sorted_state_free(wd->state);
|
||||
wd->state = NULL;
|
||||
}
|
||||
|
||||
if (wd->walking > 0)
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
wd->clear_me = 1;
|
||||
EINA_INLIST_FOREACH(wd->items, it)
|
||||
it->delete_me = 1;
|
||||
return;
|
||||
}
|
||||
evas_event_freeze(evas_object_evas_get(wd->obj));
|
||||
while (wd->items)
|
||||
{
|
||||
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
it->del_cb(it);
|
||||
}
|
||||
wd->clear_me = 0;
|
||||
if (wd->calc_job)
|
||||
{
|
||||
ecore_job_del(wd->calc_job);
|
||||
wd->calc_job = NULL;
|
||||
}
|
||||
if (wd->selected) wd->selected = eina_list_free(wd->selected);
|
||||
if (wd->clear_cb) wd->clear_cb(wd);
|
||||
wd->pan_x = 0;
|
||||
wd->pan_y = 0;
|
||||
wd->minw = 0;
|
||||
wd->minh = 0;
|
||||
wd->count = 0;
|
||||
if (wd->pan_smart)
|
||||
{
|
||||
evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
|
||||
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
|
||||
}
|
||||
if (wd->sizing_cb) wd->sizing_cb(wd->obj);
|
||||
elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
|
||||
evas_event_thaw(evas_object_evas_get(wd->obj));
|
||||
evas_event_thaw_eval(evas_object_evas_get(wd->obj));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include <Elementary_Cursor.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
#define ELM_GEN_ITEM_FROM_INLIST(it) \
|
||||
((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
|
||||
|
||||
typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type;
|
||||
typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
@ -46,6 +49,8 @@ struct Elm_Gen_Item
|
|||
} func;
|
||||
|
||||
Elm_Gen_Item_Tooltip tooltip;
|
||||
Ecore_Cb del_cb, sel_cb, highlight_cb;
|
||||
Ecore_Cb unsel_cb, unhighlight_cb, unrealize_cb;
|
||||
|
||||
Eina_Bool want_unrealize : 1;
|
||||
Eina_Bool display_only : 1;
|
||||
|
@ -58,6 +63,7 @@ struct Elm_Gen_Item
|
|||
Eina_Bool down : 1;
|
||||
Eina_Bool group : 1;
|
||||
Eina_Bool reorder : 1;
|
||||
Eina_Bool mode_set : 1; /* item uses style mode for highlight/select */
|
||||
};
|
||||
|
||||
Elm_Gen_Item *
|
||||
|
@ -70,10 +76,9 @@ elm_gen_item_new(Widget_Data *wd,
|
|||
|
||||
void
|
||||
elm_gen_item_unrealize(Elm_Gen_Item *it,
|
||||
Eina_Bool calc,
|
||||
Ecore_Cb extra_cb);
|
||||
Eina_Bool calc);
|
||||
void
|
||||
elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job);
|
||||
elm_gen_item_del_serious(Elm_Gen_Item *it);
|
||||
|
||||
void
|
||||
elm_gen_item_del_notserious(Elm_Gen_Item *it);
|
||||
|
|
|
@ -12,6 +12,15 @@
|
|||
#define PRELOAD 1
|
||||
#define REORDER_EFFECT_TIME 0.5
|
||||
|
||||
#define ELM_GEN_SETUP(wd) \
|
||||
(wd)->calc_cb = (Ecore_Cb)_calc_job
|
||||
|
||||
#define ELM_GEN_ITEM_SETUP(it) \
|
||||
(it)->del_cb = (Ecore_Cb)_item_del; \
|
||||
(it)->highlight_cb = (Ecore_Cb)_item_highlight; \
|
||||
(it)->unsel_cb = (Ecore_Cb)_item_unselect; \
|
||||
(it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
|
||||
|
||||
struct Elm_Gen_Item_Type
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
|
@ -40,6 +49,8 @@ struct _Widget_Data
|
|||
int walking;
|
||||
int item_width, item_height;
|
||||
int group_item_width, group_item_height;
|
||||
int minw, minh;
|
||||
long count;
|
||||
Evas_Coord pan_x, pan_y;
|
||||
Eina_Bool reorder_mode : 1;
|
||||
Eina_Bool on_hold : 1;
|
||||
|
@ -47,32 +58,28 @@ struct _Widget_Data
|
|||
Eina_Bool no_select : 1;
|
||||
Eina_Bool wasselected : 1;
|
||||
Eina_Bool always_select : 1;
|
||||
Eina_Bool clear_me : 1;
|
||||
Ecore_Cb del_cb, calc_cb, sizing_cb;
|
||||
Ecore_Cb clear_cb;
|
||||
////////////////////////////////////
|
||||
double align_x, align_y;
|
||||
|
||||
Evas_Coord old_pan_x, old_pan_y;
|
||||
Evas_Coord minw, minh; /* Total obj size */
|
||||
Evas_Coord reorder_item_x, reorder_item_y;
|
||||
unsigned int nmax;
|
||||
long count;
|
||||
long items_lost;
|
||||
|
||||
Eina_Bool horizontal : 1;
|
||||
Eina_Bool longpressed : 1;
|
||||
Eina_Bool clear_me : 1;
|
||||
Eina_Bool h_bounce : 1;
|
||||
Eina_Bool v_bounce : 1;
|
||||
Eina_Bool reorder_item_changed : 1;
|
||||
Eina_Bool move_effect_enabled : 1;
|
||||
};
|
||||
|
||||
#define ELM_GENGRID_ITEM_FROM_INLIST(it) \
|
||||
((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
|
||||
|
||||
static const char *widtype = NULL;
|
||||
static void _item_highlight(Elm_Gen_Item *it);
|
||||
static void _item_unrealize_cb(Elm_Gen_Item *it);
|
||||
static void _item_select(Elm_Gen_Item *it);
|
||||
static void _item_unselect(Elm_Gen_Item *it);
|
||||
static void _calc_job(void *data);
|
||||
static void _on_focus_hook(void *data,
|
||||
|
@ -430,9 +437,9 @@ _item_single_select_up(Widget_Data *wd)
|
|||
|
||||
if (!wd->selected)
|
||||
{
|
||||
prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
|
||||
prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
|
||||
while ((prev) && (prev->delete_me))
|
||||
prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
||||
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
||||
elm_gengrid_item_selected_set(prev, EINA_TRUE);
|
||||
elm_gengrid_item_show(prev);
|
||||
return EINA_TRUE;
|
||||
|
@ -464,9 +471,9 @@ _item_single_select_down(Widget_Data *wd)
|
|||
|
||||
if (!wd->selected)
|
||||
{
|
||||
next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
|
||||
next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
while ((next) && (next->delete_me))
|
||||
next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
||||
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
||||
elm_gengrid_item_selected_set(next, EINA_TRUE);
|
||||
elm_gengrid_item_show(next);
|
||||
return EINA_TRUE;
|
||||
|
@ -495,9 +502,9 @@ _item_single_select_left(Widget_Data *wd)
|
|||
Elm_Gen_Item *prev;
|
||||
if (!wd->selected)
|
||||
{
|
||||
prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
|
||||
prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
|
||||
while ((prev) && (prev->delete_me))
|
||||
prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
||||
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
||||
}
|
||||
else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
|
||||
|
||||
|
@ -516,9 +523,9 @@ _item_single_select_right(Widget_Data *wd)
|
|||
Elm_Gen_Item *next;
|
||||
if (!wd->selected)
|
||||
{
|
||||
next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
|
||||
next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
while ((next) && (next->delete_me))
|
||||
next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
||||
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
||||
}
|
||||
else next = elm_gengrid_item_next_get(wd->last_selected_item);
|
||||
|
||||
|
@ -559,13 +566,13 @@ _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|||
if (!wd) return;
|
||||
elm_smart_scroller_mirrored_set(wd->scr, rtl);
|
||||
if (!wd->items) return;
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
|
||||
while (it)
|
||||
{
|
||||
edje_object_mirrored_set(VIEW(it), rtl);
|
||||
elm_gengrid_item_update(it);
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -866,7 +873,7 @@ _mouse_up(void *data,
|
|||
if (dragged)
|
||||
{
|
||||
if (it->want_unrealize)
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
}
|
||||
if ((it->disabled) || (dragged)) return;
|
||||
if (it->wd->multi)
|
||||
|
@ -874,7 +881,7 @@ _mouse_up(void *data,
|
|||
if (!it->selected)
|
||||
{
|
||||
_item_highlight(it);
|
||||
_item_select(it);
|
||||
it->sel_cb(it);
|
||||
}
|
||||
else _item_unselect(it);
|
||||
}
|
||||
|
@ -894,7 +901,7 @@ _mouse_up(void *data,
|
|||
if (item2 != it) _item_unselect(item2);
|
||||
}
|
||||
_item_highlight(it);
|
||||
_item_select(it);
|
||||
it->sel_cb(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1152,7 @@ _group_item_place(Pan *sd)
|
|||
evas_object_raise(VIEW(it));
|
||||
}
|
||||
else
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1408,30 +1415,12 @@ _item_place(Elm_Gen_Item *it,
|
|||
else
|
||||
{
|
||||
if (!it->group)
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
else
|
||||
it->item->group_realized = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static Elm_Gen_Item *
|
||||
_item_new(Widget_Data *wd,
|
||||
const Elm_Gengrid_Item_Class *itc,
|
||||
const void *data,
|
||||
Evas_Smart_Cb func,
|
||||
const void *func_data)
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
it = elm_gen_item_new(wd, itc, data, NULL, func, func_data);
|
||||
if (!it) return NULL;
|
||||
it->item = ELM_NEW(Elm_Gen_Item_Type);
|
||||
wd->count++;
|
||||
it->group = !strcmp(it->itc->item_style, "group_index");
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
static void
|
||||
_item_del(Elm_Gen_Item *it)
|
||||
{
|
||||
|
@ -1439,43 +1428,13 @@ _item_del(Elm_Gen_Item *it)
|
|||
|
||||
evas_event_freeze(evas_object_evas_get(obj));
|
||||
it->wd->selected = eina_list_remove(it->wd->selected, it);
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
it->wd->count--;
|
||||
elm_gen_item_del_serious(it, (Ecore_Cb)_calc_job);
|
||||
elm_gen_item_del_serious(it);
|
||||
evas_event_thaw(evas_object_evas_get(obj));
|
||||
evas_event_thaw_eval(evas_object_evas_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
_item_select(Elm_Gen_Item *it)
|
||||
{
|
||||
if ((it->wd->no_select) || (it->delete_me)) return;
|
||||
if (it->selected)
|
||||
{
|
||||
if (it->wd->always_select) goto call;
|
||||
return;
|
||||
}
|
||||
it->selected = EINA_TRUE;
|
||||
it->wd->selected = eina_list_append(it->wd->selected, it);
|
||||
call:
|
||||
it->walking++;
|
||||
it->wd->walking++;
|
||||
if (it->func.func)
|
||||
it->func.func((void *)it->func.data, WIDGET(it), it);
|
||||
if (!it->delete_me)
|
||||
evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
|
||||
it->walking--;
|
||||
it->wd->walking--;
|
||||
it->wd->last_selected_item = it;
|
||||
if ((it->wd->clear_me) && (!it->wd->walking))
|
||||
elm_gengrid_clear(WIDGET(it));
|
||||
else
|
||||
{
|
||||
if ((!it->walking) && (it->delete_me))
|
||||
if (!it->relcount) _item_del(it);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_item_unselect(Elm_Gen_Item *it)
|
||||
{
|
||||
|
@ -1876,11 +1835,30 @@ static int
|
|||
_elm_gengrid_item_compare(const void *data, const void *data1)
|
||||
{
|
||||
Elm_Gen_Item *it, *item1;
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(data);
|
||||
item1 = ELM_GENGRID_ITEM_FROM_INLIST(data1);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
||||
item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
|
||||
return _elm_gengrid_item_compare_cb(it, item1);
|
||||
}
|
||||
|
||||
static Elm_Gen_Item *
|
||||
_item_new(Widget_Data *wd,
|
||||
const Elm_Gengrid_Item_Class *itc,
|
||||
const void *data,
|
||||
Evas_Smart_Cb func,
|
||||
const void *func_data)
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
it = elm_gen_item_new(wd, itc, data, NULL, func, func_data);
|
||||
if (!it) return NULL;
|
||||
it->item = ELM_NEW(Elm_Gen_Item_Type);
|
||||
wd->count++;
|
||||
it->group = !strcmp(it->itc->item_style, "group_index");
|
||||
ELM_GEN_ITEM_SETUP(it);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_gengrid_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -1909,6 +1887,7 @@ elm_gengrid_add(Evas_Object *parent)
|
|||
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
||||
|
||||
ELM_SET_WIDTYPE(widtype, "gengrid");
|
||||
ELM_GEN_SETUP(wd);
|
||||
elm_widget_type_set(obj, "gengrid");
|
||||
elm_widget_sub_object_add(parent, obj);
|
||||
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
|
||||
|
@ -2240,57 +2219,7 @@ elm_gengrid_horizontal_get(const Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_gengrid_clear(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
|
||||
if (wd->state)
|
||||
{
|
||||
eina_inlist_sorted_state_free(wd->state);
|
||||
wd->state = NULL;
|
||||
}
|
||||
if (wd->calc_job)
|
||||
{
|
||||
ecore_job_del(wd->calc_job);
|
||||
wd->calc_job = NULL;
|
||||
}
|
||||
|
||||
if (wd->walking > 0)
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
wd->clear_me = 1;
|
||||
EINA_INLIST_FOREACH(wd->items, it)
|
||||
it->delete_me = 1;
|
||||
return;
|
||||
}
|
||||
wd->clear_me = 0;
|
||||
while (wd->items)
|
||||
{
|
||||
Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
|
||||
|
||||
wd->items = eina_inlist_remove(wd->items, wd->items);
|
||||
elm_widget_item_pre_notify_del(it);
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
if (it->itc->func.del)
|
||||
it->itc->func.del((void *)it->base.data, wd->obj);
|
||||
if (it->long_timer) ecore_timer_del(it->long_timer);
|
||||
free(it->item);
|
||||
elm_widget_item_del(it);
|
||||
}
|
||||
|
||||
if (wd->selected)
|
||||
{
|
||||
eina_list_free(wd->selected);
|
||||
wd->selected = NULL;
|
||||
}
|
||||
|
||||
wd->pan_x = 0;
|
||||
wd->pan_y = 0;
|
||||
wd->minw = 0;
|
||||
wd->minh = 0;
|
||||
wd->count = 0;
|
||||
evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
|
||||
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
|
||||
elm_gen_clear(obj);
|
||||
}
|
||||
|
||||
EAPI const Evas_Object *
|
||||
|
@ -2306,7 +2235,7 @@ elm_gengrid_item_update(Elm_Gen_Item *it)
|
|||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
|
||||
if (!it->realized) return;
|
||||
if (it->want_unrealize) return;
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
_item_realize(it);
|
||||
_item_place(it, it->x, it->y);
|
||||
}
|
||||
|
@ -2397,25 +2326,7 @@ EAPI void
|
|||
elm_gengrid_item_selected_set(Elm_Gen_Item *it,
|
||||
Eina_Bool selected)
|
||||
{
|
||||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
|
||||
Widget_Data *wd = it->wd;
|
||||
if (!wd) return;
|
||||
if (it->delete_me) return;
|
||||
selected = !!selected;
|
||||
if (it->selected == selected) return;
|
||||
|
||||
if (selected)
|
||||
{
|
||||
if (!wd->multi)
|
||||
{
|
||||
while (wd->selected)
|
||||
_item_unselect(wd->selected->data);
|
||||
}
|
||||
_item_highlight(it);
|
||||
_item_select(it);
|
||||
}
|
||||
else
|
||||
_item_unselect(it);
|
||||
elm_gen_item_selected_set(it, selected);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -2796,9 +2707,9 @@ elm_gengrid_first_item_get(const Evas_Object *obj)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
if (!wd->items) return NULL;
|
||||
Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
|
||||
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
while ((it) && (it->delete_me))
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
return it;
|
||||
}
|
||||
|
||||
|
@ -2809,9 +2720,9 @@ elm_gengrid_last_item_get(const Evas_Object *obj)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
if (!wd->items) return NULL;
|
||||
Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
|
||||
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
|
||||
while ((it) && (it->delete_me))
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
return it;
|
||||
}
|
||||
|
||||
|
@ -2821,7 +2732,7 @@ elm_gengrid_item_next_get(const Elm_Gen_Item *it)
|
|||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
|
||||
while (it)
|
||||
{
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
if ((it) && (!it->delete_me)) break;
|
||||
}
|
||||
return (Elm_Gen_Item *)it;
|
||||
|
@ -2833,7 +2744,7 @@ elm_gengrid_item_prev_get(const Elm_Gen_Item *it)
|
|||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
|
||||
while (it)
|
||||
{
|
||||
it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
if ((it) && (!it->delete_me)) break;
|
||||
}
|
||||
return (Elm_Gen_Item *)it;
|
||||
|
|
|
@ -10,6 +10,19 @@
|
|||
#define MAX_ITEMS_PER_BLOCK 32
|
||||
#define REORDER_EFFECT_TIME 0.5
|
||||
|
||||
#define ELM_GEN_SETUP(wd) \
|
||||
(wd)->calc_cb = (Ecore_Cb)_calc_job; \
|
||||
(wd)->clear_cb = (Ecore_Cb)_clear_cb; \
|
||||
(wd)->sizing_cb = (Ecore_Cb)_sizing_eval
|
||||
|
||||
|
||||
#define ELM_GEN_ITEM_SETUP(it) \
|
||||
(it)->del_cb = (Ecore_Cb)_item_del; \
|
||||
(it)->highlight_cb = (Ecore_Cb)_item_highlight; \
|
||||
(it)->unsel_cb = (Ecore_Cb)_item_unselect; \
|
||||
(it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
|
||||
(it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
|
||||
|
||||
typedef struct _Item_Block Item_Block;
|
||||
typedef struct _Item_Cache Item_Cache;
|
||||
|
||||
|
@ -60,6 +73,8 @@ struct _Widget_Data
|
|||
int walking;
|
||||
int item_width, item_height;
|
||||
int group_item_width, group_item_height;
|
||||
int minw, minh;
|
||||
long count;
|
||||
Evas_Coord pan_x, pan_y;
|
||||
Eina_Bool reorder_mode : 1;
|
||||
Eina_Bool on_hold : 1;
|
||||
|
@ -67,9 +82,12 @@ struct _Widget_Data
|
|||
Eina_Bool no_select : 1;
|
||||
Eina_Bool wasselected : 1;
|
||||
Eina_Bool always_select : 1;
|
||||
Eina_Bool clear_me : 1;
|
||||
Ecore_Cb del_cb, calc_cb, sizing_cb;
|
||||
Ecore_Cb clear_cb;
|
||||
////////////////////////////////////
|
||||
Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
|
||||
Evas_Coord reorder_old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
|
||||
Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
|
||||
Ecore_Job *update_job;
|
||||
Ecore_Idle_Enterer *queue_idle_enterer;
|
||||
Ecore_Idler *must_recalc_idler;
|
||||
|
@ -95,7 +113,6 @@ struct _Widget_Data
|
|||
Eina_Bool compress : 1;
|
||||
Eina_Bool height_for_width : 1;
|
||||
Eina_Bool homogeneous : 1;
|
||||
Eina_Bool clear_me : 1;
|
||||
Eina_Bool swipe : 1;
|
||||
Eina_Bool reorder_pan_move : 1;
|
||||
Eina_Bool auto_scroll_enabled : 1;
|
||||
|
@ -144,9 +161,6 @@ struct _Item_Cache
|
|||
Eina_Bool expanded : 1; // it->item->expanded
|
||||
};
|
||||
|
||||
#define ELM_GENLIST_ITEM_FROM_INLIST(it) \
|
||||
((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
|
||||
|
||||
static const char *widtype = NULL;
|
||||
static void _item_cache_zero(Widget_Data *wd);
|
||||
static void _del_hook(Evas_Object *obj);
|
||||
|
@ -459,9 +473,9 @@ _item_single_select_up(Widget_Data *wd)
|
|||
Elm_Gen_Item *prev;
|
||||
if (!wd->selected)
|
||||
{
|
||||
prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
|
||||
prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
|
||||
while ((prev) && (prev->delete_me))
|
||||
prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
||||
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
||||
}
|
||||
else prev = elm_genlist_item_prev_get(wd->last_selected_item);
|
||||
|
||||
|
@ -480,9 +494,9 @@ _item_single_select_down(Widget_Data *wd)
|
|||
Elm_Gen_Item *next;
|
||||
if (!wd->selected)
|
||||
{
|
||||
next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
|
||||
next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
while ((next) && (next->delete_me))
|
||||
next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
||||
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
||||
}
|
||||
else next = elm_genlist_item_next_get(wd->last_selected_item);
|
||||
|
||||
|
@ -776,63 +790,54 @@ _item_del(Elm_Gen_Item *it)
|
|||
evas_event_freeze(evas_object_evas_get(obj));
|
||||
elm_genlist_item_subitems_clear(it);
|
||||
if (it->wd->show_item == it) it->wd->show_item = NULL;
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
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)
|
||||
{
|
||||
it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
if (!it->wd->anchor_item)
|
||||
it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
}
|
||||
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_gen_item_del_serious(it, (Ecore_Cb)_calc_job);
|
||||
elm_gen_item_del_serious(it);
|
||||
evas_event_thaw(evas_object_evas_get(obj));
|
||||
evas_event_thaw_eval(evas_object_evas_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
_item_select(Elm_Gen_Item *it)
|
||||
_clear_cb(Widget_Data *wd)
|
||||
{
|
||||
Evas_Object *parent = WIDGET(it);
|
||||
wd->anchor_item = NULL;
|
||||
while (wd->blocks)
|
||||
{
|
||||
Item_Block *itb = (Item_Block *)(wd->blocks);
|
||||
|
||||
if ((it->wd->no_select) || (it->delete_me) || (it->item->mode_view)) return;
|
||||
if (it->selected)
|
||||
{
|
||||
if (it->wd->always_select) goto call;
|
||||
return;
|
||||
wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
|
||||
if (itb->items) eina_list_free(itb->items);
|
||||
free(itb);
|
||||
}
|
||||
it->selected = EINA_TRUE;
|
||||
it->wd->selected = eina_list_append(it->wd->selected, it);
|
||||
call:
|
||||
evas_object_ref(parent);
|
||||
it->walking++;
|
||||
it->wd->walking++;
|
||||
if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
|
||||
if (!it->delete_me)
|
||||
evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
|
||||
it->walking--;
|
||||
it->wd->walking--;
|
||||
if ((it->wd->clear_me) && (!it->wd->walking))
|
||||
if (wd->queue_idle_enterer)
|
||||
{
|
||||
elm_genlist_clear(WIDGET(it));
|
||||
goto end;
|
||||
ecore_idle_enterer_del(wd->queue_idle_enterer);
|
||||
wd->queue_idle_enterer = NULL;
|
||||
}
|
||||
else
|
||||
if (wd->must_recalc_idler)
|
||||
{
|
||||
if ((!it->walking) && (it->delete_me))
|
||||
{
|
||||
if (!it->relcount) _item_del(it);
|
||||
goto end;
|
||||
}
|
||||
ecore_idler_del(wd->must_recalc_idler);
|
||||
wd->must_recalc_idler = NULL;
|
||||
}
|
||||
it->wd->last_selected_item = it;
|
||||
|
||||
end:
|
||||
evas_object_unref(parent);
|
||||
if (wd->queue) wd->queue = eina_list_free(wd->queue);
|
||||
if (wd->reorder_move_animator)
|
||||
{
|
||||
ecore_animator_del(wd->reorder_move_animator);
|
||||
wd->reorder_move_animator = NULL;
|
||||
}
|
||||
wd->show_item = NULL;
|
||||
wd->reorder_old_pan_y = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1335,7 +1340,7 @@ _mouse_up(void *data,
|
|||
{
|
||||
if (it->want_unrealize)
|
||||
{
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
if (it->item->block->want_unrealize)
|
||||
_item_block_unrealize(it->item->block);
|
||||
}
|
||||
|
@ -1347,7 +1352,7 @@ _mouse_up(void *data,
|
|||
if (!it->selected)
|
||||
{
|
||||
_item_highlight(it);
|
||||
_item_select(it);
|
||||
it->sel_cb(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1384,7 +1389,7 @@ _mouse_up(void *data,
|
|||
//_item_select(it);
|
||||
}
|
||||
_item_highlight(it);
|
||||
_item_select(it);
|
||||
it->sel_cb(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1997,13 +2002,13 @@ _item_block_recalc(Item_Block *itb,
|
|||
if (changed)
|
||||
{
|
||||
_item_realize(it, in, EINA_TRUE);
|
||||
elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_item_realize(it, in, EINA_TRUE);
|
||||
elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2050,7 +2055,7 @@ _item_block_unrealize(Item_Block *itb)
|
|||
it->want_unrealize = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
if (!dragging)
|
||||
|
@ -2232,7 +2237,7 @@ _item_block_position(Item_Block *itb,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
in++;
|
||||
|
@ -2269,7 +2274,7 @@ _group_items_recalc(void *data)
|
|||
else if (!git->item->want_realize && git->realized)
|
||||
{
|
||||
if (!git->dragging)
|
||||
elm_gen_item_unrealize(git, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(git, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
evas_event_thaw(evas_object_evas_get(wd->obj));
|
||||
|
@ -2451,14 +2456,14 @@ _update_job(void *data)
|
|||
it->item->updateme = EINA_FALSE;
|
||||
if (it->realized)
|
||||
{
|
||||
elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_FALSE);
|
||||
_item_realize(it, num, EINA_FALSE);
|
||||
position = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_item_realize(it, num, EINA_TRUE);
|
||||
elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
|
||||
elm_gen_item_unrealize(it, EINA_TRUE);
|
||||
}
|
||||
if ((it->item->minw != itminw) || (it->item->minh != itminh))
|
||||
recalc = EINA_TRUE;
|
||||
|
@ -3010,6 +3015,7 @@ elm_genlist_add(Evas_Object *parent)
|
|||
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
||||
|
||||
ELM_SET_WIDTYPE(widtype, "genlist");
|
||||
ELM_GEN_SETUP(wd);
|
||||
elm_widget_type_set(obj, "genlist");
|
||||
elm_widget_sub_object_add(parent, obj);
|
||||
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
|
||||
|
@ -3088,6 +3094,7 @@ _item_new(Widget_Data *wd,
|
|||
if (flags & 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 (it->parent->group)
|
||||
|
@ -3352,8 +3359,8 @@ static int
|
|||
_elm_genlist_item_compare(const void *data, const void *data1)
|
||||
{
|
||||
const Elm_Gen_Item *it, *item1;
|
||||
it = ELM_GENLIST_ITEM_FROM_INLIST(data);
|
||||
item1 = ELM_GENLIST_ITEM_FROM_INLIST(data1);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
||||
item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
|
||||
return _elm_genlist_item_compare_cb(it, item1);
|
||||
}
|
||||
|
||||
|
@ -3625,12 +3632,12 @@ elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
|
|||
|
||||
if (EINA_INLIST_GET(it)->next)
|
||||
{
|
||||
rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it->item->before = EINA_TRUE;
|
||||
}
|
||||
else if (EINA_INLIST_GET(it)->prev)
|
||||
{
|
||||
rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
it->item->before = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -3665,104 +3672,7 @@ elm_genlist_item_sorted_insert(Evas_Object *obj,
|
|||
EAPI void
|
||||
elm_genlist_clear(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
if (wd->state)
|
||||
{
|
||||
eina_inlist_sorted_state_free(wd->state);
|
||||
wd->state = NULL;
|
||||
}
|
||||
if (wd->walking > 0)
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
wd->clear_me = EINA_TRUE;
|
||||
EINA_INLIST_FOREACH(wd->items, it)
|
||||
{
|
||||
it->delete_me = EINA_TRUE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
evas_event_freeze(evas_object_evas_get(wd->obj));
|
||||
while (wd->items)
|
||||
{
|
||||
Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
|
||||
|
||||
if (wd->anchor_item == it)
|
||||
{
|
||||
wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
if (!wd->anchor_item)
|
||||
wd->anchor_item =
|
||||
ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
}
|
||||
wd->items = eina_inlist_remove(wd->items, wd->items);
|
||||
if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
|
||||
it->wd->group_items = eina_list_remove(it->wd->group_items, it);
|
||||
elm_widget_item_pre_notify_del(it);
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
|
||||
it->itc->func.del((void *)it->base.data, WIDGET(it));
|
||||
if (it->long_timer) ecore_timer_del(it->long_timer);
|
||||
if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
|
||||
free(it->item);
|
||||
elm_widget_item_del(it);
|
||||
}
|
||||
wd->clear_me = EINA_FALSE;
|
||||
wd->anchor_item = NULL;
|
||||
while (wd->blocks)
|
||||
{
|
||||
Item_Block *itb = (Item_Block *)(wd->blocks);
|
||||
|
||||
wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
|
||||
if (itb->items) eina_list_free(itb->items);
|
||||
free(itb);
|
||||
}
|
||||
if (wd->calc_job)
|
||||
{
|
||||
ecore_job_del(wd->calc_job);
|
||||
wd->calc_job = NULL;
|
||||
}
|
||||
if (wd->queue_idle_enterer)
|
||||
{
|
||||
ecore_idle_enterer_del(wd->queue_idle_enterer);
|
||||
wd->queue_idle_enterer = NULL;
|
||||
}
|
||||
if (wd->must_recalc_idler)
|
||||
{
|
||||
ecore_idler_del(wd->must_recalc_idler);
|
||||
wd->must_recalc_idler = NULL;
|
||||
}
|
||||
if (wd->queue)
|
||||
{
|
||||
eina_list_free(wd->queue);
|
||||
wd->queue = NULL;
|
||||
}
|
||||
if (wd->selected)
|
||||
{
|
||||
eina_list_free(wd->selected);
|
||||
wd->selected = NULL;
|
||||
}
|
||||
if (wd->reorder_move_animator)
|
||||
{
|
||||
ecore_animator_del(wd->reorder_move_animator);
|
||||
wd->reorder_move_animator = NULL;
|
||||
}
|
||||
wd->show_item = NULL;
|
||||
wd->pan_x = 0;
|
||||
wd->pan_y = 0;
|
||||
wd->reorder_old_pan_y = 0;
|
||||
wd->minw = 0;
|
||||
wd->minh = 0;
|
||||
if (wd->pan_smart)
|
||||
{
|
||||
evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
|
||||
evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
|
||||
}
|
||||
_sizing_eval(obj);
|
||||
elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
|
||||
evas_event_thaw(evas_object_evas_get(wd->obj));
|
||||
evas_event_thaw_eval(evas_object_evas_get(wd->obj));
|
||||
elm_gen_clear(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -3891,9 +3801,9 @@ elm_genlist_first_item_get(const Evas_Object *obj)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
if (!wd->items) return NULL;
|
||||
Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
|
||||
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
|
||||
while ((it) && (it->delete_me))
|
||||
it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
return it;
|
||||
}
|
||||
|
||||
|
@ -3904,9 +3814,9 @@ elm_genlist_last_item_get(const Evas_Object *obj)
|
|||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
if (!wd->items) return NULL;
|
||||
Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
|
||||
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
|
||||
while ((it) && (it->delete_me))
|
||||
it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
return it;
|
||||
}
|
||||
|
||||
|
@ -3916,7 +3826,7 @@ elm_genlist_item_next_get(const Elm_Gen_Item *it)
|
|||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
|
||||
while (it)
|
||||
{
|
||||
it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
||||
if ((it) && (!it->delete_me)) break;
|
||||
}
|
||||
return (Elm_Gen_Item *)it;
|
||||
|
@ -3928,7 +3838,7 @@ elm_genlist_item_prev_get(const Elm_Gen_Item *it)
|
|||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
|
||||
while (it)
|
||||
{
|
||||
it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
||||
if ((it) && (!it->delete_me)) break;
|
||||
}
|
||||
return (Elm_Gen_Item *)it;
|
||||
|
@ -3965,31 +3875,7 @@ EAPI void
|
|||
elm_genlist_item_selected_set(Elm_Gen_Item *it,
|
||||
Eina_Bool selected)
|
||||
{
|
||||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
|
||||
Widget_Data *wd = it->wd;
|
||||
if (!wd) return;
|
||||
if ((it->delete_me) || (it->disabled)) return;
|
||||
selected = !!selected;
|
||||
if (it->selected == selected) return;
|
||||
|
||||
if (selected)
|
||||
{
|
||||
if (!wd->multi)
|
||||
{
|
||||
while (wd->selected)
|
||||
{
|
||||
_item_unhighlight(wd->selected->data);
|
||||
_item_unselect(wd->selected->data);
|
||||
}
|
||||
}
|
||||
_item_highlight(it);
|
||||
_item_select(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
_item_unhighlight(it);
|
||||
_item_unselect(it);
|
||||
}
|
||||
elm_gen_item_selected_set(it, selected);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -4262,7 +4148,7 @@ elm_genlist_item_del(Elm_Gen_Item *it)
|
|||
elm_gen_item_del_notserious(it);
|
||||
if (it->item->block)
|
||||
{
|
||||
if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
|
||||
if (it->realized) elm_gen_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);
|
||||
|
@ -4775,6 +4661,7 @@ elm_genlist_item_mode_set(Elm_Gen_Item *it,
|
|||
(mode_set))
|
||||
return;
|
||||
if (!wd->mode_item_style) return;
|
||||
it->mode_set = mode_set;
|
||||
|
||||
if (wd->multi)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue