fixed plugin image size problem
[framework/uifw/elementary.git] / src / bin / test_transit.c
index 932f1dd..7596d01 100644 (file)
@@ -1,7 +1,7 @@
-#include <Elementary.h>
 #ifdef HAVE_CONFIG_H
 # include "elementary_config.h"
 #endif
+#include <Elementary.h>
 #ifndef ELM_LIB_QUICKLAUNCH
 
 typedef struct _Custom_Effect Custom_Effect;
@@ -39,7 +39,6 @@ _custom_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
 
    EINA_LIST_FOREACH(objs, elist, obj)
       evas_object_resize(obj, w, h);
-
 }
 
 static Elm_Transit_Effect *
@@ -79,7 +78,7 @@ _transit_rotation_translation_color(void *data __UNUSED__, Evas_Object *obj, voi
    elm_transit_effect_translation_add(trans, -70.0, -150.0, 70.0, 150.0);
 
    /* Color Effect */
-   elm_transit_effect_color_add(trans, 100, 255, 100, 255, 200, 50, 200, 50);
+   elm_transit_effect_color_add(trans, 100, 255, 100, 255, 50, 30, 50, 50);
 
    /* Rotation Effect */
    elm_transit_effect_rotation_add(trans, 0.0, 135.0);
@@ -106,6 +105,12 @@ _transit_wipe(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED
 }
 
 static void
+_transit_del_cb(void *data, Elm_Transit *transit __UNUSED__)
+{
+   evas_object_freeze_events_set(data, EINA_FALSE);
+}
+
+static void
 _transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Eina_List *images = NULL;
@@ -113,25 +118,26 @@ _transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_in
    Elm_Transit *trans;
    Evas_Object *ic = data;
 
-   snprintf(buf, sizeof(buf), "%s/images/icon_19.png", PACKAGE_DATA_DIR);
+   snprintf(buf, sizeof(buf), "%s/images/icon_19.png", elm_app_data_dir_get());
    images = eina_list_append(images, eina_stringshare_add(buf));
 
-   snprintf(buf, sizeof(buf), "%s/images/icon_00.png", PACKAGE_DATA_DIR);
+   snprintf(buf, sizeof(buf), "%s/images/icon_00.png", elm_app_data_dir_get());
    images = eina_list_append(images, eina_stringshare_add(buf));
 
-   snprintf(buf, sizeof(buf), "%s/images/icon_11.png", PACKAGE_DATA_DIR);
+   snprintf(buf, sizeof(buf), "%s/images/icon_11.png", elm_app_data_dir_get());
    images = eina_list_append(images, eina_stringshare_add(buf));
 
-   snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
+   snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
    images = eina_list_append(images, eina_stringshare_add(buf));
 
    trans = elm_transit_add();
+   elm_transit_del_cb_set(trans, _transit_del_cb, obj);
    elm_transit_object_add(trans, ic);
-
    elm_transit_effect_image_animation_add(trans, images);
-
    elm_transit_duration_set(trans, 5.0);
    elm_transit_go(trans);
+
+   evas_object_freeze_events_set(obj, EINA_TRUE);
 }
 
 static void
