Fixing can_focus to the widgets

Author:    Helen Fornazier <helen.fornazier@profusion.mobi>

widgets:
anchorblock:    can_focus = EINA_TRUE
anchorview:     can_focus = EINA_TRUE
fileselector:   can_focus = EINA_FALSE
hoversel:       can_focus = EINA_FALSE
notepad:        can_focus = EINA_TRUE
scrolled_entry: can_focus = EINA_TRUE
bubble:         can_focus = EINA_FALSE
calendar:       can_focus = EINA_TRUE
clock:          can_focus = EINA_TRUE
conformant:     can_focus = EINA_FALSE
flip:           can_focus = EINA_FALSE
frame:          can_focus = EINA_FALSE
gengrid:        can_focus = EINA_TRUE
genlist:        can_focus = EINA_TRUE
index:          can_focus = EINA_FALSE
list:           can_focus = EINA_TRUE
layout:         can_focus = EINA_FALSE
map:            can_focus = EINA_TRUE
mapbuf:         can_focus = EINA_FALSE
menu:           can_focus = EINA_FALSE
notify:         can_focus = EINA_FALSE
pager:          can_focus = EINA_FALSE
panes:          can_focus = EINA_FALSE
progressbar:    can_focus = EINA_FALSE
photocam:       can_focus = EINA_TRUE
scroller:       can_focus = EINA_TRUE
table:          can_focus = EINA_FALSE
thumb:          can_focus = EINA_FALSE
win:            can_focus = EINA_FALSE

SVN revision: 52888
This commit is contained in:
Tiago Rezende Campos Falcao 2010-09-29 12:22:30 +00:00
parent 18e550d688
commit 8ca4d18a0b
25 changed files with 99 additions and 5 deletions

View File

@ -192,6 +192,7 @@ elm_anchorblock_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->entry = elm_entry_add(parent);
elm_entry_item_provider_prepend(wd->entry, _item_provider, obj);

View File

@ -183,6 +183,7 @@ elm_anchorview_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->scroller = elm_scroller_add(parent);
elm_widget_resize_object_set(obj, wd->scroller);

View File

@ -409,6 +409,7 @@ elm_fileselector_add(Evas_Object *parent)
elm_widget_sub_object_add(parent, obj);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
// TODO Do we need a bg object? a frame?
// vbox

View File

@ -280,6 +280,7 @@ elm_hoversel_add(Evas_Object *parent)
elm_widget_disable_hook_set(obj, _disable_hook);
elm_widget_activate_hook_set(obj, _activate_hook);
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->btn = elm_button_add(parent);
wd->expanded = EINA_FALSE;

View File

@ -63,7 +63,8 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj)) elm_widget_focus_steal(wd->entry);
if (elm_widget_focus_get(obj))
elm_widget_focus_steal(wd->entry);
}
static char *

View File

@ -117,6 +117,7 @@ elm_bubble_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->bbl = edje_object_add(e);
_elm_theme_object_set(obj, wd->bbl, "bubble", "base", "default");

View File

@ -50,6 +50,7 @@ struct _Elm_Calendar_Mark
};
static const char *widtype = NULL;
static void _on_focus_hook(void *data, Evas_Object *obj);
static const char *_days_abbrev[] =
{
@ -327,6 +328,23 @@ _del_hook(Evas_Object *obj)
free(wd);
}
static void
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj))
{
edje_object_signal_emit(wd->calendar, "elm,action,focus", "elm");
evas_object_focus_set(wd->calendar, EINA_TRUE);
}
else
{
edje_object_signal_emit(wd->calendar, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->calendar, EINA_FALSE);
}
}
static void
_theme_hook(Evas_Object *obj)
{
@ -553,12 +571,14 @@ elm_calendar_add(Evas_Object *parent)
ELM_SET_WIDTYPE(widtype, "calendar");
elm_widget_type_set(obj, "calendar");
elm_widget_sub_object_add(parent, obj);
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->first_interval = 0.85;
wd->year_min = 2;

View File

@ -38,6 +38,7 @@ struct _Widget_Data
static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _on_focus_hook(void *data, Evas_Object *obj);
static Eina_Bool _ticker(void *data);
static Eina_Bool _signal_clock_val_up(void *data);
static Eina_Bool _signal_clock_val_down(void *data);
@ -78,9 +79,15 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj))
edje_object_signal_emit(wd->clk, "elm,action,focus", "elm");
{
edje_object_signal_emit(wd->clk, "elm,action,focus", "elm");
evas_object_focus_set(wd->clk, EINA_TRUE);
}
else
edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm");
{
edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->clk, EINA_FALSE);
}
}
static void
@ -536,6 +543,7 @@ elm_clock_add(Evas_Object *parent)
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->clk = edje_object_add(e);
elm_widget_resize_object_set(obj, wd->clk);

