2002-12-16 16:00:38 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
|
|
|
/* private calls */
|
|
|
|
|
|
|
|
/* local calls */
|
|
|
|
|
|
|
|
/* public calls */
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2009-06-17 03:01:52 -07:00
|
|
|
evas_object_focus_set(Evas_Object *obj, Eina_Bool focus)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2010-03-04 06:48:21 -08:00
|
|
|
_evas_object_event_new();
|
|
|
|
|
2002-12-16 16:00:38 -08:00
|
|
|
if (focus)
|
|
|
|
{
|
2010-05-04 08:58:10 -07:00
|
|
|
if (obj->focused) goto end;
|
2002-12-16 16:00:38 -08:00
|
|
|
if (obj->layer->evas->focused)
|
|
|
|
evas_object_focus_set(obj->layer->evas->focused, 0);
|
|
|
|
obj->focused = 1;
|
|
|
|
obj->layer->evas->focused = obj;
|
|
|
|
evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_IN, NULL);
|
2010-09-13 11:04:23 -07:00
|
|
|
evas_event_callback_call(obj->layer->evas,
|
|
|
|
EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, obj);
|
2002-12-16 16:00:38 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-04 08:58:10 -07:00
|
|
|
if (!obj->focused) goto end;
|
2002-12-16 16:00:38 -08:00
|
|
|
obj->focused = 0;
|
|
|
|
obj->layer->evas->focused = NULL;
|
|
|
|
evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
|
2010-09-13 11:04:23 -07:00
|
|
|
evas_event_callback_call(obj->layer->evas,
|
|
|
|
EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, obj);
|
2002-12-16 16:00:38 -08:00
|
|
|
}
|
2010-05-04 08:58:10 -07:00
|
|
|
end:
|
|
|
|
_evas_post_event_callback_call(obj->layer->evas);
|
2002-12-16 16:00:38 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 03:01:52 -07:00
|
|
|
EAPI Eina_Bool
|
2008-02-08 14:35:19 -08:00
|
|
|
evas_object_focus_get(const Evas_Object *obj)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
|
|
return 0;
|
2005-05-21 19:49:50 -07:00
|
|
|
MAGIC_CHECK_END();
|
2002-12-16 16:00:38 -08:00
|
|
|
return obj->focused;
|
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI Evas_Object *
|
2008-02-08 13:42:01 -08:00
|
|
|
evas_focus_get(const Evas *e)
|
2002-12-16 16:00:38 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return e->focused;
|
|
|
|
}
|