config: Added two APIs to enable/disable focus auto scroll bring in feature.

Summary:
 Summary:
    - APIs
      - elm_config_focus_auto_scroll_bring_in_enabled_set
      - elm_config_focus_auto_scroll_bring_in_enabled_get
    - list/genlist/toolbar/gengrid: Using this feature for scrolling for focus movement.
    - Added test case in "List Focus", "Genlist Focus", "Toolbar Focus" and "Gengrid Focus"

    @feature

Test Plan: elementary_test->"List Focus", "Genlist Focus", "Toolbar Focus" & "Gengrid Focus".

Reviewers: raster, seoz

CC: seoz

Differential Revision: https://phab.enlightenment.org/D799
This commit is contained in:
Amitesh Singh 2014-04-27 04:15:26 +09:00 committed by Daniel Juyung Seo
parent 112d481dca
commit 8e0ffb8332
14 changed files with 133 additions and 5 deletions

View File

@ -26,6 +26,7 @@ group "Elm_Config" struct {
value "scroll_smooth_history_weight" double: 0.1;
value "scroll_smooth_future_time" double: 0.0;
value "scroll_smooth_time_window" double: 0.01;
value "focus_auto_scroll_bring_in_enable" uchar: 0;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -26,6 +26,7 @@ group "Elm_Config" struct {
value "scroll_smooth_history_weight" double: 0.1;
value "scroll_smooth_future_time" double: 0.0;
value "scroll_smooth_time_window" double: 0.01;
value "focus_auto_scroll_bring_in_enable" uchar: 0;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -26,6 +26,7 @@ group "Elm_Config" struct {
value "scroll_smooth_history_weight" double: 0.1;
value "scroll_smooth_future_time" double: 0.0;
value "scroll_smooth_time_window" double: 0.01;
value "focus_auto_scroll_bring_in_enable" uchar: 0;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;

View File

@ -1362,6 +1362,14 @@ _test_gengrid_focus_focus_animate_check_changed(void *data,
elm_check_state_get(obj));
}
static void
_test_gengrid_focus_bring_in_changed(void *data EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
}
static void
_grid_reorder_mode(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
@ -1486,6 +1494,15 @@ test_gengrid_focus(void *data EINA_UNUSED,
elm_box_pack_end(bx_opt, ck);
evas_object_show(ck);
ck = elm_check_add(bx_opt);
elm_object_text_set(ck, "Focus Auto scroll bring in enable");
evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
evas_object_smart_callback_add(ck, "changed", _test_gengrid_focus_bring_in_changed,
NULL);
elm_check_state_set(ck, elm_config_focus_auto_scroll_bring_in_enabled_get());
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");

View File

@ -3800,6 +3800,14 @@ _focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
printf("Button clicked: %s\n", (char *)data);
}
static void
_test_genlist_focus_bring_in_changed(void *data EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
}
void
test_genlist_focus(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
@ -3963,6 +3971,15 @@ test_genlist_focus(void *data EINA_UNUSED,
elm_box_pack_end(bx_opt, chk);
evas_object_show(chk);
chk = elm_check_add(bx_opt);
elm_object_text_set(chk, "Focus Auto scroll bring in enable");
evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
evas_object_smart_callback_add(chk, "changed", _test_genlist_focus_bring_in_changed,
NULL);
elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get());
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");

View File

@ -1396,6 +1396,14 @@ _focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
printf("Button clicked: %s\n", (char *)data);
}
static void
_test_list_focus_bring_in_changed(void *data EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
}
static void
_test_list_focus(const char *name, const char *title, Eina_Bool horiz)
{
@ -1532,6 +1540,15 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz)
elm_box_pack_end(bx_opt, chk);
evas_object_show(chk);
chk = elm_check_add(bx_opt);
elm_object_text_set(chk, "Focus Auto scroll bring in enable");
evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
evas_object_smart_callback_add(chk, "changed", _test_list_focus_bring_in_changed,
NULL);
elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get());
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");

View File

@ -1126,6 +1126,14 @@ test_toolbar_focus_focus_move_policy_changed(void *data EINA_UNUSED,
elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN);
}
static void
_test_toolbar_focus_bring_in_changed(void *data EINA_UNUSED,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj));
}
void
test_toolbar_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -1212,6 +1220,16 @@ test_toolbar_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
evas_object_smart_callback_add(chk, "changed",
_test_toolbar_focus_focus_animate_check_changed,
win);
chk = elm_check_add(bx_opt);
elm_object_text_set(chk, "Focus Auto scroll bring in enable");
evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
evas_object_smart_callback_add(chk, "changed", _test_toolbar_focus_bring_in_changed,
NULL);
elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get());
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");

View File

@ -507,6 +507,7 @@ _desc_init(void)
ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE);
ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE);
ELM_CONFIG_VAL(D, T, focus_auto_scroll_bring_in_enable, T_UCHAR);
ELM_CONFIG_VAL(D, T, scale, T_DOUBLE);
ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
ELM_CONFIG_VAL(D, T, compositing, T_INT);
@ -2027,6 +2028,9 @@ _env_get(void)
if (s) _elm_config->scroll_smooth_future_time = _elm_atof(s);
s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
if (s) _elm_config->scroll_smooth_time_window = _elm_atof(s);
s = getenv("ELM_FOCUS_AUTO_SCROLL_BRING_IN_ENABLE");
if (s) _elm_config->focus_auto_scroll_bring_in_enable = !!atoi(s);
s = getenv("ELM_THEME");
if (s) eina_stringshare_replace(&_elm_config->theme, s);
@ -2923,6 +2927,18 @@ elm_config_scroll_thumbscroll_acceleration_weight_set(double weight)
_elm_config->thumbscroll_acceleration_weight = weight;
}
EAPI Eina_Bool
elm_config_focus_auto_scroll_bring_in_enabled_get(void)
{
return _elm_config->focus_auto_scroll_bring_in_enable;
}
EAPI void
elm_config_focus_auto_scroll_bring_in_enabled_set(Eina_Bool enabled)
{
_elm_config->focus_auto_scroll_bring_in_enable = !!enabled;
}
EAPI void
elm_config_longpress_timeout_set(double longpress_timeout)
{

View File

@ -550,6 +550,26 @@ EAPI double elm_config_scroll_thumbscroll_acceleration_weight_get(void);
*/
EAPI void elm_config_scroll_thumbscroll_acceleration_weight_set(double weight);
/**
* Get enable status of focus auto scroll bring in.
*
* @see elm_config_focus_auto_scroll_bring_in_enabled_set()
* @ingroup Focus
* @since 1.10
*/
EAPI Eina_Bool elm_config_focus_auto_scroll_bring_in_enabled_get(void);
/**
* Set enable status of focus auto scroll bring in.
*
* @param enabled enable scroll bring in if @c EINA_TRUE, disable otherwise
*
* @see elm_config_focus_auto_scroll_bring_in_enabled_get()
* @ingroup Focus
* @since 1.10
*/
EAPI void elm_config_focus_auto_scroll_bring_in_enabled_set(Eina_Bool enabled);
/**
* @}
*/

View File

@ -1487,8 +1487,12 @@ _elm_gengrid_item_focused(Elm_Gen_Item *it)
(elm_widget_item_disabled_get(it)))
return;
elm_gengrid_item_show
((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN);
if (!_elm_config->focus_auto_scroll_bring_in_enable)
elm_gengrid_item_show
((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN);
else
elm_gengrid_item_bring_in
((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN);
sd->focused_item = (Elm_Object_Item *)it;
if (elm_widget_focus_highlight_enabled_get(obj))

View File

@ -2432,7 +2432,12 @@ _elm_genlist_item_focused(Elm_Gen_Item *it)
(elm_widget_item_disabled_get(it)))
return;
elm_genlist_item_show((Elm_Object_Item *)it, ELM_GENLIST_ITEM_SCROLLTO_IN);
if (!_elm_config->focus_auto_scroll_bring_in_enable)
elm_genlist_item_show((Elm_Object_Item *)it,
ELM_GENLIST_ITEM_SCROLLTO_IN);
else
elm_genlist_item_bring_in((Elm_Object_Item *)it,
ELM_GENLIST_ITEM_SCROLLTO_IN);
sd->focused_item = (Elm_Object_Item *)it;
if (elm_widget_focus_highlight_enabled_get(obj))

View File

@ -1081,7 +1081,12 @@ _elm_list_item_focused(Elm_List_Item *it)
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
evas_object_geometry_get(sd->hit_rect, &sx, &sy, &sw, &sh);
if ((x < sx) || (y < sy)|| ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
elm_list_item_show((Elm_Object_Item *)it);
{
if (!_elm_config->focus_auto_scroll_bring_in_enable)
elm_list_item_show((Elm_Object_Item *)it);
else
elm_list_item_bring_in((Elm_Object_Item *)it);
}
sd->focused_item = (Elm_Object_Item *)it;
if (elm_widget_focus_highlight_enabled_get(WIDGET(it)))
{

View File

@ -234,6 +234,7 @@ struct _Elm_Config
unsigned char focus_highlight_clip_disable; /**< This shows disabled status of focus highlight clip feature. This value is false by default so the focus highlight is clipped. */
unsigned char focus_move_policy; /**< This show how the elementary focus is moved to another object. Focus can be moved by click or mouse_in. */
unsigned char item_select_on_focus_disable; /**< This shows the disabled status of select on focus feature. This value is false by default so that select on focus feature is enabled by default.*/
unsigned char focus_auto_scroll_bring_in_enable; /**< This shows the enabled status of focus auto scroll bring in feature. This is disabled by default.*/
int toolbar_shrink_mode;
unsigned char fileselector_expand_enable;
unsigned char fileselector_double_tap_navigation_enable;

View File

@ -601,7 +601,12 @@ _elm_toolbar_item_focused(Elm_Toolbar_Item *it)
return;
sd->focused_item = it;
elm_toolbar_item_show((Elm_Object_Item *)it, ELM_TOOLBAR_ITEM_SCROLLTO_IN);
if (!_elm_config->focus_auto_scroll_bring_in_enable)
elm_toolbar_item_show((Elm_Object_Item *)it,
ELM_TOOLBAR_ITEM_SCROLLTO_IN);
else
elm_toolbar_item_bring_in((Elm_Object_Item *)it,
ELM_TOOLBAR_ITEM_SCROLLTO_IN);
if (elm_widget_focus_highlight_enabled_get(obj))
{
edje_object_signal_emit