View File

@ -226,6 +226,7 @@ elm_conformant_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->base = edje_object_add(evas);
_elm_theme_object_set(obj, wd->base, "conformant", "base", "default");

View File

@ -398,6 +398,7 @@ elm_flip_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->clip = evas_object_rectangle_add(e);
evas_object_static_clip_set(wd->clip, 1);

View File

@ -107,6 +107,7 @@ elm_frame_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->frm = edje_object_add(e);
_elm_theme_object_set(obj, wd->frm, "frame", "base", "default");

View File

@ -978,6 +978,7 @@ elm_gengrid_add(Evas_Object *parent)
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);

View File

@ -1569,6 +1569,7 @@ elm_genlist_add(Evas_Object *parent)
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);

View File

@ -514,6 +514,7 @@ elm_index_add(Evas_Object *parent)
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->horizontal = EINA_FALSE;

View File

@ -240,9 +240,15 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj))
evas_object_focus_set(wd->scr, EINA_TRUE);
{
edje_object_signal_emit(wd->scr, "elm,action,focus", "elm");
evas_object_focus_set(wd->scr, EINA_TRUE);
}
else
evas_object_focus_set(wd->scr, EINA_FALSE);
{
edje_object_signal_emit(wd->scr, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->scr, EINA_FALSE);
}
}
static void

View File

@ -288,6 +288,7 @@ static void _pan_calculate(Evas_Object *obj);
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _on_focus_hook(void *data, Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _calc_job(void *data);
static void grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh);
@ -1134,6 +1135,23 @@ _del_pre_hook(Evas_Object *obj)
wd->pan_smart = NULL;
}
static void
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj))
{
edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
evas_object_focus_set(wd->obj, EINA_TRUE);
}
else
{
edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->obj, EINA_FALSE);
}
}
static void
_theme_hook(Evas_Object *obj)
{
@ -1658,10 +1676,12 @@ elm_map_add(Evas_Object *parent)
ELM_SET_WIDTYPE(widtype, "map");
elm_widget_type_set(obj, "map");
elm_widget_sub_object_add(parent, obj);
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);

View File

@ -176,6 +176,7 @@ elm_mapbuf_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL);

View File

@ -419,6 +419,7 @@ elm_menu_add(Evas_Object *parent)
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->location = elm_icon_add(obj);
wd->parent = parent;

View File

@ -334,6 +334,7 @@ elm_notify_add(Evas_Object *parent)
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->repeat_events = EINA_TRUE;

View File

@ -224,6 +224,7 @@ elm_pager_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->clip = evas_object_rectangle_add(e);
elm_widget_resize_object_set(obj, wd->clip);

View File

@ -162,6 +162,7 @@ elm_panes_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->panes = edje_object_add(e);
_elm_theme_object_set(obj, wd->panes, "panes", "vertical", "default");

View File

@ -139,6 +139,7 @@ struct _Pan
static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _on_focus_hook(void *data, Evas_Object *obj);
//static void _show_region_hook(void *data, Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _calc_job(void *data);
@ -698,6 +699,23 @@ _del_hook(Evas_Object *obj)
free(wd);
}
static void
_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_focus_get(obj))
{
edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
evas_object_focus_set(wd->obj, EINA_TRUE);
}
else
{
edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->obj, EINA_FALSE);
}
}
static void
_theme_hook(Evas_Object *obj)
{
@ -955,9 +973,11 @@ elm_photocam_add(Evas_Object *parent)
ELM_SET_WIDTYPE(widtype, "photocam");
elm_widget_type_set(obj, "photocam");
elm_widget_sub_object_add(parent, obj);
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
wd->scr = elm_smart_scroller_add(e);
elm_smart_scroller_widget_set(wd->scr, obj);

View File

@ -196,6 +196,7 @@ elm_progressbar_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->horizontal = EINA_TRUE;
wd->inverted = EINA_FALSE;

View File

@ -421,6 +421,7 @@ elm_thumb_add(Evas_Object *parent)
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
wd->frame = edje_object_add(evas);
_elm_theme_object_set(obj, wd->frame, "thumb", "base", "default");

View File

@ -2114,6 +2114,7 @@ elm_win_inwin_add(Evas_Object *obj)
elm_widget_data_set(obj2, wd);
elm_widget_del_hook_set(obj2, _del_hook);
elm_widget_theme_hook_set(obj2, _theme_hook);
elm_widget_can_focus_set(obj2, EINA_FALSE);
wd->frm = edje_object_add(win->evas);
_elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");