2013-04-25 22:13:00 -07:00
# ifdef HAVE_CONFIG_H
# include "elementary_config.h"
# endif
2009-04-22 20:48:41 -07:00
# include <Elementary.h>
2013-04-25 22:13:00 -07:00
2009-04-22 20:48:41 -07:00
# include "elm_priv.h"
2012-05-25 12:53:59 -07:00
# include "elm_widget_image.h"
2009-04-22 20:48:41 -07:00
2013-02-16 19:53:02 -08:00
# define FMT_SIZE_T "%zu"
2009-04-22 20:48:41 -07:00
2012-11-25 22:32:53 -08:00
EAPI Eo_Op ELM_OBJ_IMAGE_BASE_ID = EO_NOOP ;
# define MY_CLASS ELM_OBJ_IMAGE_CLASS
2013-11-07 03:44:22 -08:00
# define MY_CLASS_NAME "Elm_Image"
# define MY_CLASS_NAME_LEGACY "elm_image"
2012-05-25 12:53:59 -07:00
static const char SIG_DND [ ] = " drop " ;
static const char SIG_CLICKED [ ] = " clicked " ;
2013-08-09 05:12:29 -07:00
static const char SIG_DOWNLOAD_START [ ] = " download,start " ;
static const char SIG_DOWNLOAD_PROGRESS [ ] = " download,progress " ;
static const char SIG_DOWNLOAD_DONE [ ] = " download,done " ;
static const char SIG_DOWNLOAD_ERROR [ ] = " download,error " ;
2012-05-25 12:53:59 -07:00
static const Evas_Smart_Cb_Description _smart_callbacks [ ] = {
{ SIG_DND , " " } ,
2011-04-15 10:05:34 -07:00
{ SIG_CLICKED , " " } ,
2013-08-09 05:12:29 -07:00
{ SIG_DOWNLOAD_START , " " } ,
{ SIG_DOWNLOAD_PROGRESS , " " } ,
{ SIG_DOWNLOAD_DONE , " " } ,
{ SIG_DOWNLOAD_ERROR , " " } ,
2011-04-15 10:05:34 -07:00
{ NULL , NULL }
} ;
2013-10-29 16:32:43 -07:00
static void
_activate ( Evas_Object * obj )
{
evas_object_smart_callback_call ( obj , SIG_CLICKED , NULL ) ;
}
2009-04-22 20:48:41 -07:00
static void
2012-05-25 12:53:59 -07:00
_on_image_preloaded ( void * data ,
2014-01-06 06:30:02 -08:00
Evas * e EINA_UNUSED ,
2012-05-25 12:53:59 -07:00
Evas_Object * obj ,
2014-01-06 06:30:02 -08:00
void * event EINA_UNUSED )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
Elm_Image_Smart_Data * sd = data ;
sd - > preloading = EINA_FALSE ;
if ( sd - > show ) evas_object_show ( obj ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( sd - > prev_img , evas_object_del ) ;
2009-04-22 20:48:41 -07:00
}
2009-11-13 14:22:05 -08:00
static void
2012-05-25 12:53:59 -07:00
_on_mouse_up ( void * data ,
2014-01-06 06:30:02 -08:00
Evas * e EINA_UNUSED ,
Evas_Object * obj EINA_UNUSED ,
2012-11-14 02:49:54 -08:00
void * event_info )
2012-05-25 12:53:59 -07:00
{
2012-11-14 02:49:54 -08:00
Evas_Event_Mouse_Up * ev = event_info ;
if ( ev - > button ! = 1 ) return ;
if ( ev - > event_flags & EVAS_EVENT_FLAG_ON_HOLD ) return ;
2012-05-25 12:53:59 -07:00
evas_object_smart_callback_call ( data , SIG_CLICKED , NULL ) ;
}
2012-05-28 13:35:29 -07:00
static Eina_Bool
_elm_image_animate_cb ( void * data )
{
2013-04-24 04:41:37 -07:00
ELM_IMAGE_DATA_GET ( data , sd ) ;
2012-05-28 13:35:29 -07:00
if ( ! sd - > anim ) return ECORE_CALLBACK_CANCEL ;
sd - > cur_frame + + ;
if ( sd - > cur_frame > sd - > frame_count )
sd - > cur_frame = sd - > cur_frame % sd - > frame_count ;
evas_object_image_animated_frame_set ( sd - > img , sd - > cur_frame ) ;
sd - > frame_duration = evas_object_image_animated_frame_duration_get
( sd - > img , sd - > cur_frame , 0 ) ;
if ( sd - > frame_duration > 0 )
ecore_timer_interval_set ( sd - > anim_timer , sd - > frame_duration ) ;
return ECORE_CALLBACK_RENEW ;
}
2012-05-25 12:53:59 -07:00
static Evas_Object *
_img_new ( Evas_Object * obj )
2009-11-13 14:22:05 -08:00
{
2012-05-25 12:53:59 -07:00
Evas_Object * img ;
ELM_IMAGE_DATA_GET ( obj , sd ) ;
img = evas_object_image_add ( evas_object_evas_get ( obj ) ) ;
evas_object_image_scale_hint_set ( img , EVAS_IMAGE_SCALE_HINT_STATIC ) ;
evas_object_repeat_events_set ( img , EINA_TRUE ) ;
evas_object_event_callback_add
( img , EVAS_CALLBACK_IMAGE_PRELOADED , _on_image_preloaded , sd ) ;
evas_object_smart_member_add ( img , obj ) ;
elm_widget_sub_object_add ( obj , img ) ;
2009-11-13 14:22:05 -08:00
2012-05-25 12:53:59 -07:00
return img ;
2009-11-13 14:22:05 -08:00
}
2009-04-22 20:48:41 -07:00
static void
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( Evas_Object * obj , Elm_Image_Smart_Data * sd )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
Evas_Coord x , y , w , h ;
const char * type ;
if ( ! sd - > img ) return ;
w = sd - > img_w ;
h = sd - > img_h ;
type = evas_object_type_get ( sd - > img ) ;
if ( ! type ) return ;
if ( ! strcmp ( type , " edje " ) )
{
x = sd - > img_x ;
y = sd - > img_y ;
evas_object_move ( sd - > img , x , y ) ;
evas_object_resize ( sd - > img , w , h ) ;
}
else
{
double alignh = 0.5 , alignv = 0.5 ;
int iw = 0 , ih = 0 ;
2009-09-26 11:43:26 -07:00
2012-05-25 12:53:59 -07:00
evas_object_image_size_get ( sd - > img , & iw , & ih ) ;
iw = ( ( double ) iw ) * sd - > scale ;
ih = ( ( double ) ih ) * sd - > scale ;
if ( iw < 1 ) iw = 1 ;
if ( ih < 1 ) ih = 1 ;
if ( sd - > aspect_fixed )
{
h = ( ( double ) ih * w ) / ( double ) iw ;
if ( sd - > fill_inside )
{
if ( h > sd - > img_h )
{
h = sd - > img_h ;
w = ( ( double ) iw * h ) / ( double ) ih ;
}
}
else
{
if ( h < sd - > img_h )
{
h = sd - > img_h ;
w = ( ( double ) iw * h ) / ( double ) ih ;
}
}
}
2012-07-17 19:25:34 -07:00
if ( ! sd - > resize_up )
2012-05-25 12:53:59 -07:00
{
if ( w > iw ) w = iw ;
if ( h > ih ) h = ih ;
}
2012-07-17 19:25:34 -07:00
if ( ! sd - > resize_down )
2012-05-25 12:53:59 -07:00
{
if ( w < iw ) w = iw ;
if ( h < ih ) h = ih ;
}
evas_object_size_hint_align_get
2012-11-25 22:32:53 -08:00
( obj , & alignh , & alignv ) ;
2012-05-25 12:53:59 -07:00
if ( alignh = = EVAS_HINT_FILL ) alignh = 0.5 ;
if ( alignv = = EVAS_HINT_FILL ) alignv = 0.5 ;
x = sd - > img_x + ( ( sd - > img_w - w ) * alignh ) ;
y = sd - > img_y + ( ( sd - > img_h - h ) * alignv ) ;
evas_object_move ( sd - > img , x , y ) ;
evas_object_image_fill_set ( sd - > img , 0 , 0 , w , h ) ;
evas_object_resize ( sd - > img , w , h ) ;
}
2012-11-27 01:29:16 -08:00
evas_object_move ( sd - > hit_rect , x , y ) ;
evas_object_resize ( sd - > hit_rect , w , h ) ;
2009-04-22 20:48:41 -07:00
}
2012-05-25 12:53:59 -07:00
/* WARNING: whenever you patch this function, remember to do the same
* on elm_icon . c : _elm_icon_smart_file_set ( ) ' s 2 nd half .
*/
static Eina_Bool
_elm_image_edje_file_set ( Evas_Object * obj ,
const char * file ,
2013-11-03 19:17:42 -08:00
const Eina_File * f ,
2012-05-25 12:53:59 -07:00
const char * group )
{
Evas_Object * pclip ;
ELM_IMAGE_DATA_GET ( obj , sd ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( sd - > prev_img , evas_object_del ) ;
2012-05-25 12:53:59 -07:00
if ( ! sd - > edje )
{
pclip = evas_object_clip_get ( sd - > img ) ;
if ( sd - > img ) evas_object_del ( sd - > img ) ;
2009-07-06 23:46:51 -07:00
2012-05-25 12:53:59 -07:00
/* Edje object instead */
sd - > img = edje_object_add ( evas_object_evas_get ( obj ) ) ;
evas_object_smart_member_add ( sd - > img , obj ) ;
if ( sd - > show ) evas_object_show ( sd - > img ) ;
evas_object_clip_set ( sd - > img , pclip ) ;
}
sd - > edje = EINA_TRUE ;
2013-08-09 05:12:29 -07:00
if ( f )
{
if ( ! edje_object_mmap_set ( sd - > img , f , group ) )
{
ERR ( " failed to set edje file '%s', group '%s': %s " , file , group ,
edje_load_error_str ( edje_object_load_error_get ( sd - > img ) ) ) ;
return EINA_FALSE ;
}
}
else if ( ! edje_object_file_set ( sd - > img , file , group ) )
2012-05-25 12:53:59 -07:00
{
ERR ( " failed to set edje file '%s', group '%s': %s " , file , group ,
edje_load_error_str ( edje_object_load_error_get ( sd - > img ) ) ) ;
return EINA_FALSE ;
}
/* FIXME: do i want to update icon on file change ? */
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
return EINA_TRUE ;
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_smooth_scale_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool smooth = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
if ( sd - > edje ) return ;
evas_object_image_smooth_scale_set ( sd - > img , smooth ) ;
}
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_smooth_scale_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2013-12-30 18:36:43 -08:00
if ( ! ret ) return ;
2012-11-25 22:32:53 -08:00
if ( sd - > edje )
{
* ret = EINA_FALSE ;
return ;
}
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
* ret = evas_object_image_smooth_scale_get ( sd - > img ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_fill_inside_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool fill_inside = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
fill_inside = ! ! fill_inside ;
if ( sd - > fill_inside = = fill_inside ) return ;
sd - > fill_inside = fill_inside ;
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_fill_inside_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > fill_inside ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_resize_up_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool resize_up = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2012-07-17 19:25:34 -07:00
resize_up = ! ! resize_up ;
2012-05-25 12:53:59 -07:00
2012-07-17 19:25:34 -07:00
if ( sd - > resize_up = = resize_up ) return ;
2012-05-25 12:53:59 -07:00
2012-07-17 19:25:34 -07:00
sd - > resize_up = resize_up ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_resize_up_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > resize_up ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_resize_down_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool resize_down = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2012-07-17 19:25:34 -07:00
resize_down = ! ! resize_down ;
2012-05-25 12:53:59 -07:00
2012-07-17 19:25:34 -07:00
if ( sd - > resize_down = = resize_down ) return ;
2012-05-25 12:53:59 -07:00
2012-07-17 19:25:34 -07:00
sd - > resize_down = resize_down ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_resize_down_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > resize_up ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_flip_horizontal ( Evas_Object * obj , Elm_Image_Smart_Data * sd )
2012-05-25 12:53:59 -07:00
{
unsigned int * p1 , * p2 , tmp ;
unsigned int * data ;
int x , y , iw , ih ;
evas_object_image_size_get ( sd - > img , & iw , & ih ) ;
data = evas_object_image_data_get ( sd - > img , EINA_TRUE ) ;
for ( y = 0 ; y < ih ; y + + )
{
p1 = data + ( y * iw ) ;
p2 = data + ( ( y + 1 ) * iw ) - 1 ;
for ( x = 0 ; x < ( iw > > 1 ) ; x + + )
{
tmp = * p1 ;
* p1 = * p2 ;
* p2 = tmp ;
p1 + + ;
p2 - - ;
}
}
evas_object_image_data_set ( sd - > img , data ) ;
evas_object_image_data_update_add ( sd - > img , 0 , 0 , iw , ih ) ;
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_flip_vertical ( Evas_Object * obj , Elm_Image_Smart_Data * sd )
2012-05-25 12:53:59 -07:00
{
unsigned int * p1 , * p2 , tmp ;
unsigned int * data ;
int x , y , iw , ih ;
evas_object_image_size_get ( sd - > img , & iw , & ih ) ;
data = evas_object_image_data_get ( sd - > img , EINA_TRUE ) ;
for ( y = 0 ; y < ( ih > > 1 ) ; y + + )
{
p1 = data + ( y * iw ) ;
p2 = data + ( ( ih - 1 - y ) * iw ) ;
for ( x = 0 ; x < iw ; x + + )
{
tmp = * p1 ;
* p1 = * p2 ;
* p2 = tmp ;
p1 + + ;
p2 + + ;
}
}
evas_object_image_data_set ( sd - > img , data ) ;
evas_object_image_data_update_add ( sd - > img , 0 , 0 , iw , ih ) ;
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_rotate_180 ( Evas_Object * obj , Elm_Image_Smart_Data * sd )
2012-05-25 12:53:59 -07:00
{
unsigned int * p1 , * p2 , tmp ;
unsigned int * data ;
int x , hw , iw , ih ;
evas_object_image_size_get ( sd - > img , & iw , & ih ) ;
data = evas_object_image_data_get ( sd - > img , 1 ) ;
hw = iw * ih ;
x = ( hw / 2 ) ;
p1 = data ;
p2 = data + hw - 1 ;
for ( ; - - x > 0 ; )
{
tmp = * p1 ;
* p1 = * p2 ;
* p2 = tmp ;
p1 + + ;
p2 - - ;
}
evas_object_image_data_set ( sd - > img , data ) ;
evas_object_image_data_update_add ( sd - > img , 0 , 0 , iw , ih ) ;
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
static Eina_Bool
_elm_image_drag_n_drop_cb ( void * elm_obj ,
Evas_Object * obj ,
Elm_Selection_Data * drop )
{
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( obj , elm_obj_image_file_set ( drop - > data , NULL , & ret ) ) ;
if ( ret )
2012-05-25 12:53:59 -07:00
{
2013-06-04 22:40:03 -07:00
DBG ( " dnd: %s, %s, %s " , elm_widget_type_get ( elm_obj ) ,
2012-05-28 13:35:29 -07:00
SIG_DND , ( char * ) drop - > data ) ;
2012-05-25 12:53:59 -07:00
evas_object_smart_callback_call ( elm_obj , SIG_DND , drop - > data ) ;
return EINA_TRUE ;
}
2012-05-29 12:38:24 -07:00
return EINA_FALSE ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_add ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * priv = _pd ;
2012-05-25 12:53:59 -07:00
2013-09-24 21:33:39 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_add ( ) ) ;
elm_widget_sub_object_parent_add ( obj ) ;
2012-11-27 01:29:16 -08: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 ) ;
2013-07-28 19:30:35 -07:00
evas_object_propagate_events_set ( priv - > hit_rect , EINA_FALSE ) ;
2012-11-27 01:29:16 -08: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 ) ;
evas_object_event_callback_add
( priv - > hit_rect , EVAS_CALLBACK_MOUSE_UP , _on_mouse_up , obj ) ;
2012-05-25 12:53:59 -07:00
/* starts as an Evas image. may switch to an Edje object */
priv - > img = _img_new ( obj ) ;
priv - > smooth = EINA_TRUE ;
priv - > fill_inside = EINA_TRUE ;
2012-07-17 19:25:34 -07:00
priv - > resize_up = EINA_TRUE ;
priv - > resize_down = EINA_TRUE ;
2012-05-25 12:53:59 -07:00
priv - > aspect_fixed = EINA_TRUE ;
2013-11-25 03:48:22 -08:00
priv - > load_size = 0 ;
2012-05-25 12:53:59 -07:00
priv - > scale = 1.0 ;
elm_widget_can_focus_set ( obj , EINA_FALSE ) ;
2012-07-17 11:45:09 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_del ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2014-01-21 06:16:41 -08:00
ecore_timer_del ( sd - > anim_timer ) ;
evas_object_del ( sd - > img ) ;
evas_object_del ( sd - > prev_img ) ;
2014-01-21 06:23:37 -08:00
if ( sd - > remote ) _elm_url_cancel ( sd - > remote ) ;
2013-08-09 05:12:29 -07:00
free ( sd - > remote_data ) ;
eina_stringshare_del ( sd - > key ) ;
2012-05-25 12:53:59 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_del ( ) ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_move ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -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 ) ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_move ( x , y ) ) ;
2012-05-25 12:53:59 -07:00
if ( ( sd - > img_x = = x ) & & ( sd - > img_y = = y ) ) return ;
sd - > img_x = x ;
sd - > img_y = y ;
/* takes care of moving */
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_resize ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
Evas_Coord w = va_arg ( * list , Evas_Coord ) ;
Evas_Coord h = va_arg ( * list , Evas_Coord ) ;
2012-05-25 12:53:59 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_resize ( w , h ) ) ;
2012-05-25 12:53:59 -07:00
if ( ( sd - > img_w = = w ) & & ( sd - > img_h = = h ) ) return ;
sd - > img_w = w ;
sd - > img_h = h ;
/* takes care of resizing */
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_show ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
sd - > show = EINA_TRUE ;
2012-12-17 23:06:42 -08:00
if ( sd - > preloading ) return ;
2012-05-25 12:53:59 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_show ( ) ) ;
2012-05-25 12:53:59 -07:00
evas_object_show ( sd - > img ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( sd - > prev_img , evas_object_del ) ;
2012-05-25 12:53:59 -07:00
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_hide ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_hide ( ) ) ;
2012-05-25 12:53:59 -07:00
sd - > show = EINA_FALSE ;
evas_object_hide ( sd - > img ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( sd - > prev_img , evas_object_del ) ;
2012-05-25 12:53:59 -07:00
}
2012-11-27 01:29:16 -08:00
static void
_elm_image_smart_member_add ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
{
Evas_Object * member = va_arg ( * list , Evas_Object * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_member_add ( member ) ) ;
2012-11-27 01:29:16 -08:00
if ( sd - > hit_rect )
evas_object_raise ( sd - > hit_rect ) ;
}
2012-05-25 12:53:59 -07:00
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_color_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
int r = va_arg ( * list , int ) ;
int g = va_arg ( * list , int ) ;
int b = va_arg ( * list , int ) ;
int a = va_arg ( * list , int ) ;
2012-05-25 12:53:59 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_color_set ( r , g , b , a ) ) ;
2012-05-25 12:53:59 -07:00
2012-12-02 19:53:13 -08:00
evas_object_color_set ( sd - > hit_rect , 0 , 0 , 0 , 0 ) ;
2012-05-25 12:53:59 -07:00
evas_object_color_set ( sd - > img , r , g , b , a ) ;
if ( sd - > prev_img ) evas_object_color_set ( sd - > prev_img , r , g , b , a ) ;
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_clip_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
Evas_Object * clip = va_arg ( * list , Evas_Object * ) ;
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_clip_set ( clip ) ) ;
2012-05-25 12:53:59 -07:00
evas_object_clip_set ( sd - > img , clip ) ;
if ( sd - > prev_img ) evas_object_clip_set ( sd - > prev_img , clip ) ;
}
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_clip_unset ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2013-03-18 09:07:38 -07:00
eo_do_super ( obj , MY_CLASS , evas_obj_smart_clip_unset ( ) ) ;
2012-05-25 12:53:59 -07:00
evas_object_clip_unset ( sd - > img ) ;
if ( sd - > prev_img ) evas_object_clip_unset ( sd - > prev_img ) ;
}
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_theme ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
2012-05-25 12:53:59 -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 ;
2012-05-25 12:53:59 -07:00
2014-01-21 00:44:45 -08:00
eo_do_super ( obj , MY_CLASS , elm_wdg_theme_apply ( & int_ret ) ) ;
2012-11-25 22:32:53 -08:00
if ( ! int_ret ) return ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
2012-05-25 12:53:59 -07:00
}
2013-10-29 16:32:43 -07:00
static void
_elm_image_smart_event ( Eo * obj , void * _pd EINA_UNUSED , va_list * list )
{
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 * ) ;
Evas_Event_Key_Down * ev = event_info ;
if ( ret ) * ret = EINA_FALSE ;
if ( elm_widget_disabled_get ( obj ) ) return ;
if ( type ! = EVAS_CALLBACK_KEY_DOWN ) return ;
if ( ev - > event_flags & EVAS_EVENT_FLAG_ON_HOLD ) return ;
if ( ( strcmp ( ev - > key , " Return " ) ) & &
( strcmp ( ev - > key , " KP_Enter " ) ) & &
( strcmp ( ev - > key , " space " ) ) )
return ;
_activate ( obj ) ;
2013-11-12 16:54:37 -08:00
ev - > event_flags | = EVAS_EVENT_FLAG_ON_HOLD ;
2013-10-29 16:32:43 -07:00
if ( ret ) * ret = EINA_TRUE ;
}
2012-05-25 12:53:59 -07:00
static void
2012-11-25 22:32:53 -08:00
_elm_image_smart_sizing_eval ( Eo * obj , void * _pd , va_list * list EINA_UNUSED )
2012-05-25 12:53:59 -07:00
{
Evas_Coord minw = - 1 , minh = - 1 , maxw = - 1 , maxh = - 1 ;
int w , h ;
2012-06-14 00:55:55 -07:00
double ts ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_smooth_scale_set ( sd - > smooth ) ) ;
2012-05-25 12:53:59 -07:00
if ( sd - > no_scale )
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_scale_set ( 1.0 ) ) ;
2012-05-25 12:53:59 -07:00
else
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_smooth_scale_set ( elm_widget_scale_get ( obj ) * elm_config_scale_get ( ) ) ) ;
2012-05-25 12:53:59 -07:00
2012-06-14 00:55:55 -07:00
ts = sd - > scale ;
sd - > scale = 1.0 ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_size_get ( & w , & h ) ) ;
2012-06-14 00:55:55 -07:00
sd - > scale = ts ;
From: Seunggyun Kim <sgyun.kim@samsung.com>
Subject: [E-devel] [PATCH] elm_icon is disappeared when theme hook is
called.
[Current Issue]
- The elm_icon can be disappeared when theme hook is called.
You can see the problem in the below situation.
a) elementary_test -> Layout select
b) elementary_config -> Fonts(toolbar) -> select some font
class, font,
style, size
c) Select "Apply" button
then two icons in title layout are disappeared.
[Main cause]
- when theme hook is called, internally
_elm_image_smart_sizing_eval
function is called.
The function calculates icon's min, max size.
But min, max size is calculated only in case no_scale is true or
resize_down or resize_up is false.
If application isn't set no_scale or resize_down/up, minw and
minh value
is just -1.
So when theme hooks is called then sizing_eval is called, icon's
min size
is -1 and that is disappeared.
[Change Description]
- I just added evas_object_size_hint_min_get(obj, &minw, minh) in
_elm_image_smart_sizing_eval.
Patch is working well, but I don't think this is right solution
because
that would break image(icon) min,max concept
SVN revision: 74163
2012-07-19 01:10:02 -07:00
evas_object_size_hint_min_get ( obj , & minw , & minh ) ;
2012-11-25 22:32:53 -08:00
2012-06-14 00:55:55 -07:00
if ( sd - > no_scale )
2009-04-22 20:48:41 -07:00
{
2012-06-14 00:55:55 -07:00
maxw = minw = w ;
maxh = minh = h ;
2012-07-17 19:25:34 -07:00
if ( ( sd - > scale > 1.0 ) & & ( sd - > resize_up ) )
2012-06-14 00:55:55 -07:00
{
maxw = minw = w * sd - > scale ;
maxh = minh = h * sd - > scale ;
}
2012-07-17 19:25:34 -07:00
else if ( ( sd - > scale < 1.0 ) & & ( sd - > resize_down ) )
2012-06-14 00:55:55 -07:00
{
maxw = minw = w * sd - > scale ;
maxh = minh = h * sd - > scale ;
}
2009-04-22 20:48:41 -07:00
}
2012-06-14 00:55:55 -07:00
else
2009-04-22 20:48:41 -07:00
{
2012-07-17 19:25:34 -07:00
if ( ! sd - > resize_down )
2012-06-14 00:55:55 -07:00
{
minw = w * sd - > scale ;
minh = h * sd - > scale ;
}
2012-07-17 19:25:34 -07:00
if ( ! sd - > resize_up )
2012-06-14 00:55:55 -07:00
{
maxw = w * sd - > scale ;
maxh = h * sd - > scale ;
}
2009-04-22 20:48:41 -07:00
}
2012-07-17 19:25:38 -07:00
2009-04-22 20:48:41 -07:00
evas_object_size_hint_min_set ( obj , minw , minh ) ;
evas_object_size_hint_max_set ( obj , maxw , maxh ) ;
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_file_set_do ( Evas_Object * obj )
{
Evas_Object * pclip = NULL ;
2013-11-25 03:48:22 -08:00
int w , h ;
2013-06-24 19:15:15 -07:00
ELM_IMAGE_DATA_GET ( obj , sd ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( sd - > prev_img , evas_object_del ) ;
2013-06-24 19:15:15 -07:00
if ( sd - > img )
{
pclip = evas_object_clip_get ( sd - > img ) ;
sd - > prev_img = sd - > img ;
}
sd - > img = _img_new ( obj ) ;
evas_object_image_load_orientation_set ( sd - > img , EINA_TRUE ) ;
evas_object_clip_set ( sd - > img , pclip ) ;
sd - > edje = EINA_FALSE ;
2013-11-25 03:48:22 -08:00
if ( sd - > load_size > 0 )
2013-06-24 19:15:15 -07:00
evas_object_image_load_size_set ( sd - > img , sd - > load_size , sd - > load_size ) ;
2013-11-25 03:48:22 -08:00
else
{
eo_do ( ( Eo * ) obj , elm_obj_image_size_get ( & w , & h ) ) ;
evas_object_image_load_size_set ( sd - > img , w , h ) ;
}
2013-06-24 19:15:15 -07:00
}
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_memfile_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
const void * img = va_arg ( * list , const void * ) ;
size_t size = va_arg ( * list , size_t ) ;
const char * format = va_arg ( * list , const char * ) ;
const char * key = va_arg ( * list , const char * ) ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
2012-05-25 12:53:59 -07:00
_elm_image_file_set_do ( obj ) ;
evas_object_image_memfile_set
( sd - > img , ( void * ) img , size , ( char * ) format , ( char * ) key ) ;
2013-10-01 02:05:21 -07:00
if ( evas_object_visible_get ( obj ) )
{
sd - > preloading = EINA_TRUE ;
evas_object_image_preload ( sd - > img , EINA_FALSE ) ;
}
2012-05-25 12:53:59 -07:00
if ( evas_object_image_load_error_get ( sd - > img ) ! = EVAS_LOAD_ERROR_NONE )
{
ERR ( " Things are going bad for some random " FMT_SIZE_T
" byte chunk of memory (%p) " , size , sd - > img ) ;
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_FALSE ;
return ;
2012-05-25 12:53:59 -07:00
}
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
if ( ret ) * ret = EINA_TRUE ;
2012-05-25 12:53:59 -07:00
}
2012-11-25 22:32:53 -08:00
static void
2013-06-24 19:15:15 -07:00
_elm_image_smart_scale_set ( Eo * obj , void * _pd , va_list * list )
2012-05-25 12:53:59 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
2013-06-24 19:15:15 -07:00
double scale = va_arg ( * list , double ) ;
2012-05-25 12:53:59 -07:00
2013-06-24 19:15:15 -07:00
sd - > scale = scale ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
_elm_image_internal_sizing_eval ( obj , sd ) ;
2012-05-25 12:53:59 -07:00
}
2009-04-22 20:48:41 -07:00
static void
2013-06-24 19:15:15 -07:00
_elm_image_smart_scale_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
2009-04-22 20:48:41 -07:00
{
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2013-06-24 19:15:15 -07:00
double * ret = va_arg ( * list , double * ) ;
2012-05-25 12:53:59 -07:00
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > scale ;
2012-05-25 12:53:59 -07:00
}
2009-04-22 20:48:41 -07:00
EAPI Evas_Object *
elm_image_add ( Evas_Object * parent )
{
2012-05-25 12:53:59 -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 ;
}
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-11-25 22:32:53 -08:00
static void
_constructor ( Eo * obj , void * _pd EINA_UNUSED , va_list * list EINA_UNUSED )
{
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 ,
2013-11-07 03:44:22 -08:00
evas_obj_type_set ( MY_CLASS_NAME_LEGACY ) ,
2012-11-25 22:32:53 -08:00
evas_obj_smart_callbacks_descriptions_set ( _smart_callbacks , NULL ) ) ;
2009-04-22 20:48:41 -07:00
}
EAPI Eina_Bool
2012-05-25 12:53:59 -07:00
elm_image_memfile_set ( Evas_Object * obj ,
const void * img ,
size_t size ,
const char * format ,
const char * key )
{
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
EINA_SAFETY_ON_NULL_RETURN_VAL ( img , EINA_FALSE ) ;
EINA_SAFETY_ON_TRUE_RETURN_VAL ( ! size , EINA_FALSE ) ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( obj , elm_obj_image_memfile_set ( img , size , format , key , & ret ) ) ;
return ret ;
2012-05-25 12:53:59 -07:00
}
EAPI Eina_Bool
elm_image_file_set ( Evas_Object * obj ,
const char * file ,
const char * group )
2009-04-22 20:48:41 -07:00
{
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
2009-04-22 20:48:41 -07:00
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2010-12-03 06:08:33 -08:00
EINA_SAFETY_ON_NULL_RETURN_VAL ( file , EINA_FALSE ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_file_set ( file , group , & ret ) ) ;
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2009-04-22 20:48:41 -07:00
return ret ;
}
2013-11-03 19:17:42 -08:00
EAPI Eina_Bool
elm_image_mmap_set ( Evas_Object * obj ,
const Eina_File * file ,
const char * group )
{
Eina_Bool ret = EINA_FALSE ;
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
EINA_SAFETY_ON_NULL_RETURN_VAL ( file , EINA_FALSE ) ;
eo_do ( obj ,
elm_obj_image_mmap_set ( file , group , & ret ) ,
elm_obj_image_sizing_eval ( ) ) ;
return ret ;
}
2013-06-24 19:15:15 -07:00
static void
2013-08-09 05:12:29 -07:00
_elm_image_smart_internal_file_set ( Eo * obj , Elm_Image_Smart_Data * sd ,
2013-11-03 19:17:42 -08:00
const char * file , const Eina_File * f , const char * key , Eina_Bool * ret )
2013-06-24 19:15:15 -07:00
{
if ( eina_str_has_extension ( file , " .edj " ) )
{
2013-08-09 05:12:29 -07:00
Eina_Bool int_ret = _elm_image_edje_file_set ( obj , file , f , key ) ;
2013-06-24 19:15:15 -07:00
if ( ret ) * ret = int_ret ;
return ;
}
_elm_image_file_set_do ( obj ) ;
2013-08-09 05:12:29 -07:00
if ( f )
evas_object_image_mmap_set ( sd - > img , f , key ) ;
else
evas_object_image_file_set ( sd - > img , file , key ) ;
2013-06-24 19:15:15 -07:00
evas_object_hide ( sd - > img ) ;
2013-10-01 02:05:21 -07:00
if ( evas_object_visible_get ( obj ) )
{
sd - > preloading = EINA_TRUE ;
evas_object_image_preload ( sd - > img , EINA_FALSE ) ;
}
2013-06-24 19:15:15 -07:00
if ( evas_object_image_load_error_get ( sd - > img ) ! = EVAS_LOAD_ERROR_NONE )
{
ERR ( " Things are going bad for '%s' (%p) " , file , sd - > img ) ;
if ( ret ) * ret = EINA_FALSE ;
return ;
}
_elm_image_internal_sizing_eval ( obj , sd ) ;
if ( ret ) * ret = EINA_TRUE ;
2013-09-30 03:21:31 -07:00
}
2013-08-09 05:12:29 -07:00
static void
_elm_image_smart_download_done ( void * data , Elm_Url * url EINA_UNUSED , Eina_Binbuf * download )
{
Eo * obj = data ;
Elm_Image_Smart_Data * sd = eo_data_scope_get ( obj , MY_CLASS ) ;
Eina_File * f ;
size_t length ;
Eina_Bool ret = EINA_FALSE ;
if ( sd - > remote_data ) free ( sd - > remote_data ) ;
length = eina_binbuf_length_get ( download ) ;
sd - > remote_data = eina_binbuf_string_steal ( download ) ;
2014-01-21 06:23:37 -08:00
f = eina_file_virtualize ( _elm_url_get ( url ) ,
2013-08-09 05:12:29 -07:00
sd - > remote_data , length ,
EINA_FALSE ) ;
2014-01-21 06:23:37 -08:00
_elm_image_smart_internal_file_set ( obj , sd , _elm_url_get ( url ) , f , sd - > key , & ret ) ;
2013-08-09 05:12:29 -07:00
eina_file_close ( f ) ;
if ( ! ret )
{
Elm_Image_Error err = { 0 , EINA_TRUE } ;
free ( sd - > remote_data ) ;
sd - > remote_data = NULL ;
evas_object_smart_callback_call ( obj , SIG_DOWNLOAD_ERROR , & err ) ;
}
else
{
2013-09-26 02:55:44 -07:00
if ( evas_object_visible_get ( obj ) )
{
2013-10-01 02:05:21 -07:00
sd - > preloading = EINA_TRUE ;
evas_object_image_preload ( sd - > img , EINA_FALSE ) ;
2013-09-26 02:55:44 -07:00
}
2013-08-09 05:12:29 -07:00
evas_object_smart_callback_call ( obj , SIG_DOWNLOAD_DONE , NULL ) ;
}
sd - > remote = NULL ;
2014-01-21 17:12:44 -08:00
ELM_SAFE_FREE ( sd - > key , eina_stringshare_del ) ;
2013-08-09 05:12:29 -07:00
}
static void
_elm_image_smart_download_cancel ( void * data , Elm_Url * url EINA_UNUSED , int error )
{
Eo * obj = data ;
Elm_Image_Smart_Data * sd = eo_data_scope_get ( obj , MY_CLASS ) ;
Elm_Image_Error err = { error , EINA_FALSE } ;
evas_object_smart_callback_call ( obj , SIG_DOWNLOAD_ERROR , & err ) ;
sd - > remote = NULL ;
2014-01-21 17:12:44 -08:00
ELM_SAFE_FREE ( sd - > key , eina_stringshare_del ) ;
2013-08-09 05:12:29 -07:00
}
static void
_elm_image_smart_download_progress ( void * data , Elm_Url * url EINA_UNUSED , double now , double total )
{
Eo * obj = data ;
Elm_Image_Progress progress ;
progress . now = now ;
progress . total = total ;
evas_object_smart_callback_call ( obj , SIG_DOWNLOAD_PROGRESS , & progress ) ;
}
static const char * remote_uri [ ] = {
" http:// " , " https:// " , " ftp:// "
} ;
static void
_elm_image_smart_file_set ( Eo * obj , void * _pd , va_list * list )
{
const char * file = va_arg ( * list , const char * ) ;
const char * key = va_arg ( * list , const char * ) ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
unsigned int i ;
2014-01-21 06:23:37 -08:00
if ( sd - > remote ) _elm_url_cancel ( sd - > remote ) ;
2013-08-09 05:12:29 -07:00
sd - > remote = NULL ;
for ( i = 0 ; i < sizeof ( remote_uri ) / sizeof ( remote_uri [ 0 ] ) ; + + i )
if ( strncmp ( remote_uri [ i ] , file , strlen ( remote_uri [ i ] ) ) = = 0 )
{
// Found a remote target !
evas_object_hide ( sd - > img ) ;
2014-01-21 06:23:37 -08:00
sd - > remote = _elm_url_download ( file ,
2013-08-09 05:12:29 -07:00
_elm_image_smart_download_done ,
_elm_image_smart_download_cancel ,
_elm_image_smart_download_progress ,
obj ) ;
if ( sd - > remote )
{
evas_object_smart_callback_call ( obj , SIG_DOWNLOAD_START , NULL ) ;
eina_stringshare_replace ( & sd - > key , key ) ;
if ( ret ) * ret = EINA_TRUE ;
return ;
}
break ;
}
_elm_image_smart_internal_file_set ( obj , sd , file , NULL , key , ret ) ;
2013-06-24 19:15:15 -07:00
}
2013-11-03 19:17:42 -08:00
static void
_elm_image_smart_mmap_set ( Eo * obj , void * _pd , va_list * list )
{
const Eina_File * f = va_arg ( * list , const Eina_File * ) ;
const char * key = va_arg ( * list , const char * ) ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2014-01-21 06:23:37 -08:00
if ( sd - > remote ) _elm_url_cancel ( sd - > remote ) ;
2013-11-03 19:17:42 -08:00
sd - > remote = NULL ;
_elm_image_smart_internal_file_set ( obj , sd ,
eina_file_filename_get ( f ) , f ,
key , ret ) ;
}
2010-10-27 07:38:37 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_file_get ( const Evas_Object * obj ,
const char * * file ,
const char * * group )
2010-10-27 07:38:37 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_image_file_get ( file , group ) ) ;
2010-10-27 07:38:37 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_file_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
const char * * file = va_arg ( * list , const char * * ) ;
const char * * key = va_arg ( * list , const char * * ) ;
if ( sd - > edje )
edje_object_file_get ( sd - > img , file , key ) ;
else
evas_object_image_file_get ( sd - > img , file , key ) ;
}
2009-04-22 20:48:41 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_smooth_set ( Evas_Object * obj ,
Eina_Bool smooth )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_smooth_set ( smooth ) ) ;
}
2009-09-26 11:43:26 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_smooth_set ( Eo * obj , void * _pd , va_list * list )
{
Eina_Bool smooth = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
sd - > smooth = smooth ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2009-04-22 20:48:41 -07:00
}
2010-10-27 07:38:37 -07:00
EAPI Eina_Bool
elm_image_smooth_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_smooth_get ( & ret ) ) ;
return ret ;
}
2010-10-27 07:38:37 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_smooth_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > smooth ;
2010-10-27 07:38:37 -07:00
}
2009-04-22 20:48:41 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_object_size_get ( const Evas_Object * obj ,
int * w ,
int * h )
2009-09-07 21:28:05 -07:00
{
2011-11-30 22:43:06 -08:00
if ( w ) * w = 0 ;
if ( h ) * h = 0 ;
2009-09-26 11:43:26 -07:00
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_image_size_get ( w , h ) ) ;
2009-09-07 21:28:05 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_size_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
int * w = va_arg ( * list , int * ) ;
int * h = va_arg ( * list , int * ) ;
int tw , th ;
int cw = 0 , ch = 0 ;
const char * type ;
Elm_Image_Smart_Data * sd = _pd ;
type = evas_object_type_get ( sd - > img ) ;
if ( ! type ) return ;
if ( ! strcmp ( type , " edje " ) )
edje_object_size_min_get ( sd - > img , & tw , & th ) ;
else
evas_object_image_size_get ( sd - > img , & tw , & th ) ;
if ( ( sd - > resize_up ) | | ( sd - > resize_down ) )
evas_object_geometry_get ( sd - > img , NULL , NULL , & cw , & ch ) ;
tw = tw > cw ? tw : cw ;
th = th > ch ? th : ch ;
tw = ( ( double ) tw ) * sd - > scale ;
th = ( ( double ) th ) * sd - > scale ;
if ( w ) * w = tw ;
if ( h ) * h = th ;
}
2009-09-07 21:28:05 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_no_scale_set ( Evas_Object * obj ,
Eina_Bool no_scale )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_no_scale_set ( no_scale ) ) ;
}
2009-09-26 11:43:26 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_no_scale_set ( Eo * obj , void * _pd , va_list * list )
{
Eina_Bool no_scale = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
sd - > no_scale = no_scale ;
2009-09-17 15:39:18 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2009-04-22 20:48:41 -07:00
}
2010-10-27 07:38:37 -07:00
EAPI Eina_Bool
elm_image_no_scale_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_no_scale_get ( & ret ) ) ;
return ret ;
}
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_no_scale_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > no_scale ;
2010-10-27 07:38:37 -07:00
}
2012-03-05 05:36:01 -08:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_resizable_set ( Evas_Object * obj ,
Eina_Bool up ,
Eina_Bool down )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_resizable_set ( up , down ) ) ;
}
static void
_elm_image_smart_resizable_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool up = va_arg ( * list , int ) ;
Eina_Bool down = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2009-09-26 11:43:26 -07:00
2012-07-17 19:25:34 -07:00
sd - > resize_up = ! ! up ;
sd - > resize_down = ! ! down ;
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2009-04-22 20:48:41 -07:00
}
2010-10-27 07:38:37 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_resizable_get ( const Evas_Object * obj ,
Eina_Bool * size_up ,
Eina_Bool * size_down )
2010-10-27 07:38:37 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( ( Eo * ) obj , elm_obj_image_resizable_get ( size_up , size_down ) ) ;
}
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_resizable_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * size_up = va_arg ( * list , Eina_Bool * ) ;
Eina_Bool * size_down = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-07-17 19:25:34 -07:00
if ( size_up ) * size_up = sd - > resize_up ;
if ( size_down ) * size_down = sd - > resize_down ;
2010-10-27 07:38:37 -07:00
}
2009-04-22 20:48:41 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_fill_outside_set ( Evas_Object * obj ,
Eina_Bool fill_outside )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_fill_outside_set ( fill_outside ) ) ;
}
2012-05-25 12:53:59 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_fill_outside_set ( Eo * obj , void * _pd , va_list * list )
{
Eina_Bool fill_outside = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-25 12:53:59 -07:00
sd - > fill_inside = ! fill_outside ;
2009-09-26 11:43:26 -07:00
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_sizing_eval ( ) ) ;
2009-04-22 20:48:41 -07:00
}
2010-10-27 07:38:37 -07:00
EAPI Eina_Bool
elm_image_fill_outside_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_fill_outside_get ( & ret ) ) ;
return ret ;
}
2010-10-27 07:38:37 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_fill_outside_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = ! sd - > fill_inside ;
2010-10-27 07:38:37 -07:00
}
2012-03-06 22:26:20 -08:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_preload_disabled_set ( Evas_Object * obj ,
Eina_Bool disabled )
2012-03-06 22:26:20 -08:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_preload_disabled_set ( ! ! disabled ) ) ;
2012-03-06 22:26:20 -08:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_preload_disabled_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
Eina_Bool disable = va_arg ( * list , int ) ;
if ( sd - > edje | | ! sd - > preloading ) return ;
//FIXME: Need to keep the disabled status for next image loading.
evas_object_image_preload ( sd - > img , disable ) ;
sd - > preloading = ! disable ;
if ( disable )
{
if ( sd - > show & & sd - > img ) evas_object_show ( sd - > img ) ;
2013-10-02 04:18:49 -07:00
ELM_SAFE_FREE ( sd - > prev_img , evas_object_del ) ;
2013-06-24 19:15:15 -07:00
}
}
2009-04-22 20:48:41 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_prescale_set ( Evas_Object * obj ,
int size )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_load_size_set ( size ) ) ;
2009-04-22 20:48:41 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_load_size_set ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
int size = va_arg ( * list , int ) ;
sd - > load_size = size ;
}
2010-10-27 07:38:37 -07:00
EAPI int
elm_image_prescale_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) 0 ;
2010-10-27 07:38:37 -07:00
2012-11-25 22:32:53 -08:00
int ret = 0 ;
eo_do ( ( Eo * ) obj , elm_obj_image_load_size_get ( & ret ) ) ;
return ret ;
2010-10-27 07:38:37 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_load_size_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
int * ret = va_arg ( * list , int * ) ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > load_size ;
2013-06-24 19:15:15 -07:00
}
2009-04-22 20:48:41 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_orient_set ( Evas_Object * obj ,
Elm_Image_Orient orient )
2009-04-22 20:48:41 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_orient_set ( orient ) ) ;
2009-04-22 20:48:41 -07:00
}
2010-09-07 21:55:20 -07:00
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_orient_set ( Eo * obj , void * _pd , va_list * list )
{
Elm_Image_Orient orient = va_arg ( * list , Elm_Image_Orient ) ;
unsigned int * data , * data2 = NULL , * to , * from ;
int x , y , w , hw , iw , ih ;
Elm_Image_Smart_Data * sd = _pd ;
if ( sd - > edje )
return ;
switch ( orient )
{
case ELM_IMAGE_FLIP_HORIZONTAL :
2013-10-13 22:40:35 -07:00
_elm_image_flip_horizontal ( obj , sd ) ;
sd - > orient = orient ;
return ;
2013-06-24 19:15:15 -07:00
case ELM_IMAGE_FLIP_VERTICAL :
2013-10-13 22:40:35 -07:00
_elm_image_flip_vertical ( obj , sd ) ;
sd - > orient = orient ;
return ;
2013-06-24 19:15:15 -07:00
case ELM_IMAGE_ROTATE_180 :
2013-10-13 22:40:35 -07:00
_elm_image_smart_rotate_180 ( obj , sd ) ;
sd - > orient = orient ;
return ;
2013-06-24 19:15:15 -07:00
case ELM_IMAGE_ORIENT_NONE :
sd - > orient = orient ;
return ;
default :
break ;
}
evas_object_image_size_get ( sd - > img , & iw , & ih ) ;
/* we need separate destination memory if we want to rotate 90 or
* 270 degree */
data = evas_object_image_data_get ( sd - > img , EINA_FALSE ) ;
if ( ! data ) return ;
2014-01-08 22:04:46 -08:00
data2 = malloc ( sizeof ( unsigned int ) * ( iw * ih ) ) ;
2013-06-24 19:15:15 -07:00
if ( ! data2 ) return ;
2014-01-08 22:04:46 -08:00
memcpy ( data2 , data , sizeof ( unsigned int ) * ( iw * ih ) ) ;
2013-06-24 19:15:15 -07:00
w = ih ;
ih = iw ;
iw = w ;
hw = w * ih ;
evas_object_image_size_set ( sd - > img , iw , ih ) ;
data = evas_object_image_data_get ( sd - > img , EINA_TRUE ) ;
switch ( orient )
{
case ELM_IMAGE_FLIP_TRANSPOSE :
to = data ;
hw = - hw + 1 ;
2013-10-13 22:40:35 -07:00
sd - > orient = orient ;
2013-06-24 19:15:15 -07:00
break ;
case ELM_IMAGE_FLIP_TRANSVERSE :
to = data + hw - 1 ;
w = - w ;
hw = hw - 1 ;
2013-10-13 22:40:35 -07:00
sd - > orient = orient ;
2013-06-24 19:15:15 -07:00
break ;
case ELM_IMAGE_ROTATE_90 :
to = data + w - 1 ;
hw = - hw - 1 ;
2013-10-13 22:40:35 -07:00
sd - > orient = orient ;
2013-06-24 19:15:15 -07:00
break ;
case ELM_IMAGE_ROTATE_270 :
to = data + hw - w ;
w = - w ;
hw = hw + 1 ;
2013-10-13 22:40:35 -07:00
sd - > orient = orient ;
2013-06-24 19:15:15 -07:00
break ;
default :
ERR ( " unknown orient %d " , orient ) ;
evas_object_image_data_set ( sd - > img , data ) ; // give it back
if ( data2 ) free ( data2 ) ;
return ;
}
from = data2 ;
for ( x = iw ; - - x > = 0 ; )
{
for ( y = ih ; - - y > = 0 ; )
{
* to = * from ;
from + + ;
to + = w ;
}
to + = hw ;
}
if ( data2 ) free ( data2 ) ;
evas_object_image_data_set ( sd - > img , data ) ;
evas_object_image_data_update_add ( sd - > img , 0 , 0 , iw , ih ) ;
_elm_image_internal_sizing_eval ( obj , sd ) ;
}
2010-10-27 07:38:37 -07:00
EAPI Elm_Image_Orient
elm_image_orient_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ELM_IMAGE_ORIENT_NONE ;
2012-11-25 22:32:53 -08:00
Elm_Image_Orient ret = ELM_IMAGE_ORIENT_NONE ;
eo_do ( ( Eo * ) obj , elm_obj_image_orient_get ( & ret ) ) ;
return ret ;
2010-10-27 07:38:37 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_orient_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
Elm_Image_Orient * ret = va_arg ( * list , Elm_Image_Orient * ) ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > orient ;
2013-06-24 19:15:15 -07:00
}
2010-09-07 21:55:20 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_editable_set ( Evas_Object * obj ,
Eina_Bool set )
2010-09-07 21:55:20 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2014-01-01 16:11:25 -08:00
eo_do ( obj , elm_obj_image_editable_set ( set ) ) ;
2010-09-07 21:55:20 -07:00
}
2013-06-24 19:15:15 -07:00
/**
* Turns on editing through drag and drop and copy and paste .
*/
static void
_elm_image_smart_editable_set ( Eo * obj , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
Eina_Bool edit = va_arg ( * list , int ) ;
if ( sd - > edje )
{
WRN ( " No editing edje objects yet (ever) \n " ) ;
return ;
}
edit = ! ! edit ;
if ( edit = = sd - > edit ) return ;
sd - > edit = edit ;
if ( sd - > edit )
elm_drop_target_add
( obj , ELM_SEL_FORMAT_IMAGE ,
NULL , NULL ,
NULL , NULL ,
NULL , NULL ,
2014-01-01 16:11:25 -08:00
_elm_image_drag_n_drop_cb , obj ) ;
2013-06-24 19:15:15 -07:00
else
2013-11-04 05:08:53 -08:00
elm_drop_target_del
( obj , ELM_SEL_FORMAT_IMAGE ,
NULL , NULL ,
NULL , NULL ,
NULL , NULL ,
2014-01-01 16:11:25 -08:00
_elm_image_drag_n_drop_cb , obj ) ;
2013-06-24 19:15:15 -07:00
}
2010-10-27 07:38:37 -07:00
EAPI Eina_Bool
elm_image_editable_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_editable_get ( & ret ) ) ;
return ret ;
2010-10-27 07:38:37 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_editable_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > edit ;
2013-06-24 19:15:15 -07:00
}
2011-05-19 13:02:16 -07:00
EAPI Evas_Object *
elm_image_object_get ( const Evas_Object * obj )
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) NULL ;
2012-11-25 22:32:53 -08:00
Evas_Object * ret = NULL ;
eo_do ( ( Eo * ) obj , elm_obj_image_object_get ( & ret ) ) ;
return ret ;
2011-05-19 13:02:16 -07:00
}
2010-09-07 21:55:20 -07:00
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_object_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Evas_Object * * ret = va_arg ( * list , Evas_Object * * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > img ;
2013-06-24 19:15:15 -07:00
}
2011-06-26 22:02:40 -07:00
EAPI void
2012-05-25 12:53:59 -07:00
elm_image_aspect_fixed_set ( Evas_Object * obj ,
Eina_Bool fixed )
2011-06-26 22:02:40 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_aspect_fixed_set ( fixed ) ) ;
2011-06-26 22:02:40 -07:00
}
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_aspect_fixed_set ( Eo * obj , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
Eina_Bool fixed = va_arg ( * list , int ) ;
fixed = ! ! fixed ;
if ( sd - > aspect_fixed = = fixed ) return ;
sd - > aspect_fixed = fixed ;
_elm_image_internal_sizing_eval ( obj , sd ) ;
}
2011-06-26 22:02:40 -07:00
EAPI Eina_Bool
2012-01-05 21:55:51 -08:00
elm_image_aspect_fixed_get ( const Evas_Object * obj )
2011-06-26 22:02:40 -07:00
{
2012-05-25 12:53:59 -07:00
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_aspect_fixed_get ( & ret ) ) ;
return ret ;
2012-05-25 12:53:59 -07:00
}
2012-05-28 13:35:29 -07:00
2013-06-24 19:15:15 -07:00
static void
_elm_image_smart_aspect_fixed_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Elm_Image_Smart_Data * sd = _pd ;
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > aspect_fixed ;
2013-06-24 19:15:15 -07:00
}
2012-05-28 13:35:29 -07:00
EAPI Eina_Bool
elm_image_animated_available_get ( const Evas_Object * obj )
{
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_animated_available_get ( & ret ) ) ;
return ret ;
}
static void
_elm_image_smart_animated_available_get ( Eo * obj , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
2012-05-28 13:35:29 -07:00
2012-11-25 22:32:53 -08:00
Elm_Image_Smart_Data * sd = _pd ;
2012-05-28 13:35:29 -07:00
2012-11-25 22:32:53 -08:00
if ( sd - > edje )
{
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = EINA_FALSE ;
2012-11-25 22:32:53 -08:00
return ;
}
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = evas_object_image_animated_get ( elm_image_object_get ( obj ) ) ;
2012-05-28 13:35:29 -07:00
}
EAPI void
elm_image_animated_set ( Evas_Object * obj ,
Eina_Bool anim )
{
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_animated_set ( anim ) ) ;
}
static void
_elm_image_smart_animated_set ( Eo * obj , void * _pd , va_list * list )
{
Eina_Bool anim = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-28 13:35:29 -07:00
anim = ! ! anim ;
if ( sd - > anim = = anim ) return ;
if ( sd - > edje ) return ;
sd - > img = elm_image_object_get ( obj ) ;
if ( ! evas_object_image_animated_get ( sd - > img ) ) return ;
if ( anim )
{
sd - > frame_count = evas_object_image_animated_frame_count_get ( sd - > img ) ;
sd - > cur_frame = 1 ;
sd - > frame_duration =
evas_object_image_animated_frame_duration_get
( sd - > img , sd - > cur_frame , 0 ) ;
evas_object_image_animated_frame_set ( sd - > img , sd - > cur_frame ) ;
}
else
{
sd - > frame_count = - 1 ;
sd - > cur_frame = - 1 ;
sd - > frame_duration = - 1 ;
}
sd - > anim = anim ;
return ;
}
EAPI Eina_Bool
elm_image_animated_get ( const Evas_Object * obj )
{
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_animated_get ( & ret ) ) ;
return ret ;
}
2012-05-28 13:35:29 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_animated_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > anim ;
2012-05-28 13:35:29 -07:00
}
EAPI void
elm_image_animated_play_set ( Evas_Object * obj ,
Eina_Bool play )
{
ELM_IMAGE_CHECK ( obj ) ;
2012-11-25 22:32:53 -08:00
eo_do ( obj , elm_obj_image_animated_play_set ( play ) ) ;
}
static void
2013-04-24 04:41:37 -07:00
_elm_image_smart_animated_play_set ( Eo * obj , void * _pd , va_list * list )
2012-11-25 22:32:53 -08:00
{
Eina_Bool play = va_arg ( * list , int ) ;
Elm_Image_Smart_Data * sd = _pd ;
2012-05-28 13:35:29 -07:00
if ( ! sd - > anim ) return ;
if ( sd - > play = = play ) return ;
if ( sd - > edje ) return ;
if ( play )
{
sd - > anim_timer = ecore_timer_add
2013-04-24 04:41:37 -07:00
( sd - > frame_duration , _elm_image_animate_cb , obj ) ;
2012-05-28 13:35:29 -07:00
}
else
{
2013-05-29 04:56:07 -07:00
ELM_SAFE_FREE ( sd - > anim_timer , ecore_timer_del ) ;
2012-05-28 13:35:29 -07:00
}
sd - > play = play ;
}
EAPI Eina_Bool
elm_image_animated_play_get ( const Evas_Object * obj )
{
ELM_IMAGE_CHECK ( obj ) EINA_FALSE ;
2012-11-25 22:32:53 -08:00
Eina_Bool ret = EINA_FALSE ;
eo_do ( ( Eo * ) obj , elm_obj_image_animated_play_get ( & ret ) ) ;
return ret ;
}
2012-05-28 13:35:29 -07:00
2012-11-25 22:32:53 -08:00
static void
_elm_image_smart_animated_play_get ( Eo * obj EINA_UNUSED , void * _pd , va_list * list )
{
Eina_Bool * ret = va_arg ( * list , Eina_Bool * ) ;
Elm_Image_Smart_Data * sd = _pd ;
2013-12-30 18:36:43 -08:00
if ( ret ) * ret = sd - > play ;
2012-05-28 13:35:29 -07:00
}
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_ADD ) , _elm_image_smart_add ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_DEL ) , _elm_image_smart_del ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_RESIZE ) , _elm_image_smart_resize ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_MOVE ) , _elm_image_smart_move ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_SHOW ) , _elm_image_smart_show ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_HIDE ) , _elm_image_smart_hide ) ,
2012-11-27 01:29:16 -08:00
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_MEMBER_ADD ) , _elm_image_smart_member_add ) ,
2012-11-25 22:32:53 -08:00
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_COLOR_SET ) , _elm_image_smart_color_set ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_CLIP_SET ) , _elm_image_smart_clip_set ) ,
EO_OP_FUNC ( EVAS_OBJ_SMART_ID ( EVAS_OBJ_SMART_SUB_ID_CLIP_UNSET ) , _elm_image_smart_clip_unset ) ,
2014-01-21 00:44:45 -08:00
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_THEME_APPLY ) , _elm_image_smart_theme ) ,
2013-10-29 16:32:43 -07:00
EO_OP_FUNC ( ELM_WIDGET_ID ( ELM_WIDGET_SUB_ID_EVENT ) , _elm_image_smart_event ) ,
2012-11-25 22:32:53 -08:00
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ASPECT_FIXED_SET ) , _elm_image_smart_aspect_fixed_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ASPECT_FIXED_GET ) , _elm_image_smart_aspect_fixed_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_EDITABLE_SET ) , _elm_image_smart_editable_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_EDITABLE_GET ) , _elm_image_smart_editable_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_FILE_SET ) , _elm_image_smart_file_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_FILE_GET ) , _elm_image_smart_file_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SIZING_EVAL ) , _elm_image_smart_sizing_eval ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_SCALE_SET ) , _elm_image_smart_smooth_scale_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_SCALE_GET ) , _elm_image_smart_smooth_scale_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_FILL_INSIDE_SET ) , _elm_image_smart_fill_inside_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_FILL_INSIDE_GET ) , _elm_image_smart_fill_inside_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_FILL_OUTSIDE_SET ) , _elm_image_smart_fill_outside_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_FILL_OUTSIDE_GET ) , _elm_image_smart_fill_outside_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_OBJECT_GET ) , _elm_image_smart_object_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_SET ) , _elm_image_smart_load_size_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_GET ) , _elm_image_smart_load_size_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_MEMFILE_SET ) , _elm_image_smart_memfile_set ) ,
2013-11-03 19:17:42 -08:00
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_MMAP_SET ) , _elm_image_smart_mmap_set ) ,
2012-11-25 22:32:53 -08:00
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ORIENT_SET ) , _elm_image_smart_orient_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ORIENT_GET ) , _elm_image_smart_orient_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_PRELOAD_DISABLED_SET ) , _elm_image_smart_preload_disabled_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_DOWN_SET ) , _elm_image_smart_resize_down_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_DOWN_GET ) , _elm_image_smart_resize_down_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_UP_SET ) , _elm_image_smart_resize_up_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_UP_GET ) , _elm_image_smart_resize_up_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SCALE_SET ) , _elm_image_smart_scale_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SCALE_GET ) , _elm_image_smart_scale_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_OBJECT_SIZE_GET ) , _elm_image_smart_size_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_SET ) , _elm_image_smart_smooth_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_GET ) , _elm_image_smart_smooth_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_NO_SCALE_SET ) , _elm_image_smart_no_scale_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_NO_SCALE_GET ) , _elm_image_smart_no_scale_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_RESIZABLE_SET ) , _elm_image_smart_resizable_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_RESIZABLE_GET ) , _elm_image_smart_resizable_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_AVAILABLE_GET ) , _elm_image_smart_animated_available_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_SET ) , _elm_image_smart_animated_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_GET ) , _elm_image_smart_animated_get ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_PLAY_SET ) , _elm_image_smart_animated_play_set ) ,
EO_OP_FUNC ( ELM_OBJ_IMAGE_ID ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_PLAY_GET ) , _elm_image_smart_animated_play_get ) ,
EO_OP_FUNC_SENTINEL
} ;
eo_class_funcs_set ( klass , func_desc ) ;
2013-02-09 23:52:31 -08:00
2013-11-07 03:44:22 -08:00
evas_smart_legacy_type_register ( MY_CLASS_NAME_LEGACY , klass ) ;
2012-11-25 22:32:53 -08:00
}
static const Eo_Op_Description op_desc [ ] = {
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ASPECT_FIXED_SET , " Set whether the original aspect ratio of the image should be kept on resize. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ASPECT_FIXED_GET , " Get if the object retains the original aspect ratio. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_EDITABLE_SET , " Make the image 'editable'. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_EDITABLE_GET , " Check if the image is 'editable'. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_FILE_SET , " Set the file that will be used as the image's source. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_FILE_GET , " Get the file that will be used as image. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SIZING_EVAL , " 'Virtual' function on evalutating the object's final geometry. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_SCALE_SET , " 'Virtual' function on setting whether the object's image should be scaled smoothly or not. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_SCALE_GET , " 'Virtual' function on retrieving whether the object's image is to scaled smoothly or not. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_FILL_INSIDE_SET , " 'Virtual' function on how to resize the object's internal image, when maintaining a given aspect ratio -- leave blank spaces or scale to fill all space, with pixels out of bounds. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_FILL_INSIDE_GET , " 'Virtual' function on retrieving how the object's internal image is to be resized, when maintaining a given aspect ratio. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_FILL_OUTSIDE_SET , " Set if the image fills the entire object area, when keeping the aspect ratio. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_FILL_OUTSIDE_GET , " Get if the object is filled outside. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_OBJECT_GET , " Get the inlined image object of the image widget. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_SET , " 'Virtual' function on setting the object's image loading size (in pixels, applied to both axis). " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_LOAD_SIZE_GET , " 'Virtual' function on retrieving the object's image loading size. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_MEMFILE_SET , " Set a location in memory to be used as an image object's source bitmap. " ) ,
2013-11-03 19:17:42 -08:00
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_MMAP_SET , " Set an Eina_File to be used as an image object's source bitmap. " ) ,
2012-11-25 22:32:53 -08:00
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ORIENT_SET , " Set the image orientation. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ORIENT_GET , " Get the image orientation. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_PRELOAD_DISABLED_SET , " Enable or disable preloading of the image. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_DOWN_SET , " 'Virtual' function on setting whether the object's image can be resized to a size smaller than the original one. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_DOWN_GET , " 'Virtual' function on retrieving whether the object's image can be resized to a size smaller than the original one. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_UP_SET , " 'Virtual' function on setting whether the object's image can be resized to a size greater than the original one. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_RESIZE_UP_GET , " 'Virtual' function on retrieving whether the object's image can be resized to a size greater than the original one. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SCALE_SET , " 'Virtual' function on setting the scale for the object's image size. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SCALE_GET , " 'Virtual' function on retrieving the scale for the object's image size. " ) ,
2013-08-21 13:23:44 -07:00
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_OBJECT_SIZE_GET , " Get the current size of the image. " ) ,
2012-11-25 22:32:53 -08:00
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_SET , " Set the smooth effect for an image. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_SMOOTH_GET , " Get the smooth effect for an image. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_NO_SCALE_SET , " Disable scaling of this object. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_NO_SCALE_GET , " Get whether scaling is disabled on the object. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_RESIZABLE_SET , " Set if the object is (up/down) resizable. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_RESIZABLE_GET , " Get if the object is (up/down) resizable. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_AVAILABLE_GET , " Get whether an image object supports animation or not. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_SET , " Set whether an image object (which supports animation) is to animate itself or not. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_GET , " Get whether an image object has animation enabled or not. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_PLAY_SET , " Start or stop an image object's animation. " ) ,
EO_OP_DESCRIPTION ( ELM_OBJ_IMAGE_SUB_ID_ANIMATED_PLAY_GET , " Get whether an image object is under animation or not. " ) ,
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_IMAGE_BASE_ID , op_desc , ELM_OBJ_IMAGE_SUB_ID_LAST ) ,
NULL ,
sizeof ( Elm_Image_Smart_Data ) ,
_class_constructor ,
NULL
} ;
EO_DEFINE_CLASS ( elm_obj_image_class_get , & class_desc , ELM_OBJ_WIDGET_CLASS , EVAS_SMART_CLICKABLE_INTERFACE , NULL ) ;