summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2015-08-03 22:55:51 +0530
committerAmitesh Singh <amitesh.sh@samsung.com>2015-08-03 22:55:51 +0530
commit8cac65ec7e0e8cc8feb11b8e5ac6e0340ee8511a (patch)
treee171571eb0b5f3123a0f262f459d42fe8984201e
parent904de9707ecd09bb90bd0bd2897894182f4fc676 (diff)
test_popup: add popup with content area only example
-rw-r--r--src/bin/test_popup.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/src/bin/test_popup.c b/src/bin/test_popup.c
index b91954571..32712ac47 100644
--- a/src/bin/test_popup.c
+++ b/src/bin/test_popup.c
@@ -678,10 +678,9 @@ _popup_center_title_genlist_content_1button_cb(void *data, Evas_Object *obj EINA
678 evas_object_show(popup); 678 evas_object_show(popup);
679} 679}
680 680
681
682static void 681static void
683_subpopup_cb(void *data, Evas_Object *obj EINA_UNUSED, 682_subpopup_cb(void *data, Evas_Object *obj EINA_UNUSED,
684 void *event_info EINA_UNUSED) 683 void *event_info EINA_UNUSED)
685{ 684{
686 Evas_Object *popup; 685 Evas_Object *popup;
687 Evas_Object *btn, *btnclose; 686 Evas_Object *btn, *btnclose;
@@ -714,6 +713,60 @@ _subpopup_cb(void *data, Evas_Object *obj EINA_UNUSED,
714} 713}
715 714
716static void 715static void
716_popup_content_only_cb(void *data, Evas_Object *obj EINA_UNUSED,
717 void *event_info EINA_UNUSED)
718{
719 Evas_Object *popup, *bx, *hbx, *lbl, *btn;
720 Evas_Object *win = data;
721
722 popup = elm_popup_add(win);
723
724 bx = elm_box_add(popup);
725 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
726 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
727 elm_object_content_set(popup, bx);
728
729 lbl = elm_label_add(popup);
730 elm_object_text_set(lbl,
731 "<align=center>This popup contains content area only.<br>"
732 "The buttons below are the part of content area, not action area");
733 evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
734 evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, 0.0);
735 elm_box_pack_end(bx, lbl);
736 evas_object_show(lbl);
737
738 hbx = elm_box_add(bx);
739 elm_box_horizontal_set(hbx, EINA_TRUE);
740 evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
741 evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, 0.0);
742 elm_box_pack_end(bx, hbx);
743 evas_object_show(hbx);
744
745 btn = elm_button_add(hbx);
746 elm_object_text_set(btn, "Save");
747 evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup);
748 elm_box_pack_end(hbx, btn);
749 evas_object_show(btn);
750
751 btn = elm_button_add(hbx);
752 elm_object_text_set(btn, "Discard");
753 evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup);
754 elm_box_pack_end(hbx, btn);
755 evas_object_show(btn);
756
757 btn = elm_button_add(hbx);
758 elm_object_text_set(btn, "Cancel");
759 evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup);
760 elm_box_pack_end(hbx, btn);
761 evas_object_show(btn);
762
763 // popup show should be called after adding all the contents and the buttons
764 // of popup to set the focus into popup's contents correctly.
765 evas_object_show(popup);
766 elm_object_focus_set(btn, EINA_TRUE);
767}
768
769static void
717_focus_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 770_focus_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
718{ 771{
719 Eina_Bool check = elm_check_state_get(obj); 772 Eina_Bool check = elm_check_state_get(obj);
@@ -782,6 +835,9 @@ test_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
782 elm_list_item_append(list, "subpopup + X button", 835 elm_list_item_append(list, "subpopup + X button",
783 NULL, NULL, _subpopup_cb, 836 NULL, NULL, _subpopup_cb,
784 win); 837 win);
838 elm_list_item_append(list, "popup with content only",
839 NULL, NULL, _popup_content_only_cb,
840 win);
785 elm_list_go(list); 841 elm_list_go(list);
786 evas_object_show(list); 842 evas_object_show(list);
787 843