2013-04-25 22:13:00 -07:00
# ifdef HAVE_CONFIG_H
# include "elementary_config.h"
# endif
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"
EAPI Eo_Op ELM_OBJ_GENGRID_PAN_BASE_ID = EO_NOOP ;
# define MY_PAN_CLASS ELM_OBJ_GENGRID_PAN_CLASS
# define MY_PAN_CLASS_NAME "elm_gengrid_pan"
EAPI Eo_Op ELM_OBJ_GENGRID_BASE_ID = EO_NOOP ;
# define MY_CLASS ELM_OBJ_GENGRID_CLASS
# define MY_CLASS_NAME "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
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
# define GG_IT(_it) (_it->item)
2011-07-25 18:49:24 -07:00
static const char SIG_ACTIVATED [ ] = " activated " ;
2011-04-21 17:57:15 -07:00
static const char SIG_CLICKED_DOUBLE [ ] = " clicked,double " ;
2011-09-11 05:24:40 -07:00
static const char SIG_LONGPRESSED [ ] = " longpressed " ;
2011-04-21 17:57:15 -07:00
static const char SIG_SELECTED [ ] = " selected " ;
static const char SIG_UNSELECTED [ ] = " unselected " ;
static const char SIG_REALIZED [ ] = " realized " ;
static const char SIG_UNREALIZED [ ] = " unrealized " ;
static const char SIG_CHANGED [ ] = " changed " ;
static const char SIG_DRAG_START_UP [ ] = " drag,start,up " ;
static const char SIG_DRAG_START_DOWN [ ] = " drag,start,down " ;
static const char SIG_DRAG_START_LEFT [ ] = " drag,start,left " ;
static const char SIG_DRAG_START_RIGHT [ ] = " drag,start,right " ;
static const char SIG_DRAG_STOP [ ] = " drag,stop " ;
static const char SIG_DRAG [ ] = " drag " ;
static const char SIG_SCROLL [ ] = " scroll " ;
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 const char SIG_SCROLL_ANIM_START [ ] = " scroll,anim,start " ;
static const char SIG_SCROLL_ANIM_STOP [ ] = " scroll,anim,stop " ;
2011-04-21 17:57:15 -07:00
static const char SIG_SCROLL_DRAG_START [ ] = " scroll,drag,start " ;
static const char SIG_SCROLL_DRAG_STOP [ ] = " scroll,drag,stop " ;
2013-05-15 14:56:04 -07:00
static const char SIG_SCROLL_PAGE_CHANGE [ ] = " scroll,page,changed " ;
2011-10-20 09:42:42 -07:00
static const char SIG_EDGE_TOP [ ] = " edge,top " ;
static const char SIG_EDGE_BOTTOM [ ] = " edge,bottom " ;
static const char SIG_EDGE_LEFT [ ] = " edge,left " ;
static const char SIG_EDGE_RIGHT [ ] = " edge,right " ;
2011-06-06 18:01:29 -07:00
static const char SIG_MOVED [ ] = " moved " ;
2012-03-07 05:58:30 -08:00
static const char SIG_INDEX_UPDATE [ ] = " index,update " ;
2013-01-14 02:12:50 -08:00
static const char SIG_HIGHLIGHTED [ ] = " highlighted " ;
static const char SIG_UNHIGHLIGHTED [ ] = " unhighlighted " ;
2013-02-11 23:29:16 -08:00
static const char SIG_LANG_CHANGED [ ] = " language,changed " ;
2013-03-20 09:39:51 -07:00
static const char SIG_PRESSED [ ] = " pressed " ;
static const char SIG_RELEASED [ ] = " released " ;
2013-02-11 23:29:16 -08:00
2012-07-10 14:40:38 -07:00
static const Evas_Smart_Cb_Description _smart_callbacks [ ] = {
2011-07-26 00:00:19 -07:00
{ SIG_ACTIVATED , " " } ,
{ SIG_CLICKED_DOUBLE , " " } ,
2011-09-11 05:24:40 -07:00
{ SIG_LONGPRESSED , " " } ,
2011-07-26 00:00:19 -07:00
{ SIG_SELECTED , " " } ,
{ SIG_UNSELECTED , " " } ,
{ SIG_REALIZED , " " } ,
{ SIG_UNREALIZED , " " } ,
{ SIG_CHANGED , " " } ,
{ SIG_DRAG_START_UP , " " } ,
{ SIG_DRAG_START_DOWN , " " } ,
{ SIG_DRAG_START_LEFT , " " } ,
{ SIG_DRAG_START_RIGHT , " " } ,
{ SIG_DRAG_STOP , " " } ,
{ SIG_DRAG , " " } ,
{ SIG_SCROLL , " " } ,
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
{ SIG_SCROLL_ANIM_START , " " } ,
{ SIG_SCROLL_ANIM_STOP , " " } ,
2011-07-26 00:00:19 -07:00
{ SIG_SCROLL_DRAG_START , " " } ,
{ SIG_SCROLL_DRAG_STOP , " " } ,
2011-10-20 09:42:42 -07:00
{ SIG_EDGE_TOP , " " } ,
{ SIG_EDGE_BOTTOM , " " } ,
{ SIG_EDGE_LEFT , " " } ,
{ SIG_EDGE_RIGHT , " " } ,
2011-07-26 00:00:19 -07:00
{ SIG_MOVED , " " } ,
2013-01-14 02:12:50 -08:00
{ SIG_HIGHLIGHTED , " " } ,
{ SIG_UNHIGHLIGHTED , " " } ,
2013-02-11 23:29:16 -08:00
{ SIG_LANG_CHANGED , " " } ,
2013-03-20 09:39:51 -07:00
{ SIG_PRESSED , " " } ,
{ SIG_RELEASED , " " } ,
2013-05-15 14:56:04 -07:00
{ SIG_SCROLL_PAGE_CHANGE , " " } ,
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-02-11 23:29:16 -08:00
static void
_elm_gengrid_smart_translate ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
evas_object_smart_callback_call ( obj , SIG_LANG_CHANGED , NULL ) ;
if ( ret ) * ret = EINA_TRUE ;
}
2013-01-03 04:03:55 -08:00
static void
_item_show_region ( void * data )
{
Elm_Gengrid_Smart_Data * sd = data ;
Evas_Coord cvw , cvh , it_xpos = 0 , it_ypos = 0 , col = 0 , row = 0 , minx = 0 , miny = 0 ;
Elm_Gen_Item * it = NULL ;
evas_object_geometry_get ( sd - > pan_obj , NULL , NULL , & cvw , & cvh ) ;
if ( ( cvw ! = 0 ) & & ( cvh ! = 0 ) )
{
int x = 0 , y = 0 ;
if ( sd - > show_region )
it = sd - > show_it ;
else if ( sd - > bring_in )
it = sd - > bring_in_it ;
if ( ! it ) return ;
eo_do ( sd - > pan_obj , elm_obj_pan_pos_min_get ( & minx , & miny ) ) ;
if ( sd - > horizontal & & ( sd - > item_height > 0 ) )
{
row = cvh / sd - > item_height ;
if ( row < = 0 ) row = 1 ;
x = ( it - > position - 1 ) / row ;
if ( x > 0 )
y = ( it - > position - 1 ) % x ;
it_xpos = ( ( x - GG_IT ( it ) - > prev_group ) * sd - > item_width )
+ ( GG_IT ( it ) - > prev_group * sd - > group_item_width )
+ minx ;
it_ypos = y * sd - > item_height + miny ;
it - > x = x ;
it - > y = y ;
}
else if ( sd - > item_width > 0 )
{
col = cvw / sd - > item_width ;
if ( col < = 0 ) col = 1 ;
y = ( it - > position - 1 ) / col ;
if ( y > 0 )
x = ( it - > position - 1 ) % y ;
it_xpos = x * sd - > item_width + minx ;
it_ypos = ( ( y - GG_IT ( it ) - > prev_group ) * sd - > item_height )
+ ( GG_IT ( it ) - > prev_group * sd - > group_item_height )
+ miny ;
it - > x = x ;
it - > y = y ;
}
if ( sd - > show_region )
{
eo_do ( WIDGET ( it ) , elm_scrollable_interface_content_region_show (
it_xpos , it_ypos , sd - > item_width ,
sd - > item_height ) ) ;
sd - > show_region = EINA_FALSE ;
}
if ( sd - > bring_in )
{
eo_do ( WIDGET ( it ) , elm_scrollable_interface_region_bring_in (
it_xpos , it_ypos , sd - > item_width ,
sd - > item_height ) ) ;
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 ;
evas_object_smart_callback_call ( sd - > pan_obj , " 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 ;
}
2013-04-24 04:41:37 -07:00
static void
_elm_gengrid_pan_destructor ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
{
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
eo_data_unref ( psd - > wobj , psd - > wsd ) ;
eo_do_super ( obj , MY_PAN_CLASS , eo_destructor ( ) ) ;
}
2012-07-10 14:40:38 -07:00
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_move ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
va_arg ( * list , Evas_Coord ) ;
va_arg ( * list , Evas_Coord ) ;
2012-07-10 14:40:38 -07:00
if ( psd - > wsd - > calc_job ) 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
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_resize ( Eo * obj , void * _pd , va_list * list )
2012-07-10 14:40:38 -07:00
{
Evas_Coord ow , oh ;
2012-11-25 22:32:53 -08:00
Evas_Coord w = va_arg ( * list , Evas_Coord ) ;
Evas_Coord h = va_arg ( * list , Evas_Coord ) ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
2012-07-10 14:40:38 -07:00
evas_object_geometry_get ( obj , NULL , NULL , & ow , & oh ) ;
if ( ( ow = = w ) & & ( oh = = h ) ) return ;
if ( psd - > wsd - > calc_job ) 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 ) ;
if ( ( it - > generation < item - > wsd - > generation ) | | ( ! it - > highlighted ) )
return ;
edje_object_signal_emit ( VIEW ( it ) , " elm,state,unselected " , " elm " ) ;
2013-01-14 02:12:50 -08:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_UNHIGHLIGHTED , it ) ;
2012-07-10 14:40:38 -07:00
it - > highlighted = EINA_FALSE ;
if ( it - > selected )
2010-10-01 12:03:17 -07:00
{
2012-07-10 14:40:38 -07:00
it - > selected = EINA_FALSE ;
item - > wsd - > selected = eina_list_remove ( item - > wsd - > selected , it ) ;
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_UNSELECTED , it ) ;
}
}
static void
_item_mouse_move_cb ( void * data ,
Evas * evas __UNUSED__ ,
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 ;
Evas_Coord minw = 0 , minh = 0 , x , y , dx , dy , adx , ady ;
if ( ev - > event_flags & EVAS_EVENT_FLAG_ON_HOLD )
{
if ( ! GG_IT ( it ) - > wsd - > on_hold )
2010-11-10 10:04:28 -08:00
{
2012-07-10 14:40:38 -07:00
GG_IT ( it ) - > wsd - > on_hold = EINA_TRUE ;
if ( ! GG_IT ( it ) - > wsd - > was_selected )
_item_unselect ( it ) ;
2010-11-10 10:04:28 -08:00
}
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 ) ;
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_DRAG , it ) ;
return ;
2010-10-01 12:03:17 -07:00
}
2012-07-10 14:40:38 -07:00
if ( ( ! it - > down ) | | ( GG_IT ( it ) - > wsd - > 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 ) ;
2012-07-10 14:40:38 -07:00
if ( ( GG_IT ( it ) - > wsd - > reorder_mode ) & &
( GG_IT ( it ) - > wsd - > reorder_it ) )
2010-10-05 12:09:58 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_geometry_get
( GG_IT ( it ) - > wsd - > pan_obj , & ox , & oy , & ow , & oh ) ;
it_scrl_x = ev - > cur . canvas . x -
GG_IT ( it ) - > wsd - > reorder_it - > dx ;
it_scrl_y = ev - > cur . canvas . y -
GG_IT ( it ) - > wsd - > reorder_it - > dy ;
if ( it_scrl_x < ox ) GG_IT ( it ) - > wsd - > reorder_item_x = ox ;
else if ( it_scrl_x + GG_IT ( it ) - > wsd - > item_width > ox + ow )
GG_IT ( it ) - > wsd - > reorder_item_x =
ox + ow - GG_IT ( it ) - > wsd - > item_width ;
else GG_IT ( it ) - > wsd - > reorder_item_x = it_scrl_x ;
if ( it_scrl_y < oy ) GG_IT ( it ) - > wsd - > reorder_item_y = oy ;
else if ( it_scrl_y + GG_IT ( it ) - > wsd - > item_height > oy + oh )
GG_IT ( it ) - > wsd - > reorder_item_y =
oy + oh - GG_IT ( it ) - > wsd - > item_height ;
else GG_IT ( it ) - > wsd - > reorder_item_y = it_scrl_y ;
if ( GG_IT ( it ) - > wsd - > calc_job )
ecore_job_del ( GG_IT ( it ) - > wsd - > calc_job ) ;
GG_IT ( it ) - > wsd - > calc_job =
2013-04-24 04:41:37 -07:00
ecore_job_add ( _calc_job , GG_IT ( it ) - > wsd - > 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 ) ;
evas_object_geometry_get ( obj , & x , & y , NULL , NULL ) ;
x = ev - > cur . canvas . x - x ;
y = ev - > cur . canvas . y - y ;
dx = x - it - > dx ;
adx = dx ;
if ( adx < 0 ) adx = - dx ;
dy = y - it - > dy ;
ady = dy ;
if ( ady < 0 ) ady = - dy ;
minw / = 2 ;
minh / = 2 ;
if ( ( adx > minw ) | | ( ady > minh ) )
2010-10-01 12:03:17 -07:00
{
2012-07-10 14:40:38 -07:00
const char * left_drag , * right_drag ;
if ( ! elm_widget_mirrored_get ( WIDGET ( it ) ) )
2010-11-10 10:04:28 -08:00
{
2012-07-10 14:40:38 -07:00
left_drag = SIG_DRAG_START_LEFT ;
right_drag = SIG_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
{
2012-07-10 14:40:38 -07:00
left_drag = SIG_DRAG_START_RIGHT ;
right_drag = SIG_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 ) ;
2012-07-10 14:40:38 -07:00
if ( ! GG_IT ( it ) - > wsd - > was_selected )
_item_unselect ( it ) ;
if ( dy < 0 )
{
if ( ady > adx )
evas_object_smart_callback_call
( WIDGET ( it ) , SIG_DRAG_START_UP , it ) ;
2010-11-10 10:04:28 -08:00
else
2012-07-10 14:40:38 -07:00
{
if ( dx < 0 )
evas_object_smart_callback_call ( WIDGET ( it ) , left_drag , it ) ;
}
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 )
evas_object_smart_callback_call
( WIDGET ( it ) , SIG_DRAG_START_DOWN , it ) ;
2010-11-10 10:04:28 -08:00
else
2012-07-10 14:40:38 -07:00
{
if ( dx < 0 )
evas_object_smart_callback_call ( WIDGET ( it ) , left_drag , it ) ;
else
evas_object_smart_callback_call
( WIDGET ( it ) , right_drag , it ) ;
}
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 ;
Elm_Gengrid_Smart_Data * sd = GG_IT ( it ) - > wsd ;
2010-10-27 07:38:54 -07:00
2012-07-10 14:40:38 -07:00
it - > long_timer = NULL ;
if ( elm_widget_item_disabled_get ( it ) | | ( it - > dragging ) )
return ECORE_CALLBACK_CANCEL ;
sd - > longpressed = EINA_TRUE ;
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_LONGPRESSED , 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 ) ) ;
2012-11-25 22:32:53 -08:00
eo_do ( WIDGET ( it ) , elm_scrollable_interface_hold_set ( EINA_TRUE ) ) ;
eo_do ( WIDGET ( it ) , elm_scrollable_interface_bounce_allow_get (
& ( GG_IT ( it ) - > wsd - > old_h_bounce ) ,
& ( GG_IT ( it ) - > wsd - > old_v_bounce ) ) ) ;
2010-10-05 12:09:58 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( WIDGET ( it ) , elm_scrollable_interface_bounce_allow_set ( 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
{
2012-07-10 14:40:38 -07:00
if ( ( GG_IT ( it ) - > wsd - > select_mode = = ELM_OBJECT_SELECT_MODE_NONE )
| | ( ! GG_IT ( it ) - > wsd - > highlight ) | | ( it - > highlighted ) | |
( it - > generation < GG_IT ( it ) - > wsd - > generation ) )
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 " ) ;
2013-01-14 02:12:50 -08:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_HIGHLIGHTED , it ) ;
2012-07-10 14:40:38 -07:00
it - > highlighted = EINA_TRUE ;
2010-10-10 16:54:11 -07:00
}
2012-07-10 14:40:38 -07:00
static void
_item_mouse_down_cb ( void * data ,
Evas * evas __UNUSED__ ,
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 ;
2010-10-10 16:54:11 -07:00
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 ;
it - > dragging = 0 ;
evas_object_geometry_get ( obj , & x , & y , NULL , NULL ) ;
it - > dx = ev - > canvas . x - x ;
it - > dy = ev - > canvas . y - y ;
GG_IT ( it ) - > wsd - > longpressed = EINA_FALSE ;
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 )
GG_IT ( it ) - > wsd - > on_hold = EINA_TRUE ;
else GG_IT ( it ) - > wsd - > on_hold = EINA_FALSE ;
2010-10-10 16:54:11 -07:00
2012-07-10 14:40:38 -07:00
if ( GG_IT ( it ) - > wsd - > on_hold ) return ;
2010-10-05 12:09:58 -07:00
2012-07-10 14:40:38 -07:00
GG_IT ( it ) - > wsd - > was_selected = it - > selected ;
_item_highlight ( it ) ;
if ( ev - > flags & EVAS_BUTTON_DOUBLE_CLICK )
2010-10-27 07:38:57 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_CLICKED_DOUBLE , it ) ;
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_ACTIVATED , it ) ;
2010-10-27 07:38:57 -07:00
}
2013-03-20 09:39:51 -07:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_PRESSED , 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
_elm_gengrid_item_unrealize ( Elm_Gen_Item * it ,
Eina_Bool calc )
2010-10-05 12:09:58 -07:00
{
2012-07-10 14:40:38 -07:00
Evas_Object * content ;
2010-10-10 16:54:11 -07:00
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 )
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_UNREALIZED , it ) ;
2013-05-29 04:53:13 -07:00
ELM_SAFE_FREE ( it - > long_timer , ecore_timer_del ) ;
ELM_SAFE_FREE ( it - > texts , elm_widget_stringlist_free ) ;
ELM_SAFE_FREE ( it - > contents , elm_widget_stringlist_free ) ;
ELM_SAFE_FREE ( it - > states , elm_widget_stringlist_free ) ;
2010-10-05 12:09:58 -07:00
2013-03-08 20:23:42 -08:00
EINA_LIST_FREE ( it - > content_objs , content )
2012-07-10 14:40:38 -07:00
evas_object_del ( content ) ;
2010-10-05 12:09:58 -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 ;
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 ,
Evas * evas __UNUSED__ ,
Evas_Object * obj __UNUSED__ ,
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_Gengrid_Smart_Data * sd ;
Elm_Gen_Item * it = data ;
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
sd = GG_IT ( it ) - > wsd ;
2010-10-05 12:09:58 -07:00
2012-07-10 14:40:38 -07:00
it - > down = EINA_FALSE ;
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
2013-03-20 09:39:51 -07:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_RELEASED , 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 ;
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_DRAG_STOP , it ) ;
dragged = EINA_TRUE ;
2010-10-01 12:03:17 -07:00
}
2012-07-10 14:40:38 -07:00
if ( sd - > on_hold )
2010-10-01 12:03:17 -07:00
{
2012-07-10 14:40:38 -07:00
sd - > longpressed = EINA_FALSE ;
sd - > on_hold = EINA_FALSE ;
return ;
2010-10-01 12:03:17 -07:00
}
2012-07-10 14:40:38 -07:00
if ( ( sd - > reorder_mode ) & &
( sd - > reorder_it ) )
{
evas_object_smart_callback_call
( WIDGET ( it ) , SIG_MOVED , sd - > reorder_it ) ;
sd - > reorder_it = NULL ;
sd - > move_effect_enabled = EINA_FALSE ;
if ( sd - > calc_job )
ecore_job_del ( sd - > calc_job ) ;
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
2012-11-25 22:32:53 -08:00
eo_do ( WIDGET ( it ) , elm_scrollable_interface_hold_set ( EINA_FALSE ) ) ;
eo_do ( WIDGET ( it ) , elm_scrollable_interface_bounce_allow_set (
GG_IT ( it ) - > wsd - > old_h_bounce ,
GG_IT ( it ) - > wsd - > 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 ;
if ( ! sd - > was_selected ) _item_unselect ( it ) ;
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 ) ;
}
if ( elm_widget_item_disabled_get ( it ) | | ( dragged ) ) return ;
if ( sd - > multi )
{
if ( ! it - > selected )
{
_item_highlight ( it ) ;
it - > sel_cb ( it ) ;
}
else _item_unselect ( it ) ;
}
else
{
if ( ! it - > selected )
{
while ( sd - > selected )
_item_unselect ( sd - > selected - > data ) ;
}
else
{
const Eina_List * l , * l_next ;
Elm_Gen_Item * item2 ;
2010-06-03 05:53:14 -07:00
2012-10-01 00:36:27 -07:00
EINA_LIST_FOREACH_SAFE ( sd - > selected , l , l_next , item2 )
2012-07-10 14:40:38 -07:00
if ( item2 ! = it ) _item_unselect ( item2 ) ;
}
_item_highlight ( it ) ;
it - > sel_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 )
{
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_INDEX_UPDATE , it ) ;
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
{
2012-07-10 14:40:38 -07:00
evas_object_del ( VIEW ( it ) ) ;
VIEW ( it ) = NULL ;
evas_object_del ( it - > spacer ) ;
it - > spacer = NULL ;
2010-09-09 15:01:30 -07:00
}
2012-08-18 06:52:03 -07:00
static char *
2012-12-23 06:50:56 -08:00
_access_info_cb ( void * data , Evas_Object * obj __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
( ( void * ) it - > base . data , WIDGET ( it ) , key ) ;
return s ;
}
}
return NULL ;
}
static char *
2012-12-23 06:50:56 -08:00
_access_state_cb ( void * data , Evas_Object * obj __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 - > base . disabled )
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 ) ;
evas_object_geometry_get ( it - > base . view , & x , & y , & w , & h ) ;
2012-11-25 22:32:53 -08: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 ) ) )
elm_gengrid_item_bring_in ( ( Elm_Object_Item * ) it ,
ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
}
static void
_access_widget_item_register ( Elm_Gen_Item * it )
{
Elm_Access_Info * ai ;
_elm_access_widget_item_register ( ( Elm_Widget_Item * ) it ) ;
ai = _elm_access_object_get ( it - > base . access_obj ) ;
_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 ) ;
}
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
{
2012-07-10 14:40:38 -07:00
char buf [ 1024 ] ;
char style [ 1024 ] ;
2011-10-03 18:24:08 -07:00
2012-07-10 14:40:38 -07:00
if ( ( it - > realized ) | |
( it - > generation < GG_IT ( it ) - > wsd - > generation ) )
return ;
2011-10-03 18:24:08 -07:00
2012-07-10 14:40:38 -07:00
VIEW ( it ) = edje_object_add ( evas_object_evas_get ( WIDGET ( it ) ) ) ;
edje_object_scale_set
( VIEW ( it ) , elm_widget_scale_get ( WIDGET ( it ) ) * elm_config_scale_get ( ) ) ;
edje_object_mirrored_set ( VIEW ( it ) , elm_widget_mirrored_get ( WIDGET ( it ) ) ) ;
evas_object_smart_member_add ( VIEW ( it ) , GG_IT ( it ) - > wsd - > pan_obj ) ;
elm_widget_sub_object_add ( WIDGET ( it ) , VIEW ( it ) ) ;
snprintf ( style , sizeof ( style ) , " item/%s " ,
it - > itc - > item_style ? it - > itc - > item_style : " default " ) ;
elm_widget_theme_object_set ( WIDGET ( it ) , VIEW ( it ) , " gengrid " , style ,
elm_widget_style_get ( WIDGET ( it ) ) ) ;
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 ) ;
2012-07-10 14:40:38 -07:00
if ( it - > itc - > func . text_get )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
const Eina_List * l ;
const char * key ;
it - > texts =
elm_widget_stringlist_get ( edje_object_data_get ( VIEW ( it ) , " texts " ) ) ;
2012-10-01 00:36:27 -07:00
EINA_LIST_FOREACH ( it - > texts , l , key )
2010-12-10 05:01:43 -08:00
{
2012-07-10 14:40:38 -07:00
char * s = it - > itc - > func . text_get
( ( void * ) it - > base . data , WIDGET ( it ) , key ) ;
if ( s )
{
edje_object_part_text_escaped_set ( VIEW ( it ) , key , s ) ;
free ( s ) ;
}
2010-12-10 05:01:43 -08:00
}
2010-06-03 05:53:14 -07:00
}
2012-07-10 14:40:38 -07:00
if ( it - > itc - > func . content_get )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
const Eina_List * l ;
const char * key ;
Evas_Object * ic = NULL ;
it - > contents = elm_widget_stringlist_get
( edje_object_data_get ( VIEW ( it ) , " contents " ) ) ;
2012-10-01 00:36:27 -07:00
EINA_LIST_FOREACH ( it - > contents , l , key )
2010-12-10 05:01:43 -08:00
{
2011-10-23 19:10:35 -07:00
if ( it - > itc - > func . content_get )
ic = it - > itc - > func . content_get
2012-07-10 14:40:38 -07:00
( ( void * ) it - > base . data , WIDGET ( it ) , key ) ;
2010-12-10 05:01:43 -08:00
if ( ic )
{
2011-10-23 19:10:35 -07:00
it - > content_objs = eina_list_append ( it - > content_objs , ic ) ;
2011-10-20 18:08:01 -07:00
edje_object_part_swallow ( VIEW ( it ) , key , ic ) ;
2010-12-10 05:01:43 -08:00
evas_object_show ( ic ) ;
2011-10-21 09:53:01 -07:00
elm_widget_sub_object_add ( WIDGET ( it ) , ic ) ;
2010-12-10 05:01:43 -08:00
}
}
2010-06-03 05:53:14 -07:00
}
2011-10-20 15:45:38 -07:00
if ( it - > itc - > func . state_get )
2010-06-03 05:53:14 -07:00
{
2010-12-10 05:01:43 -08:00
const Eina_List * l ;
const char * key ;
2011-10-20 14:41:24 -07:00
it - > states =
2012-07-10 14:40:38 -07:00
elm_widget_stringlist_get ( edje_object_data_get ( VIEW ( it ) , " states " ) ) ;
2012-10-01 00:36:27 -07:00
EINA_LIST_FOREACH ( it - > states , l , key )
2010-12-10 05:01:43 -08:00
{
2011-10-20 15:45:38 -07:00
Eina_Bool on = it - > itc - > func . state_get
2012-07-10 14:40:38 -07:00
( ( void * ) it - > base . data , WIDGET ( it ) , l - > data ) ;
2010-12-10 05:01:43 -08:00
if ( on )
{
snprintf ( buf , sizeof ( buf ) , " elm,state,%s,active " , key ) ;
2011-10-20 18:08:01 -07:00
edje_object_signal_emit ( VIEW ( it ) , buf , " elm " ) ;
2010-12-10 05:01:43 -08:00
}
}
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
{
2012-07-10 14:40:38 -07:00
if ( ( ! GG_IT ( it ) - > wsd - > group_item_width )
& & ( ! GG_IT ( it ) - > wsd - > 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
( VIEW ( it ) , & GG_IT ( it ) - > wsd - > group_item_width ,
& GG_IT ( it ) - > wsd - > group_item_height ,
GG_IT ( it ) - > wsd - > group_item_width ,
GG_IT ( it ) - > wsd - > 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
{
2012-07-10 14:40:38 -07:00
if ( ( ! GG_IT ( it ) - > wsd - > item_width )
& & ( ! GG_IT ( it ) - > wsd - > item_height ) )
2011-09-09 05:43:34 -07:00
{
2012-07-10 14:40:38 -07:00
edje_object_size_min_restricted_calc
( VIEW ( it ) , & GG_IT ( it ) - > wsd - > item_width ,
& GG_IT ( it ) - > wsd - > item_height ,
GG_IT ( it ) - > wsd - > item_width ,
GG_IT ( it ) - > wsd - > item_height ) ;
elm_coords_finger_size_adjust
( 1 , & GG_IT ( it ) - > wsd - > item_width , 1 ,
& GG_IT ( it ) - > wsd - > item_height ) ;
2011-09-09 05:43:34 -07:00
}
2010-06-03 05:53:14 -07:00
2012-07-10 14:40:38 -07:00
evas_object_event_callback_add
( VIEW ( it ) , EVAS_CALLBACK_MOUSE_DOWN , _item_mouse_down_cb , it ) ;
evas_object_event_callback_add
( VIEW ( it ) , EVAS_CALLBACK_MOUSE_UP , _item_mouse_up_cb , it ) ;
evas_object_event_callback_add
( VIEW ( it ) , EVAS_CALLBACK_MOUSE_MOVE , _item_mouse_move_cb , it ) ;
2010-06-03 05:53:14 -07:00
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 " ) ;
2012-01-26 23:36:36 -08:00
if ( elm_widget_item_disabled_get ( 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
}
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
{
2012-07-10 14:40:38 -07:00
elm_widget_item_tooltip_content_cb_set
( it , it - > tooltip . content_cb , it - > tooltip . data , NULL ) ;
2011-10-20 14:41:24 -07:00
elm_widget_item_tooltip_style_set ( it , it - > tooltip . style ) ;
2011-12-05 09:14:07 -08:00
elm_widget_item_tooltip_window_mode_set ( 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 )
elm_widget_item_cursor_set ( it , it - > mouse_cursor ) ;
2010-09-27 11:18:37 -07:00
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 ;
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
}
2012-07-10 14:40:38 -07: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
( GG_IT ( it ) - > wsd - > pan_obj , NULL , NULL , & vw , & vh ) ;
if ( GG_IT ( it ) - > wsd - > horizontal )
evas_object_resize
( VIEW ( it ) , GG_IT ( it ) - > wsd - > group_item_width , vh ) ;
2011-09-09 05:43:34 -07:00
else
2012-07-10 14:40:38 -07:00
evas_object_resize
( VIEW ( it ) , vw , GG_IT ( it ) - > wsd - > group_item_height ) ;
2011-09-09 05:43:34 -07:00
}
else
2012-07-10 14:40:38 -07:00
evas_object_resize ( VIEW ( it ) , GG_IT ( it ) - > wsd - > item_width ,
GG_IT ( it ) - > wsd - > item_height ) ;
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
evas_object_geometry_get
( GG_IT ( it ) - > wsd - > pan_obj , NULL , NULL , & vw , & vh ) ;
if ( GG_IT ( it ) - > wsd - > horizontal )
evas_object_resize
( VIEW ( it ) , GG_IT ( it ) - > wsd - > group_item_width , vh ) ;
2011-09-09 05:43:34 -07:00
else
2012-07-10 14:40:38 -07:00
evas_object_resize
( VIEW ( it ) , vw , GG_IT ( it ) - > wsd - > group_item_height ) ;
2011-09-09 05:43:34 -07:00
}
else
2012-07-10 14:40:38 -07:00
evas_object_resize
( VIEW ( it ) , GG_IT ( it ) - > wsd - > item_width ,
GG_IT ( it ) - > wsd - > 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 ;
Elm_Gengrid_Smart_Data * wsd ;
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 ;
item = GG_IT ( it ) ;
wsd = GG_IT ( it ) - > wsd ;
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 ;
alignh = 0 ;
alignw = 0 ;
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 ;
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 ;
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 ) ;
2012-07-10 14:40:38 -07:00
x = ww - x - wsd - > item_width - wsd - > pan_x - wsd - > pan_x ;
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 )
2011-10-21 09:53:01 -07:00
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_REALIZED , it ) ;
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 ;
if ( wsd - > calc_job )
ecore_job_del ( wsd - > calc_job ) ;
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
2012-07-10 14:40:38 -07:00
_group_item_place ( Elm_Gengrid_Pan_Smart_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 ;
}
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 )
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_REALIZED , it ) ;
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
}
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_calculate ( Eo * obj EINA_UNUSED , void * _pd , va_list * list EINA_UNUSED )
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
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
2010-06-03 05:53:14 -07:00
2012-07-10 14:40:38 -07:00
if ( ! psd - > wsd - > nmax ) return ;
psd - > wsd - > reorder_item_changed = EINA_FALSE ;
2010-10-08 18:42:32 -07:00
2012-10-01 00:36:27 -07:00
EINA_INLIST_FOREACH ( psd - > wsd - > items , it )
2012-07-10 14:40:38 -07:00
{
if ( it - > group )
2011-09-09 05:43:34 -07:00
{
2012-07-10 14:40:38 -07:00
if ( psd - > wsd - > 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 ) ;
if ( psd - > wsd - > reorder_item_changed ) return ;
if ( it - > group )
2011-03-03 05:01:39 -08:00
{
2012-07-10 14:40:38 -07:00
if ( psd - > wsd - > horizontal )
{
cx + + ;
cy = 0 ;
}
else
{
cx = 0 ;
cy + + ;
}
2011-03-03 05:01:39 -08:00
}
else
{
2012-07-10 14:40:38 -07:00
if ( psd - > wsd - > horizontal )
{
cy = ( cy + 1 ) % psd - > wsd - > nmax ;
if ( ! cy ) cx + + ;
}
else
{
cx = ( cx + 1 ) % psd - > wsd - > nmax ;
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
2012-07-10 14:40:38 -07:00
if ( ( psd - > wsd - > reorder_mode ) & & ( psd - > wsd - > reorder_it ) )
{
if ( ! psd - > wsd - > reorder_item_changed )
2011-03-03 05:01:39 -08:00
{
2012-07-10 14:40:38 -07:00
psd - > wsd - > old_pan_x = psd - > wsd - > pan_x ;
psd - > wsd - > old_pan_y = psd - > wsd - > pan_y ;
2011-03-03 05:01:39 -08:00
}
2012-07-10 14:40:38 -07:00
psd - > wsd - > move_effect_enabled = EINA_FALSE ;
2011-03-03 05:01:39 -08:00
}
2013-01-03 04:03:55 -08:00
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call
2012-11-25 22:32:53 -08:00
( psd - > wobj , SIG_CHANGED , NULL ) ;
2010-06-03 05:53:14 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_pos_set ( Eo * obj , void * _pd , va_list * list )
2010-06-03 05:53:14 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Coord x = va_arg ( * list , Evas_Coord ) ;
Evas_Coord y = va_arg ( * list , Evas_Coord ) ;
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
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
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_pos_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2010-06-03 05:53:14 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Coord * x = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * y = va_arg ( * list , Evas_Coord * ) ;
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
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
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_content_size_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2010-06-03 05:53:14 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Coord * w = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * h = va_arg ( * list , Evas_Coord * ) ;
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
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
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_pos_max_get ( Eo * obj , void * _pd , va_list * list )
2010-06-03 05:53:14 -07:00
{
Evas_Coord ow , oh ;
2012-11-25 22:32:53 -08:00
Evas_Coord * x = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * y = va_arg ( * list , Evas_Coord * ) ;
2010-06-03 05:53:14 -07:00
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
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
}
2010-11-23 12:30:48 -08:00
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_pan_smart_pos_min_get ( Eo * obj , void * _pd , va_list * list )
2010-11-23 12:30:48 -08:00
{
2012-02-01 04:29:14 -08:00
Evas_Coord mx = 0 , my = 0 ;
2012-11-25 22:32:53 -08:00
Evas_Coord * x = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * y = va_arg ( * list , Evas_Coord * ) ;
2010-11-23 12:30:48 -08:00
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Pan_Smart_Data * psd = _pd ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_pan_pos_max_get ( & mx , & my ) ) ;
2010-11-23 12:30:48 -08:00
if ( x )
2012-07-10 14:40:38 -07:00
* x = - mx * 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
}
2010-06-03 05:53:14 -07:00
static void
2012-11-25 22:32:53 -08:00
_gengrid_pan_class_constructor ( Eo_Class * klass )
{
const Eo_Op_Func_Description func_desc [ ] = {
2013-04-24 04:41:37 -07:00
EO_OP_FUNC ( EO_BASE_ID ( EO_BASE_SUB_ID_DESTRUCTOR ) , _elm_gengrid_pan_destructor ) ,
2012-11-25 22:32:53 -08:00
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_RESIZE ) , _elm_gengrid_pan_smart_resize ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_MOVE ) , _elm_gengrid_pan_smart_move ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_CALCULATE ) , _elm_gengrid_pan_smart_calculate ) ,
EO_OP_FUNC ( ELM_OBJ_PAN_ID ( ELM_OBJ_PAN_SUB_ID_POS_SET ) , _elm_gengrid_pan_smart_pos_set ) ,
EO_OP_FUNC ( ELM_OBJ_PAN_ID ( ELM_OBJ_PAN_SUB_ID_POS_GET ) , _elm_gengrid_pan_smart_pos_get ) ,
EO_OP_FUNC ( ELM_OBJ_PAN_ID ( ELM_OBJ_PAN_SUB_ID_POS_MAX_GET ) , _elm_gengrid_pan_smart_pos_max_get ) ,
EO_OP_FUNC ( ELM_OBJ_PAN_ID ( ELM_OBJ_PAN_SUB_ID_POS_MIN_GET ) , _elm_gengrid_pan_smart_pos_min_get ) ,
EO_OP_FUNC ( ELM_OBJ_PAN_ID ( ELM_OBJ_PAN_SUB_ID_CONTENT_SIZE_GET ) , _elm_gengrid_pan_smart_content_size_get ) ,
EO_OP_FUNC_SENTINEL
} ;
eo_class_funcs_set ( klass , func_desc ) ;
2013-02-09 23:52:31 -08:00
evas_smart_legacy_type_register ( MY_PAN_CLASS_NAME , klass ) ;
2012-11-25 22:32:53 -08:00
}
static const Eo_Class_Description _elm_obj_gengrid_pan_class_desc = {
EO_VERSION ,
MY_PAN_CLASS_NAME ,
EO_CLASS_TYPE_REGULAR ,
EO_CLASS_DESCRIPTION_OPS ( NULL , NULL , 0 ) ,
NULL ,
sizeof ( Elm_Gengrid_Pan_Smart_Data ) ,
_gengrid_pan_class_constructor ,
NULL
} ;
2010-06-03 05:53:14 -07:00
2012-11-25 22:32:53 -08:00
EO_DEFINE_CLASS ( elm_obj_gengrid_pan_class_get , & _elm_obj_gengrid_pan_class_desc , ELM_OBJ_PAN_CLASS , NULL ) ;
2010-06-03 05:53:14 -07:00
2012-07-10 14:40:38 -07:00
static Eina_Bool
_item_multi_select_left ( Elm_Gengrid_Smart_Data * sd )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Object_Item * 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
2012-07-10 14:40:38 -07:00
prev = elm_gengrid_item_prev_get ( sd - > last_selected_item ) ;
if ( ! prev ) return EINA_TRUE ;
2011-06-02 00:09:17 -07:00
2012-07-10 14:40:38 -07:00
if ( elm_gengrid_item_selected_get ( 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 ) ;
sd - > last_selected_item = prev ;
elm_gengrid_item_show
( sd - > last_selected_item , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
}
else
{
elm_gengrid_item_selected_set ( prev , EINA_TRUE ) ;
elm_gengrid_item_show ( prev , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
}
return EINA_TRUE ;
}
static Eina_Bool
_item_multi_select_right ( Elm_Gengrid_Smart_Data * sd )
{
Elm_Object_Item * next ;
if ( ! sd - > selected ) return EINA_FALSE ;
next = elm_gengrid_item_next_get ( sd - > last_selected_item ) ;
if ( ! next ) return EINA_TRUE ;
if ( elm_gengrid_item_selected_get ( next ) )
{
elm_gengrid_item_selected_set ( sd - > last_selected_item , EINA_FALSE ) ;
sd - > last_selected_item = next ;
elm_gengrid_item_show
( sd - > last_selected_item , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
}
else
{
elm_gengrid_item_selected_set ( next , EINA_TRUE ) ;
elm_gengrid_item_show ( next , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
}
return EINA_TRUE ;
}
static Eina_Bool
_item_multi_select_up ( Elm_Gengrid_Smart_Data * sd )
{
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
_item_multi_select_down ( Elm_Gengrid_Smart_Data * sd )
{
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
_all_items_deselect ( Elm_Gengrid_Smart_Data * sd )
{
if ( ! sd - > selected ) return EINA_FALSE ;
while ( sd - > selected )
elm_gengrid_item_selected_set
( ( Elm_Object_Item * ) sd - > selected - > data , EINA_FALSE ) ;
return EINA_TRUE ;
}
static Eina_Bool
_item_single_select_up ( Elm_Gengrid_Smart_Data * sd )
{
unsigned int i ;
Elm_Gen_Item * prev ;
if ( ! sd - > selected )
{
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 ) ;
elm_gengrid_item_selected_set ( ( Elm_Object_Item * ) prev , EINA_TRUE ) ;
elm_gengrid_item_show
( ( Elm_Object_Item * ) prev , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
return EINA_TRUE ;
}
else
prev = ( Elm_Gen_Item * ) elm_gengrid_item_prev_get ( sd - > last_selected_item ) ;
if ( ! prev ) return EINA_FALSE ;
for ( i = 1 ; i < sd - > nmax ; i + + )
{
Elm_Object_Item * tmp =
elm_gengrid_item_prev_get ( ( Elm_Object_Item * ) prev ) ;
if ( ! tmp ) return EINA_FALSE ;
prev = ( Elm_Gen_Item * ) tmp ;
}
_all_items_deselect ( sd ) ;
elm_gengrid_item_selected_set ( ( Elm_Object_Item * ) prev , EINA_TRUE ) ;
elm_gengrid_item_show
( ( Elm_Object_Item * ) prev , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
return EINA_TRUE ;
}
static Eina_Bool
_item_single_select_down ( Elm_Gengrid_Smart_Data * sd )
{
unsigned int i ;
Elm_Gen_Item * next ;
if ( ! sd - > selected )
{
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 ) ;
elm_gengrid_item_selected_set ( ( Elm_Object_Item * ) next , EINA_TRUE ) ;
elm_gengrid_item_show
( ( Elm_Object_Item * ) next , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
return EINA_TRUE ;
}
else
next = ( Elm_Gen_Item * ) elm_gengrid_item_next_get ( sd - > last_selected_item ) ;
if ( ! next ) return EINA_FALSE ;
for ( i = 1 ; i < sd - > nmax ; i + + )
{
Elm_Object_Item * tmp =
elm_gengrid_item_next_get ( ( Elm_Object_Item * ) next ) ;
if ( ! tmp ) return EINA_FALSE ;
next = ( Elm_Gen_Item * ) tmp ;
}
_all_items_deselect ( sd ) ;
elm_gengrid_item_selected_set ( ( Elm_Object_Item * ) next , EINA_TRUE ) ;
elm_gengrid_item_show
( ( Elm_Object_Item * ) next , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
return EINA_TRUE ;
}
static Eina_Bool
_item_single_select_left ( Elm_Gengrid_Smart_Data * sd )
{
Elm_Gen_Item * prev ;
if ( ! sd - > selected )
{
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
prev = ( Elm_Gen_Item * ) elm_gengrid_item_prev_get ( sd - > last_selected_item ) ;
if ( ! prev ) return EINA_FALSE ;
_all_items_deselect ( sd ) ;
elm_gengrid_item_selected_set ( ( Elm_Object_Item * ) prev , EINA_TRUE ) ;
elm_gengrid_item_show
( ( Elm_Object_Item * ) prev , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
return EINA_TRUE ;
}
static Eina_Bool
_item_single_select_right ( Elm_Gengrid_Smart_Data * sd )
{
Elm_Gen_Item * next ;
if ( ! sd - > selected )
{
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
next = ( Elm_Gen_Item * ) elm_gengrid_item_next_get ( sd - > last_selected_item ) ;
if ( ! next ) return EINA_FALSE ;
_all_items_deselect ( sd ) ;
elm_gengrid_item_selected_set ( ( Elm_Object_Item * ) next , EINA_TRUE ) ;
elm_gengrid_item_show
( ( Elm_Object_Item * ) next , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
return EINA_TRUE ;
}
2012-11-25 22:32:53 -08:00
static void
_elm_gengrid_smart_event ( Eo * obj , void * _pd , va_list * list )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Object * src = va_arg ( * list , Evas_Object * ) ;
( void ) src ;
Evas_Callback_Type type = va_arg ( * list , Evas_Callback_Type ) ;
void * event_info = va_arg ( * list , void * ) ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
if ( ret ) * ret = EINA_FALSE ;
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 ;
Evas_Event_Key_Down * ev = event_info ;
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
if ( type ! = EVAS_CALLBACK_KEY_DOWN ) return ;
if ( ! sd - > items ) return ;
if ( ev - > event_flags & EVAS_EVENT_FLAG_ON_HOLD ) return ;
if ( elm_widget_disabled_get ( obj ) ) return ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj ,
elm_scrollable_interface_content_pos_get ( & x , & y ) ,
elm_scrollable_interface_step_size_get ( & step_x , & step_y ) ,
elm_scrollable_interface_page_size_get ( & page_x , & page_y ) ,
elm_scrollable_interface_content_viewport_size_get ( & v_w , & v_h ) ) ;
2012-07-10 14:40:38 -07:00
if ( ( ! strcmp ( ev - > keyname , " Left " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Left " ) ) & & ( ! ev - > string ) ) )
{
if ( ( sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_up ( sd ) ) )
| | ( _item_single_select_up ( sd ) ) ) )
2011-09-09 05:43:34 -07:00
{
2012-07-10 14:40:38 -07:00
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2011-09-09 05:43:34 -07:00
}
2012-07-10 14:40:38 -07:00
else if ( ( ! sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_left ( sd ) ) )
| | ( _item_single_select_left ( sd ) ) ) )
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
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else
x - = step_x ;
}
else if ( ( ! strcmp ( ev - > keyname , " Right " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Right " ) ) & & ( ! ev - > string ) ) )
{
if ( ( sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_down ( sd ) ) )
| | ( _item_single_select_down ( sd ) ) ) )
{
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else if ( ( ! sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_right ( sd ) ) )
| | ( _item_single_select_right ( sd ) ) ) )
{
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else
x + = step_x ;
}
else if ( ( ! strcmp ( ev - > keyname , " Up " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Up " ) ) & & ( ! ev - > string ) ) )
{
if ( ( sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_left ( sd ) ) )
| | ( _item_single_select_left ( sd ) ) ) )
{
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else if ( ( ! sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_up ( sd ) ) )
| | ( _item_single_select_up ( sd ) ) ) )
{
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else
y - = step_y ;
}
else if ( ( ! strcmp ( ev - > keyname , " Down " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Down " ) ) & & ( ! ev - > string ) ) )
{
if ( ( sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_right ( sd ) ) )
| | ( _item_single_select_right ( sd ) ) ) )
{
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else if ( ( ! sd - > horizontal ) & &
( ( ( evas_key_modifier_is_set ( ev - > modifiers , " Shift " ) ) & &
( _item_multi_select_down ( sd ) ) )
| | ( _item_single_select_down ( sd ) ) ) )
{
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else
y + = step_y ;
}
else if ( ( ! strcmp ( ev - > keyname , " Home " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Home " ) ) & & ( ! ev - > string ) ) )
{
it = elm_gengrid_first_item_get ( obj ) ;
elm_gengrid_item_bring_in ( it , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
elm_gengrid_item_selected_set ( it , EINA_TRUE ) ;
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else if ( ( ! strcmp ( ev - > keyname , " End " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_End " ) ) & & ( ! ev - > string ) ) )
{
it = elm_gengrid_last_item_get ( obj ) ;
elm_gengrid_item_bring_in ( it , ELM_GENGRID_ITEM_SCROLLTO_IN ) ;
elm_gengrid_item_selected_set ( it , EINA_TRUE ) ;
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else if ( ( ! strcmp ( ev - > keyname , " Prior " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Prior " ) ) & & ( ! ev - > string ) ) )
{
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
}
}
2012-07-10 14:40:38 -07:00
else if ( ( ! strcmp ( ev - > keyname , " Next " ) ) | |
( ( ! strcmp ( ev - > keyname , " KP_Next " ) ) & & ( ! ev - > string ) ) )
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
}
}
2012-07-10 14:40:38 -07:00
else if ( ! strcmp ( ev - > keyname , " Escape " ) )
{
2012-11-25 22:32:53 -08:00
if ( ! _all_items_deselect ( sd ) ) return ;
2012-07-10 14:40:38 -07:00
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
return ;
2012-07-10 14:40:38 -07:00
}
else if ( ( ( ! strcmp ( ev - > keyname , " Return " ) ) | |
( ! strcmp ( ev - > keyname , " KP_Enter " ) ) | |
( ! strcmp ( ev - > keyname , " space " ) ) )
& & ( ! sd - > multi ) & & ( sd - > selected ) )
{
it = elm_gengrid_selected_item_get ( obj ) ;
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_ACTIVATED , it ) ;
}
2012-11-25 22:32:53 -08:00
else return ;
2012-07-10 14:40:38 -07:00
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2013-02-27 22:18:51 -08:00
eo_do ( obj , elm_scrollable_interface_content_pos_set ( x , y , EINA_TRUE ) ) ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
2010-06-03 05:53:14 -07:00
}
2012-11-25 22:32:53 -08:00
static void
_elm_gengrid_smart_on_focus ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
2010-06-03 05:53:14 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
if ( ret ) * ret = EINA_FALSE ;
Eina_Bool int_ret = EINA_FALSE ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , elm_wdg_on_focus ( & int_ret ) ) ;
2012-11-25 22:32:53 -08:00
if ( ! int_ret ) return ;
2012-07-10 14:40:38 -07:00
if ( elm_widget_focus_get ( obj ) & & ( sd - > selected ) & &
( ! sd - > last_selected_item ) )
sd - > last_selected_item = eina_list_data_get ( sd - > selected ) ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
2010-06-03 05:53:14 -07:00
}
2012-11-25 22:32:53 -08:00
static Eina_Bool _elm_gengrid_smart_focus_next_enable = EINA_FALSE ;
static void
_elm_gengrid_smart_focus_next_manager_is ( Eo * obj EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
* ret = _elm_gengrid_smart_focus_next_enable ;
}
static void
_elm_gengrid_smart_focus_direction_manager_is ( Eo * obj EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list )
2012-08-18 06:52:03 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
* ret = EINA_FALSE ;
}
static void
_elm_gengrid_smart_focus_next ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
{
Elm_Focus_Direction dir = va_arg ( * list , Elm_Focus_Direction ) ;
Evas_Object * * next = va_arg ( * list , Evas_Object * * ) ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
if ( ret ) * ret = EINA_FALSE ;
Eina_Bool int_ret ;
2012-08-18 06:52:03 -07:00
Eina_List * items = NULL ;
Elm_Gen_Item * it ;
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-08-18 06:52:03 -07:00
EINA_INLIST_FOREACH ( sd - > items , it )
{
if ( it - > realized )
items = eina_list_append ( items , it - > base . access_obj ) ;
}
2012-11-25 22:32:53 -08:00
int_ret = elm_widget_focus_list_next_get
2012-08-18 06:52:03 -07:00
( obj , items , eina_list_data_get , dir , next ) ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = int_ret ;
2012-08-18 06:52:03 -07:00
}
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 ) ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , elm_scrollable_interface_mirrored_set ( 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 ) ;
elm_gengrid_item_update ( ( Elm_Object_Item * ) it ) ;
it = ELM_GEN_ITEM_FROM_INLIST ( EINA_INLIST_GET ( it ) - > next ) ;
}
}
2012-11-25 22:32:53 -08:00
static void
_elm_gengrid_smart_theme ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
if ( ret ) * ret = EINA_FALSE ;
Eina_Bool int_ret ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , elm_wdg_theme ( & int_ret ) ) ;
2012-11-25 22:32:53 -08:00
if ( ! int_ret ) return ;
2012-07-10 14:40:38 -07:00
_mirrored_set ( obj , elm_widget_mirrored_get ( obj ) ) ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = 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
{
2012-07-10 14:40:38 -07:00
elm_widget_item_pre_notify_del ( it ) ;
it - > generation = GG_IT ( it ) - > wsd - > generation - 1 ; /* This means that the
* item is deleted */
2013-04-01 20:44:27 -07:00
if ( it - > walking > 0 ) return ;
2012-07-10 14:40:38 -07:00
if ( it - > selected )
GG_IT ( it ) - > wsd - > selected =
eina_list_remove ( GG_IT ( it ) - > wsd - > selected , it ) ;
if ( it - > itc - > func . del )
it - > itc - > func . del ( ( void * ) it - > base . data , WIDGET ( it ) ) ;
}
static void
_elm_gengrid_item_del_serious ( Elm_Gen_Item * it )
{
_elm_gengrid_item_del_not_serious ( it ) ;
GG_IT ( it ) - > wsd - > items = eina_inlist_remove
( GG_IT ( it ) - > wsd - > items , EINA_INLIST_GET ( it ) ) ;
if ( it - > tooltip . del_cb )
it - > tooltip . del_cb ( ( void * ) it - > tooltip . data , WIDGET ( it ) , it ) ;
GG_IT ( it ) - > wsd - > 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 )
GG_IT ( it ) - > wsd - > group_items =
eina_list_remove ( GG_IT ( it ) - > wsd - > group_items , it ) ;
if ( GG_IT ( it ) - > wsd - > state )
{
eina_inlist_sorted_state_free ( GG_IT ( it ) - > wsd - > state ) ;
GG_IT ( it ) - > wsd - > state = NULL ;
}
if ( GG_IT ( it ) - > wsd - > calc_job ) ecore_job_del ( GG_IT ( it ) - > wsd - > calc_job ) ;
GG_IT ( it ) - > wsd - > calc_job =
2013-04-24 04:41:37 -07:00
ecore_job_add ( GG_IT ( it ) - > wsd - > calc_cb , GG_IT ( it ) - > wsd - > obj ) ;
2012-07-10 14:40:38 -07:00
if ( GG_IT ( it ) - > wsd - > last_selected_item = = ( Elm_Object_Item * ) it )
GG_IT ( it ) - > wsd - > last_selected_item = NULL ;
GG_IT ( it ) - > wsd - > item_count - - ;
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 ) ;
evas_event_freeze ( evas_object_evas_get ( obj ) ) ;
GG_IT ( it ) - > wsd - > selected = eina_list_remove ( GG_IT ( it ) - > wsd - > selected , it ) ;
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 ,
void * data __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
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __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
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
2011-09-27 08:04:57 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
2011-09-27 08:04:57 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
2011-09-27 08:04:57 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
2011-09-27 08:04:57 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ,
void * data __UNUSED__ )
{
evas_object_smart_callback_call ( obj , SIG_SCROLL_PAGE_CHANGE , NULL ) ;
}
2010-06-03 05:53:14 -07:00
static void
2012-07-10 14:40:38 -07:00
_scroll_cb ( Evas_Object * obj ,
void * data __UNUSED__ )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
evas_object_smart_callback_call ( obj , SIG_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 ;
2012-06-14 07:11:04 -07:00
if ( cb & & it & & item1 ) return cb ( it , 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
}
2012-01-30 18:40:08 -08:00
static void
2012-07-10 14:40:38 -07:00
_item_disable_hook ( Elm_Object_Item * item )
2012-01-30 18:40:08 -08:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
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
{
2012-07-10 14:40:38 -07:00
if ( elm_widget_item_disabled_get ( it ) )
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 " ) ;
}
}
static void
_item_del_pre_hook ( Elm_Object_Item * item )
{
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
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 ) ;
return ;
2012-01-30 18:40:08 -08:00
}
2012-07-10 14:40:38 -07:00
_item_del ( it ) ;
}
static Evas_Object *
_item_content_get_hook ( Elm_Gen_Item * it ,
const char * part )
{
return edje_object_part_swallow_get ( VIEW ( it ) , part ) ;
}
static const char *
_item_text_get_hook ( Elm_Gen_Item * it ,
const char * part )
{
if ( ! it - > itc - > func . text_get ) return NULL ;
return edje_object_part_text_get ( VIEW ( it ) , part ) ;
}
static void
_item_signal_emit_hook ( Elm_Object_Item * it ,
const char * emission ,
const char * source )
{
edje_object_signal_emit ( VIEW ( it ) , emission , source ) ;
2012-01-30 18:40:08 -08:00
}
2012-01-30 19:03:17 -08:00
static void
2012-07-10 14:40:38 -07:00
_elm_gengrid_clear ( Evas_Object * obj ,
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 ) ;
if ( ! standby ) sd - > generation + + ;
if ( sd - > state )
{
eina_inlist_sorted_state_free ( sd - > state ) ;
sd - > state = NULL ;
}
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 ) ;
elm_widget_item_free ( it ) ;
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 ) ;
2012-07-10 14:40:38 -07:00
if ( sd - > selected ) sd - > selected = eina_list_free ( sd - > selected ) ;
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 ) ;
evas_object_smart_callback_call ( sd - > pan_obj , " changed " , NULL ) ;
}
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_scrollable_interface_content_region_show ( 0 , 0 , 0 , 0 ) ) ;
evas_event_thaw ( evas_object_evas_get ( obj ) ) ;
evas_event_thaw_eval ( evas_object_evas_get ( obj ) ) ;
2012-07-10 14:40:38 -07:00
}
static void
_item_select ( Elm_Gen_Item * it )
{
Evas_Object * obj = WIDGET ( it ) ;
2012-01-30 19:03:17 -08:00
2012-07-10 14:40:38 -07:00
if ( ( it - > generation < GG_IT ( it ) - > wsd - > generation ) | | ( it - > decorate_it_set ) | |
( it - > select_mode = = ELM_OBJECT_SELECT_MODE_NONE ) | |
( GG_IT ( it ) - > wsd - > select_mode = = ELM_OBJECT_SELECT_MODE_NONE ) )
return ;
if ( ! it - > selected )
{
it - > selected = EINA_TRUE ;
GG_IT ( it ) - > wsd - > selected =
eina_list_append ( GG_IT ( it ) - > wsd - > selected , it ) ;
}
else if ( GG_IT ( it ) - > wsd - > select_mode ! = ELM_OBJECT_SELECT_MODE_ALWAYS )
return ;
evas_object_ref ( obj ) ;
it - > walking + + ;
GG_IT ( it ) - > wsd - > walking + + ;
if ( it - > func . func ) it - > func . func ( ( void * ) it - > func . data , WIDGET ( it ) , it ) ;
if ( it - > generation = = GG_IT ( it ) - > wsd - > generation )
evas_object_smart_callback_call ( WIDGET ( it ) , SIG_SELECTED , it ) ;
it - > walking - - ;
GG_IT ( it ) - > wsd - > walking - - ;
if ( ( GG_IT ( it ) - > wsd - > clear_me ) & & ( ! GG_IT ( it ) - > wsd - > walking ) )
_elm_gengrid_clear ( WIDGET ( it ) , EINA_TRUE ) ;
else
{
if ( ( ! it - > walking ) & & ( it - > generation < GG_IT ( it ) - > wsd - > generation ) )
{
2013-04-01 20:44:27 -07:00
it - > del_cb ( it ) ;
elm_widget_item_free ( it ) ;
2012-07-10 14:40:38 -07:00
}
else
GG_IT ( it ) - > wsd - > last_selected_item = ( Elm_Object_Item * ) it ;
}
evas_object_unref ( obj ) ;
2012-01-30 19:03:17 -08:00
}
2011-10-21 15:55:45 -07:00
static Elm_Gen_Item *
2012-07-10 14:40:38 -07:00
_elm_gengrid_item_new ( Elm_Gengrid_Smart_Data * sd ,
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
{
Elm_Gen_Item * it ;
2012-07-10 14:40:38 -07:00
if ( ! itc ) return NULL ;
2012-11-25 22:32:53 -08:00
it = elm_widget_item_new ( sd - > obj , Elm_Gen_Item ) ;
2011-10-21 15:55:45 -07:00
if ( ! it ) return NULL ;
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 ) ;
it - > base . data = data ;
it - > parent = NULL ;
it - > func . func = func ;
it - > func . data = func_data ;
elm_widget_item_content_get_hook_set ( it , _item_content_get_hook ) ;
elm_widget_item_text_get_hook_set ( it , _item_text_get_hook ) ;
elm_widget_item_disable_hook_set ( it , _item_disable_hook ) ;
elm_widget_item_del_pre_hook_set ( it , _item_del_pre_hook ) ;
elm_widget_item_signal_emit_hook_set ( it , _item_signal_emit_hook ) ;
it - > del_cb = ( Ecore_Cb ) _item_del ;
it - > highlight_cb = ( Ecore_Cb ) _item_highlight ;
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 */
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_sizing_eval ( Eo * obj EINA_UNUSED , void * _pd EINA_UNUSED , va_list * list EINA_UNUSED )
2012-07-10 14:40:38 -07:00
{
return ; /* no-op */
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_add ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-07-10 14:40:38 -07:00
{
2012-07-17 09:42:20 -07:00
Eina_Bool bounce = _elm_config - > thumbscroll_bounce_enable ;
Elm_Gengrid_Pan_Smart_Data * pan_data ;
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Smart_Data * priv = _pd ;
2013-04-24 04:41:37 -07:00
Elm_Widget_Smart_Data * wd = eo_data_scope_get ( obj , ELM_OBJ_WIDGET_CLASS ) ;
2012-07-10 14:40:38 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_add ( ) ) ;
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 ) ) )
CRITICAL ( " Failed to set layout! " ) ;
2012-07-17 09:42:20 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_scrollable_interface_objects_set ( 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
eo_do ( obj , elm_scrollable_interface_bounce_allow_set ( bounce , bounce ) ) ;
eo_do ( obj ,
2013-05-15 14:56:04 -07:00
elm_scrollable_interface_animate_start_cb_set
( _scroll_animate_start_cb ) ,
2012-11-25 22:32:53 -08:00
elm_scrollable_interface_animate_stop_cb_set ( _scroll_animate_stop_cb ) ,
elm_scrollable_interface_drag_start_cb_set ( _scroll_drag_start_cb ) ,
elm_scrollable_interface_drag_stop_cb_set ( _scroll_drag_stop_cb ) ,
elm_scrollable_interface_edge_left_cb_set ( _edge_left_cb ) ,
elm_scrollable_interface_edge_right_cb_set ( _edge_right_cb ) ,
elm_scrollable_interface_edge_top_cb_set ( _edge_top_cb ) ,
elm_scrollable_interface_edge_bottom_cb_set ( _edge_bottom_cb ) ,
2013-05-15 14:56:04 -07:00
elm_scrollable_interface_scroll_cb_set ( _scroll_cb ) ,
elm_scrollable_interface_page_change_cb_set ( _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 ;
2012-11-25 22:32:53 -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 ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_scrollable_interface_extern_pan_set ( priv - > pan_obj ) ) ;
2012-07-10 14:40:38 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_del ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
elm_gengrid_clear ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_unref ( sd - > pan_obj ) ;
2012-07-10 14:40:38 -07:00
evas_object_del ( sd - > pan_obj ) ;
sd - > pan_obj = NULL ;
if ( sd - > calc_job ) ecore_job_del ( sd - > calc_job ) ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_del ( ) ) ;
2012-07-10 14:40:38 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_move ( Eo * obj , void * _pd , va_list * list )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Coord x = va_arg ( * list , Evas_Coord ) ;
Evas_Coord y = va_arg ( * list , Evas_Coord ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_move ( x , y ) ) ;
2012-07-10 14:40:38 -07:00
evas_object_move ( sd - > hit_rect , x , y ) ;
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_resize ( Eo * obj , void * _pd , va_list * list )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Coord w = va_arg ( * list , Evas_Coord ) ;
Evas_Coord h = va_arg ( * list , Evas_Coord ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_resize ( w , h ) ) ;
2012-07-10 14:40:38 -07:00
evas_object_resize ( sd - > hit_rect , w , h ) ;
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_member_add ( Eo * obj , void * _pd , va_list * list )
2012-07-10 14:40:38 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Object * member = va_arg ( * list , Evas_Object * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_member_add ( 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
_access_obj_process ( Elm_Gengrid_Smart_Data * sd , Eina_Bool is_access )
{
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
_elm_access_widget_item_unregister ( ( Elm_Widget_Item * ) it ) ;
2012-10-18 21:06:42 -07:00
2012-08-18 06:52:03 -07:00
}
}
static void
2012-11-25 22:32:53 -08:00
_elm_gengrid_smart_access ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-08-18 06:52:03 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Gengrid_Smart_Data * sd = _pd ;
_elm_gengrid_smart_focus_next_enable = va_arg ( * list , int ) ;
_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 ) ;
2012-11-25 22:32:53 -08:00
Evas_Object * obj = eo_add ( MY_CLASS , parent ) ;
eo_unref ( obj ) ;
return obj ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_constructor ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
{
Elm_Gengrid_Smart_Data * sd = _pd ;
sd - > obj = obj ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , eo_constructor ( ) ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj ,
evas_obj_type_set ( MY_CLASS_NAME ) ,
evas_obj_smart_callbacks_descriptions_set ( _smart_callbacks , NULL ) ) ;
2012-07-10 14:40:38 -07:00
2013-04-02 19:28:53 -07:00
elm_widget_sub_object_add ( eo_parent_get ( obj ) , obj ) ;
2010-06-03 05:53:14 -07:00
}
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_item_size_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Evas_Coord w ,
Evas_Coord h )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_item_size_set ( w , h ) ) ;
}
static void
2013-04-24 04:41:37 -07:00
_item_size_set ( Eo * obj , void * _pd , va_list * list )
2012-11-25 22:32:53 -08:00
{
Evas_Coord w = va_arg ( * list , Evas_Coord ) ;
Evas_Coord h = va_arg ( * list , Evas_Coord ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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 ;
if ( sd - > calc_job ) 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
}
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_item_size_get ( const Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Evas_Coord * w ,
Evas_Coord * h )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_gengrid_item_size_get ( w , h ) ) ;
}
static void
_item_size_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Evas_Coord * w = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * h = va_arg ( * list , Evas_Coord * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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
}
2011-09-09 05:43:34 -07:00
EAPI void
elm_gengrid_group_item_size_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Evas_Coord w ,
Evas_Coord h )
2011-09-09 05:43:34 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_group_item_size_set ( w , h ) ) ;
}
static void
2013-04-24 04:41:37 -07:00
_group_item_size_set ( Eo * obj , void * _pd , va_list * list )
2012-11-25 22:32:53 -08:00
{
Evas_Coord w = va_arg ( * list , Evas_Coord ) ;
Evas_Coord h = va_arg ( * list , Evas_Coord ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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 ;
if ( sd - > calc_job ) 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
}
EAPI void
elm_gengrid_group_item_size_get ( const Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Evas_Coord * w ,
Evas_Coord * h )
2011-09-09 05:43:34 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_gengrid_group_item_size_get ( w , h ) ) ;
}
static void
_group_item_size_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Evas_Coord * w = va_arg ( * list , Evas_Coord * ) ;
Evas_Coord * h = va_arg ( * list , Evas_Coord * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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
}
2010-06-03 05:53:14 -07:00
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_align_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
double align_x ,
double align_y )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) ;
eo_do ( obj , elm_obj_gengrid_align_set ( align_x , align_y ) ) ;
}
static void
_align_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
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-11-25 22:32:53 -08:00
double align_x = va_arg ( * list , double ) ;
double align_y = va_arg ( * list , double ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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
}
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_align_get ( const Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
double * align_x ,
double * align_y )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_gengrid_align_get ( align_x , align_y ) ) ;
}
static void
_align_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
double * align_x = va_arg ( * list , double * ) ;
double * align_y = va_arg ( * list , double * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_append ( Evas_Object * obj ,
2011-10-20 15:45:38 -07:00
const Elm_Gengrid_Item_Class * itc ,
2012-07-10 14:40:38 -07:00
const void * data ,
Evas_Smart_Cb func ,
const void * func_data )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) NULL ;
Elm_Object_Item * ret = NULL ;
eo_do ( obj , elm_obj_gengrid_item_append ( itc , data , func , func_data , & ret ) ) ;
return ret ;
}
static void
2013-04-24 04:41:37 -07:00
_item_append ( Eo * obj , void * _pd , va_list * list )
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-11-25 22:32:53 -08:00
const Elm_Gengrid_Item_Class * itc = va_arg ( * list , const Elm_Gengrid_Item_Class * ) ;
const void * data = va_arg ( * list , const void * ) ;
Evas_Smart_Cb func = va_arg ( * list , Evas_Smart_Cb ) ;
const void * func_data = va_arg ( * list , const void * ) ;
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = NULL ;
2012-07-10 14:40:38 -07:00
it = _elm_gengrid_item_new ( sd , itc , data , func , func_data ) ;
2012-11-25 22:32:53 -08:00
if ( ! it ) return ;
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
2012-07-10 14:40:38 -07:00
if ( sd - > calc_job ) 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
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2010-10-10 14:05:23 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_prepend ( Evas_Object * obj ,
2011-10-20 15:45:38 -07:00
const Elm_Gengrid_Item_Class * itc ,
2012-07-10 14:40:38 -07:00
const void * data ,
Evas_Smart_Cb func ,
const void * func_data )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) NULL ;
Elm_Object_Item * ret = NULL ;
eo_do ( obj , elm_obj_gengrid_item_prepend ( itc , data , func , func_data , & ret ) ) ;
return ret ;
}
static void
2013-04-24 04:41:37 -07:00
_item_prepend ( Eo * obj , void * _pd , va_list * list )
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-11-25 22:32:53 -08:00
const Elm_Gengrid_Item_Class * itc = va_arg ( * list , const Elm_Gengrid_Item_Class * ) ;
const void * data = va_arg ( * list , const void * ) ;
Evas_Smart_Cb func = va_arg ( * list , Evas_Smart_Cb ) ;
const void * func_data = va_arg ( * list , const void * ) ;
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
* ret = NULL ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
it = _elm_gengrid_item_new ( sd , itc , data , func , func_data ) ;
2012-11-25 22:32:53 -08:00
if ( ! it ) return ;
2012-07-10 14:40:38 -07:00
sd - > items = eina_inlist_prepend ( sd - > items , EINA_INLIST_GET ( it ) ) ;
_item_position_update ( sd - > items , 0 ) ;
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
2012-07-10 14:40:38 -07:00
if ( sd - > calc_job ) 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
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2010-10-10 14:05:23 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_insert_before ( Evas_Object * obj ,
2011-10-20 15:45:38 -07:00
const Elm_Gengrid_Item_Class * itc ,
2012-07-10 14:40:38 -07:00
const void * data ,
Elm_Object_Item * relative ,
Evas_Smart_Cb func ,
const void * func_data )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) NULL ;
Elm_Object_Item * ret = NULL ;
eo_do ( obj , elm_obj_gengrid_item_insert_before ( itc , data , relative , func , func_data , & ret ) ) ;
return ret ;
}
static void
2013-04-24 04:41:37 -07:00
_item_insert_before ( Eo * obj , void * _pd , va_list * list )
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 ;
2010-10-10 14:05:23 -07:00
2012-11-25 22:32:53 -08:00
const Elm_Gengrid_Item_Class * itc = va_arg ( * list , const Elm_Gengrid_Item_Class * ) ;
const void * data = va_arg ( * list , const void * ) ;
Elm_Object_Item * relative = va_arg ( * list , Elm_Object_Item * ) ;
Evas_Smart_Cb func = va_arg ( * list , Evas_Smart_Cb ) ;
const void * func_data = va_arg ( * list , const void * ) ;
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
* ret = NULL ;
ELM_GENGRID_ITEM_CHECK ( relative ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
it = _elm_gengrid_item_new ( sd , itc , data , func , func_data ) ;
2012-11-25 22:32:53 -08:00
if ( ! it ) return ;
2012-07-10 14:40:38 -07:00
sd - > items = eina_inlist_prepend_relative
( sd - > items , EINA_INLIST_GET ( it ) ,
EINA_INLIST_GET ( ( Elm_Gen_Item * ) relative ) ) ;
tmp = eina_inlist_find ( sd - > items , EINA_INLIST_GET ( it ) ) ;
2012-03-07 05:58:30 -08:00
_item_position_update ( tmp , ( ( Elm_Gen_Item * ) relative ) - > position ) ;
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
( sd - > group_items , it , ( ( Elm_Gen_Item * ) relative ) - > parent ) ;
2010-10-10 14:05:23 -07:00
2012-07-10 14:40:38 -07:00
if ( sd - > calc_job ) 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
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2010-10-10 14:05:23 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_insert_after ( Evas_Object * obj ,
2011-10-20 15:45:38 -07:00
const Elm_Gengrid_Item_Class * itc ,
2012-07-10 14:40:38 -07:00
const void * data ,
Elm_Object_Item * relative ,
Evas_Smart_Cb func ,
const void * func_data )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) NULL ;
Elm_Object_Item * ret = NULL ;
eo_do ( obj , elm_obj_gengrid_item_insert_after ( itc , data , relative , func , func_data , & ret ) ) ;
return ret ;
}
static void
2013-04-24 04:41:37 -07:00
_item_insert_after ( Eo * obj , void * _pd , va_list * list )
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 ;
2012-11-25 22:32:53 -08:00
const Elm_Gengrid_Item_Class * itc = va_arg ( * list , const Elm_Gengrid_Item_Class * ) ;
const void * data = va_arg ( * list , const void * ) ;
Elm_Object_Item * relative = va_arg ( * list , Elm_Object_Item * ) ;
Evas_Smart_Cb func = va_arg ( * list , Evas_Smart_Cb ) ;
const void * func_data = va_arg ( * list , const void * ) ;
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
* ret = NULL ;
ELM_GENGRID_ITEM_CHECK ( relative ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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 ) ;
2012-11-25 22:32:53 -08:00
if ( ! it ) return ;
2012-07-10 14:40:38 -07:00
sd - > items = eina_inlist_append_relative
( sd - > items , EINA_INLIST_GET ( it ) ,
EINA_INLIST_GET ( ( Elm_Gen_Item * ) relative ) ) ;
tmp = eina_inlist_find ( sd - > items , EINA_INLIST_GET ( it ) ) ;
_item_position_update ( tmp , ( ( Elm_Gen_Item * ) 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
( sd - > group_items , it , ( ( Elm_Gen_Item * ) relative ) - > parent ) ;
2010-10-10 14:05:23 -07:00
2012-07-10 14:40:38 -07:00
if ( sd - > calc_job ) 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
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2010-06-03 05:53:14 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_sorted_insert ( Evas_Object * obj ,
2012-02-29 02:30:51 -08:00
const Elm_Gengrid_Item_Class * itc ,
2012-07-10 14:40:38 -07:00
const void * data ,
Eina_Compare_Cb comp ,
Evas_Smart_Cb func ,
const void * func_data )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) NULL ;
Elm_Object_Item * ret = NULL ;
eo_do ( obj , elm_obj_gengrid_item_sorted_insert ( itc , data , comp , func , func_data , & ret ) ) ;
return ret ;
}
static void
2013-04-24 04:41:37 -07:00
_item_sorted_insert ( Eo * obj , void * _pd , va_list * list )
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-11-25 22:32:53 -08:00
const Elm_Gengrid_Item_Class * itc = va_arg ( * list , const Elm_Gengrid_Item_Class * ) ;
const void * data = va_arg ( * list , const void * ) ;
Eina_Compare_Cb comp = va_arg ( * list , Eina_Compare_Cb ) ;
Evas_Smart_Cb func = va_arg ( * list , Evas_Smart_Cb ) ;
const void * func_data = va_arg ( * list , const void * ) ;
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
* ret = NULL ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
it = _elm_gengrid_item_new ( sd , itc , data , func , func_data ) ;
2012-11-25 22:32:53 -08:00
if ( ! it ) return ;
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
2012-07-10 14:40:38 -07:00
if ( sd - > calc_job ) 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
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2011-06-25 08:39:05 -07:00
}
2010-06-03 05:53:14 -07:00
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_horizontal_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Eina_Bool horizontal )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_horizontal_set ( horizontal ) ) ;
}
static void
2013-04-24 04:41:37 -07:00
_horizontal_set ( Eo * obj , void * _pd , va_list * list )
2012-11-25 22:32:53 -08:00
{
Eina_Bool horizontal = va_arg ( * list , int ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07: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 */
2012-07-10 14:40:38 -07:00
if ( sd - > calc_job ) 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
}
2011-04-18 03:54:25 -07:00
EAPI Eina_Bool
elm_gengrid_horizontal_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_horizontal_get ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_horizontal_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = sd - > horizontal ;
2011-04-18 03:54:25 -07:00
}
2010-06-03 05:53:14 -07:00
EAPI void
elm_gengrid_clear ( Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_clear ( ) ) ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_clear ( Eo * obj , void * _pd EINA_UNUSED , va_list * list EINA_UNUSED )
{
2012-07-10 14:40:38 -07:00
_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 *
2012-01-30 02:29:51 -08:00
elm_gengrid_item_object_get ( const Elm_Object_Item * it )
2010-06-03 05:53:14 -07:00
{
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
}
2010-10-09 12:07:42 -07:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_update ( Elm_Object_Item * item )
2010-10-09 12:07:42 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
if ( ! it - > realized ) return ;
if ( it - > want_unrealize ) return ;
_elm_gengrid_item_unrealize ( it , EINA_FALSE ) ;
_item_realize ( it ) ;
_item_place ( it , it - > x , it - > y ) ;
2010-10-09 12:07:42 -07:00
}
2011-06-25 16:20:22 -07:00
EAPI const Elm_Gengrid_Item_Class *
2012-01-30 02:29:51 -08:00
elm_gengrid_item_item_class_get ( const Elm_Object_Item * it )
2011-06-25 16:20:22 -07:00
{
2012-07-18 14:03:46 -07:00
Elm_Gen_Item * item = ( Elm_Gen_Item * ) it ;
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it , NULL ) ;
if ( item - > generation < GG_IT ( item ) - > wsd - > generation ) return NULL ;
return item - > itc ;
2011-06-25 16:20:22 -07:00
}
2012-02-29 01:01:24 -08:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_item_class_update ( Elm_Object_Item * item ,
2012-02-29 01:01:24 -08:00
const Elm_Gengrid_Item_Class * itc )
2011-06-25 16:20:22 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
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 ;
elm_gengrid_item_update ( item ) ;
2011-06-25 16:20:22 -07:00
}
2010-06-03 05:53:14 -07:00
EAPI void
2012-01-30 02:29:51 -08:00
elm_gengrid_item_pos_get ( const Elm_Object_Item * it ,
2012-07-10 14:40:38 -07:00
unsigned int * x ,
unsigned int * y )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
2012-03-06 03:51:42 -08:00
if ( x ) * x = ( ( Elm_Gen_Item * ) it ) - > x ;
if ( y ) * y = ( ( Elm_Gen_Item * ) it ) - > y ;
2010-06-03 05:53:14 -07:00
}
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_multi_select_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Eina_Bool multi )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_multi_select_set ( multi ) ) ;
}
static void
_multi_select_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool multi = va_arg ( * list , int ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
sd - > multi = ! ! multi ;
2010-06-03 05:53:14 -07:00
}
EAPI Eina_Bool
elm_gengrid_multi_select_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_multi_select_get ( & ret ) ) ;
return ret ;
}
static void
_multi_select_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
* ret = sd - > multi ;
2010-06-03 05:53:14 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2010-06-03 05:53:14 -07:00
elm_gengrid_selected_item_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) NULL ;
2012-11-25 22:32:53 -08:00
Elm_Object_Item * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_selected_item_get ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_selected_item_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = NULL ;
if ( sd - > selected ) * ret = sd - > selected - > data ;
2010-06-03 05:53:14 -07:00
}
EAPI const Eina_List *
elm_gengrid_selected_items_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) NULL ;
2012-11-25 22:32:53 -08:00
const Eina_List * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_selected_items_get ( & ret ) ) ;
return ret ;
}
static void
_selected_items_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
const Eina_List * * ret = va_arg ( * list , const Eina_List * * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
* ret = sd - > selected ;
2010-06-03 05:53:14 -07:00
}
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_selected_set ( Elm_Object_Item * item ,
Eina_Bool selected )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
2012-11-16 06:26:10 -08:00
Elm_Gengrid_Smart_Data * sd ;
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
2012-11-16 06:26:10 -08:00
sd = GG_IT ( it ) - > wsd ;
if ( ( it - > generation < sd - > generation ) | | elm_widget_item_disabled_get ( 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
{
if ( it - > unhighlight_cb )
2012-11-16 06:26:10 -08:00
it - > unhighlight_cb ( sd - > selected - > data ) ;
it - > unsel_cb ( sd - > selected - > data ) ;
2012-07-10 14:40:38 -07:00
}
}
it - > highlight_cb ( it ) ;
_item_select ( it ) ;
return ;
}
if ( it - > unhighlight_cb ) it - > unhighlight_cb ( it ) ;
it - > unsel_cb ( it ) ;
2010-06-03 05:53:14 -07:00
}
EAPI Eina_Bool
2012-01-30 02:29:51 -08:00
elm_gengrid_item_selected_get ( const Elm_Object_Item * it )
2010-06-03 05:53:14 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it , EINA_FALSE ) ;
return ( ( Elm_Gen_Item * ) it ) - > selected ;
2010-06-03 05:53:14 -07:00
}
2012-03-07 05:46:35 -08:00
EAPI Eina_List *
elm_gengrid_realized_items_get ( const Evas_Object * obj )
{
2012-11-25 22:32:53 -08:00
ELM_GENGRID_CHECK ( obj ) NULL ;
Eina_List * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_realized_items_get ( & ret ) ) ;
return ret ;
}
static void
_realized_items_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
2012-03-07 05:46:35 -08:00
Elm_Gen_Item * it ;
2012-11-25 22:32:53 -08:00
Eina_List * * ret = va_arg ( * list , Eina_List * * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* 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
{
2012-11-25 22:32:53 -08:00
if ( it - > realized ) * ret = eina_list_append ( * ret , ( Elm_Object_Item * ) it ) ;
2012-03-07 05:46:35 -08:00
}
}
EAPI void
elm_gengrid_realized_items_update ( Evas_Object * obj )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) ;
eo_do ( obj , elm_obj_gengrid_realized_items_update ( ) ) ;
}
static void
_realized_items_update ( Eo * obj , void * _pd EINA_UNUSED , va_list * list_unused EINA_UNUSED )
2012-03-07 05:46:35 -08:00
{
Eina_List * list , * l ;
Elm_Object_Item * it ;
list = elm_gengrid_realized_items_get ( obj ) ;
2012-10-01 00:36:27 -07:00
EINA_LIST_FOREACH ( list , l , 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 ,
2011-07-26 02:38:23 -07:00
Evas_Object * obj __UNUSED__ ,
Evas_Object * tooltip ,
2011-10-20 14:41:24 -07:00
void * it __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 ,
2010-12-10 05:01:43 -08:00
Evas_Object * obj __UNUSED__ ,
void * event_info __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
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
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
( it , _elm_gengrid_item_label_create , text ,
_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
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
ELM_GENGRID_ITEM_CHECK_OR_GOTO ( it , error ) ;
2010-09-27 11:18:37 -07:00
2012-07-10 14:40:38 -07:00
if ( ( it - > tooltip . content_cb = = func ) & & ( it - > tooltip . data = = data ) )
2010-09-27 11:18:37 -07:00
return ;
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 . content_cb = func ;
it - > tooltip . data = data ;
it - > tooltip . del_cb = del_cb ;
if ( VIEW ( it ) )
2010-09-27 11:18:37 -07:00
{
2012-07-10 14:40:38 -07:00
elm_widget_item_tooltip_content_cb_set
( it , it - > tooltip . content_cb , it - > tooltip . data , NULL ) ;
elm_widget_item_tooltip_style_set ( it , it - > tooltip . style ) ;
elm_widget_item_tooltip_window_mode_set ( it , it - > tooltip . free_size ) ;
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
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
2012-01-30 02:29:51 -08:00
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 ) )
elm_widget_item_tooltip_unset ( it ) ;
if ( it - > tooltip . del_cb )
it - > tooltip . del_cb ( ( void * ) it - > tooltip . data , WIDGET ( it ) , it ) ;
it - > tooltip . del_cb = NULL ;
it - > tooltip . content_cb = NULL ;
it - > tooltip . data = NULL ;
it - > tooltip . free_size = EINA_FALSE ;
if ( it - > tooltip . style )
elm_gengrid_item_tooltip_style_set ( item , 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
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
2012-03-06 03:51:42 -08:00
eina_stringshare_replace ( & ( ( Elm_Gen_Item * ) it ) - > tooltip . style , style ) ;
2011-10-20 18:08:01 -07:00
if ( VIEW ( it ) ) elm_widget_item_tooltip_style_set ( it , 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
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it , NULL ) ;
2012-03-06 03:51:42 -08:00
return ( ( Elm_Gen_Item * ) 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
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it , EINA_FALSE ) ;
2012-03-06 03:51:42 -08:00
( ( Elm_Gen_Item * ) it ) - > tooltip . free_size = disable ;
2011-12-05 09:14:07 -08:00
if ( VIEW ( it ) ) return elm_widget_item_tooltip_window_mode_set ( it , disable ) ;
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 )
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 ) ;
2012-03-06 03:51:42 -08:00
return ( ( Elm_Gen_Item * ) 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 )
2010-09-17 11:24:10 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
2012-03-06 03:51:42 -08:00
eina_stringshare_replace ( & ( ( Elm_Gen_Item * ) it ) - > mouse_cursor , cursor ) ;
2011-10-20 18:08:01 -07:00
if ( VIEW ( it ) ) elm_widget_item_cursor_set ( it , 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
{
2011-10-20 14:41:24 -07:00
return elm_widget_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
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
if ( ! it - > mouse_cursor )
2010-09-27 11:18:37 -07:00
return ;
2012-07-10 14:40:38 -07:00
if ( VIEW ( it ) )
elm_widget_item_cursor_unset ( it ) ;
2010-09-27 11:18:37 -07:00
2012-07-10 14:40:38 -07:00
eina_stringshare_del ( it - > mouse_cursor ) ;
it - > mouse_cursor = NULL ;
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
{
2011-10-20 14:41:24 -07:00
elm_widget_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
{
2011-10-20 14:41:24 -07:00
return elm_widget_item_cursor_style_get ( it ) ;
2010-09-25 15:01:19 -07:00
}
2010-09-25 15:03:37 -07:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_cursor_engine_only_set ( Elm_Object_Item * it ,
Eina_Bool engine_only )
2010-09-25 15:03:37 -07:00
{
2011-10-20 14:41:24 -07:00
elm_widget_item_cursor_engine_only_set ( it , engine_only ) ;
2010-09-25 15:03:37 -07:00
}
EAPI Eina_Bool
2012-01-30 02:29:51 -08:00
elm_gengrid_item_cursor_engine_only_get ( const Elm_Object_Item * it )
2010-09-25 15:03:37 -07:00
{
2011-10-20 14:41:24 -07:00
return elm_widget_item_cursor_engine_only_get ( it ) ;
2010-09-25 15:03:37 -07:00
}
2011-06-02 00:09:17 -07:00
EAPI void
elm_gengrid_reorder_mode_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Eina_Bool reorder_mode )
2011-06-02 00:09:17 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_reorder_mode_set ( reorder_mode ) ) ;
}
static void
_reorder_mode_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool reorder_mode = va_arg ( * list , int ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
sd - > reorder_mode = ! ! reorder_mode ;
2011-06-02 00:09:17 -07:00
}
EAPI Eina_Bool
elm_gengrid_reorder_mode_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_reorder_mode_get ( & ret ) ) ;
return ret ;
}
static void
_reorder_mode_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
* ret = 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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_scrollable_interface_bounce_allow_set ( h_bounce , v_bounce ) ) ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_bounce_set ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
{
Eina_Bool h_bounce = va_arg ( * list , int ) ;
Eina_Bool v_bounce = va_arg ( * list , int ) ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , elm_scrollable_interface_bounce_allow_set ( ! ! 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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_bounce_allow_get ( h_bounce , v_bounce ) ) ;
2010-06-03 05:53:14 -07:00
}
2010-07-06 14:14:38 -07:00
2010-09-29 09:59:35 -07:00
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_page_relative_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
double h_pagerel ,
double v_pagerel )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) ;
eo_do ( obj , elm_obj_gengrid_page_relative_set ( h_pagerel , v_pagerel ) ) ;
}
static void
_page_relative_set ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
2010-09-29 09:59:35 -07:00
{
2012-07-10 14:40:38 -07:00
Evas_Coord pagesize_h ;
Evas_Coord pagesize_v ;
2012-11-25 22:32:53 -08:00
double h_pagerel = va_arg ( * list , double ) ;
double v_pagerel = va_arg ( * list , double ) ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_paging_get ( NULL , NULL , & pagesize_h , & pagesize_v ) ) ;
eo_do ( ( Eo * ) obj , elm_scrollable_interface_paging_set
( h_pagerel , v_pagerel , pagesize_h , pagesize_v ) ) ;
2010-09-29 09:59:35 -07:00
}
2011-04-18 03:54:25 -07:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_page_relative_get ( const Evas_Object * obj ,
double * h_pagerel ,
double * v_pagerel )
2011-04-18 03:54:25 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_gengrid_page_relative_get ( h_pagerel , v_pagerel ) ) ;
}
static void
_page_relative_get ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
{
double * h_pagerel = va_arg ( * list , double * ) ;
double * v_pagerel = va_arg ( * list , double * ) ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_paging_get ( h_pagerel , v_pagerel , NULL , NULL ) ) ;
2011-04-18 03:54:25 -07:00
}
2010-09-29 09:59:35 -07:00
EAPI void
2010-12-10 05:01:43 -08:00
elm_gengrid_page_size_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Evas_Coord h_pagesize ,
Evas_Coord v_pagesize )
2012-11-25 22:32:53 -08:00
{
ELM_GENGRID_CHECK ( obj ) ;
eo_do ( obj , elm_obj_gengrid_page_size_set ( h_pagesize , v_pagesize ) ) ;
}
static void
_page_size_set ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
2010-12-10 05:01:43 -08:00
{
2012-07-10 14:40:38 -07:00
double pagerel_h ;
double pagerel_v ;
2012-11-25 22:32:53 -08:00
Evas_Coord h_pagesize = va_arg ( * list , Evas_Coord ) ;
Evas_Coord v_pagesize = va_arg ( * list , Evas_Coord ) ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_paging_get ( & pagerel_h , & pagerel_v , NULL , NULL ) ) ;
eo_do ( ( Eo * ) obj , elm_scrollable_interface_paging_set
( 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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_current_page_get ( 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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_last_page_get ( 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_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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_page_show ( 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_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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_scrollable_interface_page_bring_in ( 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 ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_scrollable_interface_policy_set ( policy_h , policy_v ) ) ;
}
static void
_scroller_policy_set ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
{
Elm_Scroller_Policy policy_h = va_arg ( * list , Elm_Scroller_Policy ) ;
Elm_Scroller_Policy policy_v = va_arg ( * list , Elm_Scroller_Policy ) ;
2012-07-10 14:40:38 -07: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
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , elm_scrollable_interface_policy_set ( 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 ) ;
eo_do ( ( Eo * ) obj , elm_scrollable_interface_policy_get ( policy_h , policy_v ) ) ;
}
static void
_scroller_policy_get ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
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 ;
2012-11-25 22:32:53 -08:00
Elm_Scroller_Policy * policy_h = va_arg ( * list , Elm_Scroller_Policy * ) ;
Elm_Scroller_Policy * policy_v = va_arg ( * list , Elm_Scroller_Policy * ) ;
2012-07-10 14:40:38 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( ( Eo * ) obj , MY_CLASS , elm_scrollable_interface_policy_get ( & 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 ;
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2010-10-10 16:54:11 -07:00
elm_gengrid_first_item_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) NULL ;
2012-11-25 22:32:53 -08:00
Elm_Object_Item * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_first_item_get ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_first_item_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
* ret = NULL ;
Elm_Gengrid_Smart_Data * sd = _pd ;
if ( ! sd - > items ) return ;
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 ) ;
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2010-10-10 16:54:11 -07:00
}
2010-09-29 09:59:35 -07:00
2013-03-16 23:36:30 -07:00
EAPI Elm_Object_Item *
elm_gengrid_at_xy_item_get ( const Evas_Object * obj ,
Evas_Coord x ,
Evas_Coord y ,
int * xposret ,
int * yposret )
{
ELM_GENGRID_CHECK ( obj ) NULL ;
Elm_Object_Item * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_at_xy_item_get ( x , y ,
xposret , yposret , & ret ) ) ;
return ret ;
}
static void
_at_xy_item_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Evas_Coord x = va_arg ( * list , Evas_Coord ) ;
Evas_Coord y = va_arg ( * list , Evas_Coord ) ;
int * xposret = va_arg ( * list , int * ) ;
int * yposret = va_arg ( * list , int * ) ;
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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 ;
}
* ret = ( Elm_Object_Item * ) it ;
return ;
}
} 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 ) ;
}
* ret = NULL ;
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2010-10-10 16:54:11 -07:00
elm_gengrid_last_item_get ( const Evas_Object * obj )
2010-07-06 14:14:38 -07:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) NULL ;
2012-11-25 22:32:53 -08:00
Elm_Object_Item * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_last_item_get ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_last_item_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Object_Item * * ret = va_arg ( * list , Elm_Object_Item * * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = NULL ;
if ( ! sd - > items ) return ;
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 ) ;
2012-11-25 22:32:53 -08:00
* ret = ( Elm_Object_Item * ) it ;
2010-10-10 16:54:11 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_next_get ( const Elm_Object_Item * item )
2010-10-10 16:54:11 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
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 ;
}
return ( Elm_Object_Item * ) it ;
2010-10-10 16:54:11 -07:00
}
2012-01-30 02:29:51 -08:00
EAPI Elm_Object_Item *
2012-07-10 14:40:38 -07:00
elm_gengrid_item_prev_get ( const Elm_Object_Item * item )
2010-10-10 16:54:11 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
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 ;
}
return ( Elm_Object_Item * ) it ;
2010-10-10 16:54:11 -07:00
}
2010-09-22 23:33:50 -07:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_show ( Elm_Object_Item * item ,
Elm_Gengrid_Item_Scrollto_Type type )
2010-09-22 23:33:50 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
Elm_Gengrid_Smart_Data * sd ;
2010-09-22 23:33:50 -07:00
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
sd = GG_IT ( it ) - > wsd ;
if ( ( it - > generation < sd - > generation ) ) return ;
2010-09-22 23:33:50 -07:00
2012-07-10 14:40:38 -07:00
if ( type = = ELM_GENGRID_ITEM_SCROLLTO_IN )
2012-03-07 04:57:17 -08:00
{
2012-07-10 14:40:38 -07:00
//TODO : type based handling like gengrid
2012-03-07 04:57:17 -08:00
}
2013-01-03 04:03:55 -08:00
sd - > show_region = EINA_TRUE ;
sd - > show_it = it ;
_item_show_region ( sd ) ;
2010-09-22 23:33:50 -07:00
}
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_bring_in ( Elm_Object_Item * item ,
Elm_Gengrid_Item_Scrollto_Type type )
2010-09-22 23:33:50 -07:00
{
2012-07-10 14:40:38 -07:00
Elm_Gengrid_Smart_Data * sd ;
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
2012-01-30 02:29:51 -08:00
2012-07-10 14:40:38 -07:00
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
sd = GG_IT ( it ) - > wsd ;
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
2012-07-10 14:40:38 -07:00
if ( type = = ELM_GENGRID_ITEM_SCROLLTO_IN )
2012-03-07 04:57:17 -08:00
{
2012-07-10 14:40:38 -07:00
//TODO : type based handling like gengrid
2012-03-07 04:57:17 -08:00
}
2013-01-03 04:03:55 -08:00
sd - > bring_in = EINA_TRUE ;
sd - > bring_in_it = it ;
_item_show_region ( sd ) ;
2010-09-22 23:33:50 -07:00
}
2012-01-04 06:33:39 -08:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_filled_set ( Evas_Object * obj ,
Eina_Bool fill )
2012-01-04 06:33:39 -08:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_filled_set ( fill ) ) ;
}
static void
_filled_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool fill = va_arg ( * list , int ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07: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
}
EAPI Eina_Bool
elm_gengrid_filled_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_filled_get ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_filled_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = sd - > filled ;
2012-01-04 06:33:39 -08:00
}
2012-03-07 05:46:35 -08:00
EAPI unsigned int
elm_gengrid_items_count ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) 0 ;
2012-11-25 22:32:53 -08:00
unsigned int ret = 0 ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_items_count ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_items_count ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
unsigned int * ret = va_arg ( * list , unsigned int * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = 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
}
2012-03-07 04:43:19 -08:00
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_select_mode_set ( Evas_Object * obj ,
Elm_Object_Select_Mode mode )
2012-03-07 04:43:19 -08:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_select_mode_set ( mode ) ) ;
}
static void
_select_mode_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Object_Select_Mode mode = va_arg ( * list , Elm_Object_Select_Mode ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
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
}
2012-03-07 08:01:37 -08:00
EAPI Elm_Object_Select_Mode
2012-03-07 04:43:19 -08:00
elm_gengrid_select_mode_get ( const Evas_Object * obj )
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ELM_OBJECT_SELECT_MODE_MAX ;
2012-11-25 22:32:53 -08:00
Elm_Object_Select_Mode ret = ELM_OBJECT_SELECT_MODE_MAX ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_select_mode_get ( & ret ) ) ;
return ret ;
}
static void
_select_mode_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Object_Select_Mode * ret = va_arg ( * list , Elm_Object_Select_Mode * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
* ret = sd - > select_mode ;
2012-03-07 04:43:19 -08:00
}
2012-03-07 05:37:18 -08:00
EAPI void
2012-03-07 07:02:01 -08:00
elm_gengrid_highlight_mode_set ( Evas_Object * obj ,
2012-07-10 14:40:38 -07:00
Eina_Bool highlight )
2012-03-07 05:37:18 -08:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_gengrid_highlight_mode_set ( highlight ) ) ;
}
static void
_highlight_mode_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool highlight = va_arg ( * list , int ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
2012-07-10 14:40:38 -07:00
sd - > highlight = ! ! highlight ;
2012-03-07 05:37:18 -08:00
}
EAPI Eina_Bool
2012-03-07 07:02:01 -08:00
elm_gengrid_highlight_mode_get ( const Evas_Object * obj )
2012-03-07 05:37:18 -08:00
{
2012-07-10 14:40:38 -07:00
ELM_GENGRID_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_gengrid_highlight_mode_get ( & ret ) ) ;
return ret ;
}
2012-07-10 14:40:38 -07:00
2012-11-25 22:32:53 -08:00
static void
_highlight_mode_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Gengrid_Smart_Data * sd = _pd ;
* ret = sd - > highlight ;
2012-03-07 05:37:18 -08:00
}
2012-03-07 05:58:30 -08:00
EAPI int
2012-07-10 14:40:38 -07:00
elm_gengrid_item_index_get ( const Elm_Object_Item * item )
2012-03-07 05:58:30 -08:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
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
EAPI void
2012-07-10 14:40:38 -07:00
elm_gengrid_item_select_mode_set ( Elm_Object_Item * item ,
2012-03-08 05:47:09 -08:00
Elm_Object_Select_Mode mode )
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it ) ;
if ( ! it ) return ;
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 )
elm_gengrid_item_update ( item ) ;
2012-03-08 05:47:09 -08:00
}
EAPI Elm_Object_Select_Mode
2012-07-10 14:40:38 -07:00
elm_gengrid_item_select_mode_get ( const Elm_Object_Item * item )
2012-03-08 05:47:09 -08:00
{
2012-07-10 14:40:38 -07:00
Elm_Gen_Item * it = ( Elm_Gen_Item * ) item ;
ELM_GENGRID_ITEM_CHECK_OR_RETURN ( it , ELM_OBJECT_SELECT_MODE_MAX ) ;
if ( ! it ) return 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
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 ;
ELM_GENGRID_CHECK ( obj ) EINA_FALSE ;
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 ) ;
return ( Elm_Object_Item * ) it ;
}
2012-11-25 22:32:53 -08:00
static void
_class_constructor ( Eo_Class * klass )
{
const Eo_Op_Func_Description func_desc [ ] = {
EO_OP_FUNC ( EO_BASE_ID ( EO_BASE_SUB_ID_CONSTRUCTOR ) , _constructor ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD ) , _elm_gengrid_smart_member_add ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_ADD ) , _elm_gengrid_smart_add ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_DEL ) , _elm_gengrid_smart_del ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_RESIZE ) , _elm_gengrid_smart_resize ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_MOVE ) , _elm_gengrid_smart_move ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_THEME ) , _elm_gengrid_smart_theme ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_EVENT ) , _elm_gengrid_smart_event ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_ON_FOCUS ) , _elm_gengrid_smart_on_focus ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS ) , _elm_gengrid_smart_focus_next_manager_is ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_FOCUS_NEXT ) , _elm_gengrid_smart_focus_next ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_ACCESS ) , _elm_gengrid_smart_access ) ,
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS ) , _elm_gengrid_smart_focus_direction_manager_is ) ,
2013-02-11 23:29:16 -08:00
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_TRANSLATE ) , _elm_gengrid_smart_translate ) ,
2012-11-25 22:32:53 -08:00
EO_OP_FUNC ( ELM_OBJ_LAYOUT_ID ( ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL ) , _elm_gengrid_smart_sizing_eval ) ,
EO_OP_FUNC ( ELM_SCROLLABLE_INTERFACE_ID ( ELM_SCROLLABLE_INTERFACE_SUB_ID_BOUNCE_ALLOW_SET ) , _bounce_set ) ,
EO_OP_FUNC ( ELM_SCROLLABLE_INTERFACE_ID ( ELM_SCROLLABLE_INTERFACE_SUB_ID_POLICY_SET ) , _scroller_policy_set ) ,
EO_OP_FUNC ( ELM_SCROLLABLE_INTERFACE_ID ( ELM_SCROLLABLE_INTERFACE_SUB_ID_POLICY_GET ) , _scroller_policy_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_SIZE_SET ) , _item_size_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_SIZE_GET ) , _item_size_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_GROUP_ITEM_SIZE_SET ) , _group_item_size_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_GROUP_ITEM_SIZE_GET ) , _group_item_size_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ALIGN_SET ) , _align_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ALIGN_GET ) , _align_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_APPEND ) , _item_append ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_PREPEND ) , _item_prepend ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_INSERT_BEFORE ) , _item_insert_before ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_INSERT_AFTER ) , _item_insert_after ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEM_SORTED_INSERT ) , _item_sorted_insert ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_HORIZONTAL_SET ) , _horizontal_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_HORIZONTAL_GET ) , _horizontal_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_CLEAR ) , _clear ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_MULTI_SELECT_SET ) , _multi_select_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_MULTI_SELECT_GET ) , _multi_select_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_SELECTED_ITEM_GET ) , _selected_item_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_SELECTED_ITEMS_GET ) , _selected_items_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_REALIZED_ITEMS_GET ) , _realized_items_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_REALIZED_ITEMS_UPDATE ) , _realized_items_update ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_REORDER_MODE_SET ) , _reorder_mode_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_REORDER_MODE_GET ) , _reorder_mode_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_PAGE_RELATIVE_SET ) , _page_relative_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_PAGE_RELATIVE_GET ) , _page_relative_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_PAGE_SIZE_SET ) , _page_size_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_FIRST_ITEM_GET ) , _first_item_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_LAST_ITEM_GET ) , _last_item_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_FILLED_SET ) , _filled_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_FILLED_GET ) , _filled_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_ITEMS_COUNT ) , _items_count ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_SELECT_MODE_SET ) , _select_mode_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_SELECT_MODE_GET ) , _select_mode_get ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_HIGHLIGHT_MODE_SET ) , _highlight_mode_set ) ,
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_HIGHLIGHT_MODE_GET ) , _highlight_mode_get ) ,
2013-03-16 23:36:30 -07:00
EO_OP_FUNC ( ELM_OBJ_GENGRID_ID ( ELM_OBJ_GENGRID_SUB_ID_AT_XY_ITEM_GET ) , _at_xy_item_get ) ,
2012-11-25 22:32:53 -08:00
EO_OP_FUNC_SENTINEL
} ;
eo_class_funcs_set ( klass , func_desc ) ;
2013-02-09 23:52:31 -08:00
2013-05-03 03:53:56 -07:00
if ( _elm_config - > access_mode )
_elm_gengrid_smart_focus_next_enable = EINA_TRUE ;
2013-02-09 23:52:31 -08:00
evas_smart_legacy_type_register ( MY_CLASS_NAME , klass ) ;
2012-11-25 22:32:53 -08:00
}
static const Eo_Op_Description op_desc [ ] = {
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_SIZE_SET , " Set the size for the items of a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_SIZE_GET , " Get the size set for the items of a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_GROUP_ITEM_SIZE_SET , " Set the size for the group items of a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_GROUP_ITEM_SIZE_GET , " Get the size set for the group items of a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ALIGN_SET , " Set the items grid's alignment within a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ALIGN_GET , " Get the items grid's alignment values within a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_APPEND , " Append a new item in a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_PREPEND , " Prepend a new item in a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_INSERT_BEFORE , " Insert an item before another in a gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_INSERT_AFTER , " Insert an item after another in a gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEM_SORTED_INSERT , " Insert an item in a gengrid widget using a user-defined sort function. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_HORIZONTAL_SET , " Set the direction in which a given gengrid widget will expand while placing its items. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_HORIZONTAL_GET , " Get for what direction a given gengrid widget will expand while placing its items. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_CLEAR , " Remove all items from a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_MULTI_SELECT_SET , " Enable or disable multi-selection in a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_MULTI_SELECT_GET , " Get whether multi-selection is enabled or disabled for a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_SELECTED_ITEM_GET , " Get the selected item in a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_SELECTED_ITEMS_GET , " Get a list of selected items in a given gengrid. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_REALIZED_ITEMS_GET , " Get a list of realized items in gengrid. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_REALIZED_ITEMS_UPDATE , " Update the contents of all realized items. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_REORDER_MODE_SET , " Set whether a given gengrid widget is or not able have items reordered. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_REORDER_MODE_GET , " Get whether a given gengrid widget is or not able have items reordered. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_PAGE_RELATIVE_SET , " EINA_DEPRECATED Set a given gengrid widget's scrolling page size, relative to its viewport size. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_PAGE_RELATIVE_GET , " EINA_DEPRECATED Get a given gengrid widget's scrolling page size, relative to its viewport size. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_PAGE_SIZE_SET , " EINA_DEPRECATED Set a given gengrid widget's scrolling page size " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_FIRST_ITEM_GET , " Get the first item in a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_LAST_ITEM_GET , " Get the last item in a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_FILLED_SET , " Set how the items grid's filled within a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_FILLED_GET , " Get how the items grid's filled within a given gengrid widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_ITEMS_COUNT , " Return how many items are currently in a list. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_SELECT_MODE_SET , " Set the gengrid select mode. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_SELECT_MODE_GET , " Get the gengrid select mode. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_HIGHLIGHT_MODE_SET , " Set whether the gengrid items should be highlighted when item selected. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_HIGHLIGHT_MODE_GET , " Get whether the gengrid items should be highlighted when item selected. " ) ,
2013-03-16 23:36:30 -07:00
EO_OP_DESCRIPTION ( ELM_OBJ_GENGRID_SUB_ID_AT_XY_ITEM_GET , " Get the item that is at the x, y canvas coords. " ) ,
2012-11-25 22:32:53 -08:00
EO_OP_DESCRIPTION_SENTINEL
} ;
static const Eo_Class_Description class_desc = {
EO_VERSION ,
MY_CLASS_NAME ,
EO_CLASS_TYPE_REGULAR ,
EO_CLASS_DESCRIPTION_OPS ( & ELM_OBJ_GENGRID_BASE_ID , op_desc , ELM_OBJ_GENGRID_SUB_ID_LAST ) ,
NULL ,
sizeof ( Elm_Gengrid_Smart_Data ) ,
_class_constructor ,
NULL
} ;
EO_DEFINE_CLASS ( elm_obj_gengrid_class_get , & class_desc , ELM_OBJ_LAYOUT_CLASS , ELM_SCROLLABLE_INTERFACE , EVAS_SMART_CLICKABLE_INTERFACE , NULL ) ;