elm_gengrid_reorder_mode_stop((Evas_Object *)data);
}
+static void
+test_gengrid_focus_item_select_on_focus_disable_changed(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info
+ EINA_UNUSED)
+{
+ elm_config_item_select_on_focus_disabled_set(elm_check_state_get(obj));
+}
+
void
test_gengrid_focus(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
elm_box_pack_end(bx_opt, ck);
evas_object_show(ck);
+ ck = elm_check_add(bx_opt);
+ elm_object_text_set(ck, "Item Select on Focus disable");
+ elm_check_state_set(ck, elm_config_item_select_on_focus_disabled_get());
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+ evas_object_smart_callback_add(ck, "changed",
+ test_gengrid_focus_item_select_on_focus_disable_changed,
+ NULL);
+ elm_box_pack_end(bx_opt, ck);
+ evas_object_show(ck);
+
//Focus movement policy
fr = elm_frame_add(bx);
elm_object_text_set(fr, "Focus Movement Policy");
evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it);
}
-/* NOTE: this code will be used later when the item selection on key press
- becomes optional. So do not remove this.
static Eina_Bool
_item_focus_up(Elm_Gengrid_Data *sd)
{
return EINA_TRUE;
}
-*/
static Eina_Bool
_item_multi_select_left(Elm_Gengrid_Data *sd)
}
if (sd->horizontal)
{
- if (_item_single_select_up(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_up(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_up(sd);
}
else
{
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT))
return EINA_FALSE;
- if (_item_single_select_left(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_left(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_left(sd);
}
}
else if (!strcmp(dir, "left_multi"))
}
if (sd->horizontal)
{
- if (_item_single_select_down(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_down(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_down(sd);
}
else
{
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT))
return EINA_FALSE;
- if (_item_single_select_right(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_right(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_right(sd);
}
}
else if (!strcmp(dir, "right_multi"))
{
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_UP))
return EINA_FALSE;
- if (_item_single_select_left(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_left(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_left(sd);
}
else
{
- if (_item_single_select_up(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_up(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_up(sd);
}
}
else if (!strcmp(dir, "up_multi"))
{
if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_DOWN))
return EINA_FALSE;
- if (_item_single_select_right(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_right(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_right(sd);
}
else
{
- if (_item_single_select_down(sd)) return EINA_TRUE;
- else return EINA_FALSE;
+ if (!_elm_config->item_select_on_focus_disable)
+ {
+ if (_item_single_select_down(sd)) return EINA_TRUE;
+ else return EINA_FALSE;
+ }
+ else
+ return _item_focus_down(sd);
}
}
else if (!strcmp(dir, "down_multi"))
else if (!strcmp(dir, "first"))
{
it = elm_gengrid_first_item_get(obj);
- elm_gengrid_item_selected_set(it, EINA_TRUE);
+ if (!_elm_config->item_select_on_focus_disable)
+ elm_gengrid_item_selected_set(it, EINA_TRUE);
+ else
+ elm_object_item_focus_set(it, EINA_TRUE);
return EINA_TRUE;
}
else if (!strcmp(dir, "last"))
{
it = elm_gengrid_last_item_get(obj);
- elm_gengrid_item_selected_set(it, EINA_TRUE);
+ if (!_elm_config->item_select_on_focus_disable)
+ elm_gengrid_item_selected_set(it, EINA_TRUE);
+ else
+ elm_object_item_focus_set(it, EINA_TRUE);
return EINA_TRUE;
}
else if (!strcmp(dir, "prior"))
ELM_GENGRID_DATA_GET(obj, sd);
Elm_Object_Item *it = NULL;
- if ((!sd->multi) && (sd->selected))
+ if (!sd->multi)
{
- it = elm_gengrid_selected_item_get(obj);
+ it = elm_object_focused_item_get(obj);
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
return EINA_TRUE;
}
it = _elm_gengrid_nearest_visible_item_get(obj, it);
if (it)
{
- if (is_sel)
+ if (!_elm_config->item_select_on_focus_disable && is_sel)
elm_gengrid_item_selected_set(it, EINA_TRUE);
else
elm_object_item_focus_set(it, EINA_TRUE);