forked from enlightenment/efl
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] datetime - accessibility feature the attached patch is to add accessibility feature to datetime. unfortunately this patch depends on previous patch ( http://sourceforge.net/mailarchive/forum.php?thread_name=CAP-c0nHQ1z5B07Nb6P7dUQhfZ8tkqnoHvj_ZEJHGZUr6Ki4SiA%40mail.gmail.com&forum_name=enlightenment-devel ) anyhow, it will be great if i can get your feedback. thanks a lot always. SVN revision: 75454
This commit is contained in:
parent
de77d3aa99
commit
8db6193871
|
@ -385,3 +385,7 @@
|
|||
* Fix sizing issue in multibutton entry by making all lines
|
||||
the same height.
|
||||
|
||||
2012-08-20 Shinwoo Kim (kimcinoo)
|
||||
|
||||
* Patch in incomplte access support in datetime.
|
||||
|
||||
|
|
|
@ -149,6 +149,15 @@ group { name: "elm/datetime/base/default";
|
|||
visible: 1;
|
||||
}
|
||||
}
|
||||
part { name: "access";
|
||||
type: RECT;
|
||||
repeat_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "bg";
|
||||
rel2.to: "bg";
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "disble_datetime";
|
||||
|
|
|
@ -371,26 +371,32 @@ _datetime_items_get(const Evas_Object *obj)
|
|||
{
|
||||
Eina_List *items = NULL;
|
||||
Datetime_Field *field;
|
||||
int loc, count = 0;
|
||||
int loc = 0;
|
||||
unsigned int idx;
|
||||
Eina_Bool visible[ELM_DATETIME_TYPE_COUNT];
|
||||
|
||||
ELM_DATETIME_DATA_GET(obj, sd);
|
||||
|
||||
for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++)
|
||||
{
|
||||
field = sd->field_list + idx;
|
||||
if (field->fmt_exist && field->visible) count++;
|
||||
if (field->fmt_exist && field->visible) visible[idx] = EINA_TRUE;
|
||||
else visible[idx] = EINA_FALSE;
|
||||
}
|
||||
for (loc = 0; loc < count; loc++)
|
||||
for (loc = 0; loc < ELM_DATETIME_TYPE_COUNT; loc++)
|
||||
{
|
||||
for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++)
|
||||
{
|
||||
field = sd->field_list + idx;
|
||||
if (field->location == loc)
|
||||
if ((field->location == loc) && (visible[idx]))
|
||||
items = eina_list_append(items, field->item_obj);
|
||||
}
|
||||
}
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
items = eina_list_append(items, sd->access_obj);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
@ -416,7 +422,7 @@ _elm_datetime_smart_focus_next(const Evas_Object *obj,
|
|||
list_free = eina_list_free;
|
||||
if (!items) return EINA_FALSE;
|
||||
}
|
||||
|
||||
printf("count = %d\n", eina_list_count(items));
|
||||
ret = elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
|
||||
if (list_free) list_free((Eina_List *)items);
|
||||
|
||||
|
@ -691,6 +697,27 @@ _field_list_init(Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
ELM_DATETIME_DATA_GET(data, sd);
|
||||
eina_strbuf_append_printf(buf,
|
||||
"%d year, %d month, %d date, %d hour, %d minute",
|
||||
sd->curr_time.tm_year, sd->curr_time.tm_mon + 1,
|
||||
sd->curr_time.tm_mday, sd->curr_time.tm_hour,
|
||||
sd->curr_time.tm_min);
|
||||
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_datetime_smart_add(Evas_Object *obj)
|
||||
{
|
||||
|
@ -732,6 +759,17 @@ _elm_datetime_smart_add(Evas_Object *obj)
|
|||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
|
||||
elm_layout_sizing_eval(obj);
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
{
|
||||
priv->access_obj = _elm_access_edje_object_part_object_register
|
||||
(obj, elm_layout_edje_get(obj), "access");
|
||||
Elm_Access_Info *ai;
|
||||
ai = _elm_access_object_get(priv->access_obj);
|
||||
_elm_access_text_set(ai, ELM_ACCESS_TYPE, "date time");
|
||||
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, obj);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -162,6 +162,7 @@ struct _Elm_Datetime_Smart_Data
|
|||
struct tm curr_time, min_limit, max_limit;
|
||||
Elm_Datetime_Module_Data *mod_data;
|
||||
char format[ELM_DATETIME_MAX_FORMAT_LEN];
|
||||
Evas_Object *access_obj;
|
||||
Eina_Bool user_format : 1; /* whether user set
|
||||
* format or default
|
||||
* format. */
|
||||
|
|
|
@ -207,6 +207,47 @@ _field_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
|||
evas_object_show(ctx_mod->ctxpopup);
|
||||
}
|
||||
|
||||
static void
|
||||
_access_set(Evas_Object *obj, Elm_Datetime_Field_Type field_type)
|
||||
{
|
||||
const char* type = NULL;
|
||||
|
||||
switch (field_type)
|
||||
{
|
||||
case ELM_DATETIME_YEAR:
|
||||
type = "datetime field, year";
|
||||
break;
|
||||
|
||||
case ELM_DATETIME_MONTH:
|
||||
type = "datetime field, month";
|
||||
break;
|
||||
|
||||
case ELM_DATETIME_DATE:
|
||||
type = "datetime field, date";
|
||||
break;
|
||||
|
||||
case ELM_DATETIME_HOUR:
|
||||
type = "datetime field, hour";
|
||||
break;
|
||||
|
||||
case ELM_DATETIME_MINUTE:
|
||||
type = "datetime field, minute";
|
||||
break;
|
||||
|
||||
case ELM_DATETIME_AMPM:
|
||||
type = "datetime field, AM PM";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_elm_access_text_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_TYPE, type);
|
||||
_elm_access_callback_set
|
||||
(_elm_access_object_get(obj), ELM_ACCESS_STATE, NULL, NULL);
|
||||
}
|
||||
|
||||
// module fucns for the specific module type
|
||||
EAPI void
|
||||
field_value_display(Elm_Datetime_Module_Data *module_data, Evas_Object *obj)
|
||||
|
@ -251,6 +292,10 @@ field_create(Elm_Datetime_Module_Data *module_data, Elm_Datetime_Field_Type fie
|
|||
evas_object_smart_callback_add(field_obj, "clicked", _field_clicked_cb, ctx_mod);
|
||||
}
|
||||
evas_object_data_set(field_obj, "_field_type", (void *)field_type);
|
||||
|
||||
// ACCESS
|
||||
_access_set(field_obj, field_type);
|
||||
|
||||
return field_obj;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue