From d991d01b83cb49442b5341859e3b0b59d43d0b21 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Thu, 5 Aug 2010 15:48:18 +0900 Subject: [PATCH] [Elementary.h.in] [elm_animatedicon.c] [elm_dayselector.c] [elm_transit.c] --- src/lib/Elementary.h.in | 3 +-- src/lib/elm_animatedicon.c | 34 +++++++++--------------- src/lib/elm_dayselector.c | 64 +++++++++++++++++++++++----------------------- src/lib/elm_transit.c | 47 ++++++++++++++++++++++++---------- 4 files changed, 78 insertions(+), 70 deletions(-) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 1a863d2..fe5b815 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2019,7 +2019,7 @@ extern "C" { EAPI Elm_Effect *elm_fx_resizable_flip_add(Evas_Object *front, Evas_Object *back, Elm_Fx_Flip_Axis axis, Eina_Bool cw); /* ImageAnimation Fx */ - EAPI Elm_Effect *elm_fx_imageanimation_add(Evas_Object *icon, const char** images, unsigned int img_cnt); + EAPI Elm_Effect *elm_fx_image_animation_add(Evas_Object *icon, const char** images, unsigned int img_cnt); /* NavigationBar */ typedef enum @@ -2475,7 +2475,6 @@ extern "C" { EAPI Evas_Object *elm_dayselector_add(Evas_Object *parent); EAPI Eina_Bool elm_dayselector_check_state_get(Evas_Object *obj, Elm_DaySelector_Day day); - EAPI void elm_dayselector_title_set(Evas_Object *parent, const char *title); /* WebView */ /* commented out until it is completed diff --git a/src/lib/elm_animatedicon.c b/src/lib/elm_animatedicon.c index 732d808..1430bbd 100644 --- a/src/lib/elm_animatedicon.c +++ b/src/lib/elm_animatedicon.c @@ -1,14 +1,5 @@ -/* - * SLP - * Copyright (c) 2009 Samsung Electronics, Inc. - * All rights reserved. - * - * This software is a confidential and proprietary information - * of Samsung Electronics, Inc. ("Confidential Information"). You - * shall not disclose such Confidential Information and shall use - * it only in accordance with the terms of the license agreement - * you entered into with Samsung Electronics. - */ +#include +#include "elm_priv.h" /** * @defgroup Animatedicon Animatedicon @@ -17,31 +8,30 @@ * This is an animatedicon. */ -#include -#include "elm_priv.h" - /** * internal data structure of animated icon object */ typedef struct _Widget_Data Widget_Data; -struct _Widget_Data { + +struct _Widget_Data +{ Evas_Object *base; Evas_Object *parent; Elm_Transit *transit; Evas_Object *icon; Ecore_Timer *timer; - char** images; - int item_num; + int img_cnt; double duration; unsigned int repeat; double interval; }; +static const char *widtype = NULL; + static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); static void _sizing_eval(Evas_Object *obj); - static void _resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -144,12 +134,12 @@ elm_animatedicon_add(Evas_Object *parent) * * @param obj animatedicon object. * @param images the image files to be animated. - * @param item_num the number of images. + * @param img_cnt the number of images. * * @ingroup Animatedicon */ EAPI void -elm_animatedicon_file_set(Evas_Object *obj, const char **images, const int item_num) +elm_animatedicon_file_set(Evas_Object *obj, const char **images, const int img_cnt) { Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -159,7 +149,7 @@ elm_animatedicon_file_set(Evas_Object *obj, const char **images, const int item_ } wd->images = (char **)images; - wd->item_num = item_num; + wd->img_cnt = img_cnt; elm_icon_file_set(wd->icon, wd->images[0], NULL); } @@ -194,7 +184,7 @@ elm_animatedicon_animation_start(Evas_Object *obj) if (!wd) return; wd->transit = elm_transit_add(wd->parent); - elm_transit_fx_insert(wd->transit, elm_fx_imageanimation_add(wd->icon, wd->images, wd->item_num)); + elm_transit_fx_insert(wd->transit, elm_fx_image_animation_add(wd->icon, wd->images, wd->img_cnt)); elm_transit_event_block_disabled_set(wd->transit, EINA_FALSE); if (wd->repeat >= 0) { elm_transit_repeat_set(wd->transit, wd->repeat); diff --git a/src/lib/elm_dayselector.c b/src/lib/elm_dayselector.c index b7fa443..3c63288 100644 --- a/src/lib/elm_dayselector.c +++ b/src/lib/elm_dayselector.c @@ -19,7 +19,6 @@ struct _Widget_Data { Evas_Object *parent; Evas_Object *base; - Evas_Object *title; Evas_Object *check[7]; }; @@ -44,13 +43,19 @@ _dayselector_resize(void *data, Evas *e, Evas_Object *obj, void *event_info) { _sizing_eval(obj); } - +*/ static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) { - _sizing_eval(obj); + Evas_Coord w, h; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_size_min_get(wd->base, &w, &h); + evas_object_size_hint_min_set(obj, w, h); + evas_object_resize(obj, w, h); } -*/ + static void _check_clicked(void *data, Evas_Object *obj, void *event_info) { @@ -74,28 +79,12 @@ _theme_hook(Evas_Object *obj) if(!wd) return; _elm_theme_object_set(obj, wd->base, "dayselector", "base", elm_widget_style_get(obj)); - _elm_theme_object_set(obj, wd->title, "label", "dayselector", "default"); for(idx=0; idx<7; ++idx) elm_object_style_set(wd->check[idx], "dayselector"); } -/** - * Set the title. - * - * @param obj Dayselector - * @param title title - * - * @ingroup Dayselector - */ -EAPI void -elm_dayselector_title_set(Evas_Object* obj, const char* title) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data* wd = (Widget_Data*) elm_widget_data_get(obj); - edje_object_part_text_set(wd->title, "elm.text", title); -} /** * Get the state of given check object. @@ -169,41 +158,52 @@ elm_dayselector_add(Evas_Object *parent) elm_object_style_set(wd->base, "dayselector"); elm_widget_resize_object_set(obj, wd->base); - //Title - wd->title = edje_object_add(e); - elm_widget_sub_object_add(obj, wd->title); - _elm_theme_object_set(obj, wd->title, "label", "dayselector", "default"); - edje_object_part_swallow(wd->base, "title", wd->title); - //Buttons - for(idx=0; idx<7; ++idx) + + //Left-side Button + wd->check[0]=elm_check_add(wd->base); + elm_widget_sub_object_add(obj, wd->check[0]); + evas_object_smart_callback_add(wd->check[0], "changed", _check_clicked, obj); + + for(idx=1; idx<6; ++idx) { wd->check[idx]=elm_check_add(wd->base); - elm_object_style_set(wd->check[idx], "dayselector"); elm_widget_sub_object_add(obj, wd->check[idx]); evas_object_smart_callback_add(wd->check[idx], "changed", _check_clicked, obj); } + //Right-side Button + wd->check[6]=elm_check_add(wd->base); + elm_widget_sub_object_add(obj, wd->check[6]); + evas_object_smart_callback_add(wd->check[6], "changed", _check_clicked, obj); + elm_check_label_set(wd->check[ELM_DAYSELECTOR_SUN], "S"); edje_object_part_swallow(wd->base, "sun", wd->check[0]); + elm_object_style_set(wd->check[0], "dayselector_sun"); elm_check_label_set(wd->check[ELM_DAYSELECTOR_MON], "M"); edje_object_part_swallow(wd->base, "mon", wd->check[1]); + elm_object_style_set(wd->check[1], "dayselector_mon"); elm_check_label_set(wd->check[ELM_DAYSELECTOR_TUE], "T"); edje_object_part_swallow(wd->base, "tue", wd->check[2]); + elm_object_style_set(wd->check[2], "dayselector_tue"); elm_check_label_set(wd->check[ELM_DAYSELECTOR_WED], "W"); edje_object_part_swallow(wd->base, "wed", wd->check[3]); + elm_object_style_set(wd->check[3], "dayselector_wed"); elm_check_label_set(wd->check[ELM_DAYSELECTOR_THU], "T"); edje_object_part_swallow(wd->base, "thu", wd->check[4]); + elm_object_style_set(wd->check[4], "dayselector_thu"); elm_check_label_set(wd->check[ELM_DAYSELECTOR_FRI], "F"); edje_object_part_swallow(wd->base, "fri", wd->check[5]); + elm_object_style_set(wd->check[5], "dayselector_fri"); elm_check_label_set(wd->check[ELM_DAYSELECTOR_SAT], "S"); edje_object_part_swallow(wd->base, "sat", wd->check[6]); -/* - evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _dayselector_resize, wd); + elm_object_style_set(wd->check[6], "dayselector_sat"); + +// evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _dayselector_resize, wd); evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); - _sizing_eval(obj); -*/ +// _sizing_eval(obj); + return obj; } diff --git a/src/lib/elm_transit.c b/src/lib/elm_transit.c index c5165ed..3536269 100644 --- a/src/lib/elm_transit.c +++ b/src/lib/elm_transit.c @@ -26,6 +26,7 @@ struct _effect void (*animation_op) (void *data, Elm_Animator *animator, double frame); void (*begin_op) (void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt); void (*end_op) (void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt); + void (*del_op) (void* data); unsigned int shared_cnt; void *user_data; }; @@ -151,6 +152,10 @@ _transit_fx_del(Elm_Effect *effect) if (effect->shared_cnt > 0) return; + + if(effect->del_op) + (*effect->del_op)(effect); + if (effect->user_data) free(effect->user_data); free(effect); @@ -1861,33 +1866,46 @@ elm_fx_rotation_add(Evas_Object *obj, float from_degree, float to_degree, // ImageAnimation FX ///////////////////////////////////////////////////////////////////////////////////// typedef struct _image_animation Elm_Fx_Image_Animation; -static void _elm_fx_imageanimation_op(void *data, Elm_Animator *animator, +static void _elm_fx_image_animation_begin(void *data, Eina_Bool auto_reverse, + unsigned int repeat_cnt); +static void _elm_fx_image_animation_op(void *data, Elm_Animator *animator, double frame); -EAPI Elm_Effect *elm_fx_imageanimation_add(Evas_Object *obj, const char **images, +EAPI Elm_Effect *elm_fx_image_animation_add(Evas_Object *obj, const char **images, unsigned int item_num); struct _image_animation { Evas_Object *obj; char **images; - int count; int img_cnt; }; + static void -_elm_fx_imageanimation_op(void *data, Elm_Animator *animator, double frame) +_elm_fx_image_animation_begin(void *data, Eina_Bool auto_reverse, + unsigned int repeat_cnt) { - Elm_Fx_Image_Animation *image_animation = (Elm_Fx_Image_Animation *) data; + Elm_Fx_Image_Animation *image_animation = data; + evas_object_show(image_animation->obj); +} - if (!image_animation->obj) - return; - image_animation->count = floor(frame * image_animation->img_cnt); + +static void +_elm_fx_image_animation_op(void *data, Elm_Animator *animator, double frame) +{ + Elm_Fx_Image_Animation *image_animation = (Elm_Fx_Image_Animation *) data; elm_icon_file_set(image_animation->obj, - image_animation->images[image_animation->count], NULL); + image_animation->images[ (int) floor(frame * image_animation->img_cnt) ], NULL); +} + +static void +_elm_fx_image_animation_del(void *data) +{ + fprintf(stderr, "image animation del!"); } /** - * Add ImageAnimation effect. + * Add image_animation effect. * * @param obj Icon object * @param images Array of image file path. @@ -1897,13 +1915,13 @@ _elm_fx_imageanimation_op(void *data, Elm_Animator *animator, double frame) * @ingroup Transit */ EAPI Elm_Effect * -elm_fx_imageanimation_add(Evas_Object *obj, const char **images, +elm_fx_image_animation_add(Evas_Object *obj, const char **images, unsigned int img_cnt) { Elm_Effect *effect; Elm_Fx_Image_Animation *image_animation; - if (!images || !(*images)) + if ((!obj) || !images || !(*images)) return NULL; effect = calloc(1, sizeof(Elm_Effect)); @@ -1920,10 +1938,11 @@ elm_fx_imageanimation_add(Evas_Object *obj, const char **images, image_animation->obj = obj; image_animation->images = (char **) images; - image_animation->count = 0; image_animation->img_cnt = img_cnt; - effect->animation_op = _elm_fx_imageanimation_op; + effect->begin_op = _elm_fx_image_animation_begin; + effect->animation_op = _elm_fx_image_animation_op; + effect->del_op = _elm_fx_image_animation_del; effect->user_data = image_animation; return effect; -- 2.7.4