summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSanghyeon Lee <sh10233.lee@samsung.com>2013-12-02 15:52:35 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2013-12-05 16:30:42 +0900
commit6ad064cfe2b20f3ca77777e8333d73c836a4024e (patch)
treee27320eb5edc2d9d6f73d0921af79a914aa9d616 /src
parent5068ced34874cf7f222c7f59043156a73090f25c (diff)
[Gengrid] Enable Scroll To Type when item bring in or show region.
Scrollto positions are divided 4 type NONE : do not scrollto. TOP : scrollto position is always top viewport. MIDDLE : scrollto position is always middle of viewport. IN : scrollto position to fully visible in viewport.
Diffstat (limited to 'src')
-rw-r--r--src/bin/test_gengrid.c345
-rw-r--r--src/lib/elm_gengrid.c42
-rw-r--r--src/lib/elm_widget_gengrid.h1
3 files changed, 221 insertions, 167 deletions
diff --git a/src/bin/test_gengrid.c b/src/bin/test_gengrid.c
index cfe0e78db..b9dbe8c5e 100644
--- a/src/bin/test_gengrid.c
+++ b/src/bin/test_gengrid.c
@@ -36,6 +36,13 @@ struct _api_data
36}; 36};
37typedef struct _api_data api_data; 37typedef struct _api_data api_data;
38 38
39struct _show_data
40{
41 int winmode;
42 int scrollto;
43};
44typedef struct _show_data show_data;
45
39enum _api_state 46enum _api_state
40{ 47{
41 GRID_ALIGN_SET, 48 GRID_ALIGN_SET,
@@ -992,211 +999,238 @@ test_gengrid_item_styles(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
992} 999}
993 1000
994static void 1001static void
995_bring_in2_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1002_rd1_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
996{ 1003{
997 Evas_Object *win, *grid; 1004 show_data *s_data = data;
998 static Item_Data id[5000]; 1005 s_data->winmode = elm_radio_state_value_get(obj);
999 int i, n; 1006}
1000 char buf[PATH_MAX];
1001
1002 win = elm_win_util_standard_add("horz bring_in", "Horz Bring_in");
1003 elm_win_autodel_set(win, EINA_TRUE);
1004 evas_object_resize(win, 600, 200);
1005 evas_object_show(win);
1006
1007 grid = elm_gengrid_add(win);
1008 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1009 elm_win_resize_object_add(win, grid);
1010 elm_gengrid_item_size_set(grid,
1011 elm_config_scale_get() * 150,
1012 elm_config_scale_get() * 150);
1013 elm_gengrid_group_item_size_set(grid,
1014 elm_config_scale_get() * 31,
1015 elm_config_scale_get() * 31);
1016 elm_gengrid_horizontal_set(grid, EINA_TRUE);
1017 elm_gengrid_align_set(grid, 0.4, 0.8);
1018
1019 gic = elm_gengrid_item_class_new();
1020 gic->item_style = "default";
1021 gic->func.text_get = grid_text_get;
1022 gic->func.content_get = grid_content_get;
1023 gic->func.state_get = grid_state_get;
1024 gic->func.del = NULL;
1025
1026 n = 0;
1027 for (i = 0; i < 5000; i++)
1028 {
1029 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
1030 n = (n + 1) % 9;
1031 id[i].mode = i;
1032 id[i].path = eina_stringshare_add(buf);
1033 id[i].item = elm_gengrid_item_append(grid, gic, &(id[i]), grid_sel, NULL);
1034 if (i == 2400)
1035 elm_gengrid_item_selected_set(id[i].item, EINA_TRUE);
1036 }
1037 1007
1038 elm_gengrid_item_class_free(gic); 1008static void
1039 evas_object_show(grid); 1009_rd2_changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1040 elm_gengrid_item_bring_in(id[2400].item, ELM_GENGRID_ITEM_SCROLLTO_IN); 1010{
1011 show_data *s_data = data;
1012 s_data->scrollto = elm_radio_state_value_get(obj);
1041} 1013}
1042 1014
1043static void 1015static void
1044_bring_in1_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1016_bring_in_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1045{ 1017{
1046 Evas_Object *win, *grid; 1018 Evas_Object *win, *grid;
1047 static Item_Data id[5000]; 1019 static Item_Data ti[5000];
1048 int i, n; 1020 int i, n;
1049 char buf[PATH_MAX]; 1021 char buf[PATH_MAX];
1050 1022
1051 win = elm_win_util_standard_add("vertical bring_in", "Vertical Bring_in"); 1023 if(!data) return;
1024
1025 show_data *s_data = data;
1026
1027 if (s_data->winmode == 0)
1028 win = elm_win_util_standard_add("horz bring_in", "Horz Bring_in");
1029 else
1030 win = elm_win_util_standard_add("vertical bring_in", "Vertical Bring_in");
1052 elm_win_autodel_set(win, EINA_TRUE); 1031 elm_win_autodel_set(win, EINA_TRUE);
1053 evas_object_resize(win, 600, 400); 1032
1054 evas_object_show(win);
1055
1056 grid = elm_gengrid_add(win); 1033 grid = elm_gengrid_add(win);
1034 elm_gengrid_item_size_set(grid, 150, 150);
1035 elm_gengrid_group_item_size_set(grid, 31, 31);
1036 if (s_data->winmode == 0)
1037 elm_gengrid_horizontal_set(grid, EINA_TRUE);
1038 else if (s_data->winmode == 1)
1039 elm_gengrid_horizontal_set(grid, EINA_FALSE);
1057 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1040 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1058 elm_win_resize_object_add(win, grid); 1041 elm_gengrid_align_set(grid, 0.1, 0.1);
1059 elm_gengrid_item_size_set(grid, 1042
1060 elm_config_scale_get() * 150,
1061 elm_config_scale_get() * 150);
1062 elm_gengrid_group_item_size_set(grid,
1063 elm_config_scale_get() * 31,
1064 elm_config_scale_get() * 31);
1065 elm_gengrid_align_set(grid, 0.1, 1.0);
1066
1067 gic = elm_gengrid_item_class_new(); 1043 gic = elm_gengrid_item_class_new();
1068 gic->item_style = "default"; 1044 gic->item_style = "default";
1069 gic->func.text_get = grid_text_get; 1045 gic->func.text_get = grid_text_get;
1070 gic->func.content_get = grid_content_get; 1046 gic->func.content_get = grid_content_get;
1071 gic->func.state_get = grid_state_get; 1047 gic->func.state_get = grid_state_get;
1072 gic->func.del = NULL; 1048 gic->func.del = NULL;
1073 1049
1074 n = 0; 1050 n = 0;
1075 for (i = 0; i < 5000; i++) 1051 for (i = 0; i < 5000; i++)
1076 { 1052 {
1077 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]); 1053 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
1078 n = (n + 1) % 9; 1054 n = (n + 1) % 9;
1079 id[i].mode = i; 1055 ti[i].mode = i;
1080 id[i].path = eina_stringshare_add(buf); 1056 ti[i].path = eina_stringshare_add(buf);
1081 id[i].item = elm_gengrid_item_append(grid, gic, &(id[i]), grid_sel, NULL); 1057 ti[i].item = elm_gengrid_item_append(grid, gic, &(ti[i]), grid_sel, NULL);
1082 if (i == 1430) 1058 if (i == 1430)
1083 elm_gengrid_item_selected_set(id[i].item, EINA_TRUE); 1059 elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
1084 } 1060 }
1085 1061
1086 elm_gengrid_item_class_free(gic); 1062 elm_gengrid_item_class_free(gic);
1087 elm_gengrid_item_bring_in(id[1430].item, ELM_GENGRID_ITEM_SCROLLTO_IN); 1063 elm_gengrid_item_bring_in(ti[1430].item, s_data->scrollto);
1088 evas_object_show(grid); 1064 evas_object_show(grid);
1065 elm_win_resize_object_add(win, grid);
1066 if (s_data->winmode == 0)
1067 evas_object_resize(win, 600, 200);
1068 if (s_data->winmode == 1)
1069 evas_object_resize(win, 600, 400);
1070 evas_object_show(win);
1089} 1071}
1090 1072
1091
1092static void 1073static void
1093_show2_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1074_show_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1094{ 1075{
1095 Evas_Object *win, *grid; 1076 Evas_Object *win, *grid;
1096 static Item_Data id[10000]; 1077 static Item_Data ti[10000];
1097 int i, n; 1078 int i, n;
1098 char buf[PATH_MAX]; 1079 char buf[PATH_MAX];
1099 1080
1100 win = elm_win_util_standard_add("horz show", "Horz Show"); 1081 if(!data) return;
1082
1083 show_data *s_data = data;
1084
1085 if (s_data->winmode == 0)
1086 win = elm_win_util_standard_add("horz show", "Horz Show");
1087 else
1088 win = elm_win_util_standard_add("vertical show", "Vertical Show");
1101 elm_win_autodel_set(win, EINA_TRUE); 1089 elm_win_autodel_set(win, EINA_TRUE);
1102 evas_object_resize(win, 600, 200); 1090
1103 evas_object_show(win);
1104
1105 grid = elm_gengrid_add(win); 1091 grid = elm_gengrid_add(win);
1092 elm_gengrid_item_size_set(grid, 150, 150);
1093 elm_gengrid_group_item_size_set(grid, 31, 31);
1094 if (s_data->winmode == 0)
1095 elm_gengrid_horizontal_set(grid, EINA_TRUE);
1096 else if (s_data->winmode == 1)
1097 elm_gengrid_horizontal_set(grid, EINA_FALSE);
1106 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1098 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1107 elm_win_resize_object_add(win, grid); 1099 elm_gengrid_align_set(grid, 0.1, 0.1);
1108 elm_gengrid_item_size_set(grid, 1100
1109 elm_config_scale_get() * 150,
1110 elm_config_scale_get() * 150);
1111 elm_gengrid_group_item_size_set(grid,
1112 elm_config_scale_get() * 31,
1113 elm_config_scale_get() * 31);
1114 elm_gengrid_horizontal_set(grid, EINA_TRUE);
1115 elm_gengrid_align_set(grid, 0.3, 0.7);
1116
1117 gic = elm_gengrid_item_class_new(); 1101 gic = elm_gengrid_item_class_new();
1118 gic->item_style = "default"; 1102 gic->item_style = "default";
1119 gic->func.text_get = grid_text_get; 1103 gic->func.text_get = grid_text_get;
1120 gic->func.content_get = grid_content_get; 1104 gic->func.content_get = grid_content_get;
1121 gic->func.state_get = grid_state_get; 1105 gic->func.state_get = grid_state_get;
1122 gic->func.del = NULL; 1106 gic->func.del = NULL;
1123 1107
1124 n = 0; 1108 n = 0;
1125 for (i = 0; i < 10000; i++) 1109 for (i = 0; i < 10000; i++)
1126 { 1110 {
1127 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]); 1111 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
1128 n = (n + 1) % 9; 1112 n = (n + 1) % 9;
1129 id[i].mode = i; 1113 ti[i].mode = i;
1130 id[i].path = eina_stringshare_add(buf); 1114 ti[i].path = eina_stringshare_add(buf);
1131 id[i].item = elm_gengrid_item_append(grid, gic, &(id[i]), grid_sel, NULL); 1115 ti[i].item = elm_gengrid_item_append(grid, gic, &(ti[i]), grid_sel, NULL);
1132 if (i == 3333) 1116 if (i == 2579)
1133 elm_gengrid_item_selected_set(id[i].item, EINA_TRUE); 1117 elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
1134 } 1118 }
1135 1119
1136 elm_gengrid_item_class_free(gic); 1120 elm_gengrid_item_class_free(gic);
1137 evas_object_show(grid); 1121 evas_object_show(grid);
1138 elm_gengrid_item_show(id[3333].item, ELM_GENGRID_ITEM_SCROLLTO_IN); 1122 elm_gengrid_item_show(ti[2579].item, s_data->scrollto);
1123 elm_win_resize_object_add(win, grid);
1124 if (s_data->winmode == 0)
1125 evas_object_resize(win, 600, 200);
1126 if (s_data->winmode == 1)
1127 evas_object_resize(win, 600, 600);
1128 evas_object_show(win);
1139} 1129}
1140 1130
1141static void 1131Evas_Object *
1142_show1_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1132_window_mode_frame_new(Evas_Object *win, Evas_Object **rdg, void *data)
1143{ 1133{
1144 Evas_Object *win, *grid; 1134 Evas_Object *fr, *bx, *rd;
1145 static Item_Data id[10000]; 1135 show_data *s_data = data;
1146 int i, n; 1136
1147 char buf[PATH_MAX]; 1137 fr = elm_frame_add(win);
1148 1138 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1149 win = elm_win_util_standard_add("vertical show", "Vertical Show"); 1139 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1150 elm_win_autodel_set(win, EINA_TRUE); 1140 elm_object_text_set(fr, "Window Mode Set");
1151 evas_object_resize(win, 600, 600); 1141 evas_object_show(fr);
1152 evas_object_show(win); 1142
1153 1143 bx = elm_box_add(win);
1154 grid = elm_gengrid_add(win); 1144 elm_object_content_set(fr, bx);
1155 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1145 evas_object_show(bx);
1156 elm_win_resize_object_add(win, grid); 1146
1157 elm_gengrid_item_size_set(grid, 1147 rd = elm_radio_add(win);
1158 elm_config_scale_get() * 150, 1148 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1159 elm_config_scale_get() * 150); 1149 elm_radio_state_value_set(rd, 0);
1160 elm_gengrid_group_item_size_set(grid, 1150 elm_object_text_set(rd, "horizontal");
1161 elm_config_scale_get() * 31, 1151 evas_object_smart_callback_add(rd, "changed", _rd1_changed_cb, s_data);
1162 elm_config_scale_get() * 31); 1152 evas_object_show(rd);
1163 elm_gengrid_align_set(grid, 0.1, 0.3); 1153 elm_box_pack_end(bx, rd);
1164 1154 *rdg = rd;
1165 gic = elm_gengrid_item_class_new(); 1155
1166 gic->item_style = "default"; 1156 rd = elm_radio_add(win);
1167 gic->func.text_get = grid_text_get; 1157 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1168 gic->func.content_get = grid_content_get; 1158 elm_radio_state_value_set(rd, 1);
1169 gic->func.state_get = grid_state_get; 1159 elm_object_text_set(rd, "vertical");
1170 gic->func.del = NULL; 1160 elm_radio_group_add(rd, *rdg);
1171 1161 evas_object_smart_callback_add(rd, "changed", _rd1_changed_cb, s_data);
1172 n = 0; 1162 evas_object_show(rd);
1173 for (i = 0; i < 10000; i++) 1163 elm_box_pack_end(bx, rd);
1174 { 1164
1175 snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]); 1165 return fr;
1176 n = (n + 1) % 9; 1166}
1177 id[i].mode = i;
1178 id[i].path = eina_stringshare_add(buf);
1179 id[i].item = elm_gengrid_item_append(grid, gic, &(id[i]), grid_sel, NULL);
1180 if (i == 2579)
1181 elm_gengrid_item_selected_set(id[i].item, EINA_TRUE);
1182 }
1183 1167
1184 elm_gengrid_item_class_free(gic); 1168Evas_Object *
1185 evas_object_show(grid); 1169_scrollto_mode_frame_new(Evas_Object *win, Evas_Object **rdg, void *data)
1186 elm_gengrid_item_show(id[2579].item, ELM_GENGRID_ITEM_SCROLLTO_IN); 1170{
1171 Evas_Object *fr, *bx, *rd;
1172 show_data *s_data = data;
1173
1174 fr = elm_frame_add(win);
1175 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1176 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1177 elm_object_text_set(fr, "Scrollto Mode Set");
1178 evas_object_show(fr);
1179
1180 bx = elm_box_add(win);
1181 elm_object_content_set(fr, bx);
1182 evas_object_show(bx);
1183
1184 rd = elm_radio_add(win);
1185 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1186 elm_radio_state_value_set(rd, 0);
1187 elm_object_text_set(rd, "SCROLLTO_NONE");
1188 evas_object_smart_callback_add(rd, "changed", _rd2_changed_cb, s_data);
1189 evas_object_show(rd);
1190 elm_box_pack_end(bx, rd);
1191 *rdg = rd;
1192
1193 rd = elm_radio_add(win);
1194 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1195 elm_radio_state_value_set(rd, 1);
1196 elm_object_text_set(rd, "SCROLLTO_IN");
1197 elm_radio_group_add(rd, *rdg);
1198 evas_object_smart_callback_add(rd, "changed", _rd2_changed_cb, s_data);
1199 evas_object_show(rd);
1200 elm_box_pack_end(bx, rd);
1201
1202 rd = elm_radio_add(win);
1203 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1204 elm_radio_state_value_set(rd, 2);
1205 elm_object_text_set(rd, "SCROLLTO_TOP");
1206 elm_radio_group_add(rd, *rdg);
1207 evas_object_smart_callback_add(rd, "changed", _rd2_changed_cb, s_data);
1208 evas_object_show(rd);
1209 elm_box_pack_end(bx, rd);
1210
1211 rd = elm_radio_add(win);
1212 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1213 elm_radio_state_value_set(rd, 4);
1214 elm_object_text_set(rd, "SCROLLTO_MIDDLE");
1215 elm_radio_group_add(rd, *rdg);
1216 evas_object_smart_callback_add(rd, "changed", _rd2_changed_cb, s_data);
1217 evas_object_show(rd);
1218 elm_box_pack_end(bx, rd);
1219
1220 return fr;
1187} 1221}
1188 1222
1189void 1223void
1190test_gengrid4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1224test_gengrid4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1191{ 1225{
1192 Evas_Object *win, *bt, *bx; 1226 Evas_Object *win, *bt, *bx, *bx2, *fr1, *fr2, *rd1 = NULL, *rd2 = NULL;
1193 api_data *api = calloc(1, sizeof(api_data)); 1227 api_data *api = calloc(1, sizeof(api_data));
1228 show_data *s_data = calloc(1, sizeof(show_data));
1194 1229
1195 win = elm_win_util_standard_add("gengrid show/scroll_in", "GenGrid Show/Bring_in"); 1230 win = elm_win_util_standard_add("gengrid show/scroll_in", "GenGrid Show/Bring_in");
1196 elm_win_autodel_set(win, EINA_TRUE); 1231 elm_win_autodel_set(win, EINA_TRUE);
1197 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); 1232 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
1198 evas_object_resize(win, 300, 300); 1233 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, s_data);
1199 evas_object_show(win);
1200 1234
1201 bx = elm_box_add(win); 1235 bx = elm_box_add(win);
1202 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1236 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1204,27 +1238,30 @@ test_gengrid4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
1204 elm_box_horizontal_set(bx, EINA_TRUE); 1238 elm_box_horizontal_set(bx, EINA_TRUE);
1205 evas_object_show(bx); 1239 evas_object_show(bx);
1206 1240
1207 bt = elm_button_add(win); 1241 bx2 = elm_box_add(win);
1208 elm_object_text_set(bt, "Vertical Show"); 1242 evas_object_size_hint_weight_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
1209 evas_object_smart_callback_add(bt, "clicked", _show1_clicked_cb, NULL); 1243 elm_win_resize_object_add(bx, bx2);
1210 elm_box_pack_end(bx, bt); 1244 elm_box_horizontal_set(bx2, EINA_TRUE);
1211 evas_object_show(bt); 1245 evas_object_show(bx2);
1212 1246
1213 bt = elm_button_add(win); 1247 fr1 = _window_mode_frame_new(win, &rd1, s_data);
1214 elm_object_text_set(bt, "Vertical Bring_in"); 1248 elm_box_pack_end(bx2, fr1);
1215 evas_object_smart_callback_add(bt, "clicked", _bring_in1_clicked_cb, NULL); 1249
1216 elm_box_pack_end(bx, bt); 1250 fr2 = _scrollto_mode_frame_new(win, &rd2, s_data);
1217 evas_object_show(bt); 1251 elm_box_pack_end(bx2, fr2);
1218 1252
1219 bt = elm_button_add(win); 1253 bt = elm_button_add(win);
1220 elm_object_text_set(bt, "Horz Show"); 1254 elm_object_text_set(bt, "Region Show");
1221 evas_object_smart_callback_add(bt, "clicked", _show2_clicked_cb, NULL); 1255 evas_object_smart_callback_add(bt, "clicked", _show_clicked_cb, s_data);
1222 elm_box_pack_end(bx, bt); 1256 elm_box_pack_end(bx, bt);
1223 evas_object_show(bt); 1257 evas_object_show(bt);
1224 1258
1225 bt = elm_button_add(win); 1259 bt = elm_button_add(win);
1226 elm_object_text_set(bt, "Horz Bring_in"); 1260 elm_object_text_set(bt, "Bring In");
1227 evas_object_smart_callback_add(bt, "clicked", _bring_in2_clicked_cb, NULL); 1261 evas_object_smart_callback_add(bt, "clicked", _bring_in_clicked_cb, s_data);
1228 elm_box_pack_end(bx, bt); 1262 elm_box_pack_end(bx, bt);
1229 evas_object_show(bt); 1263 evas_object_show(bt);
1264
1265 evas_object_resize(win, 300, 300);
1266 evas_object_show(win);
1230} 1267}
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 82b3b87b7..7ceebc7ab 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -97,7 +97,6 @@ _item_show_region(void *data)
97 Elm_Gengrid_Smart_Data *sd = data; 97 Elm_Gengrid_Smart_Data *sd = data;
98 Evas_Coord cvw, cvh, it_xpos = 0, it_ypos = 0, col = 0, row = 0, minx = 0, miny = 0; 98 Evas_Coord cvw, cvh, it_xpos = 0, it_ypos = 0, col = 0, row = 0, minx = 0, miny = 0;
99 Elm_Gen_Item *it = NULL; 99 Elm_Gen_Item *it = NULL;
100
101 evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh); 100 evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh);
102 101
103 if ((cvw != 0) && (cvh != 0)) 102 if ((cvw != 0) && (cvh != 0))
@@ -111,7 +110,6 @@ _item_show_region(void *data)
111 if (!it) return; 110 if (!it) return;
112 111
113 eo_do(sd->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny)); 112 eo_do(sd->pan_obj, elm_obj_pan_pos_min_get(&minx, &miny));
114
115 if (sd->horizontal && (sd->item_height > 0)) 113 if (sd->horizontal && (sd->item_height > 0))
116 { 114 {
117 row = cvh / sd->item_height; 115 row = cvh / sd->item_height;
@@ -122,6 +120,19 @@ _item_show_region(void *data)
122 it_xpos = ((x - GG_IT(it)->prev_group) * sd->item_width) 120 it_xpos = ((x - GG_IT(it)->prev_group) * sd->item_width)
123 + (GG_IT(it)->prev_group * sd->group_item_width) 121 + (GG_IT(it)->prev_group * sd->group_item_width)
124 + minx; 122 + minx;
123 if (sd->s_type == ELM_GENGRID_ITEM_SCROLLTO_MIDDLE)
124 {
125 if (it_xpos > 0) it_xpos = it_xpos + (cvw / 2) - (sd->item_width / 2);
126 else it_xpos = it_xpos - (cvw / 2) + (sd->item_width / 2);
127 }
128 else if (sd->s_type == ELM_GENGRID_ITEM_SCROLLTO_TOP)
129 {
130 if (it_xpos > 0) it_xpos = it_xpos + cvw - sd->item_width;
131 }
132 else if (sd->s_type != ELM_GENGRID_ITEM_SCROLLTO_IN)
133 {
134 it_xpos = 0;
135 }
125 it_ypos = y * sd->item_height + miny; 136 it_ypos = y * sd->item_height + miny;
126 it->x = x; 137 it->x = x;
127 it->y = y; 138 it->y = y;
@@ -133,10 +144,23 @@ _item_show_region(void *data)
133 y = (it->position - 1) / col; 144 y = (it->position - 1) / col;
134 if (y > 0) 145 if (y > 0)
135 x = (it->position - 1) % y; 146 x = (it->position - 1) % y;
136 it_xpos = x * sd->item_width + minx;
137 it_ypos = ((y - GG_IT(it)->prev_group) * sd->item_height) 147 it_ypos = ((y - GG_IT(it)->prev_group) * sd->item_height)
138 + (GG_IT(it)->prev_group * sd->group_item_height) 148 + (GG_IT(it)->prev_group * sd->group_item_height)
139 + miny; 149 + miny;
150 if (sd->s_type == ELM_GENGRID_ITEM_SCROLLTO_MIDDLE)
151 {
152 if (it_ypos > 0) it_ypos = it_ypos + (cvh / 2) - (sd->item_height / 2);
153 else it_ypos = it_ypos - (cvh / 2) + (sd->item_height / 2);
154 }
155 else if (sd->s_type == ELM_GENGRID_ITEM_SCROLLTO_TOP)
156 {
157 if (it_ypos > 0) it_ypos = it_ypos + cvh - sd->item_height;
158 }
159 else if (sd->s_type != ELM_GENGRID_ITEM_SCROLLTO_IN)
160 {
161 it_ypos = 0;
162 }
163 it_xpos = x * sd->item_width + minx;
140 it->x = x; 164 it->x = x;
141 it->y = y; 165 it->y = y;
142 } 166 }
@@ -3784,13 +3808,9 @@ elm_gengrid_item_show(Elm_Object_Item *item,
3784 3808
3785 if ((it->generation < sd->generation)) return; 3809 if ((it->generation < sd->generation)) return;
3786 3810
3787 if (type == ELM_GENGRID_ITEM_SCROLLTO_IN)
3788 {
3789 //TODO : type based handling like gengrid
3790 }
3791
3792 sd->show_region = EINA_TRUE; 3811 sd->show_region = EINA_TRUE;
3793 sd->show_it = it; 3812 sd->show_it = it;
3813 sd->s_type = type;
3794 3814
3795 _item_show_region(sd); 3815 _item_show_region(sd);
3796} 3816}
@@ -3807,13 +3827,9 @@ elm_gengrid_item_bring_in(Elm_Object_Item *item,
3807 3827
3808 if (it->generation < sd->generation) return; 3828 if (it->generation < sd->generation) return;
3809 3829
3810 if (type == ELM_GENGRID_ITEM_SCROLLTO_IN)
3811 {
3812 //TODO : type based handling like gengrid
3813 }
3814
3815 sd->bring_in = EINA_TRUE; 3830 sd->bring_in = EINA_TRUE;
3816 sd->bring_in_it = it; 3831 sd->bring_in_it = it;
3832 sd->s_type = type;
3817 3833
3818 _item_show_region(sd); 3834 _item_show_region(sd);
3819} 3835}
diff --git a/src/lib/elm_widget_gengrid.h b/src/lib/elm_widget_gengrid.h
index 7ad6fed5e..e5ea80c77 100644
--- a/src/lib/elm_widget_gengrid.h
+++ b/src/lib/elm_widget_gengrid.h
@@ -40,6 +40,7 @@ struct _Elm_Gengrid_Smart_Data
40 Elm_Object_Item *last_selected_item; 40 Elm_Object_Item *last_selected_item;
41 Elm_Gen_Item *show_it; 41 Elm_Gen_Item *show_it;
42 Elm_Gen_Item *bring_in_it; 42 Elm_Gen_Item *bring_in_it;
43 Elm_Gengrid_Item_Scrollto_Type s_type;
43 44
44 Ecore_Job *calc_job; 45 Ecore_Job *calc_job;
45 int walking; 46 int walking;