forked from enlightenment/efl
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] * access * Series of of pathes from kim shinwoo. looked good to me - so in they go, finishing off some more access mode to be more complete. SVN revision: 75415
This commit is contained in:
parent
cc2c9bdf14
commit
4de57c2cb9
|
@ -374,3 +374,9 @@
|
|||
2012-08-09 Cedric Bail
|
||||
|
||||
* Reset main loop after fork in quicklaunch.
|
||||
|
||||
2012-08-18 Shinwoo Kim (kimcinoo)
|
||||
|
||||
* Patch in incomplete access in: colorselecto, win, diskselector,
|
||||
gengrid, genlist, progressbar, slider, label, entry
|
||||
|
||||
|
|
|
@ -208,6 +208,15 @@ group { name: "elm/colorselector/base/default";
|
|||
events: "elm.arrow";
|
||||
}
|
||||
}
|
||||
part { name: "elm.arrow_bg_access";
|
||||
type: RECT;
|
||||
repeat_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "elm.arrow_bg";
|
||||
rel2.to: "elm.arrow_bg";
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
part { name: "elm.l_button";
|
||||
type: SWALLOW;
|
||||
scale: 1;
|
||||
|
|
|
@ -665,6 +665,22 @@ _elm_access_widget_item_register(Elm_Widget_Item *item)
|
|||
item->access_obj = ao;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
_elm_access_widget_item_unregister(Elm_Widget_Item *item)
|
||||
{
|
||||
Evas_Object *ho;
|
||||
|
||||
if (!item || item->access_obj) return;
|
||||
|
||||
ho = item->view;
|
||||
evas_object_event_callback_del_full(ho, EVAS_CALLBACK_RESIZE,
|
||||
_content_resize, item->access_obj);
|
||||
evas_object_event_callback_del_full(ho, EVAS_CALLBACK_MOVE,
|
||||
_content_move, item->access_obj);
|
||||
|
||||
evas_object_del(item->access_obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
_elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj)
|
||||
{
|
||||
|
|
|
@ -409,6 +409,46 @@ _button_repeat_cb(void *data,
|
|||
evas_object_smart_callback_call(cb_data->parent, SIG_CHANGED, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_colorbar_register(Evas_Object *obj,
|
||||
Color_Bar_Data *cd,
|
||||
const char* part)
|
||||
{
|
||||
Evas_Object *ao;
|
||||
Elm_Access_Info *ai;
|
||||
const char* colorbar_type = NULL;
|
||||
|
||||
ao = _elm_access_edje_object_part_object_register(obj, cd->colorbar, part);
|
||||
ai = _elm_access_object_get(ao);
|
||||
|
||||
switch (cd->color_type)
|
||||
{
|
||||
case HUE:
|
||||
colorbar_type = "hue color bar";
|
||||
break;
|
||||
|
||||
case SATURATION:
|
||||
colorbar_type = "saturation color bar";
|
||||
break;
|
||||
|
||||
case LIGHTNESS:
|
||||
colorbar_type = "lightness color bar";
|
||||
break;
|
||||
|
||||
case ALPHA:
|
||||
colorbar_type = "alpha color bar";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_elm_access_text_set(ai, ELM_ACCESS_TYPE, colorbar_type);
|
||||
|
||||
// this will be used in focus_next();
|
||||
cd->access_obj = ao;
|
||||
}
|
||||
|
||||
static void
|
||||
_color_bars_add(Evas_Object *obj)
|
||||
{
|
||||
|
@ -483,6 +523,10 @@ _color_bars_add(Evas_Object *obj)
|
|||
sd->cb_data[i]);
|
||||
elm_widget_sub_object_add(obj, sd->cb_data[i]->touch_area);
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
_access_colorbar_register(obj, sd->cb_data[i], "elm.arrow_bg_access");
|
||||
|
||||
/* load background rectangle of the colorbar. used for
|
||||
changing color of the opacity bar */
|
||||
if ((i == 1) || (i == 2))
|
||||
|
@ -818,6 +862,40 @@ _on_color_released(void *data,
|
|||
sd->focused = ELM_COLORSELECTOR_PALETTE;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
char *ret;
|
||||
Eina_Strbuf *buf;
|
||||
buf = eina_strbuf_new();
|
||||
int r = 0, g = 0, b = 0 ,a = 0;
|
||||
|
||||
Elm_Color_Item *it = data;
|
||||
ELM_COLORSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
|
||||
|
||||
elm_colorselector_palette_item_color_get((Elm_Object_Item *)it, &r, &g, &b, &a);
|
||||
|
||||
eina_strbuf_append_printf(buf, "red %d, green %d, blue %d, alpha %d", r, g, b, a);
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_access_widget_item_register(Elm_Color_Item *it)
|
||||
{
|
||||
Elm_Access_Info *ai;
|
||||
|
||||
_elm_access_widget_item_register((Elm_Widget_Item *)it);
|
||||
|
||||
ai = _elm_access_object_get(it->base.access_obj);
|
||||
|
||||
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("color selector palette item"));
|
||||
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
||||
}
|
||||
|
||||
static Elm_Color_Item *
|
||||
_item_new(Evas_Object *obj)
|
||||
{
|
||||
|
@ -850,6 +928,10 @@ _item_new(Evas_Object *obj)
|
|||
_item_sizing_eval(item);
|
||||
evas_object_show(VIEW(item));
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
_access_widget_item_register(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -1197,6 +1279,77 @@ _elm_colorselector_smart_event(Evas_Object *obj,
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_colorselector_smart_focus_next(const Evas_Object *obj,
|
||||
Elm_Focus_Direction dir,
|
||||
Evas_Object **next)
|
||||
{
|
||||
Eina_List *items = NULL;
|
||||
Eina_List *l;
|
||||
Elm_Widget_Item *item;
|
||||
int i = 0;
|
||||
|
||||
ELM_COLORSELECTOR_DATA_GET(obj, sd);
|
||||
if (!sd) return EINA_FALSE;
|
||||
|
||||
if (!sd->items) return EINA_FALSE;
|
||||
|
||||
EINA_LIST_FOREACH(sd->items, l, item)
|
||||
items = eina_list_append(items, item->access_obj);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
items = eina_list_append(items, sd->cb_data[i]->lbt);
|
||||
items = eina_list_append(items, sd->cb_data[i]->access_obj);
|
||||
items = eina_list_append(items, sd->cb_data[i]->rbt);
|
||||
}
|
||||
|
||||
return elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_obj_process(Evas_Object *obj, Eina_Bool is_access)
|
||||
{
|
||||
Eina_List *l;
|
||||
Elm_Color_Item *it;
|
||||
int i = 0;
|
||||
|
||||
ELM_COLORSELECTOR_DATA_GET(obj, sd);
|
||||
|
||||
if (is_access)
|
||||
{
|
||||
EINA_LIST_FOREACH(sd->items, l, it)
|
||||
_access_widget_item_register(it);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
_access_colorbar_register(obj, sd->cb_data[i],
|
||||
"elm.arrow_bg_access");
|
||||
}
|
||||
else
|
||||
{
|
||||
EINA_LIST_FOREACH(sd->items, l, it)
|
||||
_elm_access_widget_item_unregister((Elm_Widget_Item *)it);
|
||||
|
||||
//TODO: _elm_access_edje_object_part_object_unregister() ?
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_access_hook(Evas_Object *obj, Eina_Bool is_access)
|
||||
{
|
||||
ELM_COLORSELECTOR_CHECK(obj);
|
||||
ELM_COLORSELECTOR_DATA_GET(obj, sd);
|
||||
|
||||
if (is_access)
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next =
|
||||
_elm_colorselector_smart_focus_next;
|
||||
else
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next = NULL;
|
||||
|
||||
_access_obj_process(obj, is_access);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_colorselector_smart_set_user(Elm_Colorselector_Smart_Class *sc)
|
||||
{
|
||||
|
@ -1211,6 +1364,12 @@ _elm_colorselector_smart_set_user(Elm_Colorselector_Smart_Class *sc)
|
|||
ELM_WIDGET_CLASS(sc)->event = _elm_colorselector_smart_event;
|
||||
|
||||
ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_colorselector_smart_sizing_eval;
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
ELM_WIDGET_CLASS(sc)->focus_next = _elm_colorselector_smart_focus_next;
|
||||
|
||||
ELM_WIDGET_CLASS(sc)->access = _access_hook;
|
||||
}
|
||||
|
||||
EAPI const Elm_Colorselector_Smart_Class *
|
||||
|
|
|
@ -538,6 +538,7 @@ void _elm_config_access_set(Eina_Bool is_access)
|
|||
is_access = !!is_access;
|
||||
if (_elm_config->access_mode == is_access) return;
|
||||
_elm_config->access_mode = is_access;
|
||||
_elm_win_access(is_access);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -537,6 +537,42 @@ _item_click_cb(void *data,
|
|||
if (it->func) it->func((void *)it->base.data, WIDGET(it), it);
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
Elm_Diskselector_Item *it = (Elm_Diskselector_Item *)data;
|
||||
const char *txt = NULL;
|
||||
if (!it) return NULL;
|
||||
|
||||
if (!txt) txt = it->label;
|
||||
if (txt) return strdup(txt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_access_on_highlight_cb(void *data)
|
||||
{
|
||||
Evas_Coord bx, by, bw, bh;
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
Elm_Diskselector_Item *it = (Elm_Diskselector_Item *)data;
|
||||
|
||||
ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
|
||||
ELM_DISKSELECTOR_DATA_GET(WIDGET(it), sd);
|
||||
|
||||
evas_smart_objects_calculate(evas_object_evas_get(sd->main_box));
|
||||
evas_object_geometry_get(sd->main_box, &bx, &by, &bw, &bh);
|
||||
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
||||
|
||||
x -= bx;
|
||||
y -= by;
|
||||
|
||||
sd->s_iface->region_bring_in(WIDGET(it), x, y, w, h);
|
||||
}
|
||||
|
||||
static Elm_Diskselector_Item *
|
||||
_item_new(Evas_Object *obj,
|
||||
Evas_Object *icon,
|
||||
|
@ -578,6 +614,18 @@ _item_new(Evas_Object *obj,
|
|||
_item_content_set_hook((Elm_Object_Item *)it, "icon", icon);
|
||||
}
|
||||
|
||||
//XXX: ACCESS
|
||||
_elm_access_widget_item_register((Elm_Widget_Item *)it);
|
||||
|
||||
_elm_access_text_set(_elm_access_object_get(it->base.access_obj),
|
||||
ELM_ACCESS_TYPE, E_("diskselector item"));
|
||||
_elm_access_callback_set(_elm_access_object_get(it->base.access_obj),
|
||||
ELM_ACCESS_INFO,
|
||||
_access_info_cb, it);
|
||||
_elm_access_on_highlight_hook_set(
|
||||
_elm_access_object_get(it->base.access_obj), _access_on_highlight_cb,
|
||||
it);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
|
@ -694,6 +742,35 @@ _elm_diskselector_smart_on_focus(Evas_Object *obj)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_diskselector_smart_focus_next(const Evas_Object *obj,
|
||||
Elm_Focus_Direction dir,
|
||||
Evas_Object **next)
|
||||
{
|
||||
Eina_List *items = NULL;
|
||||
Eina_List *elist = NULL;
|
||||
Elm_Diskselector_Item *it;
|
||||
|
||||
ELM_DISKSELECTOR_CHECK(obj) EINA_FALSE;
|
||||
ELM_DISKSELECTOR_DATA_GET(obj, sd);
|
||||
|
||||
EINA_LIST_FOREACH (sd->items, elist, it)
|
||||
items = eina_list_append(items, it->base.access_obj);
|
||||
|
||||
if (!sd->round)
|
||||
return elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next);
|
||||
|
||||
if (!elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next))
|
||||
{
|
||||
elm_widget_focused_object_clear((Evas_Object *)obj);
|
||||
elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_diskselector_smart_event(Evas_Object *obj,
|
||||
Evas_Object *src __UNUSED__,
|
||||
|
@ -1183,6 +1260,18 @@ _elm_diskselector_smart_member_add(Evas_Object *obj,
|
|||
evas_object_raise(sd->hit_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_hook(Evas_Object *obj, Eina_Bool is_access)
|
||||
{
|
||||
ELM_DISKSELECTOR_DATA_GET(obj, sd);
|
||||
|
||||
if (is_access)
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next = _elm_diskselector_smart_focus_next;
|
||||
else
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_elm_diskselector_smart_set_user(Elm_Diskselector_Smart_Class *sc)
|
||||
{
|
||||
|
@ -1197,6 +1286,12 @@ _elm_diskselector_smart_set_user(Elm_Diskselector_Smart_Class *sc)
|
|||
ELM_WIDGET_CLASS(sc)->on_focus = _elm_diskselector_smart_on_focus;
|
||||
ELM_WIDGET_CLASS(sc)->theme = _elm_diskselector_smart_theme;
|
||||
ELM_WIDGET_CLASS(sc)->event = _elm_diskselector_smart_event;
|
||||
|
||||
//XXX: ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
ELM_WIDGET_CLASS(sc)->focus_next = _elm_diskselector_smart_focus_next;
|
||||
|
||||
ELM_WIDGET_CLASS(sc)->access = _access_hook;
|
||||
}
|
||||
|
||||
EAPI const Elm_Diskselector_Smart_Class *
|
||||
|
|
|
@ -2410,6 +2410,59 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
|
|||
return wd->text;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd || wd->password) return NULL;
|
||||
|
||||
const char *txt = elm_widget_access_info_get(obj);
|
||||
|
||||
if (!txt) txt = elm_entry_entry_get(obj);
|
||||
if (txt) return strdup(txt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_state_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
|
||||
Eina_Strbuf *buf;
|
||||
buf = eina_strbuf_new();
|
||||
|
||||
if (elm_widget_disabled_get(obj))
|
||||
eina_strbuf_append(buf, "State: Disabled");
|
||||
|
||||
if (!wd->editable)
|
||||
{
|
||||
if (!eina_strbuf_length_get(buf))
|
||||
eina_strbuf_append(buf, "State: Not Editable");
|
||||
else eina_strbuf_append(buf, ", Not Editable");
|
||||
}
|
||||
|
||||
if (wd->password)
|
||||
{
|
||||
if (!eina_strbuf_length_get(buf))
|
||||
eina_strbuf_append(buf, "State: Password");
|
||||
else eina_strbuf_append(buf, ", Password");
|
||||
}
|
||||
|
||||
char *txt = strdup(eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
if (txt) return txt;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_entry_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -2563,6 +2616,16 @@ elm_entry_add(Evas_Object *parent)
|
|||
// TODO: convert Elementary to subclassing of Evas_Smart_Class
|
||||
// TODO: and save some bytes, making descriptions per-class and not instance!
|
||||
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
||||
|
||||
// access
|
||||
_elm_access_object_register(obj, wd->ent);
|
||||
_elm_access_text_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("Entry"));
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_STATE, _access_state_cb, NULL);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -579,6 +579,80 @@ _item_unrealize_cb(Elm_Gen_Item *it)
|
|||
it->spacer = NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
||||
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
||||
|
||||
if (it->itc->func.text_get)
|
||||
{
|
||||
const Eina_List *l;
|
||||
const char *key;
|
||||
|
||||
if (!(it->texts)) it->texts =
|
||||
elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "texts"));
|
||||
|
||||
EINA_LIST_FOREACH(it->texts, l, key)
|
||||
{
|
||||
char *s = it->itc->func.text_get
|
||||
((void *)it->base.data, WIDGET(it), key);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_state_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
||||
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it, NULL);
|
||||
|
||||
if (it->base.disabled)
|
||||
return strdup(E_("State: Disabled"));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_access_on_highlight_cb(void *data)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord sx, sy, sw, sh;
|
||||
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
||||
ELM_GENGRID_ITEM_CHECK_OR_RETURN(it);
|
||||
|
||||
ELM_GENGRID_DATA_GET(it->base.widget, sd);
|
||||
|
||||
evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
|
||||
|
||||
evas_object_geometry_get(ELM_WIDGET_DATA(sd)->obj, &sx, &sy, &sw, &sh);
|
||||
if ((x < sx) || (y < sy) || ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
|
||||
elm_gengrid_item_bring_in((Elm_Object_Item *)it,
|
||||
ELM_GENGRID_ITEM_SCROLLTO_IN);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_widget_item_register(Elm_Gen_Item *it)
|
||||
{
|
||||
Elm_Access_Info *ai;
|
||||
|
||||
_elm_access_widget_item_register((Elm_Widget_Item *)it);
|
||||
|
||||
ai = _elm_access_object_get(it->base.access_obj);
|
||||
|
||||
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Gengrid Item"));
|
||||
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
||||
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
|
||||
_elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, it);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_realize(Elm_Gen_Item *it)
|
||||
{
|
||||
|
@ -723,6 +797,10 @@ _item_realize(Elm_Gen_Item *it)
|
|||
|
||||
it->realized = EINA_TRUE;
|
||||
it->want_unrealize = EINA_FALSE;
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
_access_widget_item_register(it);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -1736,6 +1814,27 @@ _elm_gengrid_smart_on_focus(Evas_Object *obj)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_gengrid_smart_focus_next(const Evas_Object *obj,
|
||||
Elm_Focus_Direction dir,
|
||||
Evas_Object **next)
|
||||
{
|
||||
Eina_List *items = NULL;
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
ELM_GENGRID_CHECK(obj) EINA_FALSE;
|
||||
ELM_GENGRID_DATA_GET(obj, sd);
|
||||
|
||||
EINA_INLIST_FOREACH(sd->items, it)
|
||||
{
|
||||
if (it->realized)
|
||||
items = eina_list_append(items, it->base.access_obj);
|
||||
}
|
||||
|
||||
return elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next);
|
||||
}
|
||||
|
||||
static void
|
||||
_mirrored_set(Evas_Object *obj,
|
||||
Eina_Bool rtl)
|
||||
|
@ -2259,6 +2358,36 @@ _elm_gengrid_smart_member_add(Evas_Object *obj,
|
|||
evas_object_raise(sd->hit_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_obj_process(Elm_Gengrid_Smart_Data * sd, Eina_Bool is_access)
|
||||
{
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
EINA_INLIST_FOREACH(sd->items, it)
|
||||
{
|
||||
if (!it->realized) continue;
|
||||
if (is_access) _access_widget_item_register(it);
|
||||
else
|
||||
_elm_access_widget_item_unregister((Elm_Widget_Item *)it);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_access_hook(Evas_Object *obj, Eina_Bool is_access)
|
||||
{
|
||||
ELM_GENGRID_CHECK(obj);
|
||||
ELM_GENGRID_DATA_GET(obj, sd);
|
||||
|
||||
if (is_access)
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next =
|
||||
_elm_gengrid_smart_focus_next;
|
||||
else
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next = NULL;
|
||||
|
||||
_access_obj_process(sd, is_access);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_gengrid_smart_set_user(Elm_Gengrid_Smart_Class *sc)
|
||||
{
|
||||
|
@ -2277,6 +2406,12 @@ _elm_gengrid_smart_set_user(Elm_Gengrid_Smart_Class *sc)
|
|||
ELM_WIDGET_CLASS(sc)->focus_direction = NULL;
|
||||
|
||||
ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_gengrid_smart_sizing_eval;
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
ELM_WIDGET_CLASS(sc)->focus_next = _elm_gengrid_smart_focus_next;
|
||||
|
||||
ELM_WIDGET_CLASS(sc)->access = _access_hook;
|
||||
}
|
||||
|
||||
EAPI const Elm_Gengrid_Smart_Class *
|
||||
|
|
|
@ -1242,6 +1242,82 @@ _item_content_realize(Elm_Gen_Item *it,
|
|||
return res;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
||||
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
||||
|
||||
if (it->itc->func.text_get)
|
||||
{
|
||||
const Eina_List *l;
|
||||
const char *key;
|
||||
|
||||
if (!(it->texts)) it->texts =
|
||||
elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "texts"));
|
||||
|
||||
EINA_LIST_FOREACH(it->texts, l, key)
|
||||
{
|
||||
char *s = it->itc->func.text_get
|
||||
((void *)it->base.data, WIDGET(it), key);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_state_cb(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
||||
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL);
|
||||
|
||||
if (it->base.disabled)
|
||||
return strdup(E_("State: Disabled"));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_access_on_highlight_cb(void *data)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord sx, sy, sw, sh;
|
||||
Elm_Gen_Item *it = (Elm_Gen_Item *)data;
|
||||
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
|
||||
|
||||
ELM_GENLIST_DATA_GET(it->base.widget, sd);
|
||||
|
||||
evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
|
||||
// XXX There would be a reason.
|
||||
if ((w == 0) && (h == 0)) return;
|
||||
|
||||
evas_object_geometry_get(ELM_WIDGET_DATA(sd)->obj, &sx, &sy, &sw, &sh);
|
||||
if ((x < sx) || (y < sy) || ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
|
||||
elm_genlist_item_bring_in((Elm_Object_Item *)it,
|
||||
ELM_GENLIST_ITEM_SCROLLTO_IN);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_widget_item_register(Elm_Gen_Item *it)
|
||||
{
|
||||
Elm_Access_Info *ai;
|
||||
|
||||
_elm_access_widget_item_register((Elm_Widget_Item *)it);
|
||||
|
||||
ai = _elm_access_object_get(it->base.access_obj);
|
||||
|
||||
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Genlist Item"));
|
||||
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
|
||||
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
|
||||
_elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, it);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_realize(Elm_Gen_Item *it,
|
||||
int in,
|
||||
|
@ -1315,6 +1391,10 @@ _item_realize(Elm_Gen_Item *it,
|
|||
(VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
|
||||
}
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
_access_widget_item_register(it);
|
||||
|
||||
_item_order_update(EINA_INLIST_GET(it), in);
|
||||
|
||||
treesize = edje_object_data_get(VIEW(it), "treesize");
|
||||
|
@ -2259,6 +2339,39 @@ _elm_genlist_smart_on_focus(Evas_Object *obj)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_genlist_smart_focus_next(const Evas_Object *obj,
|
||||
Elm_Focus_Direction dir,
|
||||
Evas_Object **next)
|
||||
{
|
||||
Item_Block *itb;
|
||||
Eina_List *items = NULL;
|
||||
Eina_Bool done = EINA_FALSE;
|
||||
|
||||
ELM_GENLIST_CHECK(obj) EINA_FALSE;
|
||||
ELM_GENLIST_DATA_GET(obj, sd);
|
||||
|
||||
EINA_INLIST_FOREACH(sd->blocks, itb)
|
||||
{
|
||||
if (itb->realized)
|
||||
{
|
||||
Eina_List *l;
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
done = EINA_TRUE;
|
||||
EINA_LIST_FOREACH(itb->items, l, it)
|
||||
{
|
||||
if (it->realized)
|
||||
items = eina_list_append(items, it->base.access_obj);
|
||||
}
|
||||
}
|
||||
else if (done) break;
|
||||
}
|
||||
|
||||
return elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_cache_clean(Elm_Genlist_Smart_Data *sd)
|
||||
{
|
||||
|
@ -4502,6 +4615,46 @@ _elm_genlist_smart_member_add(Evas_Object *obj,
|
|||
evas_object_raise(sd->hit_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_obj_process(Elm_Genlist_Smart_Data * sd, Eina_Bool is_access)
|
||||
{
|
||||
Item_Block *itb;
|
||||
Eina_Bool done = EINA_FALSE;
|
||||
|
||||
EINA_INLIST_FOREACH(sd->blocks, itb)
|
||||
{
|
||||
if (itb->realized)
|
||||
{
|
||||
Eina_List *l;
|
||||
Elm_Gen_Item *it;
|
||||
|
||||
done = EINA_TRUE;
|
||||
EINA_LIST_FOREACH(itb->items, l, it)
|
||||
{
|
||||
if (!it->realized) continue;
|
||||
if (is_access) _access_widget_item_register(it);
|
||||
else
|
||||
_elm_access_widget_item_unregister((Elm_Widget_Item *)it);
|
||||
}
|
||||
}
|
||||
else if (done) break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_access_hook(Evas_Object *obj, Eina_Bool is_access)
|
||||
{
|
||||
ELM_GENLIST_CHECK(obj);
|
||||
ELM_GENLIST_DATA_GET(obj, sd);
|
||||
|
||||
if (is_access)
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next =
|
||||
_elm_genlist_smart_focus_next;
|
||||
else
|
||||
ELM_WIDGET_CLASS(ELM_WIDGET_DATA(sd)->api)->focus_next = NULL;
|
||||
_access_obj_process(sd, is_access);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_genlist_smart_set_user(Elm_Genlist_Smart_Class *sc)
|
||||
{
|
||||
|
@ -4523,6 +4676,12 @@ _elm_genlist_smart_set_user(Elm_Genlist_Smart_Class *sc)
|
|||
ELM_WIDGET_CLASS(sc)->focus_direction = NULL;
|
||||
|
||||
ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_genlist_smart_sizing_eval;
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
ELM_WIDGET_CLASS(sc)->focus_next = _elm_genlist_smart_focus_next;
|
||||
|
||||
ELM_WIDGET_CLASS(sc)->access = _access_hook;
|
||||
}
|
||||
|
||||
EAPI const Elm_Genlist_Smart_Class *
|
||||
|
|
|
@ -304,6 +304,19 @@ _elm_label_smart_translate(Evas_Object *obj)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
const char *txt = elm_widget_access_info_get(obj);
|
||||
|
||||
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
||||
if (txt) return strdup(txt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_label_smart_add(Evas_Object *obj)
|
||||
{
|
||||
|
@ -330,6 +343,12 @@ _elm_label_smart_add(Evas_Object *obj)
|
|||
elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj));
|
||||
elm_layout_text_set(obj, NULL, "<br>");
|
||||
|
||||
_elm_access_object_register(obj, ELM_WIDGET_DATA(priv)->resize_obj);
|
||||
_elm_access_text_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("Label"));
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
||||
|
||||
elm_layout_sizing_eval(obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,45 @@ _elm_progressbar_smart_theme(Evas_Object *obj)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
const char *txt = elm_widget_access_info_get(obj);
|
||||
|
||||
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
||||
if (txt) return strdup(txt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_state_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
char *ret;
|
||||
Eina_Strbuf *buf;
|
||||
buf = eina_strbuf_new();
|
||||
|
||||
const char *txt = elm_layout_text_get(obj, "elm.text.status");
|
||||
if (txt) eina_strbuf_append(buf, txt);
|
||||
|
||||
if (elm_widget_disabled_get(obj))
|
||||
eina_strbuf_append(buf, " state: disabled");
|
||||
|
||||
if (eina_strbuf_length_get(buf))
|
||||
{
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
eina_strbuf_free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_progressbar_smart_add(Evas_Object *obj)
|
||||
{
|
||||
|
@ -211,9 +250,18 @@ _elm_progressbar_smart_add(Evas_Object *obj)
|
|||
_units_set(obj);
|
||||
_val_set(obj);
|
||||
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
elm_layout_sizing_eval(obj);
|
||||
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
|
||||
_elm_access_object_register(obj, ELM_WIDGET_DATA(priv)->resize_obj);
|
||||
_elm_access_text_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("progressbar"));
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_STATE, _access_state_cb, priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -666,6 +666,44 @@ _elm_slider_smart_calculate(Evas_Object *obj)
|
|||
elm_layout_thaw(obj);
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
const char *txt = elm_widget_access_info_get(obj);
|
||||
|
||||
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
||||
if (txt) return strdup(txt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_state_cb(void *data __UNUSED__,
|
||||
Evas_Object *obj,
|
||||
Elm_Widget_Item *item __UNUSED__)
|
||||
{
|
||||
char *ret;
|
||||
Eina_Strbuf *buf = eina_strbuf_new();
|
||||
const char *txt = elm_layout_text_get(obj, "elm.units");
|
||||
|
||||
if (txt) eina_strbuf_append(buf, txt);
|
||||
|
||||
if (elm_widget_disabled_get(obj))
|
||||
eina_strbuf_append(buf, " state: disabled");
|
||||
|
||||
if (eina_strbuf_length_get(buf))
|
||||
{
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
eina_strbuf_free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_slider_smart_add(Evas_Object *obj)
|
||||
{
|
||||
|
@ -733,6 +771,14 @@ _elm_slider_smart_add(Evas_Object *obj)
|
|||
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
|
||||
_elm_access_object_register(obj, ELM_WIDGET_DATA(priv)->resize_obj);
|
||||
_elm_access_text_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("slider"));
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_STATE, _access_state_cb, priv);
|
||||
|
||||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -578,6 +578,7 @@ EAPI Eina_Bool _elm_access_2nd_click_timeout(Evas_Object *obj);
|
|||
EAPI void _elm_access_highlight_set(Evas_Object* obj);
|
||||
EAPI Evas_Object * _elm_access_edje_object_part_object_register(Evas_Object *obj, const Evas_Object *partobj, const char* part);
|
||||
EAPI void _elm_access_widget_item_register(Elm_Widget_Item *item);
|
||||
EAPI void _elm_access_widget_item_unregister(Elm_Widget_Item *item);
|
||||
EAPI void _elm_access_on_highlight_hook_set(Elm_Access_Info *ac, Elm_Access_On_Highlight_Cb func, void *data);
|
||||
|
||||
/**< put this as the first member in your widget item struct */
|
||||
|
|
|
@ -168,6 +168,7 @@ struct _Color_Bar_Data
|
|||
Evas_Object *bg_rect;
|
||||
Evas_Object *arrow;
|
||||
Evas_Object *touch_area;
|
||||
Evas_Object *access_obj;
|
||||
Color_Type color_type;
|
||||
};
|
||||
|
||||
|
|
|
@ -1650,6 +1650,16 @@ _elm_win_rescale(Elm_Theme *th,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_elm_win_access(Eina_Bool is_access)
|
||||
{
|
||||
const Eina_List *l;
|
||||
Evas_Object *obj;
|
||||
|
||||
EINA_LIST_FOREACH (_elm_win_list, l, obj)
|
||||
elm_widget_access(obj, is_access);
|
||||
}
|
||||
|
||||
void
|
||||
_elm_win_translate(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue