summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-09-07 17:49:04 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-09-07 17:49:33 +0900
commit41b5521077578831a6c15c388f353b56954bd7cd (patch)
treeb1da1de11eeecaa9bd3d926d8f8af461782bb9f2 /src/bin
parentb9d5de725d1b5eb1b941dff2b748a58219fbb03c (diff)
test_genlist: Refactored internal codes.
Created internal function _test_genlist_focus_option_panel_create() as it is getting too big.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_genlist.c244
1 files changed, 127 insertions, 117 deletions
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 82a97ce98..64cf28dc6 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -4254,124 +4254,16 @@ _focus_autoscroll_mode_frame_create(Evas_Object *parent)
4254 return fr; 4254 return fr;
4255} 4255}
4256 4256
4257void 4257static void
4258test_genlist_focus(void *data EINA_UNUSED, 4258_test_genlist_focus_option_panel_create(Evas_Object *win, Evas_Object *bx,
4259 Evas_Object *obj EINA_UNUSED, 4259 Evas_Object *gl, Elm_Object_Item *it_0,
4260 void *event_info EINA_UNUSED) 4260 Elm_Object_Item *it_2)
4261{ 4261{
4262 Evas_Object *win, *bx, *bx2, *gl, *btn, *fr; 4262 Evas_Object *fr = NULL, *bx_opt = NULL, *chk = NULL;
4263 Evas_Object *bx_opt, *chk, *bx_btn, *btn_focus, *btn_sel, *btn_dis; 4263 Evas_Object *bx_mv = NULL, *rd = NULL, *rdg = NULL;
4264 Evas_Object *bx_mv, *rd, *rdg; 4264 Evas_Object *bx_btn = NULL, *btn_focus = NULL, *btn_sel = NULL,
4265 unsigned lhand, rhand; 4265 *btn_dis = NULL;
4266 Elm_Object_Item *it = NULL, *it_0 = NULL, *it_2 = NULL;
4267
4268 api_data *api = calloc(1, sizeof(api_data));
4269 win = elm_win_util_standard_add("genlist-focus", "Genlist Focus");
4270 elm_win_autodel_set(win, EINA_TRUE);
4271 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
4272 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL,
4273 _gl_focus_win_del_cb, NULL);
4274
4275 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
4276 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
4277
4278 bx = elm_box_add(win);
4279 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4280 elm_win_resize_object_add(win, bx);
4281 evas_object_show(bx);
4282
4283 btn = elm_button_add(bx);
4284 elm_object_text_set(btn, "Up");
4285 elm_box_pack_end(bx, btn);
4286 evas_object_smart_callback_add(btn, "clicked",
4287 _focus_button_clicked_cb, "Up");
4288 evas_object_show(btn);
4289
4290 bx2 = elm_box_add(bx);
4291 elm_box_horizontal_set(bx2, EINA_TRUE);
4292 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4293 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
4294 elm_box_pack_end(bx, bx2);
4295 evas_object_show(bx2);
4296
4297 btn = elm_button_add(bx2);
4298 elm_object_text_set(btn, "Left");
4299 elm_box_pack_end(bx2, btn);
4300 evas_object_smart_callback_add(btn, "clicked",
4301 _focus_button_clicked_cb, "Left");
4302 evas_object_show(btn);
4303
4304 gl = elm_genlist_add(bx);
4305 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4306 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
4307 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
4308 elm_box_pack_end(bx2, gl);
4309 api->gl = gl;
4310 evas_object_show(gl);
4311 evas_object_smart_callback_add(gl, "item,focused", _gl_focus_item_cb, "item,focused");
4312 evas_object_smart_callback_add(gl, "item,unfocused", _gl_focus_item_cb, "item,unfocused");
4313 evas_object_smart_callback_add(gl, "selected", _gl_focus_item_cb, "selected");
4314 evas_object_smart_callback_add(gl, "unselected", _gl_focus_item_cb, "unselected");
4315 evas_object_smart_callback_add(gl, "activated", _gl_focus_item_cb, "activated");
4316 evas_object_smart_callback_add(gl, "highlighted", _gl_focus_item_cb, "highlighted");
4317 evas_object_smart_callback_add(gl, "unhighlighted", _gl_focus_item_cb, "unhighlighted");
4318 evas_object_event_callback_add(gl, EVAS_CALLBACK_KEY_DOWN, _gl_focus_key_down_cb, NULL);
4319
4320 btn = elm_button_add(bx2);
4321 elm_object_text_set(btn, "Right");
4322 elm_box_pack_end(bx2, btn);
4323 evas_object_smart_callback_add(btn, "clicked",
4324 _focus_button_clicked_cb, "Right");
4325 evas_object_show(btn);
4326
4327 btn = elm_button_add(bx);
4328 elm_object_text_set(btn, "Down");
4329 elm_box_pack_end(bx, btn);
4330 evas_object_smart_callback_add(btn, "clicked",
4331 _focus_button_clicked_cb, "Down");
4332 evas_object_show(btn);
4333
4334 api->itc1 = elm_genlist_item_class_new();
4335 api->itc1->item_style = "default";
4336 api->itc1->func.text_get = gl_focus_text_get;
4337 api->itc1->func.content_get = gl_focus_content_get;
4338 api->itc1->func.state_get = NULL;
4339 api->itc1->func.del = NULL;
4340
4341 api->itc2 = elm_genlist_item_class_new();
4342 api->itc2->item_style = "tree_effect";
4343 api->itc2->func.text_get = gl_focus_text_get;
4344 api->itc2->func.content_get = gl_focus_content_get;
4345 api->itc2->func.state_get = NULL;
4346 api->itc2->func.del = NULL;
4347 4266
4348 for (lhand = 0; lhand < _gl_focus_objects; lhand++)
4349 {
4350 for (rhand = 0; rhand < _gl_focus_objects; rhand++)
4351 {
4352 unsigned digit1 = lhand * 10 + rhand;
4353 it = elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)digit1,
4354 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
4355 if (!it_0) it_0 = it;
4356
4357 unsigned digit2 = (_gl_focus_objects - lhand -1) * 10 +
4358 (_gl_focus_objects - rhand -1);
4359 it = elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)digit2,
4360 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
4361 if (!it_2) it_2 = it;
4362 if (rhand == 4)
4363 elm_object_item_disabled_set(it, EINA_TRUE);
4364
4365 if (rhand == (_gl_focus_objects - 1))
4366 elm_genlist_item_append(gl, api->itc2, (void*)(uintptr_t)digit1,
4367 NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
4368 }
4369 }
4370
4371 elm_genlist_item_class_free(api->itc1);
4372 elm_genlist_item_class_free(api->itc2);
4373
4374 // Options
4375 fr = elm_frame_add(bx); 4267 fr = elm_frame_add(bx);
4376 elm_object_text_set(fr, "Options"); 4268 elm_object_text_set(fr, "Options");
4377 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0); 4269 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
@@ -4440,7 +4332,6 @@ test_genlist_focus(void *data EINA_UNUSED,
4440 elm_box_pack_end(bx_opt, chk); 4332 elm_box_pack_end(bx_opt, chk);
4441 evas_object_show(chk); 4333 evas_object_show(chk);
4442 4334
4443
4444 // Focus Autoscroll Mode 4335 // Focus Autoscroll Mode
4445 fr = _focus_autoscroll_mode_frame_create(bx); 4336 fr = _focus_autoscroll_mode_frame_create(bx);
4446 elm_box_pack_end(bx, fr); 4337 elm_box_pack_end(bx, fr);
@@ -4515,6 +4406,125 @@ test_genlist_focus(void *data EINA_UNUSED,
4515 evas_object_smart_callback_add(btn_focus, "clicked", _focus_btn_cb, it_2); 4406 evas_object_smart_callback_add(btn_focus, "clicked", _focus_btn_cb, it_2);
4516 evas_object_smart_callback_add(btn_sel, "clicked", _sel_btn_cb, it_2); 4407 evas_object_smart_callback_add(btn_sel, "clicked", _sel_btn_cb, it_2);
4517 evas_object_smart_callback_add(btn_dis, "clicked", _dis_btn_cb, it_0); 4408 evas_object_smart_callback_add(btn_dis, "clicked", _dis_btn_cb, it_0);
4409}
4410
4411void
4412test_genlist_focus(void *data EINA_UNUSED,
4413 Evas_Object *obj EINA_UNUSED,
4414 void *event_info EINA_UNUSED)
4415{
4416 Evas_Object *win, *bx, *bx2, *gl, *btn;
4417 unsigned lhand, rhand;
4418 Elm_Object_Item *it = NULL, *it_0 = NULL, *it_2 = NULL;
4419
4420 api_data *api = calloc(1, sizeof(api_data));
4421 win = elm_win_util_standard_add("genlist-focus", "Genlist Focus");
4422 elm_win_autodel_set(win, EINA_TRUE);
4423 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
4424 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL,
4425 _gl_focus_win_del_cb, NULL);
4426
4427 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
4428 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
4429
4430 bx = elm_box_add(win);
4431 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4432 elm_win_resize_object_add(win, bx);
4433 evas_object_show(bx);
4434
4435 btn = elm_button_add(bx);
4436 elm_object_text_set(btn, "Up");
4437 elm_box_pack_end(bx, btn);
4438 evas_object_smart_callback_add(btn, "clicked",
4439 _focus_button_clicked_cb, "Up");
4440 evas_object_show(btn);
4441
4442 bx2 = elm_box_add(bx);
4443 elm_box_horizontal_set(bx2, EINA_TRUE);
4444 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4445 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
4446 elm_box_pack_end(bx, bx2);
4447 evas_object_show(bx2);
4448
4449 btn = elm_button_add(bx2);
4450 elm_object_text_set(btn, "Left");
4451 elm_box_pack_end(bx2, btn);
4452 evas_object_smart_callback_add(btn, "clicked",
4453 _focus_button_clicked_cb, "Left");
4454 evas_object_show(btn);
4455
4456 gl = elm_genlist_add(bx);
4457 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
4458 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
4459 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
4460 elm_box_pack_end(bx2, gl);
4461 api->gl = gl;
4462 evas_object_show(gl);
4463 evas_object_smart_callback_add(gl, "item,focused", _gl_focus_item_cb, "item,focused");
4464 evas_object_smart_callback_add(gl, "item,unfocused", _gl_focus_item_cb, "item,unfocused");
4465 evas_object_smart_callback_add(gl, "selected", _gl_focus_item_cb, "selected");
4466 evas_object_smart_callback_add(gl, "unselected", _gl_focus_item_cb, "unselected");
4467 evas_object_smart_callback_add(gl, "activated", _gl_focus_item_cb, "activated");
4468 evas_object_smart_callback_add(gl, "highlighted", _gl_focus_item_cb, "highlighted");
4469 evas_object_smart_callback_add(gl, "unhighlighted", _gl_focus_item_cb, "unhighlighted");
4470 evas_object_event_callback_add(gl, EVAS_CALLBACK_KEY_DOWN, _gl_focus_key_down_cb, NULL);
4471
4472 btn = elm_button_add(bx2);
4473 elm_object_text_set(btn, "Right");
4474 elm_box_pack_end(bx2, btn);
4475 evas_object_smart_callback_add(btn, "clicked",
4476 _focus_button_clicked_cb, "Right");
4477 evas_object_show(btn);
4478
4479 btn = elm_button_add(bx);
4480 elm_object_text_set(btn, "Down");
4481 elm_box_pack_end(bx, btn);
4482 evas_object_smart_callback_add(btn, "clicked",
4483 _focus_button_clicked_cb, "Down");
4484 evas_object_show(btn);
4485
4486 api->itc1 = elm_genlist_item_class_new();
4487 api->itc1->item_style = "default";
4488 api->itc1->func.text_get = gl_focus_text_get;
4489 api->itc1->func.content_get = gl_focus_content_get;
4490 api->itc1->func.state_get = NULL;
4491 api->itc1->func.del = NULL;
4492
4493 api->itc2 = elm_genlist_item_class_new();
4494 api->itc2->item_style = "tree_effect";
4495 api->itc2->func.text_get = gl_focus_text_get;
4496 api->itc2->func.content_get = gl_focus_content_get;
4497 api->itc2->func.state_get = NULL;
4498 api->itc2->func.del = NULL;
4499
4500 for (lhand = 0; lhand < _gl_focus_objects; lhand++)
4501 {
4502 for (rhand = 0; rhand < _gl_focus_objects; rhand++)
4503 {
4504 unsigned digit1 = lhand * 10 + rhand;
4505 it = elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)digit1,
4506 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
4507 if (!it_0) it_0 = it;
4508
4509 unsigned digit2 = (_gl_focus_objects - lhand -1) * 10 +
4510 (_gl_focus_objects - rhand -1);
4511 it = elm_genlist_item_append(gl, api->itc1, (void*)(uintptr_t)digit2,
4512 NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
4513 if (!it_2) it_2 = it;
4514 if (rhand == 4)
4515 elm_object_item_disabled_set(it, EINA_TRUE);
4516
4517 if (rhand == (_gl_focus_objects - 1))
4518 elm_genlist_item_append(gl, api->itc2, (void*)(uintptr_t)digit1,
4519 NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
4520 }
4521 }
4522
4523 elm_genlist_item_class_free(api->itc1);
4524 elm_genlist_item_class_free(api->itc2);
4525
4526 // Options
4527 _test_genlist_focus_option_panel_create(win, bx, gl, it_0, it_2);
4518 4528
4519 evas_object_resize(win, 420, 600); 4529 evas_object_resize(win, 420, 600);
4520 evas_object_show(win); 4530 evas_object_show(win);