fixed plugin image size problem
[framework/uifw/elementary.git] / src / bin / test_focus2.c
index 9a3532d..81042bd 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
 
 static void
@@ -29,8 +29,8 @@ _focus_obj(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
    const char *type = evas_object_type_get(newfocus);
    if ((type) && (!strcmp(type, "elm_widget")))
      type = elm_object_widget_type_get(newfocus);
-   printf("elm_object_focus(%p) %s\n", newfocus, type);
-   elm_object_focus(newfocus);
+   printf("elm_object_focus_set(%p, EINA_TRUE) %s\n", newfocus, type);
+   elm_object_focus_set(newfocus, EINA_TRUE);
 }
 
 static void
@@ -40,7 +40,7 @@ _focus_layout_part(void *data, Evas_Object *o __UNUSED__, void *event_info __UNU
 
    Evas_Object *newfocus = (Evas_Object *)edje_object_part_object_get(ed, "sky");
    const char *type = evas_object_type_get(newfocus);
-   printf("evas_object_focus_set(%p, 1) %s\n", newfocus, type);
+   printf("evas_object_focus_set(%p, EINA_TRUE) %s\n", newfocus, type);
    evas_object_focus_set(newfocus, EINA_TRUE);;
 }
 
@@ -48,11 +48,11 @@ _focus_layout_part(void *data, Evas_Object *o __UNUSED__, void *event_info __UNU
 void
 test_focus2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *bx, *ly, *bt, *en, *bt1;
+   Evas_Object *win, *bx, *ly, *bt, *en, *bt1;
+   char buf[PATH_MAX];
 
-   win = elm_win_add(NULL, "focus2", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Focus2");
-   elm_win_autodel_set(win, 1);
+   win = elm_win_util_standard_add("focus2", "Focus 2");
+   elm_win_autodel_set(win, EINA_TRUE);
    elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
 
    evas_event_callback_add
@@ -62,11 +62,6 @@ test_focus2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
      (evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
       _focus_out, NULL);
 
-   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);
    elm_win_resize_object_add(win, bx);
    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -80,19 +75,20 @@ test_focus2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
    elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
-   elm_entry_entry_set(en, "Scrolled Entry that should get focus");
-   elm_entry_single_line_set(en, 1);
+   elm_object_text_set(en, "Entry that should get focus");
+   elm_entry_single_line_set(en, EINA_TRUE);
    evas_object_show(en);
    elm_box_pack_end(bx, en);
 
    bt = elm_button_add(PARENT);
-   elm_object_text_set(bt, "Give focus to scrolled entry");
+   elm_object_text_set(bt, "Give focus to entry");
    evas_object_smart_callback_add(bt, "clicked", _focus_obj, en);
    elm_box_pack_end(bx, bt);
    evas_object_show(bt);
 
    ly = elm_layout_add(PARENT);
-   elm_layout_file_set(ly, PACKAGE_DATA_DIR"/objects/test.edj", "layout");
+   snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+   elm_layout_file_set(ly, buf, "layout");
    evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_box_pack_end(bx, ly);
@@ -100,20 +96,20 @@ test_focus2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
 
    bt1 = bt = elm_button_add(ly);
    elm_object_text_set(bt, "Button 1");
-   elm_layout_content_set(ly, "element1", bt);
+   elm_object_part_content_set(ly, "element1", bt);
 
    en = elm_entry_add(ly);
    elm_entry_scrollable_set(en, EINA_TRUE);
    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
    elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
-   elm_entry_entry_set(en, "Scrolled Entry that should get focus");
-   elm_entry_single_line_set(en, 1);
-   elm_layout_content_set(ly, "element2", en);
+   elm_object_text_set(en, "Scrolled Entry that should get focus");
+   elm_entry_single_line_set(en, EINA_TRUE);
+   elm_object_part_content_set(ly, "element2", en);
 
    bt = elm_button_add(ly);
    elm_object_text_set(bt, "Button 2");
-   elm_layout_content_set(ly, "element3", bt);
+   elm_object_part_content_set(ly, "element3", bt);
 
    bt = elm_button_add(PARENT);
    elm_object_text_set(bt, "Give focus to layout");