summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2012-04-19 06:52:42 +0000
committerDaniel Juyung Seo <seojuyung2@gmail.com>2012-04-19 06:52:42 +0000
commit9266750afed2c2df3bf51ac926b377834285584a (patch)
treed7448936bd156a5ca189c86cffbc6a9f04dc33e4 /src/bin
parentef5af6941cfe3127c2f66698bfa39c4d49c49b3a (diff)
elm test_list.c: Revised code.
SVN revision: 70317
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_list.c165
1 files changed, 81 insertions, 84 deletions
diff --git a/src/bin/test_list.c b/src/bin/test_list.c
index 930e303f8..b0578152f 100644
--- a/src/bin/test_list.c
+++ b/src/bin/test_list.c
@@ -704,84 +704,6 @@ _bt_clicked(void *data __UNUSED__,
704} 704}
705 705
706static void 706static void
707_first_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
708 void *event_info __UNUSED__)
709{
710 char str[128];
711 Evas_Object *li = (Evas_Object *) data;
712 Evas_Object *lb;
713
714 Elm_Object_Item *lit = elm_list_first_item_get(li);
715 if (!lit) return;
716 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
717 elm_list_item_bring_in(lit);
718 elm_list_item_selected_set(lit, EINA_TRUE);
719
720 lb = evas_object_data_get(li, "label");
721 elm_object_text_set(lb, str);
722}
723
724static void
725_prev_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
726 void *event_info __UNUSED__)
727{
728 char str[128];
729 Evas_Object *li = (Evas_Object *) data;
730 Evas_Object *lb;
731
732 Elm_Object_Item *lit = elm_list_selected_item_get(li);
733 if (!lit) return;
734 lit = elm_list_item_prev(lit);
735 if (!lit) return;
736
737 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
738 elm_list_item_bring_in(lit);
739 elm_list_item_selected_set(lit, EINA_TRUE);
740
741 lb = evas_object_data_get(li, "label");
742 elm_object_text_set(lb, str);
743}
744
745static void
746_next_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
747 void *event_info __UNUSED__)
748{
749 char str[128];
750 Evas_Object *li = (Evas_Object *) data;
751 Evas_Object *lb;
752
753 Elm_Object_Item *lit = elm_list_selected_item_get(li);
754 if (!lit) return;
755 lit = elm_list_item_next(lit);
756 if (!lit) return;
757
758 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
759 elm_list_item_bring_in(lit);
760 elm_list_item_selected_set(lit, EINA_TRUE);
761
762 lb = evas_object_data_get(li, "label");
763 elm_object_text_set(lb, str);
764}
765
766static void
767_last_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
768 void *event_info __UNUSED__)
769{
770 char str[128];
771 Evas_Object *li = (Evas_Object *) data;
772 Evas_Object *lb;
773
774 Elm_Object_Item *lit = elm_list_last_item_get(li);
775 if (!lit) return;
776 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
777 elm_list_item_bring_in(lit);
778 elm_list_item_selected_set(lit, EINA_TRUE);
779
780 lb = evas_object_data_get(li, "label");
781 elm_object_text_set(lb, str);
782}
783
784static void
785_it_clicked(void *data, Evas_Object *obj __UNUSED__, 707_it_clicked(void *data, Evas_Object *obj __UNUSED__,
786 void *event_info __UNUSED__) 708 void *event_info __UNUSED__)
787{ 709{
@@ -1108,12 +1030,87 @@ test_list5(void *data __UNUSED__,
1108 evas_object_show(win); 1030 evas_object_show(win);
1109} 1031}
1110 1032
1033static void
1034_first_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1035 void *event_info __UNUSED__)
1036{
1037 char str[128];
1038 Evas_Object *li = data, *lb;
1039 Elm_Object_Item *lit = elm_list_first_item_get(li);
1040 if (!lit) return;
1041
1042 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1043 elm_list_item_bring_in(lit);
1044 elm_list_item_selected_set(lit, EINA_TRUE);
1045
1046 lb = evas_object_data_get(li, "label");
1047 elm_object_text_set(lb, str);
1048}
1049
1050static void
1051_prev_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1052 void *event_info __UNUSED__)
1053{
1054 char str[128];
1055 Evas_Object *li = data, *lb;
1056
1057 Elm_Object_Item *lit = elm_list_selected_item_get(li);
1058 if (!lit) return;
1059 lit = elm_list_item_prev(lit);
1060 if (!lit) return;
1061
1062 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1063 elm_list_item_bring_in(lit);
1064 elm_list_item_selected_set(lit, EINA_TRUE);
1065
1066 lb = evas_object_data_get(li, "label");
1067 elm_object_text_set(lb, str);
1068}
1069
1070static void
1071_next_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1072 void *event_info __UNUSED__)
1073{
1074 char str[128];
1075 Evas_Object *li = data, *lb;
1076
1077 Elm_Object_Item *lit = elm_list_selected_item_get(li);
1078 if (!lit) return;
1079 lit = elm_list_item_next(lit);
1080 if (!lit) return;
1081
1082 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1083 elm_list_item_bring_in(lit);
1084 elm_list_item_selected_set(lit, EINA_TRUE);
1085
1086 lb = evas_object_data_get(li, "label");
1087 elm_object_text_set(lb, str);
1088}
1089
1090static void
1091_last_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
1092 void *event_info __UNUSED__)
1093{
1094 char str[128];
1095 Evas_Object *li = data, *lb;
1096 Elm_Object_Item *lit = elm_list_last_item_get(li);
1097 if (!lit) return;
1098
1099 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
1100 elm_list_item_bring_in(lit);
1101 elm_list_item_selected_set(lit, EINA_TRUE);
1102
1103 lb = evas_object_data_get(li, "label");
1104 elm_object_text_set(lb, str);
1105}
1106
1111void 1107void
1112test_list6(void *data __UNUSED__, 1108test_list6(void *data __UNUSED__,
1113 Evas_Object *obj __UNUSED__, 1109 Evas_Object *obj __UNUSED__,
1114 void *event_info __UNUSED__) 1110 void *event_info __UNUSED__)
1115{ 1111{
1116 Evas_Object *win, *gd, *bt, *li, *lb; 1112 Evas_Object *win, *gd, *bt, *li, *lb;
1113
1117 win = elm_win_util_standard_add("list6", "List 6"); 1114 win = elm_win_util_standard_add("list6", "List 6");
1118 elm_win_autodel_set(win, EINA_TRUE); 1115 elm_win_autodel_set(win, EINA_TRUE);
1119 1116
@@ -1125,7 +1122,7 @@ test_list6(void *data __UNUSED__,
1125 li = elm_list_add(win); 1122 li = elm_list_add(win);
1126 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1123 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1127 elm_list_mode_set(li, ELM_LIST_COMPRESS); 1124 elm_list_mode_set(li, ELM_LIST_COMPRESS);
1128 elm_grid_pack(gd, li, 4, 4, 92, 72); 1125 elm_grid_pack(gd, li, 4, 4, 92, 72);
1129 evas_object_show(li); 1126 evas_object_show(li);
1130 1127
1131 elm_list_item_append(li, "Eina", NULL, NULL, _it_clicked, li); 1128 elm_list_item_append(li, "Eina", NULL, NULL, _it_clicked, li);
@@ -1146,30 +1143,30 @@ test_list6(void *data __UNUSED__,
1146 bt = elm_button_add(win); 1143 bt = elm_button_add(win);
1147 elm_object_text_set(bt, "First"); 1144 elm_object_text_set(bt, "First");
1148 evas_object_smart_callback_add(bt, "clicked", _first_bt_clicked, li); 1145 evas_object_smart_callback_add(bt, "clicked", _first_bt_clicked, li);
1149 elm_grid_pack(gd, bt, 4, 80, 20, 10); 1146 elm_grid_pack(gd, bt, 4, 80, 20, 10);
1150 evas_object_show(bt); 1147 evas_object_show(bt);
1151 1148
1152 bt = elm_button_add(win); 1149 bt = elm_button_add(win);
1153 elm_object_text_set(bt, "Prev"); 1150 elm_object_text_set(bt, "Prev");
1154 evas_object_smart_callback_add(bt, "clicked", _prev_bt_clicked, li); 1151 evas_object_smart_callback_add(bt, "clicked", _prev_bt_clicked, li);
1155 elm_grid_pack(gd, bt, 28, 80, 20, 10); 1152 elm_grid_pack(gd, bt, 28, 80, 20, 10);
1156 evas_object_show(bt); 1153 evas_object_show(bt);
1157 1154
1158 bt = elm_button_add(win); 1155 bt = elm_button_add(win);
1159 elm_object_text_set(bt, "Next"); 1156 elm_object_text_set(bt, "Next");
1160 evas_object_smart_callback_add(bt, "clicked", _next_bt_clicked, li); 1157 evas_object_smart_callback_add(bt, "clicked", _next_bt_clicked, li);
1161 elm_grid_pack(gd, bt, 52, 80, 20, 10); 1158 elm_grid_pack(gd, bt, 52, 80, 20, 10);
1162 evas_object_show(bt); 1159 evas_object_show(bt);
1163 1160
1164 bt = elm_button_add(win); 1161 bt = elm_button_add(win);
1165 elm_object_text_set(bt, "Last"); 1162 elm_object_text_set(bt, "Last");
1166 evas_object_smart_callback_add(bt, "clicked", _last_bt_clicked, li); 1163 evas_object_smart_callback_add(bt, "clicked", _last_bt_clicked, li);
1167 elm_grid_pack(gd, bt, 76, 80, 20, 10); 1164 elm_grid_pack(gd, bt, 76, 80, 20, 10);
1168 evas_object_show(bt); 1165 evas_object_show(bt);
1169 1166
1170 lb = elm_label_add(win); 1167 lb = elm_label_add(win);
1171 elm_object_text_set(lb, "Nothing is selected"); 1168 elm_object_text_set(lb, "Nothing is selected");
1172 elm_grid_pack(gd, lb, 4, 90, 92, 10); 1169 elm_grid_pack(gd, lb, 4, 90, 92, 10);
1173 evas_object_show(lb); 1170 evas_object_show(lb);
1174 1171
1175 evas_object_data_set(li, "label", lb); 1172 evas_object_data_set(li, "label", lb);