summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-02-03 01:24:11 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-02-03 01:26:06 +0900
commit1977c8fca3d3687a5dc5d17918d72bb1af21b31e (patch)
treee38c473439f5da4c456fe8b282b51c433f968f89
parent844524a817cb687c3e81a9a10341d60b329ff317 (diff)
test_focus: Internal refactoring of focus tests.
- Moved focus2, focus3 from test_focus2.c to test_focus.c - Renamed "Focus 3" to "Focus Hide/Del". - Renamed "Focus Custom" to "Focus Style" - Renamed test_focus3.c to test_focus_custom_chain.c
-rw-r--r--data/objects/Makefile.am10
-rw-r--r--data/objects/test_focus_style.edc (renamed from data/objects/test_focus_custom.edc)0
-rw-r--r--src/bin/Makefile.am4
-rw-r--r--src/bin/test.c12
-rw-r--r--src/bin/test_focus.c252
-rw-r--r--src/bin/test_focus_custom_chain.c (renamed from src/bin/test_focus3.c)218
-rw-r--r--src/bin/test_focus_style.c116
7 files changed, 382 insertions, 230 deletions
diff --git a/data/objects/Makefile.am b/data/objects/Makefile.am
index 7fde81eb2..35bbf1cd4 100644
--- a/data/objects/Makefile.am
+++ b/data/objects/Makefile.am
@@ -7,7 +7,7 @@ EDJE_CC_FLAGS += -id $(top_srcdir)/data/objects -fd $(top_srcdir)/data/objects
7 7
8filesdir = $(datadir)/elementary/objects 8filesdir = $(datadir)/elementary/objects
9 9
10files_DATA = test.edj test_external.edj multip.edj cursors.edj font_preview.edj postit_ent.edj multibuttonentry.edj test_prefs.edj test_prefs.epb test_focus_custom.edj 10files_DATA = test.edj test_external.edj multip.edj cursors.edj font_preview.edj postit_ent.edj multibuttonentry.edj test_prefs.edj test_prefs.epb test_focus_style.edj
11 11
12EXTRA_DIST = \ 12EXTRA_DIST = \
13test.edc \ 13test.edc \
@@ -19,7 +19,7 @@ cursors.edc \
19font_preview.edc \ 19font_preview.edc \
20postit_ent.edc \ 20postit_ent.edc \
21multibuttonentry.edc \ 21multibuttonentry.edc \
22test_focus_custom.edc \ 22test_focus_style.edc \
23over.png \ 23over.png \
24under.png \ 24under.png \
25sky.jpg \ 25sky.jpg \
@@ -81,10 +81,10 @@ test_prefs.epb: Makefile test_prefs.epc
81 $(top_srcdir)/data/objects/test_prefs.epc \ 81 $(top_srcdir)/data/objects/test_prefs.epc \
82 $(top_builddir)/data/objects/test_prefs.epb 82 $(top_builddir)/data/objects/test_prefs.epb
83 83
84test_focus_custom.edj: Makefile test_focus_custom.edc 84test_focus_style.edj: Makefile test_focus_style.edc
85 $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) \ 85 $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) \
86 $(top_srcdir)/data/objects/test_focus_custom.edc \ 86 $(top_srcdir)/data/objects/test_focus_style.edc \
87 $(top_builddir)/data/objects/test_focus_custom.edj 87 $(top_builddir)/data/objects/test_focus_style.edj
88 88
89clean-local: 89clean-local:
90 rm -f *.edj 90 rm -f *.edj
diff --git a/data/objects/test_focus_custom.edc b/data/objects/test_focus_style.edc
index caa4d9c30..caa4d9c30 100644
--- a/data/objects/test_focus_custom.edc
+++ b/data/objects/test_focus_style.edc
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 46f35f0de..312b23c11 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -73,8 +73,8 @@ test_flip_page.c \
73test_flipselector.c \ 73test_flipselector.c \
74test_floating.c \ 74test_floating.c \
75test_focus.c \ 75test_focus.c \
76test_focus2.c \ 76test_focus_custom_chain.c \
77test_focus3.c \ 77test_focus_style.c \
78test_gengrid.c \ 78test_gengrid.c \
79test_genlist.c \ 79test_genlist.c \
80test_gesture_layer.c \ 80test_gesture_layer.c \
diff --git a/src/bin/test.c b/src/bin/test.c
index 6de3df841..4c9e790f4 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -185,9 +185,9 @@ void test_cursor3(void *data, Evas_Object *obj, void *event_info);
185void test_cursor4(void *data, Evas_Object *obj, void *event_info); 185void test_cursor4(void *data, Evas_Object *obj, void *event_info);
186void test_focus(void *data, Evas_Object *obj, void *event_info); 186void test_focus(void *data, Evas_Object *obj, void *event_info);
187void test_focus2(void *data, Evas_Object *obj, void *event_info); 187void test_focus2(void *data, Evas_Object *obj, void *event_info);
188void test_focus3(void *data, Evas_Object *obj, void *event_info); 188void test_focus_hide_del(void *data, Evas_Object *obj, void *event_info);
189void test_focus4(void *data, Evas_Object *obj, void *event_info); 189void test_focus_custom_chain(void *data, Evas_Object *obj, void *event_info);
190void test_focus_custom(void *data, Evas_Object *obj, void *event_info); 190void test_focus_style(void *data, Evas_Object *obj, void *event_info);
191void test_flipselector(void *data, Evas_Object *obj, void *event_info); 191void test_flipselector(void *data, Evas_Object *obj, void *event_info);
192void test_diskselector(void *data, Evas_Object *obj, void *event_info); 192void test_diskselector(void *data, Evas_Object *obj, void *event_info);
193void test_colorselector(void *data, Evas_Object *obj, void *event_info); 193void test_colorselector(void *data, Evas_Object *obj, void *event_info);
@@ -750,9 +750,9 @@ add_tests:
750 //------------------------------// 750 //------------------------------//
751 ADD_TEST(NULL, "Focus", "Focus", test_focus); 751 ADD_TEST(NULL, "Focus", "Focus", test_focus);
752 ADD_TEST(NULL, "Focus", "Focus 2", test_focus2); 752 ADD_TEST(NULL, "Focus", "Focus 2", test_focus2);
753 ADD_TEST(NULL, "Focus", "Focus 3", test_focus3); 753 ADD_TEST(NULL, "Focus", "Focus Hide/Del", test_focus_hide_del);
754 ADD_TEST(NULL, "Focus", "Focus 4", test_focus4); 754 ADD_TEST(NULL, "Focus", "Focus Custom Chain", test_focus_custom_chain);
755 ADD_TEST(NULL, "Focus", "Focus Custom", test_focus_custom); 755 ADD_TEST(NULL, "Focus", "Focus Style", test_focus_style);
756 756
757 //------------------------------// 757 //------------------------------//
758 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe); 758 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
diff --git a/src/bin/test_focus.c b/src/bin/test_focus.c
index ba78e03e5..4bdbf6592 100644
--- a/src/bin/test_focus.c
+++ b/src/bin/test_focus.c
@@ -1,9 +1,10 @@
1/* Test for Focus Chain Linear*/
2#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
3# include "elementary_config.h" 2# include "elementary_config.h"
4#endif 3#endif
5#include <Elementary.h> 4#include <Elementary.h>
6 5
6/**** focus 1 ****/
7
7static Eina_Bool 8static Eina_Bool
8_event(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) 9_event(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info)
9{ 10{
@@ -409,3 +410,252 @@ test_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
409 } 410 }
410 } 411 }
411} 412}
413
414/**** focus 2 ****/
415
416static void
417_focus_in(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info)
418{
419 const char *type = evas_object_type_get(event_info);
420 if ((type) && (!strcmp(type, "elm_widget")))
421 type = elm_object_widget_type_get(event_info);
422 printf("Evas_Object focus in: %p %s\n", event_info, type);
423}
424
425static void
426_focus_out(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info)
427{
428 const char *type = evas_object_type_get(event_info);
429 if ((type) && (!strcmp(type, "elm_widget")))
430 type = elm_object_widget_type_get(event_info);
431 printf("Evas_Object focus out: %p %s\n", event_info, type);
432}
433
434static void
435_focus_obj(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
436{
437 Evas_Object *newfocus = data;
438 const char *type = evas_object_type_get(newfocus);
439 if ((type) && (!strcmp(type, "elm_widget")))
440 type = elm_object_widget_type_get(newfocus);
441 printf("elm_object_focus_set(%p, EINA_TRUE) %s\n", newfocus, type);
442 elm_object_focus_set(newfocus, EINA_TRUE);
443}
444
445static void
446_focus_layout_part(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
447{
448 Evas_Object *ed = elm_layout_edje_get(data);
449
450 Evas_Object *newfocus = (Evas_Object *)edje_object_part_object_get(ed, "sky");
451 const char *type = evas_object_type_get(newfocus);
452 printf("evas_object_focus_set(%p, EINA_TRUE) %s\n", newfocus, type);
453 evas_object_focus_set(newfocus, EINA_TRUE);;
454}
455
456void
457test_focus2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
458{
459 Evas_Object *win, *bx, *ly, *bt, *en, *en1, *bt1, *bt2;
460 char buf[PATH_MAX];
461
462 win = elm_win_util_standard_add("focus2", "Focus 2");
463 elm_win_autodel_set(win, EINA_TRUE);
464 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
465
466 evas_event_callback_add
467 (evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
468 _focus_in, NULL);
469 evas_event_callback_add
470 (evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
471 _focus_out, NULL);
472
473 bx = elm_box_add(win);
474 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
475 elm_win_resize_object_add(win, bx);
476 evas_object_show(bx);
477
478#define PARENT bx /* this is broken, but should work */
479//#define PARENT win
480
481 en = elm_entry_add(PARENT);
482 elm_entry_scrollable_set(en, EINA_TRUE);
483 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
484 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
485 elm_scroller_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
486 elm_object_text_set(en, "Entry that should get focus");
487 elm_entry_single_line_set(en, EINA_TRUE);
488 evas_object_show(en);
489 elm_box_pack_end(bx, en);
490
491 bt = elm_button_add(PARENT);
492 elm_object_text_set(bt, "Give focus to entry");
493 evas_object_smart_callback_add(bt, "clicked", _focus_obj, en);
494 elm_box_pack_end(bx, bt);
495 evas_object_show(bt);
496
497 ly = elm_layout_add(PARENT);
498 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
499 elm_layout_file_set(ly, buf, "layout");
500 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
501 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
502 elm_box_pack_end(bx, ly);
503 evas_object_show(ly);
504
505 bt1 = bt = elm_button_add(ly);
506 elm_object_text_set(bt, "Button 1");
507 elm_object_part_content_set(ly, "element1", bt);
508
509 en1 = elm_entry_add(ly);
510 elm_entry_scrollable_set(en1, EINA_TRUE);
511 evas_object_size_hint_weight_set(en1, EVAS_HINT_EXPAND, 0.0);
512 evas_object_size_hint_align_set(en1, EVAS_HINT_FILL, 0.5);
513 elm_scroller_policy_set(en1, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
514 elm_object_text_set(en1, "Scrolled Entry that should get focus");
515 elm_entry_single_line_set(en1, EINA_TRUE);
516 elm_object_part_content_set(ly, "element2", en1);
517
518 bt = elm_button_add(ly);
519 elm_object_text_set(bt, "Button 2");
520 elm_object_part_content_set(ly, "element3", bt);
521
522 bt = elm_button_add(PARENT);
523 elm_object_text_set(bt, "Give focus to layout");
524 evas_object_smart_callback_add(bt, "clicked", _focus_obj, ly);
525 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
526 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
527 elm_box_pack_end(bx, bt);
528 evas_object_show(bt);
529
530 bt = elm_button_add(PARENT);
531 elm_object_text_set(bt, "Give focus to layout part");
532 evas_object_smart_callback_add(bt, "clicked", _focus_layout_part, ly);
533 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
534 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
535 elm_box_pack_end(bx, bt);
536 evas_object_show(bt);
537
538 bt = elm_button_add(PARENT);
539 elm_object_text_set(bt, "Give focus to layout 'Button 1'");
540 evas_object_smart_callback_add(bt, "clicked", _focus_obj, bt1);
541 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
542 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
543 elm_box_pack_end(bx, bt);
544 evas_object_show(bt);
545
546 bt2 = elm_button_add(PARENT);
547 elm_object_text_set(bt2, "Give focus to layout 'Entry'");
548 evas_object_smart_callback_add(bt2, "clicked", _focus_obj, en);
549 evas_object_size_hint_weight_set(bt2, EVAS_HINT_EXPAND, 0.0);
550 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, 0.5);
551 elm_box_pack_end(bx, bt2);
552 evas_object_show(bt2);
553
554 elm_object_focus_next_object_set(bt2, en, ELM_FOCUS_DOWN);
555
556 evas_object_resize(win, 400, 400);
557 evas_object_show(win);
558}
559
560/**** focus 3 ****/
561
562static Evas_Object *foc = NULL;
563
564static void
565_foc(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
566{
567 foc = obj;
568 printf("foc -> %p\n", foc);
569}
570
571static void
572_unfoc(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
573{
574 foc = NULL;
575 printf("foc -> %p\n", foc);
576}
577
578static void
579_add(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
580{
581 Evas_Object *bx = data, *en;
582
583 en = elm_entry_add(elm_object_top_widget_get(bx));
584 elm_entry_scrollable_set(en, EINA_TRUE);
585 elm_object_text_set(en, "An entry");
586 evas_object_smart_callback_add(en, "focused", _foc, NULL);
587 evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL);
588 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
589 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
590 elm_entry_single_line_set(en, EINA_TRUE);
591 elm_box_pack_start(bx, en);
592 evas_object_show(en);
593}
594
595static void
596_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
597{
598 if (foc) evas_object_del(foc);
599}
600
601static void
602_hide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
603{
604 if (foc) evas_object_hide(foc);
605}
606
607void
608test_focus_hide_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
609{
610 Evas_Object *win, *bx, *bt, *en;
611
612 win = elm_win_util_standard_add("focus-hide-del", "Focus Hide/Del");
613 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
614 elm_win_autodel_set(win, EINA_TRUE);
615
616 bx = elm_box_add(win);
617 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
618 elm_win_resize_object_add(win, bx);
619 evas_object_show(bx);
620
621 en = elm_entry_add(win);
622 elm_entry_scrollable_set(en, EINA_TRUE);
623 elm_object_text_set(en, "An entry");
624 evas_object_smart_callback_add(en, "focused", _foc, NULL);
625 evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL);
626 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
627 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
628 elm_entry_single_line_set(en, EINA_TRUE);
629 elm_box_pack_end(bx, en);
630 evas_object_show(en);
631
632 bt = elm_button_add(win);
633 elm_object_focus_allow_set(bt, EINA_FALSE);
634 elm_object_text_set(bt, "Add");
635 evas_object_smart_callback_add(bt, "clicked", _add, bx);
636 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
637 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
638 elm_box_pack_end(bx, bt);
639 evas_object_show(bt);
640
641 bt = elm_button_add(win);
642 elm_object_focus_allow_set(bt, EINA_FALSE);
643 elm_object_text_set(bt, "Del");
644 evas_object_smart_callback_add(bt, "clicked", _del, NULL);
645 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
646 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
647 elm_box_pack_end(bx, bt);
648 evas_object_show(bt);
649
650 bt = elm_button_add(win);
651 elm_object_focus_allow_set(bt, EINA_FALSE);
652 elm_object_text_set(bt, "Hide");
653 evas_object_smart_callback_add(bt, "clicked", _hide, NULL);
654 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
655 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
656 elm_box_pack_end(bx, bt);
657 evas_object_show(bt);
658
659 evas_object_resize(win, 320, 480);
660 evas_object_show(win);
661}
diff --git a/src/bin/test_focus3.c b/src/bin/test_focus_custom_chain.c
index 207327f4d..810303772 100644
--- a/src/bin/test_focus3.c
+++ b/src/bin/test_focus_custom_chain.c
@@ -1,110 +1,8 @@
1/* Test for Focus Chain Linear*/
2#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
3# include "elementary_config.h" 2# include "elementary_config.h"
4#endif 3#endif
5#include <Elementary.h> 4#include <Elementary.h>
6 5
7static Evas_Object *foc = NULL;
8
9static void
10_foc(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
11{
12 foc = obj;
13 printf("foc -> %p\n", foc);
14}
15
16static void
17_unfoc(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
18{
19 foc = NULL;
20 printf("foc -> %p\n", foc);
21}
22
23static void
24_add(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
25{
26 Evas_Object *bx = data, *en;
27
28 en = elm_entry_add(elm_object_top_widget_get(bx));
29 elm_entry_scrollable_set(en, EINA_TRUE);
30 elm_object_text_set(en, "An entry");
31 evas_object_smart_callback_add(en, "focused", _foc, NULL);
32 evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL);
33 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
34 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
35 elm_entry_single_line_set(en, EINA_TRUE);
36 elm_box_pack_start(bx, en);
37 evas_object_show(en);
38}
39
40static void
41_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
42{
43 if (foc) evas_object_del(foc);
44}
45
46static void
47_hide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
48{
49 if (foc) evas_object_hide(foc);
50}
51
52void
53test_focus3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
54{
55 Evas_Object *win, *bx, *bt, *en;
56
57 win = elm_win_util_standard_add("focus3", "Focus 3");
58 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
59 elm_win_autodel_set(win, EINA_TRUE);
60
61 bx = elm_box_add(win);
62 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63 elm_win_resize_object_add(win, bx);
64 evas_object_show(bx);
65
66 en = elm_entry_add(win);
67 elm_entry_scrollable_set(en, EINA_TRUE);
68 elm_object_text_set(en, "An entry");
69 evas_object_smart_callback_add(en, "focused", _foc, NULL);
70 evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL);
71 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
72 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
73 elm_entry_single_line_set(en, EINA_TRUE);
74 elm_box_pack_end(bx, en);
75 evas_object_show(en);
76
77 bt = elm_button_add(win);
78 elm_object_focus_allow_set(bt, EINA_FALSE);
79 elm_object_text_set(bt, "Add");
80 evas_object_smart_callback_add(bt, "clicked", _add, bx);
81 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
82 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
83 elm_box_pack_end(bx, bt);
84 evas_object_show(bt);
85
86 bt = elm_button_add(win);
87 elm_object_focus_allow_set(bt, EINA_FALSE);
88 elm_object_text_set(bt, "Del");
89 evas_object_smart_callback_add(bt, "clicked", _del, NULL);
90 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
91 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
92 elm_box_pack_end(bx, bt);
93 evas_object_show(bt);
94
95 bt = elm_button_add(win);
96 elm_object_focus_allow_set(bt, EINA_FALSE);
97 elm_object_text_set(bt, "Hide");
98 evas_object_smart_callback_add(bt, "clicked", _hide, NULL);
99 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
100 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
101 elm_box_pack_end(bx, bt);
102 evas_object_show(bt);
103
104 evas_object_resize(win, 320, 480);
105 evas_object_show(win);
106}
107
108static void 6static void
109highlight_enabled_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 7highlight_enabled_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
110{ 8{
@@ -206,7 +104,7 @@ create_win_bt_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
206} 104}
207 105
208void 106void
209test_focus4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 107test_focus_custom_chain(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
210{ 108{
211 Evas_Object *win, *fr, *bx, *bx2, *tg, *bt, *sp; 109 Evas_Object *win, *fr, *bx, *bx2, *tg, *bt, *sp;
212 Evas_Object *lb, *bt1, *bt2, *bt3, *bt4; 110 Evas_Object *lb, *bt1, *bt2, *bt3, *bt4;
@@ -215,7 +113,7 @@ test_focus4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
215 elm_config_focus_highlight_enabled_set(EINA_TRUE); 113 elm_config_focus_highlight_enabled_set(EINA_TRUE);
216 elm_config_focus_highlight_animate_set(EINA_TRUE); 114 elm_config_focus_highlight_animate_set(EINA_TRUE);
217 115
218 win = elm_win_util_standard_add("focus4", "Focus 4"); 116 win = elm_win_util_standard_add("focus-custom-chain", "Focus Custom Chain");
219 elm_win_autodel_set(win, EINA_TRUE); 117 elm_win_autodel_set(win, EINA_TRUE);
220 elm_win_focus_highlight_enabled_set(win, EINA_TRUE); 118 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
221 elm_win_focus_highlight_animate_set(win, EINA_TRUE); 119 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
@@ -343,115 +241,3 @@ test_focus4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
343 evas_object_resize(win, 320, 320); 241 evas_object_resize(win, 320, 320);
344 evas_object_show(win); 242 evas_object_show(win);
345} 243}
346
347static void
348glow_effect_on_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
349{
350 Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable");
351
352 if (elm_check_state_get(chk)) elm_win_focus_highlight_style_set(data, "glow_effect");
353}
354
355static void
356glow_effect_off_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
357{
358 Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable");
359
360 if (elm_check_state_get(chk)) elm_win_focus_highlight_style_set(data, "glow");
361}
362
363void
364test_focus_custom(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
365{
366 Evas_Object *win, *fr, *bx, *bx2, *bt, *spinner, *sp, *chk;
367 char win_focus_theme[PATH_MAX] = { 0 };
368
369 sprintf(win_focus_theme, "%s/objects/test_focus_custom.edj", elm_app_data_dir_get());
370
371 elm_theme_overlay_add(NULL, win_focus_theme);
372
373 win = elm_win_util_standard_add("focus_custom", "Focus Custom");
374 elm_win_autodel_set(win, EINA_TRUE);
375 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
376 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
377 elm_win_focus_highlight_style_set(win, "glow");
378
379 fr = elm_frame_add(win);
380 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
381 elm_win_resize_object_add(win, fr);
382 elm_object_style_set(fr, "pad_large");
383 evas_object_show(fr);
384
385 bx = elm_box_add(fr);
386 elm_object_content_set(fr, bx);
387 evas_object_show(bx);
388
389 chk = elm_check_add(bx);
390 evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
391 evas_object_size_hint_align_set(chk, EVAS_HINT_FILL, EVAS_HINT_FILL);
392 elm_object_text_set(chk, "Enable glow effect on \"Glow\" Button");
393 elm_check_state_set(chk, EINA_TRUE);
394 elm_box_pack_end(bx, chk);
395 evas_object_show(chk);
396
397 spinner = elm_spinner_add(bx);
398 evas_object_size_hint_weight_set(spinner, EVAS_HINT_EXPAND, 0.0);
399 evas_object_size_hint_align_set(spinner, EVAS_HINT_FILL, EVAS_HINT_FILL);
400 elm_box_pack_end(bx, spinner);
401 evas_object_show(spinner);
402
403 bt = elm_button_add(bx);
404 elm_object_text_set(bt, "Glow Button");
405 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
406 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
407 elm_box_pack_end(bx, bt);
408 evas_object_smart_callback_add(bt, "focused", glow_effect_on_cb, win);
409 evas_object_smart_callback_add(bt, "unfocused", glow_effect_off_cb, win);
410 evas_object_data_set(bt, "glow_is_enable", chk);
411 evas_object_show(bt);
412
413 sp = elm_separator_add(bx);
414 elm_separator_horizontal_set(sp, EINA_TRUE);
415 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
416 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, EVAS_HINT_FILL);
417 elm_box_pack_end(bx, sp);
418 evas_object_show(sp);
419
420 bx2 = elm_box_add(bx);
421 elm_box_horizontal_set(bx2, EINA_TRUE);
422 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
423 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
424 elm_box_pack_end(bx, bx2);
425 evas_object_show(bx2);
426
427 bt = elm_button_add(bx2);
428 elm_object_text_set(bt, "Button 1");
429 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
430 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
431 elm_box_pack_end(bx2, bt);
432 evas_object_show(bt);
433
434 bt = elm_button_add(bx2);
435 elm_object_text_set(bt, "Button 2");
436 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
437 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
438 elm_box_pack_end(bx2, bt);
439 evas_object_show(bt);
440
441 bt = elm_button_add(bx2);
442 elm_object_text_set(bt, "Button 3");
443 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
444 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
445 elm_box_pack_end(bx2, bt);
446 evas_object_show(bt);
447
448 bt = elm_button_add(bx2);
449 elm_object_text_set(bt, "Button 4");
450 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
451 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
452 elm_box_pack_end(bx2, bt);
453 evas_object_show(bt);
454
455 evas_object_resize(win, 320, 320);
456 evas_object_show(win);
457}
diff --git a/src/bin/test_focus_style.c b/src/bin/test_focus_style.c
new file mode 100644
index 000000000..7533c2c4d
--- /dev/null
+++ b/src/bin/test_focus_style.c
@@ -0,0 +1,116 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6static void
7glow_effect_on_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
8{
9 Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable");
10
11 if (elm_check_state_get(chk)) elm_win_focus_highlight_style_set(data, "glow_effect");
12}
13
14static void
15glow_effect_off_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
16{
17 Evas_Object *chk = evas_object_data_get(obj, "glow_is_enable");
18
19 if (elm_check_state_get(chk)) elm_win_focus_highlight_style_set(data, "glow");
20}
21
22void
23test_focus_style(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
24{
25 Evas_Object *win, *fr, *bx, *bx2, *bt, *spinner, *sp, *chk;
26 char win_focus_theme[PATH_MAX] = { 0 };
27
28 sprintf(win_focus_theme, "%s/objects/test_focus_style.edj", elm_app_data_dir_get());
29
30 elm_theme_overlay_add(NULL, win_focus_theme);
31
32 win = elm_win_util_standard_add("focus-style", "Focus Style");
33 elm_win_autodel_set(win, EINA_TRUE);
34 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
35 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
36 elm_win_focus_highlight_style_set(win, "glow");
37
38 fr = elm_frame_add(win);
39 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
40 elm_win_resize_object_add(win, fr);
41 elm_object_style_set(fr, "pad_large");
42 evas_object_show(fr);
43
44 bx = elm_box_add(fr);
45 elm_object_content_set(fr, bx);
46 evas_object_show(bx);
47
48 chk = elm_check_add(bx);
49 evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
50 evas_object_size_hint_align_set(chk, EVAS_HINT_FILL, EVAS_HINT_FILL);
51 elm_object_text_set(chk, "Enable glow effect on \"Glow\" Button");
52 elm_check_state_set(chk, EINA_TRUE);
53 elm_box_pack_end(bx, chk);
54 evas_object_show(chk);
55
56 spinner = elm_spinner_add(bx);
57 evas_object_size_hint_weight_set(spinner, EVAS_HINT_EXPAND, 0.0);
58 evas_object_size_hint_align_set(spinner, EVAS_HINT_FILL, EVAS_HINT_FILL);
59 elm_box_pack_end(bx, spinner);
60 evas_object_show(spinner);
61
62 bt = elm_button_add(bx);
63 elm_object_text_set(bt, "Glow Button");
64 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
65 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
66 elm_box_pack_end(bx, bt);
67 evas_object_smart_callback_add(bt, "focused", glow_effect_on_cb, win);
68 evas_object_smart_callback_add(bt, "unfocused", glow_effect_off_cb, win);
69 evas_object_data_set(bt, "glow_is_enable", chk);
70 evas_object_show(bt);
71
72 sp = elm_separator_add(bx);
73 elm_separator_horizontal_set(sp, EINA_TRUE);
74 evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
75 evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, EVAS_HINT_FILL);
76 elm_box_pack_end(bx, sp);
77 evas_object_show(sp);
78
79 bx2 = elm_box_add(bx);
80 elm_box_horizontal_set(bx2, EINA_TRUE);
81 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
83 elm_box_pack_end(bx, bx2);
84 evas_object_show(bx2);
85
86 bt = elm_button_add(bx2);
87 elm_object_text_set(bt, "Button 1");
88 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
89 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
90 elm_box_pack_end(bx2, bt);
91 evas_object_show(bt);
92
93 bt = elm_button_add(bx2);
94 elm_object_text_set(bt, "Button 2");
95 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
96 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
97 elm_box_pack_end(bx2, bt);
98 evas_object_show(bt);
99
100 bt = elm_button_add(bx2);
101 elm_object_text_set(bt, "Button 3");
102 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
103 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
104 elm_box_pack_end(bx2, bt);
105 evas_object_show(bt);
106
107 bt = elm_button_add(bx2);
108 elm_object_text_set(bt, "Button 4");
109 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
110 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
111 elm_box_pack_end(bx2, bt);
112 evas_object_show(bt);
113
114 evas_object_resize(win, 320, 320);
115 evas_object_show(win);
116}