2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
2015-05-26 23:23:17 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
2014-09-27 22:15:37 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
#include <Elementary.h>
|
2010-09-27 11:18:37 -07:00
|
|
|
#include <Elementary_Cursor.h>
|
2010-06-03 05:53:14 -07:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:07:07 -07:00
|
|
|
#include "elm_widget_gengrid.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_interface_scrollable.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_PAN_CLASS ELM_GENGRID_PAN_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 06:29:38 -08:00
|
|
|
#define MY_PAN_CLASS_NAME "Elm_Gengrid_Pan"
|
|
|
|
#define MY_PAN_CLASS_NAME_LEGACY "elm_gengrid_pan"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_GENGRID_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Gengrid"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_gengrid"
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-03-05 21:02:36 -08:00
|
|
|
// internally allocated
|
2012-07-10 14:40:38 -07:00
|
|
|
#define CLASS_ALLOCATED 0x3a70f00f
|
2012-03-05 21:02:36 -08:00
|
|
|
|
2011-07-25 12:51:57 -07:00
|
|
|
/* --
|
2010-06-03 05:53:14 -07:00
|
|
|
* TODO:
|
elementry / entry, menu, notify, list, gengrid, actionslider, image, icon, anchorview, fileselector_button, calendar, photocam, anchorblock,
button, map, colorselector, hover, photo, diskselector, index, bubble, pager, hoversel, check, scrolled_entry, clock, flipselector
updated signal callback list in the doxygen.
should update genlist, progressbar ...
SVN revision: 58335
2011-04-04 09:34:18 -07:00
|
|
|
* Handle non-homogeneous objects too.
|
2010-06-03 05:53:14 -07:00
|
|
|
*/
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
#define PRELOAD 1
|
2011-06-14 01:36:03 -07:00
|
|
|
#define REORDER_EFFECT_TIME 0.5
|
2010-06-03 05:53:14 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
#define CACHE_MAX 40
|
|
|
|
|
2012-07-31 15:07:07 -07:00
|
|
|
EAPI const char ELM_GENGRID_SMART_NAME[] = "elm_gengrid";
|
|
|
|
EAPI const char ELM_GENGRID_PAN_SMART_NAME[] = "elm_gengrid_pan";
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-10-18 08:06:25 -07:00
|
|
|
#define ELM_PRIV_GENGRID_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_ACTIVATED, "activated", "") \
|
|
|
|
cmd(SIG_CLICKED_DOUBLE, "clicked,double", "") \
|
2014-12-29 02:38:17 -08:00
|
|
|
cmd(SIG_CLICKED_RIGHT, "clicked,right", "") \
|
2013-10-18 08:06:25 -07:00
|
|
|
cmd(SIG_LONGPRESSED, "longpressed", "") \
|
|
|
|
cmd(SIG_SELECTED, "selected", "") \
|
|
|
|
cmd(SIG_UNSELECTED, "unselected", "") \
|
|
|
|
cmd(SIG_REALIZED, "realized", "") \
|
|
|
|
cmd(SIG_UNREALIZED, "unrealized", "") \
|
|
|
|
cmd(SIG_CHANGED, "changed", "") \
|
|
|
|
cmd(SIG_DRAG_START_UP, "drag,start,up", "") \
|
|
|
|
cmd(SIG_DRAG_START_DOWN, "drag,start,down", "") \
|
|
|
|
cmd(SIG_DRAG_START_LEFT, "drag,start,left", "") \
|
|
|
|
cmd(SIG_DRAG_START_RIGHT, "drag,start,right", "") \
|
|
|
|
cmd(SIG_DRAG_STOP, "drag,stop", "") \
|
|
|
|
cmd(SIG_DRAG, "drag", "") \
|
|
|
|
cmd(SIG_SCROLL, "scroll", "") \
|
|
|
|
cmd(SIG_SCROLL_ANIM_START, "scroll,anim,start", "") \
|
|
|
|
cmd(SIG_SCROLL_ANIM_STOP, "scroll,anim,stop", "") \
|
|
|
|
cmd(SIG_SCROLL_DRAG_START, "scroll,drag,start", "") \
|
|
|
|
cmd(SIG_SCROLL_DRAG_STOP, "scroll,drag,stop", "") \
|
|
|
|
cmd(SIG_SCROLL_PAGE_CHANGE, "scroll,page,changed", "") \
|
|
|
|
cmd(SIG_EDGE_TOP, "edge,top", "") \
|
|
|
|
cmd(SIG_EDGE_BOTTOM, "edge,bottom", "") \
|
|
|
|
cmd(SIG_EDGE_LEFT, "edge,left", "") \
|
|
|
|
cmd(SIG_EDGE_RIGHT, "edge,right", "") \
|
|
|
|
cmd(SIG_MOVED, "moved", "") \
|
|
|
|
cmd(SIG_INDEX_UPDATE, "index,update", "") \
|
|
|
|
cmd(SIG_HIGHLIGHTED, "highlighted", "") \
|
|
|
|
cmd(SIG_UNHIGHLIGHTED, "unhighlighted", "") \
|
2014-03-21 01:00:46 -07:00
|
|
|
cmd(SIG_ITEM_FOCUSED, "item,focused", "") \
|
|
|
|
cmd(SIG_ITEM_UNFOCUSED, "item,unfocused", "") \
|
2013-10-18 08:06:25 -07:00
|
|
|
cmd(SIG_PRESSED, "pressed", "") \
|
2014-04-23 05:13:57 -07:00
|
|
|
cmd(SIG_RELEASED, "released", "") \
|
|
|
|
cmd(SIG_ITEM_REORDER_START, "item,reorder,anim,start", "") \
|
|
|
|
cmd(SIG_ITEM_REORDER_STOP, "item,reorder,anim,stop", "")
|
2013-10-18 08:06:25 -07:00
|
|
|
|
|
|
|
ELM_PRIV_GENGRID_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
2013-02-11 23:29:16 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-10-18 08:06:25 -07:00
|
|
|
ELM_PRIV_GENGRID_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2014-03-21 01:00:46 -07:00
|
|
|
{SIG_ITEM_FOCUSED, ""},
|
|
|
|
{SIG_ITEM_UNFOCUSED, ""},
|
2013-02-11 23:29:16 -08:00
|
|
|
|
2011-07-26 00:00:19 -07:00
|
|
|
{NULL, NULL}
|
2011-04-21 17:57:15 -07:00
|
|
|
};
|
2013-10-18 08:06:25 -07:00
|
|
|
#undef ELM_PRIV_GENGRID_SIGNALS
|
2011-04-21 17:57:15 -07:00
|
|
|
|
2014-04-16 01:19:23 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
|
2014-04-23 05:13:57 -07:00
|
|
|
static void _item_position_update(Eina_Inlist *list, int idx);
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
static void _item_mouse_callbacks_add(Elm_Gen_Item *it, Evas_Object *view);
|
|
|
|
static void _item_mouse_callbacks_del(Elm_Gen_Item *it, Evas_Object *view);
|
2014-04-16 01:19:23 -07:00
|
|
|
|
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"select", _key_action_select},
|
|
|
|
{"escape", _key_action_escape},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
|
|
|
|
//-- item cache handle routine --//
|
|
|
|
// push item cache into caches
|
|
|
|
static Eina_Bool
|
|
|
|
_item_cache_push(Elm_Gengrid_Data *sd, Item_Cache *itc)
|
|
|
|
{
|
|
|
|
if (!itc || (sd->item_cache_max <= 0))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
sd->item_cache_count++;
|
|
|
|
sd->item_cache =
|
|
|
|
eina_inlist_prepend(sd->item_cache, EINA_INLIST_GET(itc));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// pop item cache from caches
|
|
|
|
static Item_Cache *
|
|
|
|
_item_cache_pop(Elm_Gengrid_Data *sd, Item_Cache *itc)
|
|
|
|
{
|
|
|
|
if ((!itc) || (!sd->item_cache) ||
|
|
|
|
(sd->item_cache_count <= 0))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
sd->item_cache =
|
|
|
|
eina_inlist_remove (sd->item_cache, EINA_INLIST_GET(itc));
|
|
|
|
sd->item_cache_count--;
|
|
|
|
|
|
|
|
return itc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// free one item cache from caches
|
|
|
|
static void
|
|
|
|
_item_cache_free(Item_Cache *itc)
|
|
|
|
{
|
|
|
|
if (!itc) return;
|
|
|
|
|
|
|
|
evas_object_del(itc->spacer);
|
|
|
|
evas_object_del(itc->base_view);
|
|
|
|
eina_stringshare_del(itc->item_style);
|
|
|
|
ELM_SAFE_FREE(itc ,free);
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean up item cache by removing overflowed caches
|
|
|
|
static void
|
|
|
|
_item_cache_clean(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
evas_event_freeze(evas_object_evas_get(sd->obj));
|
|
|
|
|
|
|
|
while ((sd->item_cache) && (sd->item_cache_count > sd->item_cache_max))
|
|
|
|
{
|
|
|
|
Item_Cache *itc =
|
|
|
|
EINA_INLIST_CONTAINER_GET(sd->item_cache->last, Item_Cache);
|
|
|
|
_item_cache_free(_item_cache_pop(sd, itc));
|
|
|
|
}
|
|
|
|
evas_event_thaw(evas_object_evas_get(sd->obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(sd->obj));
|
|
|
|
}
|
|
|
|
|
|
|
|
// empty all item caches
|
|
|
|
static void
|
|
|
|
_item_cache_zero(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
int pmax = sd->item_cache_max;
|
|
|
|
|
|
|
|
sd->item_cache_max = 0;
|
|
|
|
_item_cache_clean(sd);
|
|
|
|
sd->item_cache_max = pmax;
|
|
|
|
}
|
|
|
|
|
|
|
|
// add an item to item cache
|
|
|
|
static Eina_Bool
|
|
|
|
_item_cache_add(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
if (it->item->nocache_once || it->item->nocache) return EINA_FALSE;
|
|
|
|
|
|
|
|
Item_Cache *itc = NULL;
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Evas_Object *obj = sd->obj;
|
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
|
|
|
if (sd->item_cache_max > 0)
|
|
|
|
itc = ELM_NEW(Item_Cache);
|
|
|
|
if (!_item_cache_push(sd, itc))
|
|
|
|
{
|
|
|
|
if (itc) ELM_SAFE_FREE(itc, free);
|
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
itc->spacer = it->spacer;
|
|
|
|
itc->base_view = VIEW(it);
|
|
|
|
itc->item_style = eina_stringshare_add(it->itc->item_style);
|
|
|
|
|
|
|
|
if (!it->group)
|
|
|
|
{
|
|
|
|
if (it->selected)
|
|
|
|
edje_object_signal_emit(itc->base_view, "elm,state,unselected", "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
edje_object_signal_emit(itc->base_view, "elm,state,enabled", "elm");
|
2016-01-31 18:27:56 -08:00
|
|
|
if ((EO_OBJ(it) == sd->focused_item) &&
|
2015-08-04 23:57:11 -07:00
|
|
|
(elm_widget_focus_highlight_enabled_get(obj) || _elm_config->win_auto_focus_enable))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
edje_object_signal_emit(itc->base_view, "elm,state,unfocused", "elm");
|
|
|
|
|
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
// FIXME: other callbacks?
|
|
|
|
_item_mouse_callbacks_del(it, itc->base_view);
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_mirrored_set(VIEW(it),
|
|
|
|
elm_widget_mirrored_get(WIDGET(it)));
|
|
|
|
edje_object_scale_set(VIEW(it),
|
|
|
|
elm_widget_scale_get(WIDGET(it))
|
|
|
|
* elm_config_scale_get());
|
|
|
|
|
|
|
|
evas_object_hide(itc->base_view);
|
|
|
|
evas_object_move(itc->base_view, -9999, -9999);
|
|
|
|
it->spacer = NULL;
|
|
|
|
VIEW(it) = NULL;
|
|
|
|
|
|
|
|
_item_cache_clean(sd);
|
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// find an item from item cache and remove it from the cache
|
|
|
|
static Eina_Bool
|
|
|
|
_item_cache_find(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
if (it->item->nocache_once || it->item->nocache) return EINA_FALSE;
|
|
|
|
|
|
|
|
Item_Cache *itc = NULL;
|
|
|
|
Eina_Inlist *l;
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH_SAFE(sd->item_cache, l, itc)
|
|
|
|
{
|
|
|
|
if (((!it->itc->item_style) && (!itc->item_style)) ||
|
|
|
|
(it->itc->item_style && itc->item_style &&
|
|
|
|
(!strcmp(it->itc->item_style, itc->item_style))))
|
|
|
|
{
|
|
|
|
itc = _item_cache_pop(sd, itc);
|
|
|
|
if (!itc) continue;
|
|
|
|
|
|
|
|
it->spacer = itc->spacer;
|
|
|
|
VIEW(it) = itc->base_view;
|
|
|
|
itc->spacer = NULL;
|
|
|
|
itc->base_view = NULL;
|
|
|
|
|
|
|
|
_item_cache_free(itc);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_is_no_select(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
|
|
|
|
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
|
|
|
|
(it->select_mode == ELM_OBJECT_SELECT_MODE_NONE) ||
|
|
|
|
(it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-07-22 19:35:20 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_gengrid_search_by_text_item_get(Eo *obj EINA_UNUSED,
|
|
|
|
Elm_Gengrid_Data *sd,
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item_to_search_from,
|
2014-07-23 20:41:33 -07:00
|
|
|
const char *part_name,
|
|
|
|
const char *pattern,
|
|
|
|
Elm_Glob_Match_Flags flags)
|
2014-07-22 19:35:20 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = NULL;
|
2014-07-23 20:41:33 -07:00
|
|
|
char *str = NULL;
|
|
|
|
Eina_Inlist *start = NULL;
|
|
|
|
int fnflags = 0;
|
2014-07-22 19:35:20 -07:00
|
|
|
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!pattern) return NULL;
|
2014-07-22 19:35:20 -07:00
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
2014-07-23 20:41:33 -07:00
|
|
|
if (flags & ELM_GLOB_MATCH_NO_ESCAPE) fnflags |= FNM_NOESCAPE;
|
|
|
|
if (flags & ELM_GLOB_MATCH_PATH) fnflags |= FNM_PATHNAME;
|
|
|
|
if (flags & ELM_GLOB_MATCH_PERIOD) fnflags |= FNM_PERIOD;
|
|
|
|
#ifdef FNM_CASEFOLD
|
|
|
|
if (flags & ELM_GLOB_MATCH_NOCASE) fnflags |= FNM_CASEFOLD;
|
|
|
|
#endif
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item_to_search_from, item_to_search_from);
|
2014-07-23 20:41:33 -07:00
|
|
|
start = (item_to_search_from) ?
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_INLIST_GET(item_to_search_from) :
|
2014-07-23 20:41:33 -07:00
|
|
|
sd->items;
|
2014-07-22 19:35:20 -07:00
|
|
|
EINA_INLIST_FOREACH(start, it)
|
|
|
|
{
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!it->itc->func.text_get) continue;
|
2014-09-14 04:51:26 -07:00
|
|
|
str = it->itc->func.text_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)),
|
2014-08-01 08:28:24 -07:00
|
|
|
WIDGET(it), part_name);
|
2014-07-23 20:41:33 -07:00
|
|
|
if (!str) continue;
|
|
|
|
if (!fnmatch(pattern, str, fnflags))
|
|
|
|
{
|
|
|
|
free(str);
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2014-07-23 20:41:33 -07:00
|
|
|
}
|
|
|
|
free(str);
|
2014-07-22 19:35:20 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
static void
|
|
|
|
_item_show_region(void *data)
|
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Data *sd = data;
|
2016-01-17 06:11:29 -08:00
|
|
|
Evas_Coord cvw, cvh, it_xpos = 0, it_ypos = 0, minx = 0, miny = 0;
|
2014-01-20 23:54:59 -08:00
|
|
|
Evas_Coord vw = 0, vh = 0;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2013-01-03 04:03:55 -08:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
|
|
|
|
if ((cvw != 0) && (cvh != 0))
|
|
|
|
{
|
|
|
|
if (sd->show_region)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_it = sd->show_it;
|
2013-01-03 04:03:55 -08:00
|
|
|
else if (sd->bring_in)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_it = sd->bring_in_it;
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_it) return;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_pan_pos_min_get(sd->pan_obj, &minx, &miny);
|
2013-01-03 04:03:55 -08:00
|
|
|
if (sd->horizontal && (sd->item_height > 0))
|
|
|
|
{
|
2016-01-17 06:11:29 -08:00
|
|
|
if (it->x >= 1)
|
|
|
|
it_xpos = ((it->x - GG_IT(it)->prev_group) * sd->item_width)
|
2014-01-20 23:54:59 -08:00
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_width)
|
|
|
|
+ minx;
|
|
|
|
else it_xpos = minx;
|
2016-01-17 06:11:29 -08:00
|
|
|
it_ypos = it->y * sd->item_height + miny;
|
2013-01-03 04:03:55 -08:00
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
2016-01-17 06:11:29 -08:00
|
|
|
it_xpos = it->x * sd->item_width + minx;
|
|
|
|
if (it->y >= 1)
|
|
|
|
it_ypos = ((it->y - GG_IT(it)->prev_group) * sd->item_height)
|
2014-01-20 23:54:59 -08:00
|
|
|
+ (GG_IT(it)->prev_group * sd->group_item_height)
|
|
|
|
+ miny;
|
|
|
|
else it_ypos = miny;
|
2013-01-03 04:03:55 -08:00
|
|
|
}
|
|
|
|
|
2014-01-20 23:54:59 -08:00
|
|
|
switch (sd->scroll_to_type)
|
|
|
|
{
|
|
|
|
case ELM_GENGRID_ITEM_SCROLLTO_TOP:
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(it), NULL, NULL, &vw, &vh);
|
2014-01-20 23:54:59 -08:00
|
|
|
break;
|
|
|
|
case ELM_GENGRID_ITEM_SCROLLTO_MIDDLE:
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(it), NULL, NULL, &vw, &vh);
|
2014-01-20 23:54:59 -08:00
|
|
|
it_xpos = it_xpos - ((vw - sd->item_width) / 2);
|
|
|
|
it_ypos = it_ypos - ((vh - sd->item_height) / 2);
|
|
|
|
break;
|
2016-01-04 14:06:21 -08:00
|
|
|
case ELM_GENGRID_ITEM_SCROLLTO_BOTTOM:
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(WIDGET(it), NULL, NULL, &vw, &vh);
|
2016-01-04 14:06:21 -08:00
|
|
|
it_xpos = it_xpos - vw + sd->item_width;
|
|
|
|
it_ypos = it_ypos - vh + sd->item_height;
|
|
|
|
break;
|
2014-01-20 23:54:59 -08:00
|
|
|
default:
|
|
|
|
vw = sd->item_width;
|
|
|
|
vh = sd->item_height;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
if (sd->show_region)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show(WIDGET(it), it_xpos, it_ypos, vw, vh);
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->show_region = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->bring_in)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_region_bring_in(WIDGET(it), it_xpos, it_ypos, vw, vh);
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->bring_in = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_calc_job(void *data)
|
|
|
|
{
|
2013-04-24 04:41:37 -07:00
|
|
|
ELM_GENGRID_DATA_GET(data, sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh;
|
|
|
|
Elm_Gen_Item *it, *group_item = NULL;
|
|
|
|
int count_group = 0;
|
|
|
|
long count = 0;
|
2010-10-01 12:03:17 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->items_lost = 0;
|
2010-10-01 12:03:17 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((cvw != 0) || (cvh != 0))
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->horizontal) && (sd->item_height > 0))
|
|
|
|
nmax = cvh / sd->item_height;
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
nmax = cvw / sd->item_width;
|
|
|
|
|
|
|
|
if (nmax < 1)
|
|
|
|
nmax = 1;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (GG_IT(it)->prev_group != count_group)
|
|
|
|
GG_IT(it)->prev_group = count_group;
|
|
|
|
if (it->group)
|
|
|
|
{
|
|
|
|
count = count % nmax;
|
|
|
|
if (count)
|
|
|
|
sd->items_lost += nmax - count;
|
|
|
|
count_group++;
|
|
|
|
if (count) count = 0;
|
|
|
|
group_item = it;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (it->parent != group_item)
|
|
|
|
it->parent = group_item;
|
|
|
|
count++;
|
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
count = sd->item_count + sd->items_lost - count_group;
|
|
|
|
if (sd->horizontal)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
minw = (ceil(count / (float)nmax) * sd->item_width) +
|
|
|
|
(count_group * sd->group_item_width);
|
|
|
|
minh = nmax * sd->item_height;
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
else
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
minw = nmax * sd->item_width;
|
|
|
|
minh = (ceil(count / (float)nmax) * sd->item_height) +
|
|
|
|
(count_group * sd->group_item_height);
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if ((minw != sd->minw) || (minh != sd->minh))
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->minh = minh;
|
|
|
|
sd->minw = minw;
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(sd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
sd->nmax = nmax;
|
|
|
|
evas_object_smart_changed(sd->pan_obj);
|
2013-01-03 04:03:55 -08:00
|
|
|
|
|
|
|
if (sd->show_region || sd->bring_in)
|
|
|
|
_item_show_region(sd);
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->calc_job = NULL;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_eo_base_destructor(Eo *obj, Elm_Gengrid_Pan_Data *psd)
|
2013-04-24 04:41:37 -07:00
|
|
|
{
|
|
|
|
eo_data_unref(psd->wobj, psd->wsd);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_destructor(eo_super(obj, MY_PAN_CLASS));
|
2013-04-24 04:41:37 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_pan_evas_object_smart_move(Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd, Evas_Coord _gen_param2 EINA_UNUSED, Evas_Coord _gen_param3 EINA_UNUSED)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(psd->wsd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
psd->wsd->calc_job = ecore_job_add(_calc_job, psd->wobj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_pan_evas_object_smart_resize(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord w, Evas_Coord h)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ow, oh;
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
|
|
|
|
if ((ow == w) && (oh == h)) return;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(psd->wsd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
psd->wsd->calc_job = ecore_job_add(_calc_job, psd->wobj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_unselect(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item_Type *item = GG_IT(it);
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Data *sd = item->wsd;
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-08-21 09:10:07 -07:00
|
|
|
if ((it->generation < sd->generation) || (!it->selected))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (it->selected)
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
it->selected = EINA_FALSE;
|
2014-11-25 04:55:12 -08:00
|
|
|
sd->selected = eina_list_remove(sd->selected, eo_it);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), EVAS_SELECTABLE_INTERFACE_EVENT_UNSELECTED, eo_it);
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_SELECTED, EINA_FALSE);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:26:13 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_in_cb(void *data,
|
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
if (!elm_object_item_disabled_get(EO_OBJ(it)) &&
|
2014-04-01 04:26:13 -07:00
|
|
|
(_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN))
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(it), EINA_TRUE);
|
2014-04-01 04:26:13 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_move_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y;
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
Evas_Coord minw = 0, minh = 0, x, y, w, h, dx, dy, adx, ady;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if (!sd->on_hold)
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
if (!sd->was_selected)
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
else if (ELM_RECTS_POINT_OUT(x, y, w, h, ev->cur.canvas.x, ev->cur.canvas.y) &&
|
2015-07-23 22:30:21 -07:00
|
|
|
!sd->reorder_it )
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
{
|
2015-07-23 22:30:21 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
|
|
|
if (!sd->was_selected)
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
it->base->still_in = EINA_FALSE;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if ((it->dragging) && (it->down))
|
|
|
|
{
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!it->down) || (sd->longpressed))
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_geometry_get
|
2013-08-27 16:47:16 -07:00
|
|
|
(sd->pan_obj, &ox, &oy, &ow, &oh);
|
|
|
|
|
|
|
|
it_scrl_x = ev->cur.canvas.x - sd->reorder_it->dx;
|
|
|
|
it_scrl_y = ev->cur.canvas.y - sd->reorder_it->dy;
|
|
|
|
|
|
|
|
if (it_scrl_x < ox) sd->reorder_item_x = ox;
|
|
|
|
else if (it_scrl_x + sd->item_width > ox + ow)
|
|
|
|
sd->reorder_item_x = ox + ow - sd->item_width;
|
|
|
|
else sd->reorder_item_x = it_scrl_x;
|
|
|
|
|
|
|
|
if (it_scrl_y < oy) sd->reorder_item_y = oy;
|
|
|
|
else if (it_scrl_y + sd->item_height > oy + oh)
|
|
|
|
sd->reorder_item_y = oy + oh - sd->item_height;
|
|
|
|
else sd->reorder_item_y = it_scrl_y;
|
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (it->select_mode != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
|
|
|
|
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))
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2015-05-03 04:28:16 -07:00
|
|
|
const Eo_Event_Description *left_drag, *right_drag;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!elm_widget_mirrored_get(WIDGET(it)))
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2015-05-03 04:28:16 -07:00
|
|
|
left_drag = EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_START_LEFT;
|
|
|
|
right_drag = EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_START_RIGHT;
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2010-10-01 12:03:17 -07:00
|
|
|
else
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2015-05-03 04:28:16 -07:00
|
|
|
left_drag = EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_START_RIGHT;
|
|
|
|
right_drag = EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_START_LEFT;
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it->dragging = 1;
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2014-08-21 11:09:10 -07:00
|
|
|
if (!sd->was_selected)
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (dy < 0)
|
|
|
|
{
|
|
|
|
if (ady > adx)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_START_UP, eo_it);
|
2010-11-10 10:04:28 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (dx < 0)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), left_drag, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2010-10-01 12:03:17 -07:00
|
|
|
else
|
2010-11-10 10:04:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ady > adx)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_START_DOWN, eo_it);
|
2010-11-10 10:04:28 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (dx < 0)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), left_drag, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), right_drag, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2010-11-10 10:04:28 -08:00
|
|
|
}
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-27 07:38:54 -07:00
|
|
|
static Eina_Bool
|
2012-07-10 14:40:38 -07:00
|
|
|
_long_press_cb(void *data)
|
2010-10-27 07:38:54 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2010-10-27 07:38:54 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->long_timer = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)) || (it->dragging))
|
2012-07-10 14:40:38 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
sd->longpressed = EINA_TRUE;
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), EVAS_CLICKABLE_INTERFACE_EVENT_LONGPRESSED, EO_OBJ(it));
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->reorder_mode)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->reorder_it = it;
|
|
|
|
evas_object_raise(VIEW(it));
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(WIDGET(it), EINA_TRUE);
|
|
|
|
elm_interface_scrollable_bounce_allow_get(WIDGET(it), &(sd->old_h_bounce), &(sd->old_v_bounce));
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(WIDGET(it), EINA_FALSE, EINA_FALSE);
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_highlight(Elm_Gen_Item *it)
|
2010-10-10 16:54:11 -07:00
|
|
|
{
|
2013-08-26 03:55:21 -07:00
|
|
|
const char *selectraise = NULL;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2013-08-26 03:55:21 -07:00
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-08-21 08:12:40 -07:00
|
|
|
(!sd->highlight) || (it->highlighted) ||
|
2013-08-26 03:55:21 -07:00
|
|
|
(it->generation < sd->generation))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_HIGHLIGHTED, EO_OBJ(it));
|
2013-08-26 03:55:21 -07:00
|
|
|
|
|
|
|
selectraise = edje_object_data_get(VIEW(it), "selectraise");
|
|
|
|
if ((selectraise) && (!strcmp(selectraise, "on")))
|
|
|
|
evas_object_stack_above(VIEW(it), sd->stack);
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->highlighted = EINA_TRUE;
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
static void
|
|
|
|
_item_unhighlight(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
|
|
|
|
|
|
|
if (!it->highlighted ||
|
|
|
|
(it->generation < sd->generation))
|
|
|
|
return;
|
|
|
|
|
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), ELM_GENGRID_EVENT_UNHIGHLIGHTED, eo_it);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
|
|
|
|
evas_object_stack_below(VIEW(it), sd->stack);
|
|
|
|
|
|
|
|
it->highlighted = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *obj,
|
|
|
|
void *event_info)
|
2010-10-10 16:54:11 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
Elm_Gen_Item *it = data;
|
|
|
|
Evas_Coord x, y;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2014-12-29 02:38:17 -08:00
|
|
|
if (ev->button == 3)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
it->dx = ev->canvas.x - x;
|
|
|
|
it->dy = ev->canvas.y - y;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->button != 1) return;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->down = 1;
|
2014-03-22 07:51:52 -07:00
|
|
|
sd->mouse_down = EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
it->dragging = 0;
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
it->dx = ev->canvas.x - x;
|
|
|
|
it->dy = ev->canvas.y - y;
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
2015-07-26 21:59:22 -07:00
|
|
|
it->base->still_in = EINA_TRUE;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
if (sd->on_hold) return;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->was_selected = it->selected;
|
2014-03-22 03:10:27 -07:00
|
|
|
it->highlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
2010-10-27 07:38:57 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED_DOUBLE, EO_OBJ(it));
|
|
|
|
eo_event_callback_call(WIDGET(it), ELM_GENGRID_EVENT_ACTIVATED, EO_OBJ(it));
|
2010-10-27 07:38:57 -07:00
|
|
|
}
|
2013-03-20 09:39:51 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), EVAS_CLICKABLE_INTERFACE_EVENT_PRESSED, EO_OBJ(it));
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->realized)
|
|
|
|
it->long_timer = ecore_timer_add
|
|
|
|
(_elm_config->longpress_timeout, _long_press_cb, it);
|
2012-01-30 02:29:51 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
it->long_timer = NULL;
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_text_realize(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *target,
|
|
|
|
Eina_List **source,
|
|
|
|
const char *parts)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
const Eina_List *l;
|
|
|
|
const char *key;
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
if (!it->itc->func.text_get) return;
|
|
|
|
|
|
|
|
if (!(*source))
|
|
|
|
*source = elm_widget_stringlist_get
|
|
|
|
(edje_object_data_get(target, "texts"));
|
|
|
|
EINA_LIST_FOREACH(*source, l, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD)) continue;
|
|
|
|
|
|
|
|
s = it->itc->func.text_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
edje_object_part_text_escaped_set(target, key, s);
|
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(target, key, "");
|
|
|
|
}
|
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_name_changed_signal_emit(EO_OBJ(it));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_content_realize(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *target,
|
|
|
|
Eina_List **contents,
|
|
|
|
const char *src,
|
|
|
|
const char *parts)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *content;
|
2010-10-10 16:54:11 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (!parts)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(*contents, content)
|
|
|
|
evas_object_del(content);
|
|
|
|
}
|
|
|
|
if (it->itc->func.content_get)
|
|
|
|
{
|
|
|
|
Eina_List *source;
|
|
|
|
const char *key;
|
|
|
|
|
|
|
|
source = elm_widget_stringlist_get(edje_object_data_get(target, src));
|
|
|
|
|
|
|
|
EINA_LIST_FREE(source, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Evas_Object *old = edje_object_part_swallow_get(target, key);
|
|
|
|
if (old)
|
|
|
|
{
|
|
|
|
*contents = eina_list_remove(*contents, old);
|
|
|
|
evas_object_del(old);
|
|
|
|
}
|
|
|
|
content = NULL;
|
|
|
|
if (it->itc->func.content_get)
|
|
|
|
content = it->itc->func.content_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
if (!content) continue;
|
|
|
|
*contents = eina_list_append(*contents, content);
|
|
|
|
if (!edje_object_part_swallow(target, key, content))
|
|
|
|
{
|
|
|
|
ERR("%s (%p) can not be swallowed into %s",
|
|
|
|
evas_object_type_get(content), content, key);
|
|
|
|
evas_object_hide(content);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
elm_widget_sub_object_add(WIDGET(it), content);
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
elm_widget_disabled_set(content, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_state_realize(Elm_Gen_Item *it, Evas_Object *target, const char *parts)
|
|
|
|
{
|
|
|
|
Eina_List *src;
|
|
|
|
const char *key;
|
|
|
|
char buf[4096];
|
|
|
|
|
|
|
|
if (!it->itc->func.state_get) return;
|
|
|
|
|
|
|
|
src = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
|
|
|
|
EINA_LIST_FREE(src, key)
|
|
|
|
{
|
|
|
|
if (parts && fnmatch(parts, key, FNM_PERIOD)) continue;
|
|
|
|
|
|
|
|
Eina_Bool on = it->itc->func.state_get
|
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
|
|
|
|
if (on)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
|
|
|
|
edje_object_signal_emit(target, buf, "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
edje_object_message_signal_process(target);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_view_inflate(Evas_Object *view, Elm_Gen_Item *it, Eina_List **sources,
|
|
|
|
Eina_List **contents)
|
|
|
|
{
|
|
|
|
if (!view) return;
|
|
|
|
if (sources) _item_text_realize(it, view, sources, NULL);
|
|
|
|
if (contents) _item_content_realize(it, view, contents, "contents", NULL);
|
|
|
|
_item_state_realize(it, view, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Apply the right style for the created item view.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
_view_style_update(Elm_Gen_Item *it, Evas_Object *view, const char *style)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
|
|
|
snprintf(buf, sizeof(buf), "item/%s", style ? style : "default");
|
|
|
|
|
|
|
|
if (!elm_widget_theme_object_set(WIDGET(it), view,
|
|
|
|
"gengrid", buf,
|
|
|
|
elm_widget_style_get(WIDGET(it))))
|
|
|
|
{
|
|
|
|
ERR("%s is not a valid gengrid item style. "
|
|
|
|
"Automatically falls back into default style.",
|
|
|
|
style);
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(WIDGET(it), view, "gengrid", "item/default", "default");
|
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_mirrored_set(view, elm_widget_mirrored_get(WIDGET(it)));
|
|
|
|
edje_object_scale_set(view, elm_widget_scale_get(WIDGET(it)) *
|
|
|
|
elm_config_scale_get());
|
|
|
|
evas_object_stack_below(view, sd->stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a VIEW(it) during _item_realize()
|
|
|
|
*/
|
|
|
|
static Evas_Object *
|
|
|
|
_view_create(Elm_Gen_Item *it, const char *style)
|
|
|
|
{
|
|
|
|
Evas_Object *view = edje_object_add(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_object_smart_member_add(view, GG_IT(it)->wsd->pan_obj);
|
|
|
|
elm_widget_sub_object_add(WIDGET(it), view);
|
|
|
|
edje_object_scale_set(view, elm_widget_scale_get(WIDGET(it)) *
|
|
|
|
elm_config_scale_get());
|
|
|
|
|
|
|
|
_view_style_update(it, view, style);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_view_clear(Evas_Object *view, Eina_List **texts, Eina_List **contents)
|
|
|
|
{
|
|
|
|
const char *part;
|
|
|
|
Evas_Object *c;
|
|
|
|
const Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(*texts, l, part)
|
|
|
|
edje_object_part_text_set(view, part, NULL);
|
|
|
|
ELM_SAFE_FREE(*texts, elm_widget_stringlist_free);
|
|
|
|
|
|
|
|
EINA_LIST_FREE(*contents, c)
|
|
|
|
evas_object_del(c);
|
|
|
|
}
|
|
|
|
|
2016-02-15 22:28:45 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, Eina_List **l)
|
|
|
|
{
|
|
|
|
Evas_Object *content;
|
|
|
|
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
EINA_LIST_FREE (it->contents, content)
|
|
|
|
{
|
|
|
|
evas_object_smart_member_del(content);
|
|
|
|
// edje can be reused by item caching,
|
|
|
|
// content should be un-swallowed from edje
|
|
|
|
edje_object_part_unswallow(VIEW(it), content);
|
|
|
|
evas_object_hide(content);
|
|
|
|
if (l) *l = eina_list_append(*l, content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
static void
|
|
|
|
_elm_gengrid_item_unrealize(Elm_Gen_Item *it,
|
|
|
|
Eina_Bool calc)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!it->realized) return;
|
|
|
|
if (GG_IT(it)->wsd->reorder_it == it) return;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(WIDGET(it)));
|
|
|
|
if (!calc)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), ELM_GENGRID_EVENT_UNREALIZED, EO_OBJ(it));
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2010-10-05 12:09:58 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_view_clear(VIEW(it), &(it->texts), &(it->contents));
|
2010-10-05 12:09:58 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
ELM_SAFE_FREE(it->states, elm_widget_stringlist_free);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_track_cancel(EO_OBJ(it));
|
2013-09-13 00:20:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->unrealize_cb(it);
|
2010-10-27 07:38:57 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->realized = EINA_FALSE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
2013-09-12 22:19:41 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
|
2010-10-05 12:09:58 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_up_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-07-10 14:40:38 -07:00
|
|
|
void *event_info)
|
2010-10-05 12:09:58 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
|
|
|
Eina_Bool dragged = EINA_FALSE;
|
|
|
|
Elm_Gen_Item *it = data;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-12-29 02:38:17 -08:00
|
|
|
Evas_Coord x, y, dx, dy;
|
|
|
|
|
|
|
|
if ((ev->button == 3) && (!it->dragging))
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
dx = it->dx - (ev->canvas.x - x);
|
|
|
|
dy = it->dy - (ev->canvas.y - y);
|
|
|
|
if (dx < 0) dx = -dx;
|
|
|
|
if (dy < 0) dy = -dy;
|
|
|
|
if ((dx < 5) && (dy < 5))
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED_RIGHT, EO_OBJ(it));
|
2014-12-29 02:38:17 -08:00
|
|
|
return;
|
|
|
|
}
|
2010-10-27 07:38:57 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->button != 1) return;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->down = EINA_FALSE;
|
2014-03-22 07:51:52 -07:00
|
|
|
sd->mouse_down = EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
sd->on_hold = EINA_TRUE;
|
|
|
|
else sd->on_hold = EINA_FALSE;
|
2010-10-05 12:09:58 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_RELEASED, eo_it);
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->dragging)
|
2010-10-01 12:03:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
it->dragging = EINA_FALSE;
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), EVAS_DRAGGABLE_INTERFACE_EVENT_DRAG_STOP, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
dragged = EINA_TRUE;
|
2010-10-01 12:03:17 -07:00
|
|
|
}
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->reorder_mode) &&
|
|
|
|
(sd->reorder_it))
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_WIDGET_EVENT_MOVED, EO_OBJ(sd->reorder_it));
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->reorder_it = NULL;
|
|
|
|
sd->move_effect_enabled = EINA_FALSE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->calc_job =
|
2013-04-24 04:41:37 -07:00
|
|
|
ecore_job_add(_calc_job, sd->obj);
|
2010-10-01 12:03:17 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_hold_set(WIDGET(it), EINA_FALSE);
|
|
|
|
elm_interface_scrollable_bounce_allow_set(WIDGET(it), sd->old_h_bounce, sd->old_v_bounce);
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
|
|
|
|
}
|
|
|
|
if (sd->longpressed)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->longpressed = EINA_FALSE;
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
if (!sd->was_selected)
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->was_selected = EINA_FALSE;
|
|
|
|
return;
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (dragged)
|
|
|
|
{
|
|
|
|
if (it->want_unrealize)
|
|
|
|
_elm_gengrid_item_unrealize(it, EINA_FALSE);
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it)) return;
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
|
2015-07-23 22:30:21 -07:00
|
|
|
if (sd->on_hold || !it->base->still_in)
|
elm_list & elm_genlist & elm_gengrid: fix the behavior of using the mouse.
Summary:
Elementary widgets have different behavior of using the mouse, they need to be unified.
- swipe : without checking on hold, just checking drag state.
- longpress : after longpress, _item_unhighlight(), _item_unselect() are called.
- select : when the mouse pointer leaves item area, _item_unhighlight(), _item_unselect() are called.
First, apply this commit https://phab.enlightenment.org/D2550
Test Plan: elementary_test -> list
Reviewers: seoz, Hermet, CHAN, woohyun, kimcinoo, jaehwan, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2622
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:33:57 -07:00
|
|
|
{
|
|
|
|
sd->longpressed = EINA_FALSE;
|
|
|
|
sd->on_hold = EINA_FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2016-01-24 07:11:13 -08:00
|
|
|
if ((ev->flags == EVAS_BUTTON_NONE) && (sd->focused_item != eo_it))
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2013-11-02 04:50:59 -07:00
|
|
|
if (sd->multi &&
|
2013-11-03 06:58:57 -08:00
|
|
|
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
2013-11-02 04:50:59 -07:00
|
|
|
(evas_key_modifier_is_set(ev->modifiers, "Control"))))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
2014-03-22 03:10:27 -07:00
|
|
|
it->highlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(it);
|
|
|
|
it->unsel_cb(it);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
2014-08-19 00:52:24 -07:00
|
|
|
Elm_Gen_Item *sel = eo_data_scope_get(eo_sel, ELM_GENGRID_ITEM_CLASS);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb(sel);
|
2014-09-27 22:15:37 -07:00
|
|
|
it->unsel_cb(sel);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item2;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
if (item2 != it)
|
|
|
|
{
|
|
|
|
it->unhighlight_cb(item2);
|
|
|
|
it->unsel_cb(item2);
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-03-22 03:10:27 -07:00
|
|
|
it->highlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
2010-09-09 18:40:50 -07:00
|
|
|
}
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
static void
|
|
|
|
_item_mouse_callbacks_add(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_mouse_callbacks_del(Elm_Gen_Item *it,
|
|
|
|
Evas_Object *view)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down_cb, it);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(view, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up_cb, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-09 18:40:50 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_index_update(Elm_Gen_Item *it)
|
2010-09-09 18:40:50 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->position_update)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_INDEX_UPDATE, EO_OBJ(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
it->position_update = EINA_FALSE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2010-09-09 15:01:30 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_unrealize_cb(Elm_Gen_Item *it)
|
2010-09-09 15:01:30 -07:00
|
|
|
{
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (!_item_cache_add(it))
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(VIEW(it), evas_object_del);
|
|
|
|
ELM_SAFE_FREE(it->spacer, evas_object_del);
|
|
|
|
}
|
2010-09-09 15:01:30 -07:00
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
if (it->itc->func.text_get)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
const char *key;
|
|
|
|
|
|
|
|
if (!(it->texts)) it->texts =
|
|
|
|
elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "texts"));
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(it->texts, l, key)
|
|
|
|
{
|
|
|
|
char *s = it->itc->func.text_get
|
2014-09-14 04:51:26 -07:00
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
2012-08-18 06:52:03 -07:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (it->base->disabled)
|
2012-08-18 06:52:03 -07:00
|
|
|
return strdup(E_("State: Disabled"));
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_on_highlight_cb(void *data)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord sx, sy, sw, sh;
|
|
|
|
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
evas_object_geometry_get(it->base->view, &x, &y, &w, &h);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
evas_object_geometry_get(it->base->widget, &sx, &sy, &sw, &sh);
|
2012-08-18 06:52:03 -07:00
|
|
|
if ((x < sx) || (y < sy) || ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_bring_in(EO_OBJ(it),
|
2012-08-18 06:52:03 -07:00
|
|
|
ELM_GENGRID_ITEM_SCROLLTO_IN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_access_widget_item_register(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Elm_Access_Info *ai;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_access_widget_item_register(it->base);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
ai = _elm_access_info_get(it->base->access_obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
|
|
|
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Gengrid Item"));
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
|
|
|
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
|
|
|
|
_elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, it);
|
|
|
|
}
|
|
|
|
|
2015-06-25 07:38:28 -07:00
|
|
|
static void
|
2015-09-23 00:15:56 -07:00
|
|
|
_elm_gengrid_item_focus_update(Elm_Gen_Item *it)
|
2015-06-25 07:38:28 -07:00
|
|
|
{
|
|
|
|
const char *focus_raise;
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
2015-08-04 23:57:11 -07:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj) || _elm_config->win_auto_focus_enable)
|
2015-06-25 07:38:28 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit
|
|
|
|
(VIEW(it), "elm,state,focused", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
focus_raise = edje_object_data_get(VIEW(it), "focusraise");
|
|
|
|
if ((focus_raise) && (!strcmp(focus_raise, "on")))
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it1;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
EINA_LIST_FOREACH(sd->group_items, l, it1)
|
|
|
|
{
|
|
|
|
if (GG_IT(it1)->group_realized)
|
|
|
|
evas_object_raise(VIEW(it1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-03 18:24:08 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_realize(Elm_Gen_Item *it)
|
2011-10-03 18:24:08 -07:00
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2011-10-03 18:24:08 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((it->realized) ||
|
2013-08-27 16:47:16 -07:00
|
|
|
(it->generation < sd->generation))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2011-10-03 18:24:08 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (!_item_cache_find(it))
|
2014-01-08 02:07:07 -08:00
|
|
|
{
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
VIEW(it) = _view_create(it, it->itc->item_style);
|
|
|
|
if (it->item->nocache_once)
|
|
|
|
it->item->nocache_once = EINA_FALSE;
|
2014-01-08 02:07:07 -08:00
|
|
|
}
|
2013-08-26 03:55:21 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
if (it->spacer && edje_object_part_exists(VIEW(it), "elm.swallow.pad"))
|
2013-09-05 21:08:21 -07:00
|
|
|
{
|
|
|
|
it->spacer =
|
|
|
|
evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
|
|
|
|
evas_object_color_set(it->spacer, 0, 0, 0, 0);
|
|
|
|
elm_widget_sub_object_add(WIDGET(it), it->spacer);
|
|
|
|
evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1);
|
|
|
|
edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2013-01-10 04:00:05 -08:00
|
|
|
/* access */
|
|
|
|
if (_elm_config->access_mode) _access_widget_item_register(it);
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
/* infate texts, contents and states of view object */
|
|
|
|
_view_inflate(VIEW(it), it, &it->texts, &it->contents);
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!sd->group_item_width)
|
|
|
|
&& (!sd->group_item_height))
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), &sd->group_item_width,
|
|
|
|
&sd->group_item_height,
|
|
|
|
sd->group_item_width,
|
|
|
|
sd->group_item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!sd->item_width)
|
|
|
|
&& (!sd->item_height))
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), &sd->item_width,
|
|
|
|
&sd->item_height,
|
|
|
|
sd->item_width,
|
|
|
|
sd->item_height);
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_coords_finger_size_adjust
|
2013-08-27 16:47:16 -07:00
|
|
|
(1, &sd->item_width, 1,
|
|
|
|
&sd->item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_mouse_callbacks_add(it, VIEW(it));
|
2012-03-07 05:58:30 -08:00
|
|
|
_elm_gengrid_item_index_update(it);
|
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
if (it->selected)
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(eo_it))
|
2011-10-20 18:08:01 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2013-09-09 02:53:47 -07:00
|
|
|
edje_object_message_signal_process(VIEW(it));
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_show(VIEW(it));
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
if (it->tooltip.content_cb)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set(eo_it, it->tooltip.content_cb, it->tooltip.data, NULL);
|
|
|
|
elm_wdg_item_tooltip_style_set(eo_it, it->tooltip.style);
|
|
|
|
elm_wdg_item_tooltip_window_mode_set(eo_it, it->tooltip.free_size);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
if (it->mouse_cursor)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_set(eo_it, it->mouse_cursor);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2015-04-14 03:20:16 -07:00
|
|
|
if (it->cursor_engine_only)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_engine_only_set(eo_it, it->cursor_engine_only);
|
2015-04-14 03:20:16 -07:00
|
|
|
|
2015-03-11 03:59:58 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
|
|
|
{
|
2015-09-23 00:15:56 -07:00
|
|
|
_elm_gengrid_item_focus_update(it);
|
2015-03-11 03:59:58 -07:00
|
|
|
_elm_widget_item_highlight_in_theme(WIDGET(it), EO_OBJ(it));
|
|
|
|
_elm_widget_highlight_in_theme_update(WIDGET(it));
|
|
|
|
_elm_widget_focus_highlight_start(WIDGET(it));
|
|
|
|
}
|
|
|
|
|
2011-10-20 14:41:24 -07:00
|
|
|
it->realized = EINA_TRUE;
|
|
|
|
it->want_unrealize = EINA_FALSE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2011-06-14 01:36:03 -07:00
|
|
|
static Eina_Bool
|
2012-03-30 05:31:01 -07:00
|
|
|
_reorder_item_move_animator_cb(void *data)
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it = data;
|
2011-06-14 01:36:03 -07:00
|
|
|
Evas_Coord dx, dy;
|
2012-07-10 14:40:38 -07:00
|
|
|
double tt, t;
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2011-06-14 01:36:03 -07:00
|
|
|
|
2012-02-21 15:59:25 -08:00
|
|
|
tt = REORDER_EFFECT_TIME;
|
2012-07-10 14:40:38 -07:00
|
|
|
t = ((0.0 > (t = ecore_loop_time_get() -
|
|
|
|
GG_IT(it)->moving_effect_start_time)) ? 0.0 : t);
|
|
|
|
dx = ((GG_IT(it)->tx - GG_IT(it)->ox) / 10)
|
|
|
|
* elm_config_scale_get();
|
|
|
|
dy = ((GG_IT(it)->ty - GG_IT(it)->oy) / 10)
|
|
|
|
* elm_config_scale_get();
|
2011-06-14 01:36:03 -07:00
|
|
|
|
2012-02-21 15:59:25 -08:00
|
|
|
if (t <= tt)
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
GG_IT(it)->rx += (1 * sin((t / tt) * (M_PI / 2)) * dx);
|
|
|
|
GG_IT(it)->ry += (1 * sin((t / tt) * (M_PI / 2)) * dy);
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
GG_IT(it)->rx += dx;
|
|
|
|
GG_IT(it)->ry += dy;
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
|
2015-01-08 02:36:19 -08:00
|
|
|
if (((dx > 0) && (GG_IT(it)->rx >= GG_IT(it)->tx)) ||
|
|
|
|
((dx <= 0) && (GG_IT(it)->rx <= GG_IT(it)->tx))
|
|
|
|
|| ((dy > 0) && (GG_IT(it)->ry >= GG_IT(it)->ty)) ||
|
|
|
|
((dy <= 0) && (GG_IT(it)->ry <= GG_IT(it)->ty)))
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_move(VIEW(it), GG_IT(it)->tx, GG_IT(it)->ty);
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw, vh;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get
|
2013-08-27 16:47:16 -07:00
|
|
|
(sd->pan_obj, NULL, NULL, &vw, &vh);
|
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_resize
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), sd->group_item_width, vh);
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_resize
|
2013-08-27 16:47:16 -07:00
|
|
|
(VIEW(it), vw, sd->group_item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_resize(VIEW(it), sd->item_width, sd->item_height);
|
2012-07-10 14:40:38 -07:00
|
|
|
GG_IT(it)->moving = EINA_FALSE;
|
|
|
|
GG_IT(it)->item_reorder_move_animator = NULL;
|
|
|
|
|
2011-06-14 01:36:03 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_move(VIEW(it), GG_IT(it)->rx, GG_IT(it)->ry);
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw, vh;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
|
|
|
|
if (sd->horizontal)
|
|
|
|
evas_object_resize(VIEW(it), sd->group_item_width, vh);
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_resize(VIEW(it), vw, sd->group_item_height);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
2013-08-27 16:47:16 -07:00
|
|
|
evas_object_resize(VIEW(it), sd->item_width, sd->item_height);
|
2011-06-14 01:36:03 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2011-09-09 05:43:34 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_place(Elm_Gen_Item *it,
|
|
|
|
Evas_Coord cx,
|
|
|
|
Evas_Coord cy)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh, iw, ih, ww;
|
|
|
|
Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh;
|
|
|
|
Eina_Bool reorder_item_move_forward = EINA_FALSE;
|
2011-09-09 05:43:34 -07:00
|
|
|
Eina_Bool was_realized;
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item_Type *item;
|
|
|
|
long items_count;
|
2014-05-14 20:13:23 -07:00
|
|
|
int item_pos;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
item = GG_IT(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, wsd);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it->x = cx;
|
|
|
|
it->y = cy;
|
|
|
|
evas_object_geometry_get(wsd->pan_obj, &ox, &oy, &vw, &vh);
|
|
|
|
|
|
|
|
/* Preload rows/columns at each side of the Gengrid */
|
|
|
|
cvx = ox - PRELOAD * wsd->item_width;
|
|
|
|
cvy = oy - PRELOAD * wsd->item_height;
|
|
|
|
cvw = vw + 2 * PRELOAD * wsd->item_width;
|
|
|
|
cvh = vh + 2 * PRELOAD * wsd->item_height;
|
|
|
|
|
|
|
|
items_count = wsd->item_count -
|
|
|
|
eina_list_count(wsd->group_items) + wsd->items_lost;
|
|
|
|
if (wsd->horizontal)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2010-11-10 15:59:59 -08:00
|
|
|
int columns, items_visible = 0, items_row;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->item_height > 0)
|
|
|
|
items_visible = vh / wsd->item_height;
|
2010-10-08 18:42:32 -07:00
|
|
|
if (items_visible < 1)
|
2010-12-10 05:01:43 -08:00
|
|
|
items_visible = 1;
|
2010-10-08 18:42:32 -07:00
|
|
|
|
2011-09-09 05:43:34 -07:00
|
|
|
columns = items_count / items_visible;
|
|
|
|
if (items_count % items_visible)
|
2010-12-10 05:01:43 -08:00
|
|
|
columns++;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
tcw = (wsd->item_width * columns) + (wsd->group_item_width *
|
|
|
|
eina_list_count(wsd->group_items));
|
|
|
|
alignw = (vw - tcw) * wsd->align_x;
|
2010-11-23 12:30:48 -08:00
|
|
|
|
2010-10-10 18:55:07 -07:00
|
|
|
items_row = items_visible;
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((unsigned int)items_row > wsd->item_count)
|
|
|
|
items_row = wsd->item_count;
|
|
|
|
if (wsd->filled && (unsigned int)wsd->nmax
|
|
|
|
> (unsigned int)wsd->item_count)
|
|
|
|
tch = wsd->nmax * wsd->item_height;
|
|
|
|
else
|
|
|
|
tch = items_row * wsd->item_height;
|
|
|
|
alignh = (vh - tch) * wsd->align_y;
|
2014-05-14 20:13:23 -07:00
|
|
|
item_pos = items_row * cx + cy + 1;
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
if (item_pos != it->position && !it->position_update)
|
2014-05-14 20:13:23 -07:00
|
|
|
{
|
|
|
|
it->position = item_pos;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2010-10-10 18:55:07 -07:00
|
|
|
else
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-02-21 15:59:25 -08:00
|
|
|
unsigned int rows, items_visible = 0, items_col;
|
2010-10-08 18:42:32 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->item_width > 0)
|
|
|
|
items_visible = vw / wsd->item_width;
|
2010-10-08 18:42:32 -07:00
|
|
|
if (items_visible < 1)
|
2010-12-10 05:01:43 -08:00
|
|
|
items_visible = 1;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2011-09-09 05:43:34 -07:00
|
|
|
rows = items_count / items_visible;
|
|
|
|
if (items_count % items_visible)
|
2010-12-10 05:01:43 -08:00
|
|
|
rows++;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
tch = (wsd->item_height * rows) + (wsd->group_item_height *
|
|
|
|
eina_list_count(wsd->group_items));
|
|
|
|
alignh = (vh - tch) * wsd->align_y;
|
2010-11-23 12:30:48 -08:00
|
|
|
|
2010-10-10 18:55:07 -07:00
|
|
|
items_col = items_visible;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (items_col > wsd->item_count)
|
|
|
|
items_col = wsd->item_count;
|
|
|
|
if (wsd->filled && (unsigned int)wsd->nmax
|
|
|
|
> (unsigned int)wsd->item_count)
|
|
|
|
tcw = wsd->nmax * wsd->item_width;
|
|
|
|
else
|
|
|
|
tcw = items_col * wsd->item_width;
|
|
|
|
alignw = (vw - tcw) * wsd->align_x;
|
2014-05-14 20:13:23 -07:00
|
|
|
item_pos = cx + items_col * cy + 1;
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
if (item_pos != it->position && !it->position_update)
|
2014-05-14 20:13:23 -07:00
|
|
|
{
|
|
|
|
it->position = item_pos;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2010-10-10 18:55:07 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
x = (((cx - item->prev_group) * wsd->item_width)
|
|
|
|
+ (item->prev_group * wsd->group_item_width)) -
|
|
|
|
wsd->pan_x + ox + alignw;
|
2011-11-30 03:03:22 -08:00
|
|
|
y = oy;
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = wsd->group_item_width;
|
2011-09-09 05:43:34 -07:00
|
|
|
ih = vh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-30 03:03:22 -08:00
|
|
|
x = ox;
|
2012-07-10 14:40:38 -07:00
|
|
|
y = (((cy - item->prev_group) * wsd->item_height)
|
|
|
|
+ (item->prev_group * wsd->group_item_height))
|
|
|
|
- wsd->pan_y + oy + alignh;
|
2011-09-09 05:43:34 -07:00
|
|
|
iw = vw;
|
2012-07-10 14:40:38 -07:00
|
|
|
ih = wsd->group_item_height;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
item->gx = x;
|
|
|
|
item->gy = y;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
x = (((cx - item->prev_group) * wsd->item_width)
|
|
|
|
+ (item->prev_group * wsd->group_item_width)) -
|
|
|
|
wsd->pan_x + ox + alignw;
|
|
|
|
y = (cy * wsd->item_height) - wsd->pan_y + oy + alignh;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
x = (cx * wsd->item_width) - wsd->pan_x + ox + alignw;
|
|
|
|
y = (((cy - item->prev_group)
|
|
|
|
* wsd->item_height) + (item->prev_group *
|
|
|
|
wsd->group_item_height)) -
|
|
|
|
wsd->pan_y + oy + alignh;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (elm_widget_mirrored_get(WIDGET(it))) /* Switch items side
|
|
|
|
* and componsate for
|
|
|
|
* pan_x when in RTL
|
|
|
|
* mode */
|
|
|
|
{
|
2011-10-21 09:53:01 -07:00
|
|
|
evas_object_geometry_get(WIDGET(it), NULL, NULL, &ww, NULL);
|
2015-05-28 07:07:27 -07:00
|
|
|
x = ww - x - wsd->item_width - wsd->pan_x - wsd->pan_x + ox + ox;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = wsd->item_width;
|
|
|
|
ih = wsd->item_height;
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
was_realized = it->realized;
|
2011-09-09 05:43:34 -07:00
|
|
|
if (ELM_RECTS_INTERSECT(x, y, iw, ih, cvx, cvy, cvw, cvh))
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2011-10-20 14:41:24 -07:00
|
|
|
_item_realize(it);
|
2010-12-10 05:01:43 -08:00
|
|
|
if (!was_realized)
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
{
|
|
|
|
_elm_gengrid_item_index_update(it);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_REALIZED, EO_OBJ(it));
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
}
|
2011-10-20 15:23:48 -07:00
|
|
|
if (it->parent)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gx < ox)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
it->parent->item->gx = x + wsd->item_width -
|
|
|
|
wsd->group_item_width;
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gx > ox)
|
|
|
|
it->parent->item->gx = ox;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2011-11-30 03:03:22 -08:00
|
|
|
it->parent->item->group_realized = EINA_TRUE;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gy < oy)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
it->parent->item->gy = y + wsd->item_height -
|
|
|
|
wsd->group_item_height;
|
2011-11-30 03:03:22 -08:00
|
|
|
if (it->parent->item->gy > oy)
|
|
|
|
it->parent->item->gy = oy;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
it->parent->item->group_realized = EINA_TRUE;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->reorder_mode)
|
2011-06-02 00:09:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->reorder_it)
|
2011-06-02 00:09:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (item->moving) return;
|
2011-10-03 17:59:18 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!wsd->move_effect_enabled)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
item->ox = x;
|
|
|
|
item->oy = y;
|
2011-10-03 17:59:18 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->reorder_it == it)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_move(VIEW(it), wsd->reorder_item_x,
|
|
|
|
wsd->reorder_item_y);
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_resize(VIEW(it), iw, ih);
|
2011-10-03 17:59:18 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord nx, ny, nw, nh;
|
|
|
|
|
|
|
|
if (wsd->move_effect_enabled)
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((item->ox != x) || (item->oy != y))
|
|
|
|
if (((wsd->old_pan_x == wsd->pan_x)
|
|
|
|
&& (wsd->old_pan_y == wsd->pan_y))
|
|
|
|
|| ((wsd->old_pan_x != wsd->pan_x) &&
|
|
|
|
!(item->ox - wsd->pan_x
|
|
|
|
+ wsd->old_pan_x == x)) ||
|
|
|
|
((wsd->old_pan_y != wsd->pan_y) &&
|
|
|
|
!(item->oy - wsd->pan_y +
|
|
|
|
wsd->old_pan_y == y)))
|
|
|
|
{
|
|
|
|
item->tx = x;
|
|
|
|
item->ty = y;
|
|
|
|
item->rx = item->ox;
|
|
|
|
item->ry = item->oy;
|
|
|
|
item->moving = EINA_TRUE;
|
|
|
|
item->moving_effect_start_time =
|
|
|
|
ecore_loop_time_get();
|
|
|
|
item->item_reorder_move_animator =
|
|
|
|
ecore_animator_add
|
|
|
|
(_reorder_item_move_animator_cb, it);
|
|
|
|
return;
|
|
|
|
}
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
|
2011-10-03 17:59:18 -07:00
|
|
|
/* need fix here */
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
nx = x + (wsd->group_item_width / 2);
|
2011-10-03 17:59:18 -07:00
|
|
|
ny = y;
|
|
|
|
nw = 1;
|
|
|
|
nh = vh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nx = x;
|
2012-07-10 14:40:38 -07:00
|
|
|
ny = y + (wsd->group_item_height / 2);
|
2011-10-03 17:59:18 -07:00
|
|
|
nw = vw;
|
|
|
|
nh = 1;
|
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
nx = x + (wsd->item_width / 2);
|
|
|
|
ny = y + (wsd->item_height / 2);
|
2011-10-03 17:59:18 -07:00
|
|
|
nw = 1;
|
2011-09-09 05:43:34 -07:00
|
|
|
nh = 1;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (ELM_RECTS_INTERSECT
|
|
|
|
(wsd->reorder_item_x, wsd->reorder_item_y,
|
|
|
|
wsd->item_width, wsd->item_height,
|
|
|
|
nx, ny, nw, nh))
|
2011-06-02 00:09:17 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (wsd->horizontal)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((wsd->nmax * wsd->reorder_it->x +
|
|
|
|
wsd->reorder_it->y) >
|
|
|
|
(wsd->nmax * it->x + it->y))
|
2011-10-03 17:59:18 -07:00
|
|
|
reorder_item_move_forward = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((wsd->nmax * wsd->reorder_it->y +
|
|
|
|
wsd->reorder_it->x) >
|
|
|
|
(wsd->nmax * it->y + it->x))
|
2011-10-03 17:59:18 -07:00
|
|
|
reorder_item_move_forward = EINA_TRUE;
|
|
|
|
}
|
2011-06-02 00:09:17 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->items = eina_inlist_remove
|
|
|
|
(wsd->items,
|
|
|
|
EINA_INLIST_GET(wsd->reorder_it));
|
2011-10-03 17:59:18 -07:00
|
|
|
if (reorder_item_move_forward)
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->items = eina_inlist_prepend_relative
|
|
|
|
(wsd->items,
|
|
|
|
EINA_INLIST_GET(wsd->reorder_it),
|
|
|
|
EINA_INLIST_GET(it));
|
2011-10-03 17:59:18 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->items = eina_inlist_append_relative
|
|
|
|
(wsd->items,
|
|
|
|
EINA_INLIST_GET(wsd->reorder_it),
|
|
|
|
EINA_INLIST_GET(it));
|
|
|
|
|
|
|
|
wsd->reorder_item_changed = EINA_TRUE;
|
|
|
|
wsd->move_effect_enabled = EINA_TRUE;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(wsd->calc_job);
|
2012-07-10 14:40:38 -07:00
|
|
|
wsd->calc_job =
|
2013-04-24 04:41:37 -07:00
|
|
|
ecore_job_add(_calc_job, wsd->obj);
|
2011-10-03 17:59:18 -07:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
else if (item->item_reorder_move_animator)
|
2011-10-03 17:59:18 -07:00
|
|
|
{
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(item->item_reorder_move_animator,
|
2013-05-23 08:58:38 -07:00
|
|
|
ecore_animator_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
item->moving = EINA_FALSE;
|
2011-10-03 17:59:18 -07:00
|
|
|
}
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2011-10-20 18:08:01 -07:00
|
|
|
evas_object_move(VIEW(it), x, y);
|
|
|
|
evas_object_resize(VIEW(it), iw, ih);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
item->group_realized = EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
else
|
2010-11-03 11:30:48 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
if (!it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_unrealize(it, EINA_FALSE);
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
item->group_realized = EINA_FALSE;
|
2010-11-03 11:30:48 -07:00
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2012-03-07 05:58:30 -08:00
|
|
|
static void
|
2014-04-01 04:50:40 -07:00
|
|
|
_group_item_place(Elm_Gengrid_Pan_Data *psd)
|
2012-03-07 05:58:30 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord iw, ih, vw, vh;
|
|
|
|
Eina_Bool was_realized;
|
2012-03-07 05:58:30 -08:00
|
|
|
Elm_Gen_Item *it;
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_List *l;
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_geometry_get(psd->wsd->pan_obj, NULL, NULL, &vw, &vh);
|
|
|
|
if (psd->wsd->horizontal)
|
2012-03-07 05:58:30 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = psd->wsd->group_item_width;
|
|
|
|
ih = vh;
|
2012-03-07 05:58:30 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
iw = vw;
|
|
|
|
ih = psd->wsd->group_item_height;
|
|
|
|
}
|
2015-06-25 07:38:28 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(psd->wsd->group_items, l, it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
was_realized = it->realized;
|
|
|
|
if (GG_IT(it)->group_realized)
|
|
|
|
{
|
|
|
|
_item_realize(it);
|
|
|
|
if (!was_realized)
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
{
|
|
|
|
_elm_gengrid_item_index_update(it);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_GENGRID_EVENT_REALIZED, EO_OBJ(it));
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_move
|
|
|
|
(VIEW(it), GG_IT(it)->gx,
|
|
|
|
GG_IT(it)->gy);
|
|
|
|
evas_object_resize(VIEW(it), iw, ih);
|
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_elm_gengrid_item_unrealize(it, EINA_FALSE);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_pan_evas_object_smart_calculate(Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord cx = 0, cy = 0;
|
|
|
|
Elm_Gen_Item *it;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Data *sd = psd->wsd;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
if (!sd->nmax) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->reorder_item_changed = EINA_FALSE;
|
2010-10-08 18:42:32 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (it->group)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->horizontal)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (cy)
|
|
|
|
{
|
|
|
|
cx++;
|
|
|
|
cy = 0;
|
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (cx)
|
|
|
|
{
|
|
|
|
cx = 0;
|
|
|
|
cy++;
|
|
|
|
}
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
}
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_place(it, cx, cy);
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->reorder_item_changed) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->group)
|
2011-03-03 05:01:39 -08:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
cx++;
|
|
|
|
cy = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cx = 0;
|
|
|
|
cy++;
|
|
|
|
}
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
cy = (cy + 1) % sd->nmax;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!cy) cx++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
cx = (cx + 1) % sd->nmax;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!cx) cy++;
|
|
|
|
}
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
_group_item_place(psd);
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
if ((sd->reorder_mode) && (sd->reorder_it))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
if (!sd->reorder_item_changed)
|
2011-03-03 05:01:39 -08:00
|
|
|
{
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->old_pan_x = sd->pan_x;
|
|
|
|
sd->old_pan_y = sd->pan_y;
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->move_effect_enabled = EINA_FALSE;
|
2011-03-03 05:01:39 -08:00
|
|
|
}
|
2013-01-03 04:03:55 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(psd->wobj, ELM_INTERFACE_SCROLLABLE_EVENT_CHANGED, NULL);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (sd->focused_item)
|
|
|
|
_elm_widget_focus_highlight_start(psd->wobj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_elm_pan_pos_set(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord x, Evas_Coord y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((x == psd->wsd->pan_x) && (y == psd->wsd->pan_y)) return;
|
|
|
|
psd->wsd->pan_x = x;
|
|
|
|
psd->wsd->pan_y = y;
|
|
|
|
evas_object_smart_changed(obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (x) *x = psd->wsd->pan_x;
|
|
|
|
if (y) *y = psd->wsd->pan_y;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Pan_Data *psd, Evas_Coord *w, Evas_Coord *h)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (w) *w = psd->wsd->minw;
|
|
|
|
if (h) *h = psd->wsd->minh;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_elm_pan_pos_max_get(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
|
|
|
Evas_Coord ow, oh;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
|
|
|
|
if (x)
|
2012-07-10 14:40:38 -07:00
|
|
|
*x = (ow < psd->wsd->minw) ? psd->wsd->minw - ow : 0;
|
2010-06-03 05:53:14 -07:00
|
|
|
if (y)
|
2012-07-10 14:40:38 -07:00
|
|
|
*y = (oh < psd->wsd->minh) ? psd->wsd->minh - oh : 0;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_elm_pan_pos_min_get(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
|
2010-11-23 12:30:48 -08:00
|
|
|
{
|
2012-02-01 04:29:14 -08:00
|
|
|
Evas_Coord mx = 0, my = 0;
|
2015-05-28 07:07:27 -07:00
|
|
|
Eina_Bool mirrored = elm_widget_mirrored_get(psd->wsd->obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_pan_pos_max_get(obj, &mx, &my);
|
2010-11-23 12:30:48 -08:00
|
|
|
if (x)
|
2015-05-28 07:07:27 -07:00
|
|
|
*x = -mx * (mirrored ? 1 - psd->wsd->align_x : psd->wsd->align_x);
|
2010-11-23 12:30:48 -08:00
|
|
|
if (y)
|
2012-07-10 14:40:38 -07:00
|
|
|
*y = -my * psd->wsd->align_y;
|
2010-11-23 12:30:48 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_pan_class_constructor(Eo_Class *klass)
|
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_PAN_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
#include "elm_gengrid_pan.eo.c"
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-03-21 01:00:46 -07:00
|
|
|
static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_focused(Elm_Object_Item *eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-03-21 01:00:46 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-03-23 07:29:16 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (it->generation < sd->generation)
|
|
|
|
return;
|
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it == sd->focused_item) ||
|
2016-03-02 04:10:48 -08:00
|
|
|
(elm_wdg_item_disabled_get(eo_it)))
|
2014-03-21 01:00:46 -07:00
|
|
|
return;
|
|
|
|
|
2014-05-11 06:42:45 -07:00
|
|
|
switch (_elm_config->focus_autoscroll_mode)
|
|
|
|
{
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_SHOW:
|
|
|
|
elm_gengrid_item_show
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
case ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN:
|
|
|
|
elm_gengrid_item_bring_in
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2014-05-11 06:42:45 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->focused_item = eo_it;
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2015-09-23 00:06:15 -07:00
|
|
|
/* If item is not realized state, widget couldn't get focus_highlight data. */
|
|
|
|
if (it->realized)
|
|
|
|
{
|
2015-09-23 00:15:56 -07:00
|
|
|
_elm_gengrid_item_focus_update(it);
|
2015-09-23 00:06:15 -07:00
|
|
|
_elm_widget_item_highlight_in_theme(obj, eo_it);
|
|
|
|
_elm_widget_highlight_in_theme_update(obj);
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
|
|
|
}
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_ITEM_FOCUSED, eo_it);
|
2014-10-03 07:14:37 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_unfocused(Elm_Object_Item *eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 07:29:16 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (it->generation < sd->generation)
|
|
|
|
return;
|
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it))
|
2014-03-21 01:00:46 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
if ((!sd->focused_item) ||
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_it != sd->focused_item))
|
2014-03-21 01:00:46 -07:00
|
|
|
return;
|
|
|
|
|
2015-08-04 23:57:11 -07:00
|
|
|
if (elm_widget_focus_highlight_enabled_get(obj) || _elm_config->win_auto_focus_enable)
|
2014-03-23 07:29:16 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(sd->focused_item, focus_it);
|
2014-03-23 07:29:16 -07:00
|
|
|
edje_object_signal_emit
|
2014-09-27 22:15:37 -07:00
|
|
|
(VIEW(focus_it), "elm,state,unfocused", "elm");
|
2014-03-23 07:29:16 -07:00
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
sd->focused_item = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_ITEM_UNFOCUSED, eo_it);
|
2014-10-03 07:14:37 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_FOCUSED, EINA_FALSE);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_focus_up(Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Gen_Item *prev = NULL;
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (!sd->focused_item)
|
|
|
|
{
|
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
while ((prev) && (prev->generation < sd->generation))
|
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(prev), EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev = elm_gengrid_item_prev_get(sd->focused_item);
|
|
|
|
if (!eo_prev) return EINA_FALSE;
|
2014-08-19 00:52:24 -07:00
|
|
|
prev = eo_data_scope_get(eo_prev, ELM_GENGRID_ITEM_CLASS);
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_prev == sd->focused_item) return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 1; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_tmp =
|
|
|
|
elm_gengrid_item_prev_get(EO_OBJ(prev));
|
|
|
|
if (!eo_tmp) return EINA_FALSE;
|
2014-08-19 00:52:24 -07:00
|
|
|
prev = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(prev), EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_focus_down(Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2015-08-11 19:09:14 -07:00
|
|
|
unsigned int i, idx;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Gen_Item *next = NULL;
|
2015-08-11 19:09:14 -07:00
|
|
|
Elm_Object_Item *eo_tmp = NULL;
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
if (!sd->focused_item)
|
|
|
|
{
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
while ((next) && (next->generation < sd->generation))
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
2015-08-11 19:09:14 -07:00
|
|
|
idx = elm_gengrid_item_index_get(sd->focused_item);
|
|
|
|
|
|
|
|
if (idx > sd->item_count -
|
|
|
|
((sd->item_count % sd->nmax) == 0 ?
|
|
|
|
sd->nmax : (sd->item_count % sd->nmax)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
if (idx > sd->item_count - sd->nmax)
|
|
|
|
{
|
|
|
|
eo_tmp = elm_gengrid_last_item_get(sd->obj);
|
|
|
|
next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next = eo_data_scope_get(sd->focused_item, ELM_GENGRID_ITEM_CLASS);
|
|
|
|
for (i = 0; i < sd->nmax; i++)
|
|
|
|
{
|
|
|
|
eo_tmp = elm_gengrid_item_next_get(EO_OBJ(next));
|
|
|
|
if (!eo_tmp) return EINA_FALSE;
|
|
|
|
next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS);
|
|
|
|
}
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_focus_left(Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *prev;
|
|
|
|
|
|
|
|
if (!sd->focused_item)
|
|
|
|
{
|
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
while ((prev) && (prev->generation < sd->generation))
|
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev = elm_gengrid_item_prev_get(sd->focused_item);
|
|
|
|
if (!eo_prev) return EINA_FALSE;
|
2014-08-19 00:52:24 -07:00
|
|
|
prev = eo_data_scope_get(eo_prev, ELM_GENGRID_ITEM_CLASS);
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_prev == sd->focused_item) return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(prev), EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_focus_right(Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *next;
|
|
|
|
|
|
|
|
if (!sd->focused_item)
|
|
|
|
{
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
while ((next) && (next->generation < sd->generation))
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_next = elm_gengrid_item_next_get(sd->focused_item);
|
|
|
|
if (!eo_next) return EINA_FALSE;
|
2014-08-19 00:52:24 -07:00
|
|
|
next = eo_data_scope_get(eo_next, ELM_GENGRID_ITEM_CLASS);
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_next == sd->focused_item) return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_left(Elm_Gengrid_Data *sd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!sd->selected) return EINA_FALSE;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = elm_gengrid_item_prev_get(sd->last_selected_item);
|
|
|
|
if (!eo_prev) return EINA_TRUE;
|
2011-06-02 00:09:17 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (elm_gengrid_item_selected_get(eo_prev))
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->last_selected_item = eo_prev;
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_show
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_prev, EINA_TRUE);
|
|
|
|
elm_gengrid_item_show(eo_prev, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_right(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_next;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = elm_gengrid_item_next_get(sd->last_selected_item);
|
|
|
|
if (!eo_next) return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (elm_gengrid_item_selected_get(eo_next))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
elm_gengrid_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->last_selected_item = eo_next;
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_show
|
2014-09-27 22:15:37 -07:00
|
|
|
(eo_next, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_next, EINA_TRUE);
|
|
|
|
elm_gengrid_item_show(eo_next, ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_up(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
Eina_Bool r = EINA_TRUE;
|
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; (r) && (i < sd->nmax); i++)
|
|
|
|
r &= _item_multi_select_left(sd);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_multi_select_down(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
Eina_Bool r = EINA_TRUE;
|
|
|
|
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; (r) && (i < sd->nmax); i++)
|
|
|
|
r &= _item_multi_select_right(sd);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_all_items_deselect(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (!sd->selected) return EINA_FALSE;
|
|
|
|
|
|
|
|
while (sd->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_it = sd->selected->data;
|
|
|
|
elm_gengrid_item_selected_set(eo_it, EINA_FALSE);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_single_select_up(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!sd->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = EO_OBJ(ELM_GEN_ITEM_FROM_INLIST(sd->items->last));
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = sd->last_selected_item;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
while (eo_prev)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-05-14 04:50:11 -07:00
|
|
|
for (i = 0; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = elm_gengrid_item_prev_get(eo_prev);
|
|
|
|
if (!eo_prev) return EINA_FALSE;
|
2014-05-14 04:50:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_prev)) break;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_prev) return EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-05-14 04:50:11 -07:00
|
|
|
_all_items_deselect(sd);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_prev, EINA_TRUE);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_single_select_down(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
Gengrid: Updated gengrid to select the last item.
Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
2015-05-21 02:02:00 -07:00
|
|
|
unsigned int idx;
|
|
|
|
Elm_Object_Item *eo_next, *eo_orig;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!sd->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = EO_OBJ(ELM_GEN_ITEM_FROM_INLIST(sd->items));
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = sd->last_selected_item;
|
Gengrid: Updated gengrid to select the last item.
Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
2015-05-21 02:02:00 -07:00
|
|
|
eo_orig = eo_next;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
while (eo_next)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-05-14 04:50:11 -07:00
|
|
|
for (i = 0; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = elm_gengrid_item_next_get(eo_next);
|
Gengrid: Updated gengrid to select the last item.
Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
2015-05-21 02:02:00 -07:00
|
|
|
if (!eo_next) break;
|
2014-05-14 04:50:11 -07:00
|
|
|
}
|
|
|
|
|
Gengrid: Updated gengrid to select the last item.
Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
2015-05-21 02:02:00 -07:00
|
|
|
if (eo_next && !elm_object_item_disabled_get(eo_next)) break;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
Gengrid: Updated gengrid to select the last item.
Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
2015-05-21 02:02:00 -07:00
|
|
|
if (!eo_next)
|
|
|
|
{
|
|
|
|
idx = elm_gengrid_item_index_get(eo_orig);
|
2015-08-27 23:34:49 -07:00
|
|
|
if (idx > sd->item_count -
|
|
|
|
((sd->item_count % sd->nmax) == 0 ?
|
|
|
|
sd->nmax : (sd->item_count % sd->nmax)))
|
Gengrid: Updated gengrid to select the last item.
Summary:
Updated gengrid to move item selection in 'vertical' mode to the last
item, when currently selected item is not in the last row. As per the
original behaviour, on moving down from such an item, it takes the
focus out of the gengrid widget. Now it is updated to go to the last
item (in last row), and then on further pressing down, focus comes
out of gengrid.
This is something similar to what happens in other UI systems like in
Ubuntu and Windows, when pressing down on (n-1)th row, the last item
in the nth row gets focused.
Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com>
Reviewers: Hermet, SanghyeonLee, raster
Reviewed By: raster
Subscribers: sachin.dev, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2418
2015-05-21 02:02:00 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
else
|
|
|
|
eo_next = elm_gengrid_last_item_get(sd->obj);
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-05-14 04:50:11 -07:00
|
|
|
_all_items_deselect(sd);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_next, EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_single_select_left(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *prev;
|
|
|
|
|
|
|
|
if (!sd->selected)
|
|
|
|
{
|
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
2015-12-07 15:55:33 -08:00
|
|
|
while (((prev) && (prev->generation < sd->generation))
|
|
|
|
|| elm_object_item_disabled_get(EO_OBJ(prev)))
|
2012-07-10 14:40:38 -07:00
|
|
|
prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
|
|
|
|
}
|
|
|
|
else
|
2014-05-14 04:50:11 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev =
|
|
|
|
elm_gengrid_item_prev_get(sd->last_selected_item);
|
|
|
|
while (eo_prev)
|
2014-05-14 04:50:11 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_prev))
|
2014-05-14 04:50:11 -07:00
|
|
|
break;
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = elm_gengrid_item_prev_get(eo_prev);
|
2014-05-14 04:50:11 -07:00
|
|
|
}
|
2014-08-19 00:52:24 -07:00
|
|
|
prev = eo_data_scope_get(eo_prev, ELM_GENGRID_ITEM_CLASS);
|
2014-05-14 04:50:11 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!prev) return EINA_FALSE;
|
|
|
|
|
|
|
|
_all_items_deselect(sd);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(EO_OBJ(prev), EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-04-01 04:50:40 -07:00
|
|
|
_item_single_select_right(Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *next;
|
|
|
|
|
|
|
|
if (!sd->selected)
|
|
|
|
{
|
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
2015-12-07 15:55:33 -08:00
|
|
|
while (((next) && (next->generation < sd->generation))
|
|
|
|
|| elm_object_item_disabled_get(EO_OBJ(next)))
|
2012-07-10 14:40:38 -07:00
|
|
|
next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
|
|
|
|
}
|
|
|
|
else
|
2014-05-14 04:50:11 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_next =
|
|
|
|
elm_gengrid_item_next_get(sd->last_selected_item);
|
|
|
|
while (eo_next)
|
2014-05-14 04:50:11 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_next))
|
2014-05-14 04:50:11 -07:00
|
|
|
break;
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = elm_gengrid_item_next_get(eo_next);
|
2014-05-14 04:50:11 -07:00
|
|
|
}
|
2014-08-19 00:52:24 -07:00
|
|
|
next = eo_data_scope_get(eo_next, ELM_GENGRID_ITEM_CLASS);
|
2014-05-14 04:50:11 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!next) return EINA_FALSE;
|
|
|
|
|
|
|
|
_all_items_deselect(sd);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(EO_OBJ(next), EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-04-03 02:31:47 -07:00
|
|
|
static Eina_Bool
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_edge_check(Elm_Object_Item *eo_it,
|
2014-04-03 02:31:47 -07:00
|
|
|
Elm_Focus_Direction dir)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-04-03 05:06:36 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
2014-04-03 02:31:47 -07:00
|
|
|
ELM_GENGRID_DATA_GET(WIDGET(it), sd);
|
|
|
|
Evas_Coord ix = 0, iy = 0; //item's geometry
|
|
|
|
Evas_Coord cx = 0, cy = 0; //prev or next item's geometry
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item = NULL;
|
|
|
|
Elm_Gen_Item *tmp = it;
|
2014-12-16 02:28:50 -08:00
|
|
|
Eina_Bool mirrored = elm_widget_mirrored_get(WIDGET(it));
|
2014-04-03 02:31:47 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, NULL, NULL);
|
|
|
|
|
|
|
|
if (((sd->horizontal) && (dir == ELM_FOCUS_UP)) ||
|
|
|
|
((!sd->horizontal) && (dir == ELM_FOCUS_LEFT)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_prev_get(EO_OBJ(it));
|
|
|
|
while (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->reorder_mode || !elm_object_item_disabled_get(eo_item)) break;
|
|
|
|
eo_item = elm_gengrid_item_prev_get(eo_item);
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-04-03 02:31:47 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, NULL, NULL);
|
2014-12-16 02:28:50 -08:00
|
|
|
if ((sd->horizontal) && (ix == cx) && (iy > cy))
|
2014-04-03 02:31:47 -07:00
|
|
|
return EINA_FALSE;
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!sd->horizontal) && (iy == cy))
|
2015-08-26 02:04:58 -07:00
|
|
|
{
|
|
|
|
if ((!mirrored && (ix > cx)) || (mirrored && (ix < cx)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if ((dir == ELM_FOCUS_UP) || (!eo_item && sd->reorder_mode))
|
2014-06-06 22:54:28 -07:00
|
|
|
return EINA_TRUE;
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
|
|
|
else if (((sd->horizontal) && (dir == ELM_FOCUS_DOWN)) ||
|
|
|
|
((!sd->horizontal) && (dir == ELM_FOCUS_RIGHT)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(EO_OBJ(it));
|
|
|
|
while (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->reorder_mode || !elm_object_item_disabled_get(eo_item)) break;
|
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_item)
|
2014-04-03 02:31:47 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-04-03 02:31:47 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, NULL, NULL);
|
2014-12-16 02:28:50 -08:00
|
|
|
if ((sd->horizontal) && (ix == cx) && (iy < cy))
|
2014-04-03 02:31:47 -07:00
|
|
|
return EINA_FALSE;
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!sd->horizontal) && (iy == cy))
|
2015-08-26 02:04:58 -07:00
|
|
|
{
|
|
|
|
if ((!mirrored && (ix < cx)) || (mirrored && (ix > cx)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if ((dir == ELM_FOCUS_DOWN) || (!eo_item && sd->reorder_mode))
|
2014-06-06 22:54:28 -07:00
|
|
|
return EINA_TRUE;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
else if (((!sd->horizontal) && (dir == ELM_FOCUS_UP)) ||
|
|
|
|
((sd->horizontal) && (dir == ELM_FOCUS_LEFT)))
|
|
|
|
{
|
|
|
|
Evas_Coord col, row, cvw, cvh;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
if (sd->horizontal && sd->item_height > 0)
|
|
|
|
{
|
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
2015-08-26 03:05:47 -07:00
|
|
|
col = tmp->position / row;
|
|
|
|
if (col == 0)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
2015-08-26 03:05:47 -07:00
|
|
|
row = tmp->position / col;
|
|
|
|
if (row == 0)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (((!sd->horizontal) && (dir == ELM_FOCUS_DOWN)) ||
|
|
|
|
((sd->horizontal) && (dir == ELM_FOCUS_RIGHT)))
|
|
|
|
{
|
|
|
|
Evas_Coord col = 0, row = 0, cvw, cvh;
|
|
|
|
int x = 0;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
if (sd->horizontal && sd->item_height > 0)
|
|
|
|
{
|
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
|
|
|
col = sd->item_count / row;
|
|
|
|
x = sd->item_count % row;
|
|
|
|
if (x == 0)
|
|
|
|
{
|
|
|
|
if ((tmp->position <= (row * col)) &&
|
2014-06-06 22:54:28 -07:00
|
|
|
(tmp->position > (row * (col - 1))))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((tmp->position <= ((col * row) + x)) &&
|
2014-06-06 22:57:44 -07:00
|
|
|
(tmp->position > ((col - 1) * row) + x))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
|
|
|
row = sd->item_count / col;
|
|
|
|
x = sd->item_count % col;
|
|
|
|
if (x == 0)
|
|
|
|
{
|
|
|
|
if ((tmp->position <= (col * row)) &&
|
2014-06-06 22:54:28 -07:00
|
|
|
(tmp->position > (col * (row - 1))))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((tmp->position <= ((col * row) + x)) &&
|
2014-06-06 22:54:28 -07:00
|
|
|
(tmp->position > (((col * (row - 1)) + x))))
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
static Elm_Object_Item *
|
|
|
|
get_up_item(Elm_Gengrid_Data *sd, Elm_Object_Item *eo_it)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_prev = NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_prev = elm_gengrid_item_prev_get(eo_it);
|
|
|
|
if (!eo_prev)
|
|
|
|
return NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
for (i = 1; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_tmp = elm_gengrid_item_prev_get(eo_prev);
|
|
|
|
if (!eo_tmp) return eo_prev;
|
|
|
|
eo_prev = eo_tmp;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return eo_prev;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
static Elm_Object_Item *
|
|
|
|
get_down_item(Elm_Gengrid_Data *sd, Elm_Object_Item *eo_it)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_next = NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_next = elm_gengrid_item_next_get(eo_it);
|
|
|
|
if (!eo_next)
|
|
|
|
return NULL;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
for (i = 1; i < sd->nmax; i++)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_tmp = elm_gengrid_item_next_get(eo_next);
|
|
|
|
if (!eo_tmp) return eo_next;
|
|
|
|
eo_next = eo_tmp;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return eo_next;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
typedef struct _Item_Info
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
Evas_Coord x, y;
|
|
|
|
} Item_Info;
|
|
|
|
|
|
|
|
typedef struct _Reorder_Normal_Data
|
|
|
|
{
|
|
|
|
Item_Info *items;
|
|
|
|
Elm_Gen_Item *corner_item;
|
|
|
|
int no;
|
|
|
|
} Reorder_Normal_Data;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_free_reorder_normal_data(Reorder_Normal_Data *rnd)
|
|
|
|
{
|
|
|
|
free(rnd->items);
|
|
|
|
free(rnd);
|
|
|
|
}
|
|
|
|
|
2014-04-23 05:13:57 -07:00
|
|
|
static void
|
|
|
|
_anim_end(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
Eina_Inlist *tmp = NULL;
|
|
|
|
Elm_Gen_Item *it1_prev = NULL, *it2_prev = NULL;
|
|
|
|
it1_prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(sd->reorder.it1)->prev);
|
|
|
|
it2_prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(sd->reorder.it2)->prev);
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
if ((sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL) &&
|
|
|
|
((!sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_UP) || (sd->reorder.dir == ELM_FOCUS_DOWN))) ||
|
|
|
|
(sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_LEFT) || (sd->reorder.dir == ELM_FOCUS_RIGHT)))))
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
if ((sd->reorder.dir == ELM_FOCUS_UP) ||
|
|
|
|
(sd->reorder.dir == ELM_FOCUS_LEFT))
|
|
|
|
{
|
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
}
|
|
|
|
else if ((sd->reorder.dir == ELM_FOCUS_DOWN) ||
|
|
|
|
(sd->reorder.dir == ELM_FOCUS_RIGHT))
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((sd->reorder.type == ELM_GENGRID_REORDER_TYPE_SWAP) &&
|
|
|
|
((!sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_UP) || (sd->reorder.dir == ELM_FOCUS_DOWN))) ||
|
|
|
|
(sd->horizontal && ((sd->reorder.dir == ELM_FOCUS_LEFT) || (sd->reorder.dir == ELM_FOCUS_RIGHT)))))
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if (it1_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
|
|
|
|
tmp);
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
2014-04-03 02:31:47 -07:00
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
else if ((!sd->horizontal && (sd->reorder.dir == ELM_FOCUS_LEFT)) ||
|
|
|
|
(sd->horizontal && (sd->reorder.dir == ELM_FOCUS_UP)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!(sd->reorder.it2 == it1_prev))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if (it1_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_prepend_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
else if ((!sd->horizontal && (sd->reorder.dir == ELM_FOCUS_RIGHT)) ||
|
|
|
|
(sd->horizontal && (sd->reorder.dir == ELM_FOCUS_DOWN)))
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!(sd->reorder.it1 == it2_prev))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if (it1_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it1_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it2),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if (it2_prev)
|
|
|
|
{
|
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it2_prev));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
tmp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
sd->items = eina_inlist_append_relative(sd->items, EINA_INLIST_GET(sd->reorder.it1),
|
|
|
|
EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
_item_position_update(sd->items, 0);
|
|
|
|
|
|
|
|
ecore_job_del(sd->calc_job);
|
|
|
|
sd->calc_job = ecore_job_add(_calc_job, sd->obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_item_move_cb(void *data, double pos)
|
|
|
|
{
|
|
|
|
Elm_Gengrid_Data *sd = data;
|
|
|
|
double frame = pos;
|
2014-04-26 08:37:23 -07:00
|
|
|
Evas_Coord xx1, yy1, xx2, yy2;
|
2014-04-23 05:13:57 -07:00
|
|
|
double dx, dy;
|
|
|
|
|
2014-04-23 05:21:07 -07:00
|
|
|
switch (sd->reorder.tween_mode)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
case ECORE_POS_MAP_LINEAR:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 0, 0);
|
|
|
|
break;
|
|
|
|
case ECORE_POS_MAP_ACCELERATE:
|
|
|
|
case ECORE_POS_MAP_DECELERATE:
|
|
|
|
case ECORE_POS_MAP_SINUSOIDAL:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 1.0, 0);
|
|
|
|
break;
|
|
|
|
case ECORE_POS_MAP_DIVISOR_INTERP:
|
|
|
|
case ECORE_POS_MAP_BOUNCE:
|
|
|
|
case ECORE_POS_MAP_SPRING:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 1.0, 1.0);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
frame = ecore_animator_pos_map(frame, sd->reorder.tween_mode, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
dx = sd->reorder.x2 - sd->reorder.x1;
|
|
|
|
dy = sd->reorder.y2 - sd->reorder.y1;
|
2014-07-08 23:09:43 -07:00
|
|
|
xx1 = sd->reorder.x1 + (dx * frame);
|
|
|
|
yy1 = sd->reorder.y1 + (dy * frame);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
Reorder_Normal_Data *rnd = sd->reorder.data;
|
|
|
|
|
|
|
|
for (;i < rnd->no; i++)
|
|
|
|
{
|
|
|
|
dx = rnd->items[i + 1].x - rnd->items[i].x;
|
|
|
|
dy = rnd->items[i + 1].y - rnd->items[i].y;
|
|
|
|
xx2 = rnd->items[i].x + (frame * dx);
|
|
|
|
yy2 = rnd->items[i].y + (frame * dy);
|
|
|
|
evas_object_move(VIEW(rnd->items[i].it), xx2, yy2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_SWAP)
|
|
|
|
{
|
|
|
|
xx2 = sd->reorder.x2 - (dx * frame);
|
|
|
|
yy2 = sd->reorder.y2 - (dy * frame);
|
|
|
|
evas_object_move(VIEW(sd->reorder.it2), xx2, yy2);
|
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2014-04-26 08:37:23 -07:00
|
|
|
evas_object_move(VIEW(sd->reorder.it1), xx1, yy1);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
if (pos == 1.0)
|
|
|
|
{
|
|
|
|
_anim_end(sd);
|
2014-07-08 23:09:43 -07:00
|
|
|
if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL)
|
|
|
|
_free_reorder_normal_data(sd->reorder.data);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_show(EO_OBJ(sd->reorder.it1),
|
2014-04-23 05:13:57 -07:00
|
|
|
ELM_GENGRID_ITEM_SCROLLTO_IN);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(sd->obj, ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_STOP, EO_OBJ(sd->reorder.it1));
|
|
|
|
eo_event_callback_call
|
|
|
|
(sd->obj, ELM_WIDGET_EVENT_MOVED, EO_OBJ(sd->reorder.it1));
|
2014-04-23 05:13:57 -07:00
|
|
|
sd->reorder.running = EINA_FALSE;
|
|
|
|
}
|
|
|
|
_elm_widget_focus_highlight_start(sd->obj);
|
2014-04-03 02:31:47 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
static void
|
|
|
|
_store_nearby_items(Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
Reorder_Normal_Data *rnd = sd->reorder.data;
|
|
|
|
Eina_Inlist *itr;
|
|
|
|
Evas_Coord x, y, cvw, cvh, col = 0, row = 0;
|
|
|
|
int i = 0;
|
|
|
|
int corner_item_pos = 0;
|
|
|
|
Eina_Inlist *it1_list, *it2_list;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
|
|
|
|
|
|
|
|
rnd->no = abs(sd->reorder.it2->position - sd->reorder.it1->position);
|
|
|
|
rnd->items = malloc(sizeof(Item_Info) * (rnd->no + 1));
|
2015-07-15 11:13:50 -07:00
|
|
|
rnd->corner_item = NULL;
|
2014-07-08 23:09:43 -07:00
|
|
|
|
|
|
|
if (sd->horizontal && sd->item_height > 0)
|
|
|
|
{
|
|
|
|
row = cvh / sd->item_height;
|
|
|
|
if (row <= 0) row = 1;
|
|
|
|
if (sd->reorder.dir == ELM_FOCUS_RIGHT)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / row;
|
|
|
|
corner_item_pos = corner_item_pos * row;
|
|
|
|
corner_item_pos = sd->reorder.it2->position - corner_item_pos;
|
|
|
|
}
|
|
|
|
else if (sd->reorder.dir == ELM_FOCUS_LEFT)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / row;
|
|
|
|
corner_item_pos = (corner_item_pos + 1) * row;
|
|
|
|
corner_item_pos = corner_item_pos - sd->reorder.it2->position;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sd->item_width > 0)
|
|
|
|
{
|
|
|
|
col = cvw / sd->item_width;
|
|
|
|
if (col <= 0) col = 1;
|
|
|
|
if (sd->reorder.dir == ELM_FOCUS_DOWN)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / col;
|
|
|
|
corner_item_pos = corner_item_pos * col;
|
|
|
|
corner_item_pos = sd->reorder.it2->position - corner_item_pos;
|
|
|
|
}
|
|
|
|
else if (sd->reorder.dir == ELM_FOCUS_UP)
|
|
|
|
{
|
|
|
|
corner_item_pos = (sd->reorder.it2->position + 1) / col;
|
|
|
|
corner_item_pos = (corner_item_pos + 1) * col;
|
|
|
|
corner_item_pos = corner_item_pos - sd->reorder.it2->position;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
it1_list = eina_inlist_find(sd->items, EINA_INLIST_GET(sd->reorder.it1));
|
|
|
|
it2_list = eina_inlist_find(sd->items, EINA_INLIST_GET(sd->reorder.it2));
|
|
|
|
|
|
|
|
if ((sd->reorder.it1->position) < (sd->reorder.it2)->position)
|
|
|
|
{
|
|
|
|
for (itr = it2_list; itr != it1_list; itr = itr->prev)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *cur = EINA_INLIST_CONTAINER_GET(itr, Elm_Gen_Item);
|
|
|
|
evas_object_geometry_get(VIEW(cur), &x, &y, NULL, NULL);
|
|
|
|
rnd->items[i].it = cur;
|
|
|
|
rnd->items[i].x = x;
|
|
|
|
rnd->items[i].y = y;
|
|
|
|
if (i == (corner_item_pos - 1))
|
|
|
|
rnd->corner_item = cur;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
rnd->items[i].it = sd->reorder.it1;
|
|
|
|
rnd->items[i].x = sd->reorder.x1;
|
|
|
|
rnd->items[i].y = sd->reorder.y1;
|
|
|
|
}
|
|
|
|
else if (sd->reorder.it1->position > sd->reorder.it2->position)
|
|
|
|
{
|
|
|
|
for (itr = it2_list; itr != it1_list; itr = itr->next)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *cur = EINA_INLIST_CONTAINER_GET(itr, Elm_Gen_Item);
|
|
|
|
evas_object_geometry_get(VIEW(cur), &x, &y, NULL, NULL);
|
|
|
|
rnd->items[i].it = cur;
|
|
|
|
rnd->items[i].x = x;
|
|
|
|
rnd->items[i].y = y;
|
|
|
|
if (i == (corner_item_pos - 1))
|
|
|
|
rnd->corner_item = cur;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
rnd->items[i].it = sd->reorder.it1;
|
|
|
|
rnd->items[i].x = sd->reorder.x1;
|
|
|
|
rnd->items[i].y = sd->reorder.y1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-23 05:13:57 -07:00
|
|
|
static void
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(Elm_Object_Item *eo_it1, Elm_Object_Item *eo_it2, Elm_Focus_Direction dir)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it1, it1);
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it2, it2);
|
2014-04-23 05:13:57 -07:00
|
|
|
ELM_GENGRID_DATA_GET(WIDGET(it1), sd);
|
2014-04-26 08:37:23 -07:00
|
|
|
Evas_Coord xx1, yy1, xx2, yy2;
|
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
sd->reorder.running = EINA_TRUE;
|
|
|
|
sd->reorder.dir = dir;
|
|
|
|
sd->reorder.it1 = it1;
|
|
|
|
sd->reorder.it2 = it2;
|
|
|
|
|
2014-04-26 08:37:23 -07:00
|
|
|
evas_object_geometry_get(VIEW(it1), &xx1, &yy1, NULL, NULL);
|
|
|
|
evas_object_geometry_get(VIEW(it2), &xx2, &yy2, NULL, NULL);
|
|
|
|
sd->reorder.x1 = xx1;
|
|
|
|
sd->reorder.y1 = yy1;
|
|
|
|
sd->reorder.x2 = xx2;
|
|
|
|
sd->reorder.y2 = yy2;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
2014-07-08 23:09:43 -07:00
|
|
|
if (sd->reorder.type == ELM_GENGRID_REORDER_TYPE_NORMAL)
|
|
|
|
{
|
|
|
|
Reorder_Normal_Data *rnd = malloc(sizeof(Reorder_Normal_Data));
|
|
|
|
sd->reorder.data = rnd;
|
|
|
|
_store_nearby_items(sd);
|
|
|
|
if (rnd->corner_item)
|
|
|
|
evas_object_raise(VIEW(rnd->corner_item));
|
|
|
|
}
|
|
|
|
evas_object_raise(VIEW(it1));
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(sd->obj, ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_START, EO_OBJ(sd->reorder.it1));
|
2014-04-23 05:13:57 -07:00
|
|
|
//TODO: Add elm config for time
|
|
|
|
ecore_animator_timeline_add(0.3, _item_move_cb, sd);
|
|
|
|
}
|
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_item_horizontal_loop(Evas_Object *obj, Elm_Focus_Direction dir)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item = sd->focused_item;
|
2014-06-09 22:55:56 -07:00
|
|
|
unsigned int counter, i;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-06-09 22:55:56 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_UP)
|
|
|
|
{
|
|
|
|
counter = 0;
|
2014-09-27 22:15:37 -07:00
|
|
|
while (!_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_prev_get(eo_item);
|
2014-08-19 00:52:24 -07:00
|
|
|
item = eo_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
counter++;
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_first_item_get(obj);
|
2014-06-09 22:55:56 -07:00
|
|
|
for (i = 0; i < counter; i++)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < sd->nmax; i++)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2014-08-19 00:52:24 -07:00
|
|
|
item = eo_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dir == ELM_FOCUS_RIGHT)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
while (!_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_gengrid_item_next_get(eo_item))
|
2014-06-09 22:55:56 -07:00
|
|
|
break;
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_next_get(eo_item);
|
2014-08-19 00:52:24 -07:00
|
|
|
item = eo_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dir == ELM_FOCUS_LEFT)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
while (!_elm_gengrid_item_edge_check(EO_OBJ(item), dir))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_gengrid_item_prev_get(EO_OBJ(item)))
|
2014-06-09 22:55:56 -07:00
|
|
|
break;
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_item = elm_gengrid_item_prev_get(eo_item);
|
2014-08-19 00:52:24 -07:00
|
|
|
item = eo_data_scope_get(eo_item, ELM_GENGRID_ITEM_CLASS);
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_item) return EINA_FALSE;
|
|
|
|
if (sd->reorder_mode && !(sd->focused_item == eo_item))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(sd->focused_item, eo_item, ELM_FOCUS_RIGHT);
|
2014-06-09 22:55:56 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-13 22:50:30 -07:00
|
|
|
if (_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_object_item_focus_set(eo_item, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_gengrid_item_selected_set(eo_item, EINA_TRUE);
|
2014-06-09 22:55:56 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-08-08 00:23:10 -07:00
|
|
|
return EINA_FALSE;
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
|
|
|
|
2014-04-16 01:19:23 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-16 01:19:23 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord x = 0;
|
|
|
|
Evas_Coord y = 0;
|
|
|
|
Evas_Coord v_w = 0;
|
|
|
|
Evas_Coord v_h = 0;
|
|
|
|
Evas_Coord step_x = 0;
|
|
|
|
Evas_Coord step_y = 0;
|
|
|
|
Evas_Coord page_x = 0;
|
|
|
|
Evas_Coord page_y = 0;
|
|
|
|
Elm_Object_Item *it = NULL;
|
2014-12-16 02:28:50 -08:00
|
|
|
Eina_Bool mirrored = elm_widget_mirrored_get(obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_get(obj, &x, &y);
|
|
|
|
elm_interface_scrollable_step_size_get(obj, &step_x, &step_y);
|
|
|
|
elm_interface_scrollable_page_size_get(obj, &page_x, &page_y);
|
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &v_w, &v_h);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-26 11:17:01 -07:00
|
|
|
if (sd->reorder_mode && sd->reorder.running) return EINA_TRUE;
|
2015-09-10 02:29:24 -07:00
|
|
|
_elm_widget_focus_auto_show(obj);
|
2014-12-16 02:28:50 -08:00
|
|
|
if ((!strcmp(dir, "left") && !mirrored) ||
|
|
|
|
(!strcmp(dir, "right") && mirrored))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-23 05:13:57 -07:00
|
|
|
if (sd->reorder_mode)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_left;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
if (sd->item_loop_enable)
|
2015-08-26 08:13:39 -07:00
|
|
|
return EINA_TRUE;
|
2014-12-15 19:22:58 -08:00
|
|
|
return EINA_FALSE;
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
if (!sd->horizontal)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_left = elm_gengrid_item_prev_get(sd->focused_item);
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_left = get_up_item(sd, sd->focused_item);
|
|
|
|
if (!eo_left)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(sd->focused_item, eo_left, ELM_FOCUS_LEFT);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2015-09-15 03:41:51 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Evas_Object *next = NULL;
|
|
|
|
Elm_Object_Item *next_item = NULL;
|
|
|
|
next_item = elm_object_item_focus_next_item_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_LEFT);
|
|
|
|
if (next_item)
|
|
|
|
{
|
|
|
|
elm_object_item_focus_set(next_item, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
next = elm_object_item_focus_next_object_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_LEFT);
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(next, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2014-03-22 07:51:52 -07:00
|
|
|
if (sd->horizontal)
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
{
|
2014-06-09 22:55:56 -07:00
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT))
|
|
|
|
{
|
|
|
|
if (sd->item_loop_enable)
|
2015-08-27 22:04:52 -07:00
|
|
|
{
|
|
|
|
if (_item_horizontal_loop(obj, ELM_FOCUS_RIGHT))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-12-15 19:22:58 -08:00
|
|
|
return EINA_FALSE;
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_up(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_up(sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-08-10 11:28:16 -07:00
|
|
|
if (sd->focused_item && (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT) ||
|
|
|
|
!elm_gengrid_item_prev_get(sd->focused_item)))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
if (sd->item_loop_enable)
|
|
|
|
{
|
|
|
|
if (_item_horizontal_loop(obj, ELM_FOCUS_RIGHT))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_left(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_left(sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!strcmp(dir, "left_multi") && !mirrored) ||
|
|
|
|
(!strcmp(dir, "right_multi") && mirrored))
|
2014-04-16 01:19:23 -07:00
|
|
|
{
|
|
|
|
if (sd->horizontal)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-16 01:19:23 -07:00
|
|
|
if (_item_multi_select_up(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_up(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT))
|
|
|
|
return EINA_FALSE;
|
|
|
|
if (_item_multi_select_left(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_left(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!strcmp(dir, "right") && !mirrored) ||
|
|
|
|
(!strcmp(dir, "left") && mirrored))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-23 05:13:57 -07:00
|
|
|
if (sd->reorder_mode)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_right;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
2015-08-26 08:13:39 -07:00
|
|
|
if (sd->item_loop_enable)
|
|
|
|
return EINA_TRUE;
|
2014-12-15 19:22:58 -08:00
|
|
|
return EINA_FALSE;
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
2014-04-23 05:13:57 -07:00
|
|
|
if (!sd->horizontal)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_right = elm_gengrid_item_next_get(sd->focused_item);
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_right = get_down_item(sd, sd->focused_item);
|
|
|
|
if (!eo_right)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(sd->focused_item, eo_right, ELM_FOCUS_RIGHT);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2015-09-15 03:41:51 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Evas_Object *next = NULL;
|
|
|
|
Elm_Object_Item *next_item = NULL;
|
|
|
|
next_item = elm_object_item_focus_next_item_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_RIGHT);
|
|
|
|
if (next_item)
|
|
|
|
{
|
|
|
|
elm_object_item_focus_set(next_item, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
next = elm_object_item_focus_next_object_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_RIGHT);
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(next, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2014-03-22 07:51:52 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-08-10 11:28:16 -07:00
|
|
|
if (sd->focused_item && _elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
if (sd->item_loop_enable)
|
|
|
|
{
|
|
|
|
if (_item_horizontal_loop(obj, ELM_FOCUS_UP))
|
|
|
|
return EINA_TRUE;
|
2015-08-26 08:13:39 -07:00
|
|
|
}
|
2014-06-09 22:55:56 -07:00
|
|
|
}
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_down(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_down(sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-08-10 11:28:16 -07:00
|
|
|
if (sd->focused_item && (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT) ||
|
|
|
|
!elm_gengrid_item_next_get(sd->focused_item)))
|
2014-06-09 22:55:56 -07:00
|
|
|
{
|
|
|
|
if (sd->item_loop_enable)
|
|
|
|
{
|
|
|
|
if (_item_horizontal_loop(obj, ELM_FOCUS_LEFT))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_right(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_right(sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
2014-12-16 02:28:50 -08:00
|
|
|
else if ((!strcmp(dir, "right_multi") && !mirrored) ||
|
|
|
|
(!strcmp(dir, "left_multi") && mirrored))
|
2014-04-16 01:19:23 -07:00
|
|
|
{
|
|
|
|
if (sd->horizontal)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-16 01:19:23 -07:00
|
|
|
if (_item_multi_select_down(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_down(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT))
|
|
|
|
return EINA_FALSE;
|
|
|
|
if (_item_multi_select_right(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_right(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "up"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-23 05:13:57 -07:00
|
|
|
if (sd->reorder_mode)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_up;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_UP))
|
2014-12-15 19:22:58 -08:00
|
|
|
return EINA_FALSE;
|
2014-04-23 05:13:57 -07:00
|
|
|
if (!sd->horizontal)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_up = get_up_item(sd, sd->focused_item);
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_up = elm_gengrid_item_prev_get(sd->focused_item);
|
|
|
|
if (!eo_up)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(sd->focused_item, eo_up, ELM_FOCUS_UP);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2015-09-15 03:41:51 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Evas_Object *next = NULL;
|
|
|
|
Elm_Object_Item *next_item = NULL;
|
|
|
|
next_item = elm_object_item_focus_next_item_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_UP);
|
|
|
|
if (next_item)
|
|
|
|
{
|
|
|
|
elm_object_item_focus_set(next_item, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
next = elm_object_item_focus_next_object_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_UP);
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(next, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2014-03-22 07:51:52 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-08-10 11:28:16 -07:00
|
|
|
if (sd->focused_item && _elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_UP))
|
2014-04-16 01:19:23 -07:00
|
|
|
return EINA_FALSE;
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
|
|
|
if (_item_single_select_left(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_left(sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_up(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_up(sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "up_multi"))
|
|
|
|
{
|
|
|
|
if (sd->horizontal)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-16 01:19:23 -07:00
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_UP))
|
|
|
|
return EINA_FALSE;
|
|
|
|
if (_item_multi_select_left(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_left(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_item_multi_select_up(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_up(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "down"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-23 05:13:57 -07:00
|
|
|
if (sd->reorder_mode)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_down;
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_DOWN))
|
2014-12-15 19:22:58 -08:00
|
|
|
return EINA_FALSE;
|
2014-04-23 05:13:57 -07:00
|
|
|
if (!sd->horizontal)
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_down = get_down_item(sd, sd->focused_item);
|
2014-04-23 05:13:57 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_down = elm_gengrid_item_next_get(sd->focused_item);
|
|
|
|
if (!eo_down)
|
2014-04-23 05:13:57 -07:00
|
|
|
return EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
_swap_items(sd->focused_item, eo_down, ELM_FOCUS_DOWN);
|
2014-04-23 05:13:57 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2015-09-15 03:41:51 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Evas_Object *next = NULL;
|
|
|
|
Elm_Object_Item *next_item = NULL;
|
|
|
|
next_item = elm_object_item_focus_next_item_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_DOWN);
|
|
|
|
if (next_item)
|
|
|
|
{
|
|
|
|
elm_object_item_focus_set(next_item, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
next = elm_object_item_focus_next_object_get(sd->focused_item,
|
|
|
|
ELM_FOCUS_DOWN);
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(next, EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2014-03-22 07:51:52 -07:00
|
|
|
if (sd->horizontal)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-08-10 11:28:16 -07:00
|
|
|
if (sd->focused_item && _elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_DOWN))
|
2014-04-16 01:19:23 -07:00
|
|
|
return EINA_FALSE;
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_right(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_right(sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
else
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
{
|
2014-04-26 21:42:47 -07:00
|
|
|
return _item_single_select_down(sd);
|
2014-04-26 21:08:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return _item_focus_down(sd);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
|
|
|
else if (!strcmp(dir, "down_multi"))
|
|
|
|
{
|
|
|
|
if (sd->horizontal)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-16 01:19:23 -07:00
|
|
|
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_DOWN))
|
|
|
|
return EINA_FALSE;
|
|
|
|
if (_item_multi_select_right(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_right(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_item_multi_select_down(sd)) return EINA_TRUE;
|
|
|
|
else if (_item_single_select_down(sd)) return EINA_TRUE;
|
|
|
|
else return EINA_FALSE;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "first"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
it = elm_gengrid_first_item_get(obj);
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_gengrid_item_selected_set(it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "last"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
it = elm_gengrid_last_item_get(obj);
|
2014-04-26 21:08:15 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable)
|
|
|
|
elm_gengrid_item_selected_set(it, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_item_focus_set(it, EINA_TRUE);
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "prior"))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
if (page_x < 0)
|
|
|
|
x -= -(page_x * v_w) / 100;
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
x -= page_x;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (page_y < 0)
|
|
|
|
y -= -(page_y * v_h) / 100;
|
2011-09-09 05:43:34 -07:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
y -= page_y;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else if (!strcmp(dir, "next"))
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->horizontal)
|
|
|
|
{
|
|
|
|
if (page_x < 0)
|
|
|
|
x += -(page_x * v_w) / 100;
|
|
|
|
else
|
|
|
|
x += page_x;
|
|
|
|
}
|
|
|
|
else
|
2011-06-14 01:36:03 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (page_y < 0)
|
|
|
|
y += -(page_y * v_h) / 100;
|
|
|
|
else
|
|
|
|
y += page_y;
|
2011-06-14 01:36:03 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-16 01:19:23 -07:00
|
|
|
else return EINA_FALSE;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_pos_set(obj, x, y, EINA_TRUE);
|
2014-04-16 01:19:23 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2015-02-12 02:15:57 -08:00
|
|
|
_key_action_select(Evas_Object *obj, const char *params)
|
2014-04-16 01:19:23 -07:00
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2015-02-12 02:15:57 -08:00
|
|
|
Elm_Object_Item *eo_it = elm_object_focused_item_get(obj);
|
2015-08-31 00:21:26 -07:00
|
|
|
if (!eo_it) return EINA_TRUE;
|
2015-02-12 02:15:57 -08:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-04-16 01:19:23 -07:00
|
|
|
|
2015-02-12 02:15:57 -08:00
|
|
|
if (sd->multi &&
|
|
|
|
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
|
|
|
(!strcmp(params, "multi"))))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2015-02-12 02:15:57 -08:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
it->highlight_cb(it);
|
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
|
|
|
else it->unsel_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2015-02-12 02:15:57 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
while (sd->selected)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
|
|
|
Elm_Gen_Item *sel = eo_data_scope_get(eo_sel, ELM_GENGRID_ITEM_CLASS);
|
|
|
|
it->unsel_cb(sel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Eina_List *l, *l_next;
|
|
|
|
Elm_Object_Item *eo_item2;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2);
|
|
|
|
if (item2 != it) it->unsel_cb(item2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
it->highlight_cb(it);
|
|
|
|
it->sel_cb(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sd->multi)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), ELM_GENGRID_EVENT_ACTIVATED, eo_it);
|
2015-02-12 02:15:57 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2014-04-16 01:19:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!_all_items_deselect(sd)) return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_event(Eo *obj, Elm_Gengrid_Data *sd, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
|
|
|
(void) src;
|
|
|
|
|
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
|
|
|
if (!sd->items) return EINA_FALSE;
|
|
|
|
|
2015-12-21 04:55:23 -08:00
|
|
|
if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions))
|
2014-04-16 01:19:23 -07:00
|
|
|
return EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-03-23 05:25:40 -07:00
|
|
|
/*
|
|
|
|
* This function searches the nearest visible item based on the given item.
|
|
|
|
* If the given item is in the gengrid viewport, this returns the given item.
|
|
|
|
* Or this searches the realized items and checks the nearest fully visible item
|
|
|
|
* according to the given item's position.
|
|
|
|
*/
|
|
|
|
static Elm_Object_Item *
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_nearest_visible_item_get(Evas_Object *obj, Elm_Object_Item *eo_it)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vx = 0, vy = 0, vw = 0, vh = 0; // gengrid viewport geometry
|
|
|
|
Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0; // given item geometry
|
|
|
|
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; // candidate item geometry
|
|
|
|
Eina_List *item_list = NULL, *l = NULL;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_item = NULL;
|
2014-03-23 05:25:40 -07:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-23 10:10:59 -07:00
|
|
|
Eina_Bool search_next = EINA_FALSE;
|
2014-03-23 05:25:40 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2014-03-23 05:25:40 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(sd->pan_obj, &vx, &vy, &vw, &vh);
|
|
|
|
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih); // FIXME: check if the item is realized or not
|
|
|
|
|
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, ix, iy, iw, ih))
|
2014-03-23 10:10:59 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!elm_object_item_disabled_get(eo_it))
|
|
|
|
return eo_it;
|
2014-03-23 10:10:59 -07:00
|
|
|
else
|
|
|
|
search_next = EINA_TRUE;
|
|
|
|
}
|
2014-03-23 05:25:40 -07:00
|
|
|
|
2014-12-26 01:40:14 -08:00
|
|
|
item_list = elm_gengrid_realized_items_get(obj);
|
|
|
|
|
2014-03-23 10:10:59 -07:00
|
|
|
if ((iy < vy) || search_next)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_LIST_FOREACH(item_list, l, eo_item)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-03-23 05:25:40 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 10:10:59 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:37 -07:00
|
|
|
!elm_object_item_disabled_get(eo_item))
|
2014-12-26 01:40:14 -08:00
|
|
|
{
|
|
|
|
eina_list_free(item_list);
|
|
|
|
return eo_item;
|
|
|
|
}
|
2014-03-23 05:25:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_LIST_REVERSE_FOREACH(item_list, l, eo_item)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
2014-03-23 05:25:40 -07:00
|
|
|
evas_object_geometry_get(VIEW(item), &cx, &cy, &cw, &ch);
|
2014-03-23 10:10:59 -07:00
|
|
|
if (ELM_RECTS_INCLUDE(vx, vy, vw, vh, cx, cy, cw, ch) &&
|
2014-09-27 22:15:37 -07:00
|
|
|
!elm_object_item_disabled_get(eo_item))
|
2014-12-26 01:40:14 -08:00
|
|
|
{
|
|
|
|
eina_list_free(item_list);
|
|
|
|
return eo_item;
|
|
|
|
}
|
2014-03-23 05:25:40 -07:00
|
|
|
}
|
|
|
|
}
|
2014-12-26 03:22:57 -08:00
|
|
|
eina_list_free(item_list);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return eo_it;
|
2014-03-23 05:25:40 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-16 02:46:10 -07:00
|
|
|
_elm_gengrid_elm_widget_on_focus(Eo *obj, Elm_Gengrid_Data *sd, Elm_Object_Item *item)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
int_ret = elm_obj_widget_on_focus(eo_super(obj, MY_CLASS), NULL);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (elm_widget_focus_get(obj) && (sd->selected) &&
|
|
|
|
(!sd->last_selected_item))
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *sel = eina_list_data_get(sd->selected);
|
2014-08-19 00:52:24 -07:00
|
|
|
sd->last_selected_item = eo_data_scope_get(sel, ELM_GENGRID_ITEM_CLASS);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-03-23 00:48:10 -07:00
|
|
|
if (elm_widget_focus_get(obj) && !sd->mouse_down)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2015-09-15 03:41:51 -07:00
|
|
|
if (item) eo_it = item;
|
|
|
|
else
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2015-09-24 23:24:53 -07:00
|
|
|
if (sd->last_focused_item)
|
2015-09-15 03:41:51 -07:00
|
|
|
eo_it = sd->last_focused_item;
|
|
|
|
else if (sd->last_selected_item)
|
|
|
|
eo_it = sd->last_selected_item;
|
|
|
|
else if (_elm_config->first_item_focus_on_first_focus_in)
|
2015-09-24 23:24:53 -07:00
|
|
|
eo_it = elm_gengrid_first_item_get(obj);
|
2014-03-22 07:51:52 -07:00
|
|
|
}
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_it)
|
2014-03-22 07:51:52 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
eo_it = _elm_gengrid_nearest_visible_item_get(obj, eo_it);
|
|
|
|
if (eo_it)
|
2014-03-23 05:25:40 -07:00
|
|
|
{
|
2015-09-24 23:24:53 -07:00
|
|
|
if (!_elm_config->item_select_on_focus_disable &&
|
|
|
|
eo_it != sd->last_selected_item)
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_selected_set(eo_it, EINA_TRUE);
|
2014-03-23 05:25:40 -07:00
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
2014-03-23 05:25:40 -07:00
|
|
|
_elm_widget_focus_highlight_start(obj);
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->focused_item)
|
|
|
|
{
|
|
|
|
sd->last_focused_item = sd->focused_item;
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_unfocused(sd->focused_item);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2015-08-12 01:25:15 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_on_focus_region(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
|
|
|
{
|
|
|
|
if (!sd->focused_item) return EINA_FALSE;
|
|
|
|
if (elm_object_focus_region_show_mode_get(obj) == ELM_FOCUS_REGION_SHOW_ITEM)
|
|
|
|
{
|
|
|
|
Evas_Coord vx, vy;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(sd->focused_item, focus_it);
|
|
|
|
evas_object_geometry_get(VIEW(focus_it), x, y, w, h);
|
|
|
|
evas_object_geometry_get(obj, &vx, &vy, NULL, NULL);
|
|
|
|
|
|
|
|
*x -= vx;
|
|
|
|
*y -= vy;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static Eina_Bool _elm_gengrid_smart_focus_next_enable = EINA_FALSE;
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return _elm_gengrid_smart_focus_next_enable;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-15 03:41:51 -07:00
|
|
|
_elm_gengrid_elm_widget_focus_next(Eo *obj, Elm_Gengrid_Data *sd, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-18 06:52:03 -07:00
|
|
|
Eina_List *items = NULL;
|
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (it->realized)
|
2014-09-27 22:15:37 -07:00
|
|
|
items = eina_list_append(items, it->base->access_obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return elm_widget_focus_list_next_get
|
2015-09-15 03:41:51 -07:00
|
|
|
(obj, items, eina_list_data_get, dir, next, next_item);
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
|
2015-09-24 23:24:53 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_focus_direction(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
|
|
|
|
{
|
|
|
|
Eina_List *items = NULL, *l = NULL;
|
|
|
|
Elm_Object_Item *eo_item = NULL;
|
|
|
|
Eina_Bool ret = EINA_FALSE;
|
|
|
|
double c_weight = 0.0;
|
|
|
|
|
|
|
|
items = elm_gengrid_realized_items_get(obj);
|
|
|
|
eo_item = elm_object_focused_item_get(base);
|
|
|
|
if (eo_item)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, base_item);
|
|
|
|
base = VIEW(base_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(items, l, eo_item)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_item, item);
|
|
|
|
|
|
|
|
c_weight = _elm_widget_focus_direction_weight_get(base, VIEW(item), degree);
|
|
|
|
if ((c_weight == -1.0) ||
|
|
|
|
((c_weight != 0.0) && (*weight != -1.0) &&
|
|
|
|
((int)(*weight * 100000000) < (int)(c_weight * 100000000))))
|
|
|
|
{
|
|
|
|
*direction = (Evas_Object *)obj;
|
|
|
|
*direction_item = eo_item;
|
|
|
|
*weight = c_weight;
|
|
|
|
ret = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_list_free(items);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool rtl)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_cache_zero(sd);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_mirrored_set(eo_super(obj, MY_CLASS), rtl);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!sd->items) return;
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
edje_object_mirrored_set(VIEW(it), rtl);
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_update(EO_OBJ(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_theme_apply(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-04-03 08:07:36 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2016-03-02 04:10:48 -08:00
|
|
|
int_ret = elm_obj_widget_theme_apply(eo_super(obj, MY_CLASS));
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_position_update(Eina_Inlist *list,
|
|
|
|
int idx)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(list, it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
it->position = idx++;
|
|
|
|
it->position_update = EINA_TRUE;
|
|
|
|
}
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_del_not_serious(Elm_Gen_Item *it)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2013-08-27 16:47:16 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_pre_notify_del(eo_it);
|
2013-08-27 16:47:16 -07:00
|
|
|
it->generation = sd->generation - 1; /* This means that the item is deleted */
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-04-01 20:44:27 -07:00
|
|
|
if (it->walking > 0) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-02-12 02:42:25 -08:00
|
|
|
if (sd->show_it == eo_it)
|
|
|
|
{
|
|
|
|
sd->show_it = NULL;
|
|
|
|
sd->show_region = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->bring_in_it == eo_it)
|
|
|
|
{
|
|
|
|
sd->bring_in_it = NULL;
|
|
|
|
sd->bring_in = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->selected)
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, eo_it);
|
|
|
|
if (sd->last_selected_item == eo_it)
|
2014-03-08 09:55:35 -08:00
|
|
|
sd->last_selected_item = NULL;
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->focused_item == eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->focused_item = NULL;
|
2014-09-27 22:15:37 -07:00
|
|
|
if (sd->last_focused_item == eo_it)
|
2014-03-21 01:00:46 -07:00
|
|
|
sd->last_focused_item = NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (it->itc->func.del)
|
2014-09-14 04:51:26 -07:00
|
|
|
it->itc->func.del((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_elm_gengrid_item_del_serious(Elm_Gen_Item *it)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2013-08-27 16:47:16 -07:00
|
|
|
|
2015-05-28 08:58:46 -07:00
|
|
|
sd->item_count--;
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_del_not_serious(it);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->walking -= it->walking;
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->group)
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->group_items = eina_list_remove(sd->group_items, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-08-27 16:47:16 -07:00
|
|
|
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->calc_job = ecore_job_add(sd->calc_cb, sd->obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(it->item, free);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_del(Elm_Gen_Item *it)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2014-08-21 11:09:10 -07:00
|
|
|
sd->selected = eina_list_remove(sd->selected, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->realized) _elm_gengrid_item_unrealize(it, EINA_FALSE);
|
|
|
|
_elm_gengrid_item_del_serious(it);
|
|
|
|
elm_gengrid_item_class_unref((Elm_Gengrid_Item_Class *)it->itc);
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_animate_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, EVAS_SCROLLABLE_INTERFACE_EVENT_SCROLL_ANIM_START, NULL);
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_animate_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, EVAS_SCROLLABLE_INTERFACE_EVENT_SCROLL_ANIM_STOP, NULL);
|
elm genlist: Added "scroll,anim,start", "scroll,anim,stop",
"scroll,drag,start", "scroll,drag,stop" smart callbacks to genlist.
elm gengrid: Added "scroll,anim,start", "scroll,anim,stop" smart
callbacks to genlist.
SVN revision: 62710
2011-08-22 21:02:26 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_drag_start_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, EVAS_SCROLLABLE_INTERFACE_EVENT_SCROLL_DRAG_START, NULL);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_drag_stop_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, EVAS_SCROLLABLE_INTERFACE_EVENT_SCROLL_DRAG_STOP, NULL);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2011-09-27 08:04:57 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_left_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_EDGE_LEFT, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_right_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_EDGE_RIGHT, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_top_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_EDGE_TOP, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_edge_bottom_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2011-09-27 08:04:57 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_EDGE_BOTTOM, NULL);
|
2011-09-27 08:04:57 -07:00
|
|
|
}
|
|
|
|
|
2013-05-15 14:56:04 -07:00
|
|
|
static void
|
|
|
|
_scroll_page_change_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2013-05-15 14:56:04 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, ELM_GENGRID_EVENT_SCROLL_PAGE_CHANGED, NULL);
|
2013-05-15 14:56:04 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_scroll_cb(Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *data EINA_UNUSED)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(obj, EVAS_SCROLLABLE_INTERFACE_EVENT_SCROLL, NULL);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2011-06-25 08:39:05 -07:00
|
|
|
static int
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_compare(const void *data,
|
|
|
|
const void *data1)
|
2011-06-25 08:39:05 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it, *item1;
|
2012-06-14 07:11:04 -07:00
|
|
|
Eina_Compare_Cb cb = NULL;
|
|
|
|
ptrdiff_t d;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2011-10-21 15:55:45 -07:00
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
|
|
|
item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it && GG_IT(it)->wsd->item_compare_cb)
|
|
|
|
cb = GG_IT(it)->wsd->item_compare_cb;
|
|
|
|
else if (item1 && GG_IT(item1)->wsd->item_compare_cb)
|
|
|
|
cb = GG_IT(item1)->wsd->item_compare_cb;
|
2014-09-27 22:15:37 -07:00
|
|
|
if (cb && it && item1) return cb(EO_OBJ(it), EO_OBJ(item1));
|
2012-07-10 14:40:38 -07:00
|
|
|
d = (char *)data - (char *)data1;
|
2012-06-14 07:11:04 -07:00
|
|
|
if (d < 0) return -1;
|
|
|
|
if (!d) return 0;
|
|
|
|
return 1;
|
2011-06-25 08:39:05 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_disable(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2012-01-30 18:40:08 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->generation < GG_IT(it)->wsd->generation) return;
|
2012-01-30 18:40:08 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->realized)
|
2012-01-30 18:40:08 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
|
2012-01-30 18:40:08 -08:00
|
|
|
else
|
2012-07-10 14:40:38 -07:00
|
|
|
edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_item_elm_widget_item_del_pre(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2013-04-01 20:44:27 -07:00
|
|
|
if (it->walking > 0)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
_elm_gengrid_item_del_not_serious(it);
|
2014-08-22 09:52:53 -07:00
|
|
|
return EINA_FALSE;
|
2012-01-30 18:40:08 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
_item_del(it);
|
2014-08-22 09:52:53 -07:00
|
|
|
return EINA_TRUE;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_gengrid_item_elm_widget_item_part_content_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char * part)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
return edje_object_part_swallow_get(VIEW(it), part);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_gengrid_item_elm_widget_item_part_text_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char * part)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
if (!it->itc->func.text_get) return NULL;
|
|
|
|
return edje_object_part_text_get(VIEW(it), part);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char *emission, const char *source)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(VIEW(it), emission, source);
|
2012-01-30 18:40:08 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_focus_set(Eo *eo_it, Elm_Gen_Item *it, Eina_Bool focused)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (focused)
|
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->last_focused_item = eo_it;
|
2014-03-21 01:00:46 -07:00
|
|
|
if (!elm_object_focus_get(obj))
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
|
|
|
2015-02-02 22:47:32 -08:00
|
|
|
if (!elm_widget_focus_get(obj))
|
|
|
|
return;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_it != sd->focused_item)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
if (sd->focused_item)
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_unfocused(sd->focused_item);
|
|
|
|
_elm_gengrid_item_focused(eo_it);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2015-02-02 22:47:32 -08:00
|
|
|
{
|
|
|
|
if (!elm_widget_focus_get(obj))
|
|
|
|
return;
|
|
|
|
_elm_gengrid_item_unfocused(eo_it);
|
|
|
|
}
|
2015-08-12 01:25:15 -07:00
|
|
|
elm_widget_focus_region_show(obj);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_item_elm_widget_item_focus_get(Eo *eo_it, Elm_Gen_Item *it)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if (eo_it == sd->focused_item)
|
2014-03-21 01:00:46 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-30 19:03:17 -08:00
|
|
|
static void
|
2014-04-01 04:50:40 -07:00
|
|
|
_internal_elm_gengrid_clear(Evas_Object *obj,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool standby)
|
2012-01-30 19:03:17 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Inlist *next, *l;
|
|
|
|
|
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
2014-03-14 11:15:22 -07:00
|
|
|
if (!sd->items) return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (!standby) sd->generation++;
|
|
|
|
|
2013-09-08 02:50:00 -07:00
|
|
|
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (sd->walking > 0)
|
2012-01-30 19:03:17 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->clear_me = EINA_TRUE;
|
2012-01-30 19:03:17 -08:00
|
|
|
return;
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2012-07-10 14:40:38 -07:00
|
|
|
for (l = sd->items, next = l ? l->next : NULL;
|
|
|
|
l;
|
|
|
|
l = next, next = next ? next->next : NULL)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(l);
|
|
|
|
|
|
|
|
if (it->generation < sd->generation)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *itn = NULL;
|
|
|
|
|
|
|
|
if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next);
|
|
|
|
if (itn) itn->walking++; /* prevent early death of subitem */
|
|
|
|
it->del_cb(it);
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_del(EO_OBJ(it));
|
2012-07-10 14:40:38 -07:00
|
|
|
if (itn) itn->walking--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sd->clear_me = EINA_FALSE;
|
|
|
|
sd->pan_changed = EINA_TRUE;
|
2013-05-29 04:53:13 -07:00
|
|
|
ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
|
2014-01-21 17:47:33 -08:00
|
|
|
sd->selected = eina_list_free(sd->selected);
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->clear_cb) sd->clear_cb(sd);
|
|
|
|
sd->pan_x = 0;
|
|
|
|
sd->pan_y = 0;
|
|
|
|
sd->minw = 0;
|
|
|
|
sd->minh = 0;
|
|
|
|
|
|
|
|
if (sd->pan_obj)
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(sd->pan_obj, sd->minw, sd->minh);
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(sd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_content_region_show(obj, 0, 0, 0, 0);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2016-02-19 15:58:30 -08:00
|
|
|
|
|
|
|
_elm_widget_focus_highlight_start(obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_select(Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = WIDGET(it);
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-11-25 04:55:12 -08:00
|
|
|
Elm_Object_Item *eo_it = EO_OBJ(it);
|
2012-01-30 19:03:17 -08:00
|
|
|
|
2014-08-21 10:48:29 -07:00
|
|
|
if (_is_no_select(it) ||
|
2014-08-21 08:12:40 -07:00
|
|
|
(it->generation < sd->generation) ||
|
|
|
|
(it->decorate_it_set))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
2014-08-21 08:12:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!it->selected)
|
|
|
|
{
|
|
|
|
it->selected = EINA_TRUE;
|
2014-11-25 04:55:12 -08:00
|
|
|
sd->selected = eina_list_append(sd->selected, eo_it);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
2014-08-27 05:56:38 -07:00
|
|
|
else if ((sd->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS) &&
|
|
|
|
(it->select_mode != ELM_OBJECT_SELECT_MODE_ALWAYS))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
evas_object_ref(obj);
|
|
|
|
it->walking++;
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->walking++;
|
2015-11-18 02:39:13 -08:00
|
|
|
|
|
|
|
elm_object_item_focus_set(eo_it, EINA_TRUE);
|
|
|
|
sd->last_selected_item = eo_it;
|
|
|
|
|
2014-11-25 04:55:12 -08:00
|
|
|
if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it);
|
2013-08-27 16:47:16 -07:00
|
|
|
if (it->generation == sd->generation)
|
2014-03-22 07:51:52 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it);
|
2015-11-05 01:52:28 -08:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_SELECTED, EINA_TRUE);
|
2014-03-22 07:51:52 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it->walking--;
|
2013-08-27 16:47:16 -07:00
|
|
|
sd->walking--;
|
|
|
|
if ((sd->clear_me) && (!sd->walking))
|
2014-04-01 04:50:40 -07:00
|
|
|
_internal_elm_gengrid_clear(WIDGET(it), EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
else
|
|
|
|
{
|
2013-08-27 16:47:16 -07:00
|
|
|
if ((!it->walking) && (it->generation < sd->generation))
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2013-04-01 20:44:27 -07:00
|
|
|
it->del_cb(it);
|
2014-11-25 04:55:12 -08:00
|
|
|
eo_del(eo_it);
|
2015-11-18 02:39:13 -08:00
|
|
|
sd->last_selected_item = NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
evas_object_unref(obj);
|
2012-01-30 19:03:17 -08:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_eo_base_constructor(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_it = eo_constructor(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2014-08-19 00:52:24 -07:00
|
|
|
it->base = eo_data_scope_get(eo_it, ELM_WIDGET_ITEM_CLASS);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(eo_it, ELM_ATSPI_ROLE_LIST_ITEM);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return eo_it;
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
|
|
|
|
2011-10-21 15:55:45 -07:00
|
|
|
static Elm_Gen_Item *
|
2014-04-01 04:50:40 -07:00
|
|
|
_elm_gengrid_item_new(Elm_Gengrid_Data *sd,
|
2012-07-10 14:40:38 -07:00
|
|
|
const Elm_Gen_Item_Class *itc,
|
|
|
|
const void *data,
|
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *func_data)
|
2011-10-21 15:55:45 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!itc) return NULL;
|
|
|
|
|
2016-03-11 04:34:16 -08:00
|
|
|
Eo *eo_it = eo_add(ELM_GENGRID_ITEM_CLASS, sd->obj);
|
2014-09-27 22:15:37 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it->generation = sd->generation;
|
|
|
|
it->itc = itc;
|
|
|
|
elm_gengrid_item_class_ref((Elm_Gengrid_Item_Class *)itc);
|
|
|
|
|
2014-09-14 04:51:26 -07:00
|
|
|
WIDGET_ITEM_DATA_SET(EO_OBJ(it), data);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->parent = NULL;
|
|
|
|
it->func.func = func;
|
|
|
|
it->func.data = func_data;
|
|
|
|
|
|
|
|
it->del_cb = (Ecore_Cb)_item_del;
|
|
|
|
it->highlight_cb = (Ecore_Cb)_item_highlight;
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb = (Ecore_Cb)_item_unhighlight;
|
2012-11-16 06:26:04 -08:00
|
|
|
it->sel_cb = (Ecore_Cb)_item_select;
|
2012-07-10 14:40:38 -07:00
|
|
|
it->unsel_cb = (Ecore_Cb)_item_unselect;
|
|
|
|
it->unrealize_cb = (Ecore_Cb)_item_unrealize_cb;
|
2011-10-21 15:55:45 -07:00
|
|
|
|
2012-11-16 06:26:07 -08:00
|
|
|
GG_IT(it) = ELM_NEW(Elm_Gen_Item_Type);
|
|
|
|
GG_IT(it)->wsd = sd;
|
|
|
|
|
|
|
|
it->group = it->itc->item_style &&
|
|
|
|
(!strcmp(it->itc->item_style, "group_index"));
|
|
|
|
sd->item_count++;
|
|
|
|
|
|
|
|
return it;
|
2011-10-21 15:55:45 -07:00
|
|
|
}
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
/* common layout sizing won't apply here */
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_layout_sizing_eval(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
return; /* no-op */
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_evas_object_smart_add(Eo *obj, Elm_Gengrid_Data *priv)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2012-07-17 09:42:20 -07:00
|
|
|
Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
|
2014-04-01 04:50:40 -07:00
|
|
|
Elm_Gengrid_Pan_Data *pan_data;
|
2013-10-05 01:14:21 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
evas_obj_smart_add(eo_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(priv->hit_rect, obj);
|
|
|
|
elm_widget_sub_object_add(obj, priv->hit_rect);
|
|
|
|
|
2012-07-17 09:42:20 -07:00
|
|
|
/* common scroller hit rectangle setup */
|
2012-07-10 14:40:38 -07:00
|
|
|
evas_object_color_set(priv->hit_rect, 0, 0, 0, 0);
|
|
|
|
evas_object_show(priv->hit_rect);
|
|
|
|
evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
|
2012-07-17 09:42:20 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
priv->calc_cb = (Ecore_Cb)_calc_job;
|
|
|
|
|
|
|
|
priv->generation = 1;
|
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "gengrid", "base",
|
|
|
|
elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-07-17 09:42:20 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, wd->resize_obj, priv->hit_rect);
|
2012-07-17 09:42:20 -07:00
|
|
|
|
|
|
|
priv->old_h_bounce = bounce;
|
|
|
|
priv->old_v_bounce = bounce;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, bounce, bounce);
|
|
|
|
|
|
|
|
elm_interface_scrollable_animate_start_cb_set
|
|
|
|
(obj, _scroll_animate_start_cb);
|
|
|
|
elm_interface_scrollable_animate_stop_cb_set(obj, _scroll_animate_stop_cb);
|
|
|
|
elm_interface_scrollable_drag_start_cb_set(obj, _scroll_drag_start_cb);
|
|
|
|
elm_interface_scrollable_drag_stop_cb_set(obj, _scroll_drag_stop_cb);
|
|
|
|
elm_interface_scrollable_edge_left_cb_set(obj, _edge_left_cb);
|
|
|
|
elm_interface_scrollable_edge_right_cb_set(obj, _edge_right_cb);
|
|
|
|
elm_interface_scrollable_edge_top_cb_set(obj, _edge_top_cb);
|
|
|
|
elm_interface_scrollable_edge_bottom_cb_set(obj, _edge_bottom_cb);
|
|
|
|
elm_interface_scrollable_scroll_cb_set(obj, _scroll_cb);
|
|
|
|
elm_interface_scrollable_page_change_cb_set(obj, _scroll_page_change_cb);
|
2012-07-17 09:42:20 -07:00
|
|
|
|
|
|
|
priv->align_x = 0.5;
|
|
|
|
priv->align_y = 0.5;
|
|
|
|
priv->highlight = EINA_TRUE;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
priv->item_cache_max = CACHE_MAX;
|
2012-07-17 09:42:20 -07:00
|
|
|
|
2016-03-11 04:34:16 -08:00
|
|
|
priv->pan_obj = eo_add(MY_PAN_CLASS, evas_object_evas_get(obj));
|
2013-04-24 04:41:37 -07:00
|
|
|
pan_data = eo_data_scope_get(priv->pan_obj, MY_PAN_CLASS);
|
|
|
|
eo_data_ref(obj, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
pan_data->wobj = obj;
|
2012-07-17 09:42:20 -07:00
|
|
|
pan_data->wsd = priv;
|
|
|
|
|
2013-08-26 03:55:21 -07:00
|
|
|
priv->stack = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(priv->stack, priv->pan_obj);
|
|
|
|
evas_object_raise(priv->stack);
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_extern_pan_set(obj, priv->pan_obj);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_evas_object_smart_del(Eo *obj, Elm_Gengrid_Data *sd)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
|
|
|
elm_gengrid_clear(obj);
|
2013-09-08 02:50:00 -07:00
|
|
|
ELM_SAFE_FREE(sd->pan_obj, evas_object_del);
|
2013-08-26 03:55:21 -07:00
|
|
|
ELM_SAFE_FREE(sd->stack, evas_object_del);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
_item_cache_zero(sd);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
evas_obj_smart_del(eo_super(obj, MY_CLASS));
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_evas_object_smart_move(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord x, Evas_Coord y)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
evas_obj_smart_move(eo_super(obj, MY_CLASS), x, y);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
evas_object_move(sd->hit_rect, x, y);
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_evas_object_smart_resize(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord w, Evas_Coord h)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
evas_obj_smart_resize(eo_super(obj, MY_CLASS), w, h);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
evas_object_resize(sd->hit_rect, w, h);
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_gengrid_evas_object_smart_member_add(Eo *obj, Elm_Gengrid_Data *sd, Evas_Object *member)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
evas_obj_smart_member_add(eo_super(obj, MY_CLASS), member);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static void
|
2014-04-01 04:50:40 -07:00
|
|
|
_access_obj_process(Elm_Gengrid_Data * sd, Eina_Bool is_access)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it;
|
2012-10-18 21:06:42 -07:00
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
{
|
|
|
|
if (!it->realized) continue;
|
|
|
|
if (is_access) _access_widget_item_register(it);
|
|
|
|
else
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_access_widget_item_unregister(it->base);
|
2012-10-18 21:06:42 -07:00
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_widget_access(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool acs)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
_elm_gengrid_smart_focus_next_enable = acs;
|
2012-11-25 22:32:53 -08:00
|
|
|
_access_obj_process(sd, _elm_gengrid_smart_focus_next_enable);
|
2012-07-31 15:07:07 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_gengrid_add(Evas_Object *parent)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2016-03-11 04:34:16 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
return obj;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2014-04-01 04:50:40 -07:00
|
|
|
_elm_gengrid_eo_base_constructor(Eo *obj, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
obj = eo_constructor(eo_super(obj, MY_CLASS));
|
2012-11-25 22:32:53 -08:00
|
|
|
sd->obj = obj;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
evas_obj_type_set(obj, MY_CLASS_NAME_LEGACY);
|
|
|
|
evas_obj_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_TREE_TABLE);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_size_set(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord w, Evas_Coord h)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->item_width == w) && (sd->item_height == h)) return;
|
|
|
|
sd->item_width = w;
|
|
|
|
sd->item_height = h;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_size_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Evas_Coord *w, Evas_Coord *h)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (w) *w = sd->item_width;
|
|
|
|
if (h) *h = sd->item_height;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_group_item_size_set(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord w, Evas_Coord h)
|
2011-09-09 05:43:34 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((sd->group_item_width == w) && (sd->group_item_height == h)) return;
|
|
|
|
sd->group_item_width = w;
|
|
|
|
sd->group_item_height = h;
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_group_item_size_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Evas_Coord *w, Evas_Coord *h)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (w) *w = sd->group_item_width;
|
|
|
|
if (h) *h = sd->group_item_height;
|
2011-09-09 05:43:34 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_align_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, double align_x, double align_y)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
double old_h, old_y;
|
2011-07-25 12:51:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
old_h = sd->align_x;
|
|
|
|
old_y = sd->align_y;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
|
|
|
if (align_x > 1.0)
|
|
|
|
align_x = 1.0;
|
|
|
|
else if (align_x < 0.0)
|
|
|
|
align_x = 0.0;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->align_x = align_x;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
|
|
|
if (align_y > 1.0)
|
|
|
|
align_y = 1.0;
|
|
|
|
else if (align_y < 0.0)
|
|
|
|
align_y = 0.0;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->align_y = align_y;
|
2011-07-25 12:51:40 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((old_h != sd->align_x) || (old_y != sd->align_y))
|
|
|
|
evas_object_smart_calculate(sd->pan_obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_align_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, double *align_x, double *align_y)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (align_x) *align_x = sd->align_x;
|
|
|
|
if (align_y) *align_y = sd->align_y;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_item_append(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Evas_Smart_Cb func, const void *func_data)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it));
|
2013-03-04 03:29:44 -08:00
|
|
|
it->position = sd->item_count;
|
2012-03-07 05:58:30 -08:00
|
|
|
it->position_update = EINA_TRUE;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_prepend(sd->group_items, it);
|
2011-09-09 05:43:34 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2015-10-02 07:44:19 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
|
|
|
elm_interface_atspi_accessible_added(EO_OBJ(it));
|
|
|
|
elm_interface_atspi_accessible_children_changed_added_signal_emit(sd->obj, EO_OBJ(it));
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_item_prepend(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Evas_Smart_Cb func, const void *func_data)
|
2010-10-10 14:05:23 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it));
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
_item_position_update(sd->items, 1);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_append(sd->group_items, it);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2015-10-02 07:44:19 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
|
|
|
elm_interface_atspi_accessible_added(EO_OBJ(it));
|
|
|
|
elm_interface_atspi_accessible_children_changed_added_signal_emit(sd->obj, EO_OBJ(it));
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_insert_before(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Elm_Object_Item *eo_relative, Evas_Smart_Cb func, const void *func_data)
|
2010-10-10 14:05:23 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Inlist *tmp;
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL);
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->items = eina_inlist_prepend_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it),
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_INLIST_GET(relative));
|
2012-07-10 14:40:38 -07:00
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it));
|
2014-09-27 22:15:37 -07:00
|
|
|
_item_position_update(tmp, relative->position);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_append_relative
|
2014-09-27 22:15:37 -07:00
|
|
|
(sd->group_items, it, relative->parent);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:37 -07:00
|
|
|
_elm_gengrid_item_insert_after(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Elm_Object_Item *eo_relative, Evas_Smart_Cb func, const void *func_data)
|
2010-10-10 14:05:23 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Inlist *tmp;
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_relative, NULL);
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_relative, relative);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(relative, NULL);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->items = eina_inlist_append_relative
|
|
|
|
(sd->items, EINA_INLIST_GET(it),
|
2014-09-27 22:15:37 -07:00
|
|
|
EINA_INLIST_GET(relative));
|
2012-07-10 14:40:38 -07:00
|
|
|
tmp = eina_inlist_find(sd->items, EINA_INLIST_GET(it));
|
2014-09-27 22:15:37 -07:00
|
|
|
_item_position_update(tmp, relative->position + 1);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2011-10-21 01:52:03 -07:00
|
|
|
if (it->group)
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->group_items = eina_list_prepend_relative
|
2014-09-27 22:15:37 -07:00
|
|
|
(sd->group_items, it, relative->parent);
|
2010-10-10 14:05:23 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_item_sorted_insert(Eo *obj, Elm_Gengrid_Data *sd, const Elm_Gengrid_Item_Class *itc, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data)
|
2011-06-25 08:39:05 -07:00
|
|
|
{
|
2011-10-21 01:52:03 -07:00
|
|
|
Elm_Gen_Item *it;
|
2011-06-25 08:39:05 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
it = _elm_gengrid_item_new(sd, itc, data, func, func_data);
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!it) return NULL;
|
2011-06-25 08:39:05 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!sd->state)
|
2012-06-14 07:11:04 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->state = eina_inlist_sorted_state_new();
|
|
|
|
eina_inlist_sorted_state_init(sd->state, sd->items);
|
2012-06-14 07:11:04 -07:00
|
|
|
}
|
2011-09-05 13:31:51 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->item_compare_cb = comp;
|
|
|
|
sd->items = eina_inlist_sorted_state_insert
|
|
|
|
(sd->items, EINA_INLIST_GET(it), _elm_gengrid_item_compare, sd->state);
|
|
|
|
_item_position_update(sd->items, 0);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2011-06-25 08:39:05 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_horizontal_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Bool horizontal)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-02-28 22:22:59 -08:00
|
|
|
horizontal = !!horizontal;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (horizontal == sd->horizontal) return;
|
|
|
|
sd->horizontal = horizontal;
|
2010-06-03 05:53:14 -07:00
|
|
|
|
|
|
|
/* Update the items to conform to the new layout */
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->calc_job);
|
2013-04-24 04:41:37 -07:00
|
|
|
sd->calc_job = ecore_job_add(_calc_job, obj);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_horizontal_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2011-04-18 03:54:25 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->horizontal;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_clear(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
_internal_elm_gengrid_clear(obj, EINA_FALSE);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2012-02-28 22:44:35 -08:00
|
|
|
EINA_DEPRECATED EAPI const Evas_Object *
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_object_get(const Elm_Object_Item *eo_it)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
2011-10-20 18:08:01 -07:00
|
|
|
return VIEW(it);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
if (!it->realized) return;
|
|
|
|
if (it->want_unrealize) return;
|
|
|
|
|
2013-09-09 03:00:58 -07:00
|
|
|
_elm_gengrid_item_unrealize(it, EINA_TRUE);
|
2012-07-10 14:40:38 -07:00
|
|
|
_item_realize(it);
|
|
|
|
_item_place(it, it->x, it->y);
|
elm_gengrid: fix the bug that gengrid item index(position) is updated wrong value in item_update
Summary:
elm_gengrid_item_update perform item_unrealize/item_realize/item_place itself.
But when gengrid items are added and not calculated yet,
caller want to get item's index after execute elm_gengrid_item_update,
return value is wrong because item_place update it's position in not-updated item's x and y.
to prevent this,
if item position is already updated,
do not updates position in item place.
additionally,
I fixed gengrid item prepend wrong posiiton update.
gengrid item position start from 1 not 0, so item_position_update also must be started from 1.
@fix
Test Plan:
To test this scenario,
need to fix src/bin/test_gengrid.c first.
1. add below codes in bottom of _after_bt_clicked(line 703).
```
Elm_Object_Item *it = elm_gengrid_item_next_get(id->item);
printf("before update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
elm_gengrid_item_update(it);
printf("after update efl item[%p], index [%d]\n",id->item,elm_gengrid_item_index_get(it));
```
2. execute elementary_test and go to gengrid2 test.
3. add 3 items and select 2nd item then add new item by insert after.
4. you can see index is changed wrong value after item_update executed.
after add fallback code in item_update,
index is returned same value even after item_update execusion.
Reviewers: raster, Hermet, seoz, jaehwan
Subscribers: anand.km, eagleeye, singh.amitesh
Differential Revision: https://phab.enlightenment.org/D2616
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:35:44 -07:00
|
|
|
|
|
|
|
_elm_gengrid_item_index_update(it);
|
2010-10-09 12:07:42 -07:00
|
|
|
}
|
|
|
|
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_fields_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
const char *parts,
|
|
|
|
Elm_Gengrid_Item_Field_Type itf)
|
|
|
|
{
|
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
|
|
|
if (!it->realized) return;
|
|
|
|
if (it->want_unrealize) return;
|
|
|
|
|
|
|
|
if ((!itf) || (itf & ELM_GENGRID_ITEM_FIELD_TEXT))
|
|
|
|
_item_text_realize(it, VIEW(it), &it->texts, parts);
|
|
|
|
|
|
|
|
if ((!itf) || (itf & ELM_GENGRID_ITEM_FIELD_CONTENT))
|
|
|
|
_item_content_realize(it, VIEW(it), &it->contents, "contents", parts);
|
|
|
|
|
|
|
|
if ((!itf) || (itf & ELM_GENGRID_ITEM_FIELD_STATE))
|
|
|
|
_item_state_realize(it, VIEW(it), parts);
|
|
|
|
|
|
|
|
_item_place(it, it->x, it->y);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static const Elm_Gengrid_Item_Class *
|
|
|
|
_elm_gengrid_item_item_class_get(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *item)
|
|
|
|
{
|
2012-07-18 14:03:46 -07:00
|
|
|
if (item->generation < GG_IT(item)->wsd->generation) return NULL;
|
|
|
|
return item->itc;
|
2011-06-25 16:20:22 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_item_class_update(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
const Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2011-10-20 15:45:38 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(itc);
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (it->generation < GG_IT(it)->wsd->generation) return;
|
|
|
|
it->itc = itc;
|
gengrid: add item cache in gengrid for efficient realize/unrealize operation.
Summary:
gengrid realize/unrealize items each smart calculation if their posiiton is updated.
This concept will be occurred useless view object creation and deletion.
So instead of delete items in unrealize function, push item cache into cache list,
and pop item cache from cache list in realize function to reuse item view object
more efficiently.
the cache concept is already implemented in genlist widget and this patch is improved
item cache of genlist cache.
@feature
```
NOTICE: This patch is written under the D2561 Patch which add elm_gengrid_item_fields_update.
So it must submitted after D2561.
```
Test Plan:
I've tested below three cases,
1. tested ith this patch in elementary_test and checked all gengrid features are working properly.
2. tested with changing CACHE_MAX to another value which is set 40 in default
and checked all gengrid features are working properly.
3. tested with set it->item->nocache true, and checked cache is never generated
and checked all gengrid features are working properly.
Reviewers: raster, Hermet, seoz, jaehwan, singh.amitesh
Subscribers: eagleeye, singh.amitesh, Jaehyun
Differential Revision: https://phab.enlightenment.org/D2641
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:28:07 -07:00
|
|
|
it->item->nocache_once = EINA_TRUE;
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_update(EO_OBJ(it));
|
2011-06-25 16:20:22 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_pos_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
unsigned int *x,
|
|
|
|
unsigned int *y)
|
|
|
|
{
|
|
|
|
if (x) *x = it->x;
|
|
|
|
if (y) *y = it->y;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_multi_select_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool multi)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->multi = !!multi;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_multi_select_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->multi;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_multi_select_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Object_Multi_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-03 08:15:58 -08:00
|
|
|
if (mode >= ELM_OBJECT_MULTI_SELECT_MODE_MAX)
|
|
|
|
return;
|
2013-11-03 06:58:57 -08:00
|
|
|
|
2013-11-03 08:15:58 -08:00
|
|
|
if (sd->multi_select_mode != mode)
|
|
|
|
sd->multi_select_mode = mode;
|
2013-11-03 06:58:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Multi_Select_Mode
|
|
|
|
_elm_gengrid_multi_select_mode_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2013-11-03 08:15:58 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->multi_select_mode;
|
2013-11-03 06:58:57 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_selected_item_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
if (sd->selected) return sd->selected->data;
|
|
|
|
return NULL;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_gengrid_selected_items_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->selected;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
Eina_Bool selected)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2016-03-02 04:10:48 -08:00
|
|
|
if ((it->generation < sd->generation) || elm_wdg_item_disabled_get(EO_OBJ(it)))
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
selected = !!selected;
|
|
|
|
if (it->selected == selected) return;
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
{
|
2012-11-16 06:26:10 -08:00
|
|
|
if (!sd->multi)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2012-11-16 06:26:10 -08:00
|
|
|
while (sd->selected)
|
2012-07-10 14:40:38 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
Elm_Object_Item *eo_sel = sd->selected->data;
|
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_sel, sel);
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb(sel);
|
2014-09-27 22:15:37 -07:00
|
|
|
it->unsel_cb(sel);
|
2012-07-10 14:40:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
it->highlight_cb(it);
|
2014-03-22 03:10:27 -07:00
|
|
|
it->sel_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
return;
|
|
|
|
}
|
gengrid: add unhighlight callback
Summary:
item_unselect check it->select status, so when item highlighted but not selected,
item highlight is remaining even after unselect_cb is called.
And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed.
so divide them, too.
This patch will solve upon problem.
Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2653
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-06-25 07:31:36 -07:00
|
|
|
it->unhighlight_cb(it);
|
2012-07-10 14:40:38 -07:00
|
|
|
it->unsel_cb(it);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_item_selected_get(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
return it->selected;
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_List*
|
|
|
|
_elm_gengrid_realized_items_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Gen_Item *it;
|
2014-12-26 01:45:29 -08:00
|
|
|
Eina_Bool done = EINA_FALSE;
|
2012-03-07 05:46:35 -08:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
Eina_List *ret = NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2014-12-26 01:45:29 -08:00
|
|
|
if (it->realized)
|
|
|
|
{
|
|
|
|
done = EINA_TRUE;
|
|
|
|
ret = eina_list_append(ret, EO_OBJ(it));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (done) break;
|
|
|
|
}
|
2012-03-07 05:46:35 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_realized_items_update(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2015-02-03 15:30:06 -08:00
|
|
|
Eina_List *list;
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Object_Item *it;
|
|
|
|
|
|
|
|
list = elm_gengrid_realized_items_get(obj);
|
2015-02-03 15:30:06 -08:00
|
|
|
EINA_LIST_FREE(list, it)
|
2012-03-07 05:46:35 -08:00
|
|
|
elm_gengrid_item_update(it);
|
|
|
|
}
|
|
|
|
|
2010-09-27 11:18:37 -07:00
|
|
|
static Evas_Object *
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_label_create(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *tooltip,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *it EINA_UNUSED)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2011-07-26 02:38:23 -07:00
|
|
|
Evas_Object *label = elm_label_add(tooltip);
|
2010-09-27 11:18:37 -07:00
|
|
|
if (!label)
|
|
|
|
return NULL;
|
|
|
|
elm_object_style_set(label, "tooltip");
|
2011-06-28 23:41:31 -07:00
|
|
|
elm_object_text_set(label, data);
|
2010-09-27 11:18:37 -07:00
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_label_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(data);
|
|
|
|
}
|
|
|
|
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_text_set(Elm_Object_Item *it,
|
|
|
|
const char *text)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_text_set(it, text);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_text_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it, const char *text)
|
|
|
|
{
|
2010-09-27 11:18:37 -07:00
|
|
|
text = eina_stringshare_add(text);
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_content_cb_set
|
2014-09-27 22:15:37 -07:00
|
|
|
(EO_OBJ(it), _elm_gengrid_item_label_create, text,
|
2012-07-10 14:40:38 -07:00
|
|
|
_elm_gengrid_item_label_del_cb);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_content_cb_set(Elm_Object_Item *item,
|
2010-12-10 05:01:43 -08:00
|
|
|
Elm_Tooltip_Item_Content_Cb func,
|
2012-07-10 14:40:38 -07:00
|
|
|
const void *data,
|
|
|
|
Evas_Smart_Cb del_cb)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set(item, func, data, del_cb);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_content_cb_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
Elm_Tooltip_Item_Content_Cb func,
|
|
|
|
const void *data,
|
|
|
|
Evas_Smart_Cb del_cb)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_GOTO(it, error);
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
if ((it->tooltip.content_cb != func) || (it->tooltip.data != data))
|
|
|
|
{
|
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
|
|
|
it->tooltip.content_cb = func;
|
|
|
|
it->tooltip.data = data;
|
|
|
|
it->tooltip.del_cb = del_cb;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
if (VIEW(it))
|
2010-09-27 11:18:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_content_cb_set
|
|
|
|
(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS), it->tooltip.content_cb, it->tooltip.data, NULL);
|
|
|
|
elm_wdg_item_tooltip_style_set(eo_it, it->tooltip.style);
|
|
|
|
elm_wdg_item_tooltip_window_mode_set(eo_it, it->tooltip.free_size);
|
2010-09-27 11:18:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
2010-11-02 04:26:47 -07:00
|
|
|
error:
|
2010-09-27 11:18:37 -07:00
|
|
|
if (del_cb) del_cb((void *)data, NULL, NULL);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_unset(Elm_Object_Item *item)
|
2012-01-30 02:29:51 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_unset(item);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-01-30 02:29:51 -08:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_unset(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
2012-01-30 02:29:51 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((VIEW(it)) && (it->tooltip.content_cb))
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_unset(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
if (it->tooltip.del_cb)
|
|
|
|
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
|
|
|
it->tooltip.del_cb = NULL;
|
|
|
|
it->tooltip.content_cb = NULL;
|
|
|
|
it->tooltip.data = NULL;
|
|
|
|
it->tooltip.free_size = EINA_FALSE;
|
|
|
|
if (it->tooltip.style)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_style_set(eo_it, NULL);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_style_set(Elm_Object_Item *it,
|
|
|
|
const char *style)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_tooltip_style_set(it, style);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_style_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const char *style)
|
|
|
|
{
|
|
|
|
eina_stringshare_replace(&it->tooltip.style, style);
|
2016-03-02 04:10:48 -08:00
|
|
|
if (VIEW(it)) elm_wdg_item_tooltip_style_set(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS), style);
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_tooltip_style_get(const Elm_Object_Item *it)
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_tooltip_style_get(it);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_style_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
|
|
|
return it->tooltip.style;
|
Tooltips: split owner/eventarea, allow subitems to have indepentent tooltips.
Now owner widget (elm_widget) is just used to listen for theme changes
and create/destroy the tooltip data. The actual mouse events operates
on all Evas_Object and is the one where tooltip data is actually
stored.
The public API is basically the same, just the event_info is now NULL
to avoid confusion.
The internal API introduces elm_object_sub_tooltip_content_cb_set()
and as the first parameter the eventarea. While this may be confusing,
as the second parameter is the actual elementary object, it is the one
that all other calls receive, like elm_object_tooltip_hide() or
elm_object_tooltip_unset(), thus it does make sense to have such order.
Also internal API, elm_widget_item_tooltip_* functions were
added. They are a variation of the widget API to handle its items, as
such the func() gets one more parameter: item, and the del_cb() gets
the item as event_info (that's why the public widget version got
event_info always NULL, to not confuse with this one!)
Widgets with items that makes sense to have tooltips got extra API:
* toolbar
* list
* gengrid
* genlist
SVN revision: 52173
2010-09-12 14:05:13 -07:00
|
|
|
}
|
|
|
|
|
2011-07-26 02:38:23 -07:00
|
|
|
EAPI Eina_Bool
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_tooltip_window_mode_set(Elm_Object_Item *it,
|
|
|
|
Eina_Bool disable)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_tooltip_window_mode_set(it, disable);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_window_mode_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
Eina_Bool disable)
|
|
|
|
{
|
|
|
|
it->tooltip.free_size = disable;
|
|
|
|
if (VIEW(it))
|
2015-02-23 09:12:35 -08:00
|
|
|
{
|
|
|
|
Eina_Bool ret;
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_wdg_item_tooltip_window_mode_set(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS), disable);
|
2015-02-23 09:12:35 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2011-07-27 19:22:37 -07:00
|
|
|
return EINA_TRUE;
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_tooltip_window_mode_get(const Elm_Object_Item *it)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_tooltip_window_mode_get(it);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_item_elm_widget_item_tooltip_window_mode_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
2011-07-26 02:38:23 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return it->tooltip.free_size;
|
2011-07-26 02:38:23 -07:00
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_cursor_set(Elm_Object_Item *it,
|
|
|
|
const char *cursor)
|
2014-09-27 22:15:37 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_set(it, cursor);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_cursor_set(Eo *eo_it, Elm_Gen_Item *it,
|
|
|
|
const char *cursor)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
eina_stringshare_replace(&it->mouse_cursor, cursor);
|
2016-03-02 04:10:48 -08:00
|
|
|
if (VIEW(it)) elm_wdg_item_cursor_set(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS), cursor);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2010-11-04 17:46:54 -07:00
|
|
|
EAPI const char *
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_cursor_get(const Elm_Object_Item *it)
|
2010-11-04 17:46:54 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_get(it);
|
2010-11-04 17:46:54 -07:00
|
|
|
}
|
|
|
|
|
2010-09-17 11:24:10 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_cursor_unset(Elm_Object_Item *item)
|
2010-09-17 11:24:10 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_unset(item);
|
2014-09-27 22:15:37 -07:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_elm_widget_item_cursor_unset(Eo *eo_it, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
|
|
|
if (!it->mouse_cursor)
|
2010-09-27 11:18:37 -07:00
|
|
|
return;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
if (VIEW(it)) elm_wdg_item_cursor_unset(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2010-09-27 11:18:37 -07:00
|
|
|
|
2013-09-08 02:50:00 -07:00
|
|
|
ELM_SAFE_FREE(it->mouse_cursor, eina_stringshare_del);
|
2010-09-17 11:24:10 -07:00
|
|
|
}
|
|
|
|
|
2010-09-25 15:01:19 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_item_cursor_style_set(Elm_Object_Item *it,
|
|
|
|
const char *style)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_style_set(it, style);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2012-01-30 02:29:51 -08:00
|
|
|
elm_gengrid_item_cursor_style_get(const Elm_Object_Item *it)
|
2010-09-25 15:01:19 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_style_get(it);
|
2010-09-25 15:01:19 -07:00
|
|
|
}
|
|
|
|
|
2010-09-25 15:03:37 -07:00
|
|
|
EAPI void
|
2015-04-14 03:20:16 -07:00
|
|
|
elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *eo_it,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool engine_only)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2015-04-14 03:20:16 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
|
|
|
it->cursor_engine_only = engine_only;
|
|
|
|
if (it->realized)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_cursor_engine_only_set(eo_it, engine_only);
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2015-04-14 03:20:16 -07:00
|
|
|
elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *eo_it)
|
2010-09-25 15:03:37 -07:00
|
|
|
{
|
2015-04-14 03:20:16 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
|
|
|
|
if (it->realized)
|
2016-03-02 04:10:48 -08:00
|
|
|
return elm_wdg_item_cursor_engine_only_get(eo_it);
|
2015-04-14 03:20:16 -07:00
|
|
|
else return it->cursor_engine_only;
|
2010-09-25 15:03:37 -07:00
|
|
|
}
|
|
|
|
|
2015-08-13 23:21:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_mode_start(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Ecore_Pos_Map tween_mode)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
sd->reorder_mode = EINA_TRUE;
|
|
|
|
sd->reorder.tween_mode = tween_mode;
|
2014-07-08 23:09:43 -07:00
|
|
|
sd->reorder.type = ELM_GENGRID_REORDER_TYPE_NORMAL;
|
2014-04-23 05:13:57 -07:00
|
|
|
}
|
|
|
|
|
2015-08-13 23:21:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_mode_stop(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2014-04-23 05:13:57 -07:00
|
|
|
{
|
|
|
|
sd->reorder_mode = EINA_FALSE;
|
|
|
|
sd->reorder.tween_mode = -1;
|
|
|
|
}
|
|
|
|
|
2015-08-13 23:21:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_type_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Gengrid_Reorder_Type type)
|
2014-07-08 23:09:43 -07:00
|
|
|
{
|
|
|
|
sd->reorder.type = type;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_reorder_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool reorder_mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->reorder_mode = !!reorder_mode;
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_reorder_mode_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->reorder_mode;
|
2011-06-02 00:09:17 -07:00
|
|
|
}
|
|
|
|
|
2010-06-03 05:53:14 -07:00
|
|
|
EAPI void
|
2010-12-10 05:01:43 -08:00
|
|
|
elm_gengrid_bounce_set(Evas_Object *obj,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool h_bounce,
|
|
|
|
Eina_Bool v_bounce)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, h_bounce, v_bounce);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_interface_scrollable_bounce_allow_set(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, Eina_Bool h_bounce, Eina_Bool v_bounce)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(eo_super(obj, MY_CLASS), !!h_bounce, !!v_bounce);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-12-10 05:01:43 -08:00
|
|
|
elm_gengrid_bounce_get(const Evas_Object *obj,
|
2012-07-10 14:40:38 -07:00
|
|
|
Eina_Bool *h_bounce,
|
|
|
|
Eina_Bool *v_bounce)
|
2010-06-03 05:53:14 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_get(obj, h_bounce, v_bounce);
|
2010-06-03 05:53:14 -07:00
|
|
|
}
|
2010-07-06 14:14:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_page_relative_set(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED, double h_pagerel, double v_pagerel)
|
2010-09-29 09:59:35 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Evas_Coord pagesize_h;
|
|
|
|
Evas_Coord pagesize_v;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_get(obj, NULL, NULL, &pagesize_h, &pagesize_v);
|
|
|
|
elm_interface_scrollable_paging_set
|
|
|
|
(obj, h_pagerel, v_pagerel, pagesize_h, pagesize_v);
|
2010-09-29 09:59:35 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_page_relative_get(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED, double *h_pagerel, double *v_pagerel)
|
2011-04-18 03:54:25 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_get(obj, h_pagerel, v_pagerel, NULL, NULL);
|
2011-04-18 03:54:25 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_page_size_set(Eo *obj, Elm_Gengrid_Data *_pd EINA_UNUSED, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
|
2010-12-10 05:01:43 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
double pagerel_h;
|
|
|
|
double pagerel_v;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_paging_get(obj, &pagerel_h, &pagerel_v, NULL, NULL);
|
|
|
|
elm_interface_scrollable_paging_set
|
|
|
|
(obj, pagerel_h, pagerel_v, h_pagesize, v_pagesize);
|
2010-09-29 09:59:35 -07:00
|
|
|
}
|
|
|
|
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_current_page_get(const Evas_Object *obj,
|
|
|
|
int *h_pagenumber,
|
|
|
|
int *v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_current_page_get(obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_last_page_get(const Evas_Object *obj,
|
|
|
|
int *h_pagenumber,
|
|
|
|
int *v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_last_page_get(obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
2014-08-27 01:24:01 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_page_show(const Evas_Object *obj,
|
|
|
|
int h_pagenumber,
|
|
|
|
int v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 07:21:42 -08:00
|
|
|
elm_interface_scrollable_page_show((Eo *) obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
2014-08-27 01:24:01 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_page_bring_in(const Evas_Object *obj,
|
|
|
|
int h_pagenumber,
|
|
|
|
int v_pagenumber)
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 07:21:42 -08:00
|
|
|
elm_interface_scrollable_page_bring_in((Eo *) obj, h_pagenumber, v_pagenumber);
|
elm gengrid: Added page feature to gengrid. Patch by Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu>. Thanks a lot!
On Wed, Aug 31, 2011 at 1:52 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Earlier this month, there was a svn commit
> (http://trac.enlightenment.org/e/changeset/62496) which added a few
> page-related APIs to the elm scroller. These should probably also be
> added to gengrid, genlist and maybe even grid and list. Right now,
> though, I need them for gengrid. So I propose this patch, based
> entirely on the change that went in before. I've built it and I'm
> using these new gengrid APIs in my code now.
On Fri, Sep 9, 2011 at 4:45 PM, Benjamin Drucker
<benjamin.t.drucker@alum.mit.edu> wrote:
> Slowly but surely....
>
> This version of the gengrid page APIs patch has the following changes:
> 1. fixed spacing issues
> 2. add const where needed
> 3. submitted a gengrid longpressed change in a separate patch
>
> I really want to try to squeak this in the upcoming release if at all
> possible. If I have an extra space in some file, I promise I'll not do
> it again for the next patch!
>
> Thanks!!
> Ben
SVN revision: 63403
2011-09-14 19:16:37 -07:00
|
|
|
}
|
|
|
|
|
2012-03-07 05:46:35 -08:00
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_scroller_policy_set(Evas_Object *obj,
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Scroller_Policy policy_h,
|
|
|
|
Elm_Scroller_Policy policy_v)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, policy_h, policy_v);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_interface_scrollable_policy_set(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-03-07 05:46:35 -08:00
|
|
|
if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
|
|
|
|
(policy_v >= ELM_SCROLLER_POLICY_LAST))
|
|
|
|
return;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_set(eo_super(obj, MY_CLASS), policy_h, policy_v);
|
2012-03-07 05:46:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-07-10 14:40:38 -07:00
|
|
|
elm_gengrid_scroller_policy_get(const Evas_Object *obj,
|
2012-03-07 05:46:35 -08:00
|
|
|
Elm_Scroller_Policy *policy_h,
|
|
|
|
Elm_Scroller_Policy *policy_v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
|
|
|
ELM_GENGRID_CHECK(obj);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_get(obj, policy_h, policy_v);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_interface_scrollable_policy_get(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
Elm_Scroller_Policy s_policy_h, s_policy_v;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_policy_get(eo_super(obj, MY_CLASS), &s_policy_h, &s_policy_v);
|
2012-03-07 05:46:35 -08:00
|
|
|
if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
|
|
|
|
if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_first_item_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!sd->items) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
|
|
|
|
while ((it) && (it->generation < sd->generation))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_gengrid_at_xy_item_get(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret)
|
2013-03-16 23:36:30 -07:00
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items);
|
|
|
|
|
2013-05-10 06:38:28 -07:00
|
|
|
Evas_Coord l = 0, r = 0, t = 0, b = 0; /* left, right, top, bottom */
|
2013-03-16 23:36:30 -07:00
|
|
|
Eina_Bool init = EINA_TRUE;
|
|
|
|
|
|
|
|
while ((it) && (it->generation < sd->generation))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
|
|
|
|
if (it)
|
|
|
|
do
|
|
|
|
{
|
|
|
|
Evas_Coord itx, ity;
|
|
|
|
Evas_Coord itw, ith;
|
|
|
|
evas_object_geometry_get(VIEW(it), &itx, &ity, &itw, &ith);
|
|
|
|
|
|
|
|
/* Record leftmost, rightmost, top, bottom cords to set posret */
|
|
|
|
if ((itw > 0) && (ith > 0) && (itx >= 0) && (ity >= 0))
|
|
|
|
{ /* A scroller, ignore items in negative cords,or not rendered */
|
|
|
|
if (init)
|
|
|
|
{
|
|
|
|
l = itx;
|
|
|
|
r = itx + itw;
|
|
|
|
t = ity;
|
|
|
|
b = ity + ith;
|
|
|
|
init = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (itx < l)
|
|
|
|
l = itx;
|
|
|
|
if ((itx + itw) > r)
|
|
|
|
r = itx + itw;
|
|
|
|
if (ity < t)
|
|
|
|
t = ity;
|
|
|
|
if ((ity + ith) > b)
|
|
|
|
b = ity + ith;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ELM_RECTS_INTERSECT
|
|
|
|
(itx, ity, itw, ith, x, y, 1, 1))
|
|
|
|
{
|
|
|
|
if (yposret)
|
|
|
|
{
|
|
|
|
if (y <= (ity + (ith / 4))) *yposret = -1;
|
|
|
|
else if (y >= (ity + ith - (ith / 4)))
|
|
|
|
*yposret = 1;
|
|
|
|
else *yposret = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xposret)
|
|
|
|
{
|
|
|
|
if (x <= (itx + (itw / 4))) *xposret = -1;
|
|
|
|
else if (x >= (itx + itw - (itw / 4)))
|
|
|
|
*xposret = 1;
|
|
|
|
else *xposret = 0;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} while ((it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next)));
|
|
|
|
|
|
|
|
/* No item found, tell the user if hit left/right/top/bottom of items */
|
|
|
|
if (xposret)
|
|
|
|
{
|
|
|
|
*xposret = 0;
|
|
|
|
if (x < l)
|
|
|
|
*xposret = (-1);
|
|
|
|
else if (x > r)
|
|
|
|
*xposret = (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yposret)
|
|
|
|
{
|
|
|
|
*yposret = 0;
|
|
|
|
if (y < t)
|
|
|
|
*yposret = (-1);
|
|
|
|
else if (y > b)
|
|
|
|
*yposret = (1);
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
return NULL;
|
2013-03-16 23:36:30 -07:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_gengrid_last_item_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2010-07-06 14:14:38 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
if (!sd->items) return NULL;
|
2012-07-10 14:40:38 -07:00
|
|
|
|
|
|
|
Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
|
|
|
|
while ((it) && (it->generation < sd->generation))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_gengrid_item_next_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
|
|
|
|
if ((it) && (it->generation == GG_IT(it)->wsd->generation)) break;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_gengrid_item_prev_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
|
|
|
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
|
|
|
|
if ((it) && (it->generation == GG_IT(it)->wsd->generation)) break;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2010-10-10 16:54:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_show(Eo *eo_it, Elm_Gen_Item *it, Elm_Gengrid_Item_Scrollto_Type type)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2014-03-24 01:59:50 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if ((it->generation < sd->generation)) return;
|
2010-09-22 23:33:50 -07:00
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->show_region = EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->show_it = eo_it;
|
2014-01-20 23:54:59 -08:00
|
|
|
sd->scroll_to_type = type;
|
2013-01-03 04:03:55 -08:00
|
|
|
|
|
|
|
_item_show_region(sd);
|
2010-09-22 23:33:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_bring_in(Eo *eo_it, Elm_Gen_Item *it, Elm_Gengrid_Item_Scrollto_Type type)
|
|
|
|
{
|
2014-08-21 11:09:10 -07:00
|
|
|
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
|
2010-09-22 23:33:50 -07:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->generation < sd->generation) return;
|
2010-09-22 23:33:50 -07:00
|
|
|
|
2013-01-03 04:03:55 -08:00
|
|
|
sd->bring_in = EINA_TRUE;
|
2014-09-27 22:15:37 -07:00
|
|
|
sd->bring_in_it = eo_it;
|
2014-01-20 23:54:59 -08:00
|
|
|
sd->scroll_to_type = type;
|
2013-01-03 04:03:55 -08:00
|
|
|
|
|
|
|
_item_show_region(sd);
|
2010-09-22 23:33:50 -07:00
|
|
|
}
|
2012-01-04 06:33:39 -08:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_filled_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool fill)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-01-04 06:33:39 -08:00
|
|
|
fill = !!fill;
|
2012-07-10 14:40:38 -07:00
|
|
|
if (sd->filled != fill)
|
|
|
|
sd->filled = fill;
|
2012-01-04 06:33:39 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_filled_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-03-07 05:46:35 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->filled;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-07-10 14:40:38 -07:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static unsigned int
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_gengrid_items_count(const Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->item_count;
|
2012-03-07 05:46:35 -08:00
|
|
|
}
|
|
|
|
|
2012-02-22 23:36:12 -08:00
|
|
|
EAPI Elm_Gengrid_Item_Class *
|
|
|
|
elm_gengrid_item_class_new(void)
|
|
|
|
{
|
|
|
|
Elm_Gengrid_Item_Class *itc;
|
|
|
|
|
|
|
|
itc = calloc(1, sizeof(Elm_Gengrid_Item_Class));
|
|
|
|
if (!itc)
|
|
|
|
return NULL;
|
2012-03-05 21:02:36 -08:00
|
|
|
itc->version = CLASS_ALLOCATED;
|
2012-02-22 23:36:12 -08:00
|
|
|
itc->refcount = 1;
|
|
|
|
itc->delete_me = EINA_FALSE;
|
|
|
|
|
|
|
|
return itc;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (!itc || (itc->version != CLASS_ALLOCATED)) return;
|
|
|
|
|
|
|
|
if (!itc->delete_me) itc->delete_me = EINA_TRUE;
|
|
|
|
if (itc->refcount > 0) elm_gengrid_item_class_unref(itc);
|
|
|
|
else
|
2012-02-22 23:36:12 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
itc->version = 0;
|
|
|
|
free(itc);
|
2012-02-22 23:36:12 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2012-03-05 21:02:36 -08:00
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-04 18:46:29 -08:00
|
|
|
{
|
|
|
|
itc->refcount++;
|
|
|
|
if (itc->refcount == 0) itc->refcount--;
|
|
|
|
}
|
2012-02-22 23:36:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc)
|
|
|
|
{
|
2012-03-05 21:02:36 -08:00
|
|
|
if (itc && (itc->version == CLASS_ALLOCATED))
|
2012-03-04 18:46:29 -08:00
|
|
|
{
|
|
|
|
if (itc->refcount > 0) itc->refcount--;
|
|
|
|
if (itc->delete_me && (!itc->refcount))
|
|
|
|
elm_gengrid_item_class_free(itc);
|
|
|
|
}
|
2012-02-22 23:36:12 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_select_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Elm_Object_Select_Mode mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (sd->select_mode != mode)
|
|
|
|
sd->select_mode = mode;
|
2012-03-07 04:43:19 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
|
|
|
_elm_gengrid_select_mode_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-03-07 04:43:19 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->select_mode;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_highlight_mode_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool highlight)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
sd->highlight = !!highlight;
|
2012-03-07 05:37:18 -08:00
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_highlight_mode_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2012-03-07 05:37:18 -08:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->highlight;
|
2012-03-07 05:37:18 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static int
|
|
|
|
_elm_gengrid_item_index_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, -1);
|
2012-03-07 05:58:30 -08:00
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
return it->position;
|
2012-03-07 05:58:30 -08:00
|
|
|
}
|
2012-03-08 05:47:09 -08:00
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_item_select_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|
|
|
Elm_Object_Select_Mode mode)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->generation < GG_IT(it)->wsd->generation) return;
|
2012-03-08 05:47:09 -08:00
|
|
|
if (mode >= ELM_OBJECT_SELECT_MODE_MAX)
|
|
|
|
return;
|
|
|
|
|
2012-07-10 14:40:38 -07:00
|
|
|
if (it->select_mode != mode)
|
|
|
|
it->select_mode = mode;
|
|
|
|
|
|
|
|
if (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
2014-09-27 22:15:37 -07:00
|
|
|
elm_gengrid_item_update(EO_OBJ(it));
|
2012-03-08 05:47:09 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:37 -07:00
|
|
|
EOLIAN static Elm_Object_Select_Mode
|
|
|
|
_elm_gengrid_item_select_mode_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
|
|
|
{
|
2012-07-10 14:40:38 -07:00
|
|
|
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, ELM_OBJECT_SELECT_MODE_MAX);
|
|
|
|
|
|
|
|
return it->select_mode;
|
2012-03-08 05:47:09 -08:00
|
|
|
}
|
2012-11-14 08:34:33 -08:00
|
|
|
|
2014-10-03 07:14:37 -07:00
|
|
|
EOLIAN Elm_Atspi_State_Set
|
|
|
|
_elm_gengrid_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_it, Elm_Gen_Item *it EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Atspi_State_Set ret;
|
2014-10-09 01:17:09 -07:00
|
|
|
Eina_Bool sel;
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_atspi_accessible_state_set_get(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
sel = elm_obj_gengrid_item_selected_get(eo_it);
|
2014-10-09 01:17:09 -07:00
|
|
|
|
|
|
|
STATE_TYPE_SET(ret, ELM_ATSPI_STATE_SELECTABLE);
|
|
|
|
|
|
|
|
if (sel)
|
|
|
|
STATE_TYPE_SET(ret, ELM_ATSPI_STATE_SELECTED);
|
2014-10-03 07:14:37 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-10-21 05:46:35 -07:00
|
|
|
EOLIAN char*
|
2015-12-17 00:36:02 -08:00
|
|
|
_elm_gengrid_item_elm_interface_atspi_accessible_name_get(Eo *eo_it, Elm_Gen_Item *it)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
2014-10-21 05:46:35 -07:00
|
|
|
char *ret;
|
2014-10-03 07:14:37 -07:00
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_atspi_accessible_name_get(eo_super(eo_it, ELM_GENGRID_ITEM_CLASS));
|
2015-12-17 00:36:02 -08:00
|
|
|
if (ret) return ret;
|
|
|
|
|
2014-10-03 07:14:37 -07:00
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
if (it->itc->func.text_get)
|
|
|
|
{
|
|
|
|
Eina_List *texts;
|
|
|
|
const char *key;
|
|
|
|
|
|
|
|
texts =
|
|
|
|
elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "texts"));
|
|
|
|
|
|
|
|
EINA_LIST_FREE(texts, key)
|
|
|
|
{
|
2015-05-04 02:45:06 -07:00
|
|
|
char *str_markup = it->itc->func.text_get
|
2014-10-03 07:14:37 -07:00
|
|
|
((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
|
|
|
|
|
2015-05-04 02:45:06 -07:00
|
|
|
char *str_utf8 = _elm_util_mkup_to_text(str_markup);
|
2014-10-03 07:14:37 -07:00
|
|
|
|
2015-05-04 02:45:06 -07:00
|
|
|
free(str_markup);
|
|
|
|
|
|
|
|
if (str_utf8)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
|
|
|
if (eina_strbuf_length_get(buf) > 0)
|
|
|
|
eina_strbuf_append(buf, ", ");
|
2015-05-04 02:45:06 -07:00
|
|
|
eina_strbuf_append(buf, str_utf8);
|
|
|
|
free(str_utf8);
|
2014-10-03 07:14:37 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-14 08:34:33 -08:00
|
|
|
EAPI Elm_Object_Item *
|
|
|
|
elm_gengrid_nth_item_get(const Evas_Object *obj, unsigned int nth)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *it = NULL;
|
|
|
|
Eina_Accessor *a;
|
|
|
|
void *data;
|
|
|
|
|
2014-04-03 08:07:36 -07:00
|
|
|
ELM_GENGRID_CHECK(obj) NULL;
|
2012-11-14 08:34:33 -08:00
|
|
|
ELM_GENGRID_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
|
|
|
a = eina_inlist_accessor_new(sd->items);
|
|
|
|
if (!a) return NULL;
|
|
|
|
if (eina_accessor_data_get(a, nth, &data))
|
|
|
|
it = ELM_GEN_ITEM_FROM_INLIST(data);
|
|
|
|
eina_accessor_free(a);
|
2014-09-27 22:15:37 -07:00
|
|
|
return EO_OBJ(it);
|
2012-11-14 08:34:33 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
2016-02-17 17:02:14 -08:00
|
|
|
_elm_gengrid_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-03 03:19:45 -07:00
|
|
|
Evas_Coord ox, oy, oh, ow, item_x = 0, item_y = 0, item_w = 0, item_h = 0;
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2014-05-09 09:07:57 -07:00
|
|
|
evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh);
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2014-05-06 22:13:19 -07:00
|
|
|
if (sd->focused_item)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-09-27 22:15:37 -07:00
|
|
|
ELM_GENGRID_ITEM_DATA_GET(sd->focused_item, focus_it);
|
|
|
|
evas_object_geometry_get(VIEW(focus_it), &item_x, &item_y, &item_w, &item_h);
|
|
|
|
elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), &item_x, &item_y, &item_w, &item_h);
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
2016-02-17 17:02:14 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(obj, x, y, w, h);
|
|
|
|
return;
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
|
2014-04-03 03:19:45 -07:00
|
|
|
*x = item_x;
|
|
|
|
*y = item_y;
|
|
|
|
*w = item_w;
|
|
|
|
*h = item_h;
|
|
|
|
|
|
|
|
if (sd->horizontal)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-03 03:19:45 -07:00
|
|
|
if (item_x < ox)
|
|
|
|
{
|
|
|
|
*x = ox;
|
|
|
|
}
|
|
|
|
else if (item_x > (ox + ow - item_w))
|
|
|
|
{
|
|
|
|
*x = ox + ow - item_w;
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-03 03:19:45 -07:00
|
|
|
if (item_y < oy)
|
|
|
|
{
|
|
|
|
*y = oy;
|
|
|
|
}
|
|
|
|
else if (item_y > (oy + oh - item_h))
|
|
|
|
{
|
|
|
|
*y = oy + oh - item_h;
|
|
|
|
}
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_gengrid_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
2014-03-21 01:00:46 -07:00
|
|
|
{
|
2014-04-01 04:50:40 -07:00
|
|
|
return sd->focused_item;
|
2014-03-21 01:00:46 -07:00
|
|
|
}
|
|
|
|
|
2014-06-09 22:55:56 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, Eina_Bool enable)
|
|
|
|
{
|
|
|
|
sd->item_loop_enable = !!enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_elm_widget_item_loop_enabled_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
return sd->item_loop_enable;
|
|
|
|
}
|
|
|
|
|
2014-04-26 21:43:37 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_wheel_disabled_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Bool disabled)
|
|
|
|
{
|
|
|
|
disabled = !!disabled;
|
|
|
|
if (sd->wheel_disabled != disabled)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_scrollable_wheel_disabled_set(obj, disabled);
|
2014-04-26 21:43:37 -07:00
|
|
|
|
|
|
|
sd->wheel_disabled = disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_gengrid_wheel_disabled_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd)
|
|
|
|
{
|
|
|
|
return sd->wheel_disabled;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_gengrid_class_constructor(Eo_Class *klass)
|
|
|
|
{
|
2013-05-03 03:53:56 -07:00
|
|
|
if (_elm_config->access_mode)
|
|
|
|
_elm_gengrid_smart_focus_next_enable = EINA_TRUE;
|
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN const Elm_Atspi_Action *
|
|
|
|
_elm_gengrid_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "move,prior", "move", "prior", _key_action_move},
|
|
|
|
{ "move,next", "move", "next", _key_action_move},
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,left,multi", "move", "left_multi", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "move,right,multi", "move", "right_multi", _key_action_move},
|
|
|
|
{ "move,up", "move", "up", _key_action_move},
|
|
|
|
{ "move,up,multi", "move", "up_multi", _key_action_move},
|
|
|
|
{ "move,down", "move", "down", _key_action_move},
|
|
|
|
{ "move,down,multi", "move", "down_multi", _key_action_move},
|
|
|
|
{ "move,first", "move", "first", _key_action_move},
|
|
|
|
{ "move,last", "move", "last", _key_action_move},
|
|
|
|
{ "select", "select", NULL, _key_action_select},
|
2015-02-12 02:15:57 -08:00
|
|
|
{ "select,multi", "select", "multi", _key_action_select},
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "escape", "escape", NULL, _key_action_escape},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2014-10-03 07:14:37 -07:00
|
|
|
EOLIAN Eina_List*
|
2015-12-01 07:55:12 -08:00
|
|
|
_elm_gengrid_elm_interface_atspi_accessible_children_get(Eo *obj, Elm_Gengrid_Data *sd)
|
2014-10-03 07:14:37 -07:00
|
|
|
{
|
2015-12-01 07:55:12 -08:00
|
|
|
Eina_List *ret = NULL, *ret2 = NULL;
|
2014-10-03 07:14:37 -07:00
|
|
|
Elm_Gen_Item *it;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->items, it)
|
|
|
|
ret = eina_list_append(ret, EO_OBJ(it));
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
ret2 = elm_interface_atspi_accessible_children_get(eo_super(obj, ELM_GENGRID_CLASS));
|
2015-12-01 07:55:12 -08:00
|
|
|
|
|
|
|
return eina_list_merge(ret, ret2);
|
2014-10-03 07:14:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Elm_Atspi_State_Set
|
|
|
|
_elm_gengrid_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Gengrid_Data *sd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Elm_Atspi_State_Set ret;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
ret = elm_interface_atspi_accessible_state_set_get(eo_super(obj, ELM_GENGRID_CLASS));
|
2014-10-03 07:14:37 -07:00
|
|
|
|
|
|
|
STATE_TYPE_SET(ret, ELM_ATSPI_STATE_MANAGES_DESCENDANTS);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-05-26 23:23:17 -07:00
|
|
|
EOLIAN int
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_selected_children_count_get(Eo *objm EINA_UNUSED, Elm_Gengrid_Data *pd)
|
|
|
|
{
|
|
|
|
return eina_list_count(pd->selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eo*
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_selected_child_get(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_idx)
|
|
|
|
{
|
|
|
|
return eina_list_nth(pd->selected, child_idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_child_select(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
|
|
|
{
|
|
|
|
Eo *item;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(pd->selected, l, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_gengrid_item_selected_set(item, EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_is_child_selected(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
return elm_gengrid_item_selected_get(EO_OBJ(item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_all_children_select(Eo *obj, Elm_Gengrid_Data *pd)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
|
|
|
|
if (!elm_gengrid_multi_select_get(obj))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
elm_gengrid_item_selected_set(EO_OBJ(item), EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_clear(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd)
|
|
|
|
{
|
|
|
|
return _all_items_deselect(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_elm_gengrid_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *pd, int child_index)
|
|
|
|
{
|
|
|
|
Elm_Gen_Item *item;
|
|
|
|
if (pd->select_mode != ELM_OBJECT_SELECT_MODE_NONE)
|
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(pd->items, item)
|
|
|
|
{
|
|
|
|
if (child_index-- == 0)
|
|
|
|
{
|
|
|
|
elm_gengrid_item_selected_set(EO_OBJ(item), EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-04-01 04:50:40 -07:00
|
|
|
#include "elm_gengrid.eo.c"
|
2014-09-27 22:15:37 -07:00
|
|
|
#include "elm_gengrid_item.eo.c"
|