aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/bin/test_gengrid.c
diff options
context:
space:
mode:
authorJaehwan Kim <jae.hwan.kim@samsung.com>2015-08-12 17:25:15 +0900
committerJaehwan Kim <jae.hwan.kim@samsung.com>2015-08-12 17:30:44 +0900
commitb3a86fc230d3329d1d7722735563855e450c2749 (patch)
treec51dc5dff485cfdf5492fd7da081fb7e838233a0 /legacy/elementary/src/bin/test_gengrid.c
parentFix docs for elm_object_tooltip_orient_set (diff)
downloadefl-b3a86fc230d3329d1d7722735563855e450c2749.tar.gz
focus: add the focus region show mode
When the focus is move to the object in scroller, it is scrolled to show the focus region as a widget. If the focus region want to be shown as an item, set the mode ELM_FOCUS_REGION_SHOW_ITEM. If then, it will be scrolled as an item. TODO: Widgets have items are added on_focus_region function. @feature
Diffstat (limited to 'legacy/elementary/src/bin/test_gengrid.c')
-rw-r--r--legacy/elementary/src/bin/test_gengrid.c79
1 files changed, 76 insertions, 3 deletions
diff --git a/legacy/elementary/src/bin/test_gengrid.c b/legacy/elementary/src/bin/test_gengrid.c
index 93d7f38f0e..7e7c982b98 100644
--- a/legacy/elementary/src/bin/test_gengrid.c
+++ b/legacy/elementary/src/bin/test_gengrid.c
@@ -29,6 +29,7 @@ struct _api_data
unsigned int state; /* What state we are testing */
Evas_Object *box; /* Use this to get box content */
Evas_Object *grid;
+ Evas_Object *grid2;
Elm_Gengrid_Item_Field_Type field_type;
};
typedef struct _api_data api_data;
@@ -1644,6 +1645,19 @@ _gg_focus_focus_animate_changed_cb(void *data,
}
static void
+_gg_focus_region_show_item_cb(void *data,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ if (elm_check_state_get(obj))
+ elm_object_focus_region_show_mode_set((Evas_Object *)data,
+ ELM_FOCUS_REGION_SHOW_ITEM);
+ else
+ elm_object_focus_region_show_mode_set((Evas_Object *)data,
+ ELM_FOCUS_REGION_SHOW_WIDGET);
+}
+
+static void
_grid_reorder_mode(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
@@ -1675,7 +1689,7 @@ test_gengrid_focus(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
- Evas_Object *win, *bx, *bx_horiz, *gengrid, *btn, *fr, *bx_mv, *bx_opt, *ck, *rdg, *rd;
+ Evas_Object *win, *bx, *bx_horiz, *in_bx, *scr, *gengrid, *gengrid2, *btn, *fr, *bx_mv, *bx_opt, *ck, *rdg, *rd;
Elm_Gengrid_Item_Class *ic;
Item_Data *id;
char buf[PATH_MAX];
@@ -1711,13 +1725,26 @@ test_gengrid_focus(void *data EINA_UNUSED,
evas_object_show(btn);
elm_object_focus_set(btn, EINA_TRUE);
- gengrid = elm_gengrid_add(bx);
+ scr = elm_scroller_add(bx);
+ evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, scr);
+ evas_object_show(scr);
+
+ in_bx = elm_box_add(scr);
+ evas_object_size_hint_weight_set(in_bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(in_bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(scr, in_bx);
+ evas_object_show(in_bx);
+
+ gengrid = elm_gengrid_add(in_bx);
elm_gengrid_item_size_set(gengrid,
ELM_SCALE_SIZE(150),
ELM_SCALE_SIZE(150));
evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, gengrid);
+ evas_object_size_hint_min_set(gengrid, 0, ELM_SCALE_SIZE(600));
+ elm_box_pack_end(in_bx, gengrid);
evas_object_show(gengrid);
evas_object_smart_callback_add(gengrid, "item,focused", _gengrid_focus_item_cb, "item,focused");
evas_object_smart_callback_add(gengrid, "item,unfocused", _gengrid_focus_item_cb, "item,unfocused");
@@ -1728,6 +1755,24 @@ test_gengrid_focus(void *data EINA_UNUSED,
evas_object_smart_callback_add(gengrid, "unhighlighted", _gengrid_focus_item_cb, "unhighlighted");
evas_object_event_callback_add(gengrid, EVAS_CALLBACK_KEY_DOWN, _gengrid_focus_key_down_cb, NULL);
+ gengrid2 = elm_gengrid_add(in_bx);
+ elm_gengrid_item_size_set(gengrid2,
+ ELM_SCALE_SIZE(150),
+ ELM_SCALE_SIZE(150));
+ evas_object_size_hint_weight_set(gengrid2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(gengrid2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_min_set(gengrid2, 0, ELM_SCALE_SIZE(600));
+ elm_box_pack_end(in_bx, gengrid2);
+ evas_object_show(gengrid2);
+ evas_object_smart_callback_add(gengrid2, "item,focused", _gengrid_focus_item_cb, "item,focused");
+ evas_object_smart_callback_add(gengrid2, "item,unfocused", _gengrid_focus_item_cb, "item,unfocused");
+ evas_object_smart_callback_add(gengrid2, "selected", _gengrid_focus_item_cb, "selected");
+ evas_object_smart_callback_add(gengrid2, "unselected", _gengrid_focus_item_cb, "unselected");
+ evas_object_smart_callback_add(gengrid2, "activated", _gengrid_focus_item_cb, "activated");
+ evas_object_smart_callback_add(gengrid2, "highlighted", _gengrid_focus_item_cb, "highlighted");
+ evas_object_smart_callback_add(gengrid2, "unhighlighted", _gengrid_focus_item_cb, "unhighlighted");
+ evas_object_event_callback_add(gengrid2, EVAS_CALLBACK_KEY_DOWN, _gengrid_focus_key_down_cb, NULL);
+
btn = elm_button_add(bx);
elm_object_text_set(btn, "Down");
elm_box_pack_end(bx, btn);
@@ -1792,9 +1837,23 @@ test_gengrid_focus(void *data EINA_UNUSED,
evas_object_show(ck);
ck = elm_check_add(bx_opt);
+ elm_object_text_set(ck, "Focus Region Show as Item");
+ elm_check_state_set(ck, EINA_FALSE);
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+ evas_object_smart_callback_add(ck, "changed",
+ _gg_focus_region_show_item_cb,
+ gengrid);
+ evas_object_smart_callback_add(ck, "changed",
+ _gg_focus_region_show_item_cb,
+ gengrid2);
+ elm_box_pack_end(bx_opt, ck);
+ evas_object_show(ck);
+
+ ck = elm_check_add(bx_opt);
elm_object_text_set(ck, "Horizontal Mode");
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
evas_object_smart_callback_add(ck, "changed", _horizontal_grid, gengrid);
+ evas_object_smart_callback_add(ck, "changed", _horizontal_grid, gengrid2);
elm_box_pack_end(bx_opt, ck);
evas_object_show(ck);
@@ -1802,6 +1861,7 @@ test_gengrid_focus(void *data EINA_UNUSED,
elm_object_text_set(ck, "Rorder mode enable");
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
evas_object_smart_callback_add(ck, "changed", _grid_reorder_mode, gengrid);
+ evas_object_smart_callback_add(ck, "changed", _grid_reorder_mode, gengrid2);
elm_box_pack_end(bx_opt, ck);
evas_object_show(ck);
@@ -1882,6 +1942,19 @@ test_gengrid_focus(void *data EINA_UNUSED,
if (i == 4)
elm_object_item_disabled_set(id->item, EINA_TRUE);
}
+
+ n = 0;
+ for (i = 0; i < 24; i++)
+ {
+ id = calloc(1, sizeof(Item_Data));
+ snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
+ n = (n + 1) % 9;
+ id->mode = i;
+ id->path = eina_stringshare_add(buf);
+ id->item = elm_gengrid_item_append(gengrid2, ic, id, NULL, NULL);
+ if (i == 4)
+ elm_object_item_disabled_set(id->item, EINA_TRUE);
+ }
elm_gengrid_item_class_free(ic);
evas_object_resize(win, 600, 600);