@@ -230,18 +236,12 @@ _transit_resizable_flip(void *data, Evas_Object *obj, void *event_info __UNUSED_
 void
 test_transit(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bx, *bt, *ic;
+   Evas_Object *win, *bx, *bt, *ic;
    char buf[PATH_MAX];
 
-   win = elm_win_add(NULL, "transit", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit");
+   win = elm_win_util_standard_add("transit", "Transit");
    elm_win_autodel_set(win, EINA_TRUE);
 
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
-
    bx = elm_box_add(win);
    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(win, bx);
@@ -249,13 +249,13 @@ test_transit(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
    evas_object_show(bx);
 
    ic = elm_icon_add(win);
-   snprintf(buf, sizeof(buf), "%s/images/icon_11.png", PACKAGE_DATA_DIR);
+   snprintf(buf, sizeof(buf), "%s/images/icon_11.png", elm_app_data_dir_get());
    elm_icon_file_set(ic, buf, NULL);
    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "ImageAnimation Effect");
-   elm_button_icon_set(bt, ic);
+   elm_object_part_content_set(bt, "icon", ic);
    elm_box_pack_end(bx, bt);
    evas_object_show(bt);
    evas_object_show(ic);
@@ -281,17 +281,10 @@ test_transit(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
 void
 test_transit2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt;
+   Evas_Object *win, *bt;
 
-   win = elm_win_add(NULL, "transit2", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 2");
+   win = elm_win_util_standard_add("transit2", "Transit 2");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Resizing Effect");
@@ -300,6 +293,7 @@ test_transit2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_resize(bt, 100, 50);
    evas_object_smart_callback_add(bt, "clicked", _transit_resizing, NULL);
 
+   evas_object_resize(win, 400, 400);
    evas_object_show(win);
 }
 
@@ -307,17 +301,10 @@ test_transit2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_transit3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt, *bt2;
+   Evas_Object *win, *bt, *bt2;
 
-   win = elm_win_add(NULL, "transit3", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 3");
+   win = elm_win_util_standard_add("transit3", "Transit 3");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Front Button - Flip Effect");
@@ -330,6 +317,7 @@ test_transit3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_move(bt2, 50, 50);
    evas_object_resize(bt2, 200, 200);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_flip, bt2);
@@ -340,17 +328,10 @@ test_transit3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt;
+   Evas_Object *win, *bt;
 
-   win = elm_win_add(NULL, "transit4", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 4");
+   win = elm_win_util_standard_add("transit4", "Transit 4");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Zoom Effect");
@@ -360,6 +341,7 @@ test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 
    evas_object_smart_callback_add(bt, "clicked", _transit_zoom, NULL);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 }
 
@@ -367,39 +349,36 @@ test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_transit5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt, *bt2, *ic;
+   Evas_Object *win, *bt, *bt2, *ic;
+   char buf[PATH_MAX];
 
-   win = elm_win_add(NULL, "transit5", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 5");
+   win = elm_win_util_standard_add("transit5", "Transit 5");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    ic = elm_icon_add(win);
-   elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_01.jpg", NULL);
+   snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
    evas_object_size_hint_max_set(ic, 50, 50);
 
    bt = elm_button_add(win);
-   elm_button_icon_set(bt, ic);
+   elm_object_part_content_set(bt, "icon", ic);
    elm_object_text_set(bt, "Before Button - Blend Effect");
    evas_object_move(bt, 25, 125);
    evas_object_resize(bt, 250, 50);
    evas_object_show(bt);
 
    ic = elm_icon_add(win);
-   elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_02.jpg", NULL);
+   snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
    evas_object_size_hint_max_set(ic, 50, 50);
 
    bt2 = elm_button_add(win);
-   elm_button_icon_set(bt2, ic);
+   elm_object_part_content_set(bt2, "icon", ic);
    elm_object_text_set(bt2, "After Button - Blend Effect");
    evas_object_move(bt2, 25, 125);
    evas_object_resize(bt2, 250, 50);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_blend, bt2);
@@ -410,39 +389,36 @@ test_transit5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_transit6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt, *bt2, *ic;
+   Evas_Object *win, *bt, *bt2, *ic;
+   char buf[PATH_MAX];
 
-   win = elm_win_add(NULL, "transit6", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 6");
+   win = elm_win_util_standard_add("transit6","Transit 6");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    ic = elm_icon_add(win);
-   elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_01.jpg", NULL);
+   snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
    evas_object_size_hint_max_set(ic, 50, 50);
 
    bt = elm_button_add(win);
-   elm_button_icon_set(bt, ic);
+   elm_object_part_content_set(bt, "icon", ic);
    elm_object_text_set(bt, "Before Button - Fade Effect");
    evas_object_move(bt, 25, 125);
    evas_object_resize(bt, 250, 50);
    evas_object_show(bt);
 
    ic = elm_icon_add(win);
-   elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_02.jpg", NULL);
+   snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
    evas_object_size_hint_max_set(ic, 50, 50);
 
    bt2 = elm_button_add(win);
-   elm_button_icon_set(bt2, ic);
+   elm_object_part_content_set(bt2, "icon", ic);
    elm_object_text_set(bt2, "After Button - Fade Effect");
    evas_object_move(bt2, 25, 125);
    evas_object_resize(bt2, 250, 50);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_fade, bt2);
@@ -453,17 +429,10 @@ test_transit6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_transit7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt, *bt2;
+   Evas_Object *win, *bt, *bt2;
 
-   win = elm_win_add(NULL, "transit7", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 7");
+   win = elm_win_util_standard_add("transit7", "Transit 7");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Front Button - Resizable Flip Effect");
@@ -476,6 +445,7 @@ test_transit7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_move(bt2, 50, 100);
    evas_object_resize(bt2, 300, 200);
 
+   evas_object_resize(win, 400, 400);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_resizable_flip, bt2);
@@ -486,20 +456,12 @@ test_transit7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 void
 test_transit8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt;
+   Evas_Object *win, *bt;
    Elm_Transit *trans;
    Elm_Transit_Effect *effect_context;
 
-   win = elm_win_add(NULL, "transit8", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 8");
+   win = elm_win_util_standard_add("transit8", "Transit 8");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
-   evas_object_show(win);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Button - Custom Effect");
@@ -519,25 +481,20 @@ test_transit8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    elm_transit_duration_set(trans, 5.0);
    elm_transit_repeat_times_set(trans, -1);
    elm_transit_go(trans);
+
+   evas_object_resize(win, 400, 400);
+   evas_object_show(win);
 }
 
 /* Chain Transit Effect */
 void
 test_transit9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bt, *bt2, *bt3, *bt4;
+   Evas_Object *win, *bt, *bt2, *bt3, *bt4;
    Elm_Transit *trans, *trans2, *trans3, *trans4;
 
-   win = elm_win_add(NULL, "transit9", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Transit 9");
+   win = elm_win_util_standard_add("transit9", "Transit 9");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
-   evas_object_show(win);
-
-   bg = elm_bg_add(win);
-   elm_win_resize_object_add(win, bg);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_show(bg);
 
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Chain 1");
@@ -594,7 +551,8 @@ test_transit9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    elm_transit_duration_set(trans4, 1);
    elm_transit_objects_final_state_keep_set(trans4, EINA_TRUE);
    elm_transit_chain_transit_add(trans3, trans4);
-}
-
 
+   evas_object_resize(win, 400, 400);
+   evas_object_show(win);
+}
 #endif