timer = NULL;
}
+static void
+test_genlist_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));
+}
+
static Eina_Bool
_focus_timer_cb(void *data)
{
elm_box_pack_end(bx_opt, chk);
evas_object_show(chk);
+ chk = elm_check_add(bx_opt);
+ elm_object_text_set(chk, "Item Select on Focus disable");
+ elm_check_state_set(chk, elm_config_item_select_on_focus_disabled_get());
+ evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
+ evas_object_smart_callback_add(chk, "changed",
+ test_genlist_focus_item_select_on_focus_disable_changed,
+ NULL);
+ elm_box_pack_end(bx_opt, chk);
+ evas_object_show(chk);
+
// 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_focused_next(Evas_Object *obj, Elm_Focus_Direction dir)
{
return EINA_TRUE;
}
-*/
static void
_elm_genlist_item_content_focus_set(Elm_Gen_Item *it, Elm_Focus_Direction dir)
Eina_Bool ret = EINA_FALSE;
Evas_Coord v = 0;
Evas_Coord min = 0;
+ Eina_Bool focus_only = EINA_FALSE;
// get content size and viewport size
eo_do(obj,
(NULL, NULL, NULL, &v),
elm_interface_scrollable_content_size_get(NULL, &min));
- if (multi)
+ if (multi && !_elm_config->item_select_on_focus_disable)
{
if (dir == ELM_FOCUS_UP)
ret = _item_multi_select_up(sd);
else if (dir == ELM_FOCUS_DOWN)
ret = _item_multi_select_down(sd);
}
- else
+ else if (!multi && !_elm_config->item_select_on_focus_disable)
{
if (dir == ELM_FOCUS_UP)
ret = _item_single_select_up(sd);
else if (dir == ELM_FOCUS_DOWN)
ret = _item_single_select_down(sd);
}
+ else if (_elm_config->item_select_on_focus_disable)
+ {
+ ret = _item_focused_next(obj, dir);
+ }
if (ret)
return EINA_TRUE;
+ focus_only = _elm_config->item_select_on_focus_disable && elm_widget_focus_highlight_enabled_get(obj);
// handle item loop feature
if (sd->item_loop_enable)
{
else if(dir == ELM_FOCUS_DOWN)
it = elm_genlist_first_item_get(obj);
- if (it)
+ if (it && focus_only)
+ elm_object_item_focus_set(it, EINA_TRUE);
+ else if (it)
elm_genlist_item_selected_set(it, EINA_TRUE);
}
return EINA_TRUE;
{
Elm_Object_Item *it = NULL;
- it = elm_genlist_selected_item_get(obj);
+ it = elm_object_focused_item_get(obj);
elm_genlist_item_expanded_set(it, !elm_genlist_item_expanded_get(it));
evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
it = _elm_genlist_nearest_visible_item_get(obj, it);
if (it)
{
- if (is_sel)
+ if (!_elm_config->item_select_on_focus_disable && is_sel)
elm_genlist_item_selected_set(it, EINA_TRUE);
else
elm_object_item_focus_set(it, EINA_TRUE);
{
Evas_Object *genlist = data;
Elm_Object_Item *it = elm_genlist_last_item_get(genlist);
- elm_genlist_item_selected_set(it, EINA_TRUE);
+ if (!_elm_config->item_select_on_focus_disable)
+ elm_genlist_item_selected_set(it, EINA_TRUE);
+ else
+ elm_object_item_focus_set(it, EINA_TRUE);
elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm");
}
{
Evas_Object *genlist = data;
Elm_Object_Item *it = elm_genlist_first_item_get(genlist);
- elm_genlist_item_selected_set(it, EINA_TRUE);
+ if (!_elm_config->item_select_on_focus_disable)
+ elm_genlist_item_selected_set(it, EINA_TRUE);
+ else
+ elm_object_item_focus_set(it, EINA_TRUE);
elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm");
}