2004-11-24 19:37:45 -08:00
# include "e.h"
typedef struct _E_Smart_Data E_Smart_Data ;
2012-06-12 00:20:44 -07:00
typedef struct _Cache_Item Cache_Item ;
typedef struct _Cache Cache ;
2004-11-24 19:37:45 -08:00
struct _E_Smart_Data
2010-03-08 18:45:14 -08:00
{
2012-06-12 00:20:44 -07:00
Evas_Coord x , y , w , h ;
Evas_Object * obj ;
Evas_Object * eventarea ;
2012-12-06 18:48:30 -08:00
const char * fdo ;
2012-10-25 00:28:24 -07:00
Ecore_Timer * guessing_animation ;
2012-12-06 18:48:30 -08:00
Ecore_Timer * timer , * fdo_reload_timer ;
2012-10-25 00:28:24 -07:00
double last_resize ;
2012-06-12 00:20:44 -07:00
int size ;
int frame , frame_count ;
2017-11-08 06:22:24 -08:00
unsigned char fill_inside E_BITFIELD ;
unsigned char scale_up E_BITFIELD ;
unsigned char preload E_BITFIELD ;
unsigned char loading E_BITFIELD ;
unsigned char animated E_BITFIELD ;
unsigned char invalid E_BITFIELD ;
Eina_Bool edje E_BITFIELD ;
2011-08-25 17:44:45 -07:00
} ;
struct _Cache_Item
{
2012-06-12 00:20:44 -07:00
unsigned int timestamp ;
2011-08-29 01:30:23 -07:00
2012-06-12 00:20:44 -07:00
Evas_Object * icon , * obj ;
const char * id ;
Eina_List * objs ;
2011-08-25 17:44:45 -07:00
} ;
struct _Cache
{
2012-06-12 00:20:44 -07:00
Eina_Hash * hash ;
2011-08-25 17:44:45 -07:00
2012-06-12 00:20:44 -07:00
char * file ;
Eet_File * ef ;
Ecore_Timer * timer ;
Eina_List * load_queue ;
2010-03-08 18:45:14 -08:00
} ;
2004-11-24 19:37:45 -08:00
/* local subsystem functions */
2012-06-12 00:20:44 -07:00
static void _e_icon_smart_reconfigure ( E_Smart_Data * sd ) ;
static void _e_icon_smart_init ( void ) ;
static void _e_icon_smart_add ( Evas_Object * obj ) ;
static void _e_icon_smart_del ( Evas_Object * obj ) ;
static void _e_icon_smart_move ( Evas_Object * obj , Evas_Coord x , Evas_Coord y ) ;
static void _e_icon_smart_resize ( Evas_Object * obj , Evas_Coord w , Evas_Coord h ) ;
static void _e_icon_smart_show ( Evas_Object * obj ) ;
static void _e_icon_smart_hide ( Evas_Object * obj ) ;
static void _e_icon_smart_color_set ( Evas_Object * obj , int r , int g , int b , int a ) ;
static void _e_icon_smart_clip_set ( Evas_Object * obj , Evas_Object * clip ) ;
static void _e_icon_smart_clip_unset ( Evas_Object * obj ) ;
static void _e_icon_obj_prepare ( Evas_Object * obj , E_Smart_Data * sd ) ;
static void _e_icon_preloaded ( void * data , Evas * e , Evas_Object * obj , void * event_info ) ;
2004-11-24 19:37:45 -08:00
/* local subsystem globals */
static Evas_Smart * _e_smart = NULL ;
2011-08-25 17:44:45 -07:00
EINTERN int
e_icon_init ( void )
{
return 1 ;
}
EINTERN int
e_icon_shutdown ( void )
{
return 1 ;
}
2004-11-24 19:37:45 -08:00
/* externally accessible functions */
2015-05-07 12:13:10 -07:00
E_API Evas_Object *
2004-11-24 19:37:45 -08:00
e_icon_add ( Evas * evas )
{
_e_icon_smart_init ( ) ;
return evas_object_smart_add ( evas , _e_smart ) ;
}
2009-05-15 04:47:28 -07:00
static void
_e_icon_obj_prepare ( Evas_Object * obj , E_Smart_Data * sd )
{
if ( ! sd - > obj ) return ;
2010-03-08 18:45:14 -08:00
2012-07-20 00:26:16 -07:00
if ( sd - > edje )
2009-05-15 04:47:28 -07:00
{
2012-06-12 00:20:44 -07:00
Evas_Object * pclip ;
2011-05-10 21:56:42 -07:00
2012-06-12 00:20:44 -07:00
pclip = evas_object_clip_get ( sd - > obj ) ;
evas_object_del ( sd - > obj ) ;
sd - > obj = evas_object_image_add ( evas_object_evas_get ( obj ) ) ;
2012-10-25 00:28:24 -07:00
if ( ! sd - > animated )
evas_object_image_scale_hint_set ( sd - > obj ,
EVAS_IMAGE_SCALE_HINT_STATIC ) ;
2012-06-12 00:20:44 -07:00
evas_object_smart_member_add ( sd - > obj , obj ) ;
evas_object_event_callback_add ( sd - > obj , EVAS_CALLBACK_IMAGE_PRELOADED ,
_e_icon_preloaded , obj ) ;
evas_object_clip_set ( sd - > obj , pclip ) ;
2009-05-15 04:47:28 -07:00
}
}
2011-08-11 03:39:37 -07:00
static Eina_Bool
_frame_anim ( void * data )
{
E_Smart_Data * sd = data ;
double t ;
int fr ;
sd - > frame + + ;
fr = ( sd - > frame % ( sd - > frame_count ) ) + 1 ;
evas_object_image_animated_frame_set ( sd - > obj , fr ) ;
t = evas_object_image_animated_frame_duration_get ( sd - > obj , fr , 0 ) ;
2017-02-03 13:52:28 -08:00
sd - > timer = ecore_timer_loop_add ( t , _frame_anim , sd ) ;
2011-08-11 03:39:37 -07:00
return EINA_FALSE ;
}
static int
_handle_anim ( E_Smart_Data * sd )
{
double t ;
2011-08-29 01:30:23 -07:00
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
sd - > frame = 0 ;
sd - > frame_count = 0 ;
if ( ! evas_object_image_animated_get ( sd - > obj ) ) return 0 ;
sd - > frame_count = evas_object_image_animated_frame_count_get ( sd - > obj ) ;
if ( sd - > frame_count < 2 ) return 0 ;
2017-01-09 01:24:25 -08:00
if ( ! sd - > invalid ) evas_object_show ( sd - > obj ) ;
2011-08-11 03:39:37 -07:00
t = evas_object_image_animated_frame_duration_get ( sd - > obj , sd - > frame , 0 ) ;
2017-02-03 13:52:28 -08:00
sd - > timer = ecore_timer_loop_add ( t , _frame_anim , sd ) ;
2011-08-11 03:39:37 -07:00
return 1 ;
}
2017-01-01 05:19:51 -08:00
E_API void
2004-11-24 19:37:45 -08:00
e_icon_file_set ( Evas_Object * obj , const char * file )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-01-11 02:09:48 -08:00
int len ;
2010-06-18 18:19:01 -07:00
2017-01-01 05:19:51 -08:00
if ( ! file ) return ;
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2010-06-18 18:19:01 -07:00
2011-01-11 02:09:48 -08:00
len = strlen ( file ) ;
if ( ( len > 4 ) & & ( ! strcasecmp ( file + len - 4 , " .edj " ) ) )
2017-01-01 05:19:51 -08:00
{
e_icon_file_edje_set ( obj , file , " icon " ) ;
return ;
}
2011-08-29 01:30:23 -07:00
2004-11-24 19:37:45 -08:00
/* smart code here */
2009-05-15 04:47:28 -07:00
_e_icon_obj_prepare ( obj , sd ) ;
2008-02-05 04:00:19 -08:00
/* FIXME: 64x64 - unhappy about this. use icon size */
2009-10-21 23:47:02 -07:00
sd - > loading = 0 ;
2010-11-05 06:11:31 -07:00
if ( sd - > fdo )
{
2012-06-12 00:20:44 -07:00
eina_stringshare_del ( sd - > fdo ) ;
sd - > fdo = NULL ;
2010-11-05 06:11:31 -07:00
}
2011-05-10 21:56:42 -07:00
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
sd - > guessing_animation = NULL ;
2011-08-11 03:39:37 -07:00
sd - > frame = 0 ;
sd - > frame_count = 0 ;
2017-01-09 01:24:25 -08:00
sd - > invalid = 0 ;
2012-07-20 00:26:16 -07:00
sd - > edje = EINA_FALSE ;
2011-08-29 01:30:23 -07:00
2008-02-05 04:00:19 -08:00
if ( sd - > size ! = 0 )
evas_object_image_load_size_set ( sd - > obj , sd - > size , sd - > size ) ;
2010-06-18 18:19:01 -07:00
if ( sd - > preload ) evas_object_hide ( sd - > obj ) ;
2011-08-25 17:44:45 -07:00
2017-01-01 05:19:51 -08:00
if ( sd - > preload )
evas_object_image_load_head_skip_set ( sd - > obj , EINA_TRUE ) ;
2004-11-24 19:37:45 -08:00
evas_object_image_file_set ( sd - > obj , file , NULL ) ;
2017-01-01 05:19:51 -08:00
// if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
// return EINA_FALSE;
2011-09-06 14:23:35 -07:00
2011-08-11 03:39:37 -07:00
if ( ! _handle_anim ( sd ) )
2009-10-21 23:47:02 -07:00
{
2012-06-12 00:20:44 -07:00
if ( sd - > preload )
{
sd - > loading = 1 ;
evas_object_image_preload ( sd - > obj , EINA_FALSE ) ;
}
else if ( evas_object_visible_get ( obj ) )
{
evas_object_show ( sd - > obj ) ;
}
2009-10-21 23:47:02 -07:00
}
2004-11-24 19:37:45 -08:00
_e_icon_smart_reconfigure ( sd ) ;
}
2017-01-01 05:19:51 -08:00
E_API void
2005-10-20 08:07:45 -07:00
e_icon_file_key_set ( Evas_Object * obj , const char * file , const char * key )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2017-01-01 05:19:51 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2010-06-18 18:19:01 -07:00
2005-10-20 08:07:45 -07:00
/* smart code here */
2009-10-21 23:47:02 -07:00
sd - > loading = 0 ;
2010-11-05 06:11:31 -07:00
if ( sd - > fdo )
{
2012-06-12 00:20:44 -07:00
eina_stringshare_del ( sd - > fdo ) ;
sd - > fdo = NULL ;
2010-11-05 06:11:31 -07:00
}
2011-08-29 01:30:23 -07:00
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
sd - > guessing_animation = NULL ;
2011-08-11 03:39:37 -07:00
sd - > frame = 0 ;
sd - > frame_count = 0 ;
2017-01-09 01:24:25 -08:00
sd - > invalid = 0 ;
2012-07-20 00:26:16 -07:00
sd - > edje = EINA_FALSE ;
2011-08-29 01:30:23 -07:00
2009-05-15 04:47:28 -07:00
_e_icon_obj_prepare ( obj , sd ) ;
2008-02-05 04:00:19 -08:00
if ( sd - > size ! = 0 )
evas_object_image_load_size_set ( sd - > obj , sd - > size , sd - > size ) ;
2010-06-18 18:19:01 -07:00
if ( sd - > preload ) evas_object_hide ( sd - > obj ) ;
2017-01-09 01:24:25 -08:00
if ( sd - > preload )
evas_object_image_load_head_skip_set ( sd - > obj , EINA_TRUE ) ;
2005-10-20 08:07:45 -07:00
evas_object_image_file_set ( sd - > obj , file , key ) ;
2017-01-01 05:19:51 -08:00
// if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
// return EINA_FALSE;
2011-08-11 03:39:37 -07:00
if ( ! _handle_anim ( sd ) )
2009-10-21 23:47:02 -07:00
{
2012-06-12 00:20:44 -07:00
if ( sd - > preload )
{
sd - > loading = 1 ;
evas_object_image_preload ( sd - > obj , 0 ) ;
}
else if ( evas_object_visible_get ( obj ) )
evas_object_show ( sd - > obj ) ;
2009-10-21 23:47:02 -07:00
}
2005-10-20 08:07:45 -07:00
_e_icon_smart_reconfigure ( sd ) ;
}
2015-05-07 12:13:10 -07:00
E_API void
2012-07-20 00:52:53 -07:00
e_icon_edje_object_set ( Evas_Object * obj , Evas_Object * edje )
{
E_Smart_Data * sd ;
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
/* smart code here */
if ( sd - > obj ) evas_object_del ( sd - > obj ) ;
sd - > loading = 0 ;
if ( sd - > fdo )
{
eina_stringshare_del ( sd - > fdo ) ;
sd - > fdo = NULL ;
}
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
sd - > guessing_animation = NULL ;
2012-07-20 00:52:53 -07:00
sd - > frame = 0 ;
sd - > frame_count = 0 ;
2017-01-09 01:24:25 -08:00
sd - > invalid = 0 ;
2012-07-20 00:52:53 -07:00
sd - > edje = EINA_TRUE ;
sd - > obj = edje ;
if ( evas_object_visible_get ( obj ) ) evas_object_show ( sd - > obj ) ;
evas_object_smart_member_add ( sd - > obj , obj ) ;
_e_icon_smart_reconfigure ( sd ) ;
}
2015-05-07 12:13:10 -07:00
E_API Evas_Object *
2014-03-27 06:29:56 -07:00
e_icon_edje_get ( Evas_Object * obj )
{
E_Smart_Data * sd ;
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( NULL ) ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) )
return NULL ;
return sd - > edje ? sd - > obj : NULL ;
}
2017-01-01 05:19:51 -08:00
E_API void
2005-11-03 19:33:23 -08:00
e_icon_file_edje_set ( Evas_Object * obj , const char * file , const char * part )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2017-01-01 05:19:51 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2010-06-18 18:19:01 -07:00
2005-11-03 19:33:23 -08:00
/* smart code here */
2005-11-04 12:36:05 -08:00
if ( sd - > obj ) evas_object_del ( sd - > obj ) ;
2009-10-21 23:47:02 -07:00
sd - > loading = 0 ;
2010-11-05 06:11:31 -07:00
if ( sd - > fdo )
{
2012-06-12 00:20:44 -07:00
eina_stringshare_del ( sd - > fdo ) ;
sd - > fdo = NULL ;
2010-11-05 06:11:31 -07:00
}
2011-08-29 01:30:23 -07:00
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
sd - > guessing_animation = NULL ;
2011-08-11 03:39:37 -07:00
sd - > frame = 0 ;
sd - > frame_count = 0 ;
2017-01-09 01:24:25 -08:00
sd - > invalid = 0 ;
2012-07-20 00:26:16 -07:00
sd - > edje = EINA_TRUE ;
2011-08-29 01:30:23 -07:00
2005-11-03 19:33:23 -08:00
sd - > obj = edje_object_add ( evas_object_evas_get ( obj ) ) ;
edje_object_file_set ( sd - > obj , file , part ) ;
2017-01-01 05:19:51 -08:00
// if (edje_object_load_error_get(sd->obj) != EDJE_LOAD_ERROR_NONE)
// return EINA_FALSE;
2010-06-18 18:19:01 -07:00
if ( evas_object_visible_get ( obj ) ) evas_object_show ( sd - > obj ) ;
2006-01-12 18:11:11 -08:00
evas_object_smart_member_add ( sd - > obj , obj ) ;
2005-11-03 19:33:23 -08:00
_e_icon_smart_reconfigure ( sd ) ;
}
2017-01-01 05:19:51 -08:00
E_API void
2010-11-05 06:11:31 -07:00
e_icon_fdo_icon_set ( Evas_Object * obj , const char * icon )
{
E_Smart_Data * sd ;
2010-11-09 12:15:55 -08:00
const char * path ;
2011-01-06 20:31:47 -08:00
int len ;
2011-08-29 01:30:23 -07:00
2017-01-01 05:19:51 -08:00
if ( ! icon ) return ;
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
if ( icon [ 0 ] = = ' / ' )
{
e_icon_file_set ( obj , icon ) ;
return ;
}
2010-11-05 06:11:31 -07:00
2017-01-01 05:19:51 -08:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2010-11-05 06:11:31 -07:00
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
sd - > guessing_animation = NULL ;
2011-08-11 03:39:37 -07:00
sd - > frame = 0 ;
sd - > frame_count = 0 ;
2017-01-09 01:24:25 -08:00
sd - > invalid = 0 ;
2012-07-20 00:26:16 -07:00
sd - > edje = EINA_FALSE ;
2011-08-29 01:30:23 -07:00
2010-11-05 06:11:31 -07:00
eina_stringshare_replace ( & sd - > fdo , icon ) ;
2017-01-01 05:19:51 -08:00
if ( ! sd - > fdo ) return ;
2011-05-10 21:56:42 -07:00
2010-11-05 06:11:31 -07:00
path = efreet_icon_path_find ( e_config - > icon_theme , sd - > fdo , sd - > size ) ;
2015-04-30 09:32:31 -07:00
if ( ! path )
{
if ( e_util_strcmp ( e_config - > icon_theme , " hicolor " ) )
path = efreet_icon_path_find ( " hicolor " , sd - > fdo , sd - > size ) ;
2017-01-01 05:19:51 -08:00
if ( ! path ) return ;
2015-04-30 09:32:31 -07:00
}
2010-11-05 06:11:31 -07:00
2011-01-06 20:31:47 -08:00
len = strlen ( icon ) ;
if ( ( len > 4 ) & & ( ! strcasecmp ( icon + len - 4 , " .edj " ) ) )
2017-01-01 05:19:51 -08:00
{
e_icon_file_edje_set ( obj , path , " icon " ) ;
return ;
}
2011-08-29 01:30:23 -07:00
2010-11-05 06:11:31 -07:00
/* smart code here */
_e_icon_obj_prepare ( obj , sd ) ;
sd - > loading = 0 ;
if ( sd - > size ! = 0 )
evas_object_image_load_size_set ( sd - > obj , sd - > size , sd - > size ) ;
if ( sd - > preload ) evas_object_hide ( sd - > obj ) ;
2017-01-09 01:24:25 -08:00
if ( sd - > preload )
evas_object_image_load_head_skip_set ( sd - > obj , EINA_TRUE ) ;
2010-11-05 06:11:31 -07:00
evas_object_image_file_set ( sd - > obj , path , NULL ) ;
2017-01-01 05:19:51 -08:00
// if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
// return EINA_FALSE;
2010-11-05 06:11:31 -07:00
if ( sd - > preload )
{
2012-06-12 00:20:44 -07:00
sd - > loading = 1 ;
evas_object_image_preload ( sd - > obj , 0 ) ;
2010-11-05 06:11:31 -07:00
}
else if ( evas_object_visible_get ( obj ) )
evas_object_show ( sd - > obj ) ;
_e_icon_smart_reconfigure ( sd ) ;
2017-01-01 05:19:51 -08:00
return ;
2010-11-05 06:11:31 -07:00
}
2015-05-07 12:13:10 -07:00
E_API void
2013-06-13 05:27:32 -07:00
e_icon_image_object_set ( Evas_Object * obj , Evas_Object * o )
2005-11-22 01:27:25 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2012-06-13 02:13:15 -07:00
const char * str ;
2010-06-18 18:19:01 -07:00
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2012-06-13 02:13:15 -07:00
str = evas_object_type_get ( o ) ;
2012-07-20 00:52:53 -07:00
if ( ( ! str ) | | strcmp ( str , " image " ) )
2013-01-11 02:34:29 -08:00
CRI ( EINA_COLOR_RED " ****************** \n trying to set an image object of type '%s'! this is not what you want! \n ****************** \n " EINA_COLOR_RESET , str ) ;
2010-06-18 18:19:01 -07:00
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
sd - > timer = NULL ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
sd - > guessing_animation = NULL ;
2011-08-11 03:39:37 -07:00
sd - > frame = 0 ;
sd - > frame_count = 0 ;
2017-01-09 01:24:25 -08:00
sd - > invalid = 0 ;
2012-07-20 00:26:16 -07:00
sd - > edje = EINA_FALSE ;
2011-08-29 01:30:23 -07:00
2005-11-22 01:27:25 -08:00
/* smart code here */
if ( sd - > obj ) evas_object_del ( sd - > obj ) ;
2009-10-21 23:47:02 -07:00
sd - > loading = 0 ;
2005-11-22 01:27:25 -08:00
sd - > obj = o ;
2006-01-12 18:11:11 -08:00
evas_object_smart_member_add ( sd - > obj , obj ) ;
2010-06-18 18:19:01 -07:00
if ( evas_object_visible_get ( obj ) ) evas_object_show ( sd - > obj ) ;
2013-06-13 05:26:57 -07:00
_handle_anim ( sd ) ;
2010-03-08 18:45:14 -08:00
_e_icon_smart_reconfigure ( sd ) ;
2005-11-22 01:27:25 -08:00
}
2015-05-07 12:13:10 -07:00
E_API Eina_Bool
2012-12-19 09:00:10 -08:00
e_icon_file_get ( const Evas_Object * obj , const char * * file , const char * * group )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2012-12-19 09:00:10 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( EINA_FALSE ) ;
if ( ( ! file ) & & ( ! group ) ) return EINA_FALSE ;
if ( file ) * file = NULL ;
if ( group ) * group = NULL ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return EINA_FALSE ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje )
2005-11-03 19:33:23 -08:00
{
2012-12-19 09:00:10 -08:00
edje_object_file_get ( sd - > obj , file , group ) ;
return file | | group ;
2005-11-03 19:33:23 -08:00
}
2012-12-19 09:00:10 -08:00
evas_object_image_file_get ( sd - > obj , file , group ) ;
return file | | group ;
2004-11-24 19:37:45 -08:00
}
2015-05-07 12:13:10 -07:00
E_API void
2010-03-08 18:45:14 -08:00
e_icon_smooth_scale_set ( Evas_Object * obj , Eina_Bool smooth )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje ) return ;
2004-11-24 19:37:45 -08:00
evas_object_image_smooth_scale_set ( sd - > obj , smooth ) ;
}
2015-05-07 12:13:10 -07:00
E_API Eina_Bool
2010-03-08 18:45:14 -08:00
e_icon_smooth_scale_get ( const Evas_Object * obj )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( 0 ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return EINA_FALSE ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje )
2010-03-08 18:45:14 -08:00
return EINA_FALSE ;
2004-11-24 19:37:45 -08:00
return evas_object_image_smooth_scale_get ( sd - > obj ) ;
}
2015-05-07 12:13:10 -07:00
E_API void
2010-03-08 18:45:14 -08:00
e_icon_alpha_set ( Evas_Object * obj , Eina_Bool alpha )
2005-06-02 23:43:23 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje ) return ;
2005-06-02 23:43:23 -07:00
evas_object_image_alpha_set ( sd - > obj , alpha ) ;
}
2015-05-07 12:13:10 -07:00
E_API Eina_Bool
2010-03-08 18:45:14 -08:00
e_icon_alpha_get ( const Evas_Object * obj )
2005-06-02 23:43:23 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( 0 ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return EINA_FALSE ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje ) return EINA_FALSE ;
2005-06-02 23:43:23 -07:00
return evas_object_image_alpha_get ( sd - > obj ) ;
}
2015-05-07 12:13:10 -07:00
E_API void
2010-03-08 18:45:14 -08:00
e_icon_preload_set ( Evas_Object * obj , Eina_Bool preload )
2009-04-04 20:49:16 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2009-04-04 20:49:16 -07:00
sd - > preload = preload ;
}
2015-05-07 12:13:10 -07:00
E_API Eina_Bool
2010-03-08 18:45:14 -08:00
e_icon_preload_get ( const Evas_Object * obj )
2009-04-04 20:49:16 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( 0 ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return EINA_FALSE ;
2009-04-04 20:49:16 -07:00
return sd - > preload ;
}
2015-05-07 12:13:10 -07:00
E_API void
2010-03-08 18:45:14 -08:00
e_icon_size_get ( const Evas_Object * obj , int * w , int * h )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2011-08-29 01:30:23 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) )
2010-03-08 18:45:14 -08:00
{
2012-06-12 00:20:44 -07:00
if ( w ) * w = 0 ;
if ( h ) * h = 0 ;
return ;
2010-03-08 18:45:14 -08:00
}
2012-07-20 00:26:16 -07:00
if ( sd - > edje )
edje_object_size_min_calc ( sd - > obj , w , h ) ;
else
2012-06-12 00:23:00 -07:00
evas_object_image_size_get ( sd - > obj , w , h ) ;
2004-11-24 19:37:45 -08:00
}
2015-05-07 12:13:10 -07:00
E_API Eina_Bool
2010-03-08 18:45:14 -08:00
e_icon_fill_inside_get ( const Evas_Object * obj )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( 0 ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return EINA_FALSE ;
2010-03-08 18:45:14 -08:00
return sd - > fill_inside ;
2004-11-24 19:37:45 -08:00
}
2015-05-07 12:13:10 -07:00
E_API void
2010-03-08 18:45:14 -08:00
e_icon_fill_inside_set ( Evas_Object * obj , Eina_Bool fill_inside )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2010-03-08 18:45:14 -08:00
fill_inside = ! ! fill_inside ;
if ( sd - > fill_inside = = fill_inside ) return ;
2004-11-24 19:37:45 -08:00
sd - > fill_inside = fill_inside ;
_e_icon_smart_reconfigure ( sd ) ;
}
2015-05-07 12:13:10 -07:00
E_API Eina_Bool
2010-03-08 18:45:14 -08:00
e_icon_scale_up_get ( const Evas_Object * obj )
2008-07-19 07:09:46 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( 0 ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return EINA_FALSE ;
2010-03-08 18:45:14 -08:00
return sd - > scale_up ;
2008-07-19 07:09:46 -07:00
}
2015-05-07 12:13:10 -07:00
E_API void
2010-03-08 18:45:14 -08:00
e_icon_scale_up_set ( Evas_Object * obj , Eina_Bool scale_up )
2008-07-19 07:09:46 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2010-03-08 18:45:14 -08:00
scale_up = ! ! scale_up ;
if ( sd - > scale_up = = scale_up ) return ;
2008-07-19 07:09:46 -07:00
sd - > scale_up = scale_up ;
_e_icon_smart_reconfigure ( sd ) ;
}
2015-05-07 12:13:10 -07:00
E_API void
2005-06-02 23:43:23 -07:00
e_icon_data_set ( Evas_Object * obj , void * data , int w , int h )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje ) return ;
2005-06-02 23:43:23 -07:00
evas_object_image_size_set ( sd - > obj , w , h ) ;
evas_object_image_data_copy_set ( sd - > obj , data ) ;
}
2015-05-07 12:13:10 -07:00
E_API void *
2010-03-08 18:45:14 -08:00
e_icon_data_get ( const Evas_Object * obj , int * w , int * h )
2005-09-26 02:13:44 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( NULL ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return NULL ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje ) return NULL ;
2005-09-26 02:13:44 -07:00
evas_object_image_size_get ( sd - > obj , w , h ) ;
return evas_object_image_data_get ( sd - > obj , 0 ) ;
}
2015-05-07 12:13:10 -07:00
E_API void
2008-02-05 04:00:19 -08:00
e_icon_scale_size_set ( Evas_Object * obj , int size )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2008-02-05 04:00:19 -08:00
sd - > size = size ;
2012-07-20 00:26:16 -07:00
if ( sd - > edje ) return ;
2008-02-05 04:00:19 -08:00
evas_object_image_load_size_set ( sd - > obj , sd - > size , sd - > size ) ;
}
2015-05-07 12:13:10 -07:00
E_API int
2010-03-08 18:45:14 -08:00
e_icon_scale_size_get ( const Evas_Object * obj )
2008-02-05 04:00:19 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( 0 ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return 0 ;
2008-02-05 04:00:19 -08:00
return sd - > size ;
}
2015-05-07 12:13:10 -07:00
E_API void
2010-06-18 15:39:00 -07:00
e_icon_selected_set ( const Evas_Object * obj , Eina_Bool selected )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2010-06-18 15:39:00 -07:00
2011-12-31 06:35:05 -08:00
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERRNR ( ) ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2012-07-20 00:26:16 -07:00
if ( ! sd - > edje ) return ;
2010-06-18 15:39:00 -07:00
if ( selected )
edje_object_signal_emit ( sd - > obj , " e,state,selected " , " e " ) ;
else
edje_object_signal_emit ( sd - > obj , " e,state,unselected " , " e " ) ;
}
2017-01-01 05:19:51 -08:00
E_API void
e_icon_edje_emit ( const Evas_Object * obj , const char * sig , const char * src )
{
E_Smart_Data * sd ;
if ( evas_object_smart_smart_get ( obj ) ! = _e_smart ) SMARTERR ( ) ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
edje_object_signal_emit ( sd - > obj , sig , src ) ;
}
2004-11-24 19:37:45 -08:00
/* local subsystem globals */
static void
_e_icon_smart_reconfigure ( E_Smart_Data * sd )
{
int iw , ih ;
Evas_Coord x , y , w , h ;
2010-03-08 18:45:14 -08:00
2007-07-15 17:50:50 -07:00
if ( ! sd - > obj ) return ;
2017-01-01 05:19:51 -08:00
w = sd - > w ;
h = sd - > h ;
x = sd - > x ;
y = sd - > y ;
if ( ! sd - > loading )
2004-11-24 19:37:45 -08:00
{
2017-01-01 05:19:51 -08:00
if ( sd - > edje )
2012-06-12 00:20:44 -07:00
{
2017-01-01 05:19:51 -08:00
evas_object_move ( sd - > obj , x , y ) ;
evas_object_resize ( sd - > obj , w , h ) ;
2012-06-12 00:20:44 -07:00
}
else
{
2017-01-01 05:19:51 -08:00
iw = 0 ;
ih = 0 ;
evas_object_image_size_get ( sd - > obj , & iw , & ih ) ;
if ( iw < 1 ) iw = 1 ;
if ( ih < 1 ) ih = 1 ;
if ( sd - > fill_inside )
2012-06-12 00:20:44 -07:00
{
2017-01-01 05:19:51 -08:00
w = sd - > w ;
h = ( ( double ) ih * w ) / ( double ) iw ;
if ( h > sd - > h )
{
h = sd - > h ;
w = ( ( double ) iw * h ) / ( double ) ih ;
}
2012-06-12 00:20:44 -07:00
}
2017-01-01 05:19:51 -08:00
else
{
w = sd - > w ;
h = ( ( double ) ih * w ) / ( double ) iw ;
if ( h < sd - > h )
{
h = sd - > h ;
w = ( ( double ) iw * h ) / ( double ) ih ;
}
}
if ( ! sd - > scale_up )
2012-06-12 00:20:44 -07:00
{
2017-01-01 05:19:51 -08:00
if ( ( w > iw ) | | ( h > ih ) )
{
w = iw ;
h = ih ;
}
2012-06-12 00:20:44 -07:00
}
2017-01-01 05:19:51 -08:00
x = sd - > x + ( ( sd - > w - w ) / 2 ) ;
y = sd - > y + ( ( sd - > h - h ) / 2 ) ;
evas_object_move ( sd - > obj , x , y ) ;
evas_object_image_fill_set ( sd - > obj , 0 , 0 , w , h ) ;
evas_object_resize ( sd - > obj , w , h ) ;
2012-06-12 00:20:44 -07:00
}
2004-11-24 19:37:45 -08:00
}
2017-01-01 05:19:51 -08:00
evas_object_move ( sd - > eventarea , x , y ) ;
evas_object_resize ( sd - > eventarea , w , h ) ;
2004-11-24 19:37:45 -08:00
}
static void
_e_icon_smart_init ( void )
{
if ( _e_smart ) return ;
2012-06-12 00:20:44 -07:00
{
static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION ( " e_icon " ) ;
if ( ! sc . add )
{
sc . add = _e_icon_smart_add ;
sc . del = _e_icon_smart_del ;
sc . move = _e_icon_smart_move ;
sc . resize = _e_icon_smart_resize ;
sc . show = _e_icon_smart_show ;
sc . hide = _e_icon_smart_hide ;
sc . color_set = _e_icon_smart_color_set ;
sc . clip_set = _e_icon_smart_clip_set ;
sc . clip_unset = _e_icon_smart_clip_unset ;
}
_e_smart = evas_smart_class_new ( & sc ) ;
}
2004-11-24 19:37:45 -08:00
}
2009-04-04 20:49:16 -07:00
static void
2015-03-18 15:09:09 -07:00
_e_icon_preloaded ( void * data , Evas * e EINA_UNUSED , Evas_Object * obj EINA_UNUSED , void * event_info EINA_UNUSED )
2009-04-04 20:49:16 -07:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2017-01-09 01:24:25 -08:00
int iw , ih ;
2010-06-18 18:19:01 -07:00
if ( ! ( sd = evas_object_smart_data_get ( data ) ) ) return ;
2011-09-06 14:23:35 -07:00
2009-04-04 20:49:16 -07:00
evas_object_smart_callback_call ( data , " preloaded " , NULL ) ;
2017-01-09 01:24:25 -08:00
evas_object_image_size_get ( sd - > obj , & iw , & ih ) ;
if ( ( iw > 0 ) & & ( ih > 0 ) )
{
sd - > invalid = 0 ;
evas_object_show ( sd - > obj ) ;
}
else
sd - > invalid = 1 ;
2009-10-21 23:47:02 -07:00
sd - > loading = 0 ;
2017-01-01 05:19:51 -08:00
_e_icon_smart_reconfigure ( sd ) ;
2009-04-04 20:49:16 -07:00
}
2004-11-24 19:37:45 -08:00
static void
_e_icon_smart_add ( Evas_Object * obj )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
2010-05-01 11:24:30 -07:00
2010-06-18 18:19:01 -07:00
if ( ! ( sd = calloc ( 1 , sizeof ( E_Smart_Data ) ) ) ) return ;
2010-05-01 11:24:30 -07:00
2004-11-24 19:37:45 -08:00
sd - > obj = evas_object_image_add ( evas_object_evas_get ( obj ) ) ;
2009-04-04 20:49:16 -07:00
evas_object_event_callback_add ( sd - > obj , EVAS_CALLBACK_IMAGE_PRELOADED ,
2012-06-12 00:20:44 -07:00
_e_icon_preloaded , obj ) ;
2017-01-01 05:19:51 -08:00
sd - > eventarea = evas_object_rectangle_add ( evas_object_evas_get ( obj ) ) ;
evas_object_color_set ( sd - > eventarea , 0 , 0 , 0 , 0 ) ;
evas_object_smart_member_add ( sd - > eventarea , obj ) ;
2004-11-24 19:37:45 -08:00
sd - > x = 0 ;
sd - > y = 0 ;
sd - > w = 0 ;
sd - > h = 0 ;
sd - > fill_inside = 1 ;
2008-07-19 07:09:46 -07:00
sd - > scale_up = 1 ;
2008-02-05 04:00:19 -08:00
sd - > size = 64 ;
2017-01-01 05:19:51 -08:00
sd - > preload = 0 ;
2004-11-24 19:37:45 -08:00
evas_object_smart_member_add ( sd - > obj , obj ) ;
evas_object_smart_data_set ( obj , sd ) ;
}
2010-03-08 18:45:14 -08:00
2004-11-24 19:37:45 -08:00
static void
_e_icon_smart_del ( Evas_Object * obj )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2004-11-24 19:37:45 -08:00
evas_object_del ( sd - > obj ) ;
2010-05-01 11:24:30 -07:00
evas_object_del ( sd - > eventarea ) ;
2010-11-05 06:11:31 -07:00
if ( sd - > fdo ) eina_stringshare_del ( sd - > fdo ) ;
2012-11-25 04:30:09 -08:00
if ( sd - > fdo_reload_timer ) ecore_timer_del ( sd - > fdo_reload_timer ) ;
2011-08-11 03:39:37 -07:00
if ( sd - > timer ) ecore_timer_del ( sd - > timer ) ;
2012-10-25 00:28:24 -07:00
if ( sd - > guessing_animation ) ecore_timer_del ( sd - > guessing_animation ) ;
2011-12-31 06:35:05 -08:00
evas_object_smart_data_set ( obj , NULL ) ;
memset ( sd , 0 , sizeof ( * sd ) ) ;
2004-11-24 19:37:45 -08:00
free ( sd ) ;
}
static void
_e_icon_smart_move ( Evas_Object * obj , Evas_Coord x , Evas_Coord y )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2006-07-17 12:51:37 -07:00
if ( ( sd - > x = = x ) & & ( sd - > y = = y ) ) return ;
2004-11-24 19:37:45 -08:00
sd - > x = x ;
sd - > y = y ;
_e_icon_smart_reconfigure ( sd ) ;
}
2012-10-25 00:28:24 -07:00
static Eina_Bool
_e_icon_guess_anim ( void * data )
{
E_Smart_Data * sd = data ;
double t = ecore_loop_time_get ( ) ;
if ( t - sd - > last_resize < 0.2 )
{
evas_object_image_scale_hint_set ( sd - > obj ,
EVAS_IMAGE_SCALE_HINT_DYNAMIC ) ;
sd - > animated = EINA_TRUE ;
}
else
{
evas_object_image_scale_hint_set ( sd - > obj ,
EVAS_IMAGE_SCALE_HINT_STATIC ) ;
}
sd - > guessing_animation = NULL ;
return EINA_FALSE ;
}
2012-11-25 04:30:09 -08:00
static Eina_Bool
_e_icon_fdo_reload ( void * data )
{
E_Smart_Data * sd = data ;
const char * path ;
sd - > fdo_reload_timer = NULL ;
sd - > size = MAX ( sd - > w , sd - > h ) ;
path = efreet_icon_path_find ( e_config - > icon_theme , sd - > fdo , sd - > size ) ;
2015-04-30 09:32:31 -07:00
if ( ! path )
{
if ( e_util_strcmp ( e_config - > icon_theme , " hicolor " ) )
path = efreet_icon_path_find ( " hicolor " , sd - > fdo , sd - > size ) ;
if ( ! path ) return EINA_FALSE ;
}
2013-01-11 02:34:29 -08:00
2012-11-25 04:30:09 -08:00
/* smart code here */
evas_object_image_load_size_set ( sd - > obj , sd - > size , sd - > size ) ;
evas_object_image_file_set ( sd - > obj , path , NULL ) ;
if ( sd - > preload )
{
sd - > loading = 1 ;
evas_object_image_preload ( sd - > obj , 0 ) ;
}
return EINA_FALSE ;
}
2004-11-24 19:37:45 -08:00
static void
_e_icon_smart_resize ( Evas_Object * obj , Evas_Coord w , Evas_Coord h )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2006-07-17 12:51:37 -07:00
if ( ( sd - > w = = w ) & & ( sd - > h = = h ) ) return ;
2004-11-24 19:37:45 -08:00
sd - > w = w ;
sd - > h = h ;
2010-11-05 06:11:31 -07:00
if ( sd - > fdo )
{
2012-11-25 04:30:09 -08:00
if ( sd - > fdo_reload_timer ) ecore_timer_del ( sd - > fdo_reload_timer ) ;
2017-02-03 13:52:28 -08:00
sd - > fdo_reload_timer = ecore_timer_loop_add ( 0.1 , _e_icon_fdo_reload , sd ) ;
2010-11-05 06:11:31 -07:00
}
2012-10-25 00:53:38 -07:00
if ( ( ! sd - > edje ) & & ( ( sd - > loading & & sd - > preload ) | |
2013-01-11 02:34:29 -08:00
( ! sd - > loading & & ! sd - > preload ) )
2012-10-25 00:28:24 -07:00
& & ! sd - > animated )
{
evas_object_image_scale_hint_set ( sd - > obj ,
EVAS_IMAGE_SCALE_HINT_DYNAMIC ) ;
if ( ! sd - > guessing_animation )
2017-02-03 13:52:28 -08:00
sd - > guessing_animation = ecore_timer_loop_add ( 0.3 ,
2012-10-25 00:28:24 -07:00
_e_icon_guess_anim ,
sd ) ;
}
sd - > last_resize = ecore_loop_time_get ( ) ;
2004-11-24 19:37:45 -08:00
_e_icon_smart_reconfigure ( sd ) ;
}
static void
_e_icon_smart_show ( Evas_Object * obj )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2009-10-21 23:47:02 -07:00
if ( ! ( ( sd - > preload ) & & ( sd - > loading ) ) )
2011-08-29 01:30:23 -07:00
{
2017-01-09 01:24:25 -08:00
if ( ! sd - > invalid ) evas_object_show ( sd - > obj ) ;
2011-08-25 17:44:45 -07:00
}
2011-08-29 01:30:23 -07:00
2010-05-01 11:24:30 -07:00
evas_object_show ( sd - > eventarea ) ;
2004-11-24 19:37:45 -08:00
}
static void
_e_icon_smart_hide ( Evas_Object * obj )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2004-11-24 19:37:45 -08:00
evas_object_hide ( sd - > obj ) ;
2010-05-01 11:24:30 -07:00
evas_object_hide ( sd - > eventarea ) ;
2004-11-24 19:37:45 -08:00
}
static void
_e_icon_smart_color_set ( Evas_Object * obj , int r , int g , int b , int a )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2004-11-24 19:37:45 -08:00
evas_object_color_set ( sd - > obj , r , g , b , a ) ;
}
static void
2012-06-12 00:20:44 -07:00
_e_icon_smart_clip_set ( Evas_Object * obj , Evas_Object * clip )
2004-11-24 19:37:45 -08:00
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2004-11-24 19:37:45 -08:00
evas_object_clip_set ( sd - > obj , clip ) ;
2010-05-01 11:24:30 -07:00
evas_object_clip_set ( sd - > eventarea , clip ) ;
2004-11-24 19:37:45 -08:00
}
static void
_e_icon_smart_clip_unset ( Evas_Object * obj )
{
2010-06-18 18:19:01 -07:00
E_Smart_Data * sd ;
if ( ! ( sd = evas_object_smart_data_get ( obj ) ) ) return ;
2004-11-24 19:37:45 -08:00
evas_object_clip_unset ( sd - > obj ) ;
2010-05-01 11:24:30 -07:00
evas_object_clip_unset ( sd - > eventarea ) ;
2010-03-08 18:45:14 -08:00
}