forked from enlightenment/efl
elm: Fixed on_focus_region() issue. Focused area should be scrolled only when it is needed. Now only entry needs this feature.
SVN revision: 78111
This commit is contained in:
parent
3721aab314
commit
5b7785ccea
|
@ -868,7 +868,7 @@ _elm_entry_smart_translate(Evas_Object *obj)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_elm_entry_smart_on_focus_region(const Evas_Object *obj,
|
_elm_entry_smart_on_focus_region(const Evas_Object *obj,
|
||||||
Evas_Coord *x,
|
Evas_Coord *x,
|
||||||
Evas_Coord *y,
|
Evas_Coord *y,
|
||||||
|
@ -879,6 +879,7 @@ _elm_entry_smart_on_focus_region(const Evas_Object *obj,
|
||||||
|
|
||||||
edje_object_part_text_cursor_geometry_get
|
edje_object_part_text_cursor_geometry_get
|
||||||
(sd->entry_edje, "elm.text", x, y, w, h);
|
(sd->entry_edje, "elm.text", x, y, w, h);
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -97,16 +97,16 @@ _elm_widget_theme_func(Evas_Object *obj)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_elm_widget_on_focus_region_func(const Evas_Object *obj,
|
_elm_widget_on_focus_region_func_unimplemented(const Evas_Object *obj __UNUSED__,
|
||||||
Evas_Coord *x,
|
Evas_Coord *x __UNUSED__,
|
||||||
Evas_Coord *y,
|
Evas_Coord *y __UNUSED__,
|
||||||
Evas_Coord *w,
|
Evas_Coord *w __UNUSED__,
|
||||||
Evas_Coord *h)
|
Evas_Coord *h __UNUSED__)
|
||||||
{
|
{
|
||||||
evas_object_geometry_get(obj, NULL, NULL, w, h);
|
WRN("The %s widget does not implement the \"on_focus_region\" function.",
|
||||||
if (x) *x = 0;
|
elm_widget_type_get(obj));
|
||||||
if (y) *y = 0;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -720,7 +720,7 @@ _elm_widget_smart_set(Elm_Widget_Smart_Class *api)
|
||||||
API_DEFAULT_SET_UNIMPLEMENTED(disable);
|
API_DEFAULT_SET_UNIMPLEMENTED(disable);
|
||||||
|
|
||||||
API_DEFAULT_SET(theme);
|
API_DEFAULT_SET(theme);
|
||||||
API_DEFAULT_SET(on_focus_region);
|
API_DEFAULT_SET_UNIMPLEMENTED(on_focus_region);
|
||||||
|
|
||||||
API_DEFAULT_SET_UNIMPLEMENTED(translate);
|
API_DEFAULT_SET_UNIMPLEMENTED(translate);
|
||||||
API_DEFAULT_SET_UNIMPLEMENTED(event);
|
API_DEFAULT_SET_UNIMPLEMENTED(event);
|
||||||
|
@ -883,6 +883,10 @@ _propagate_event(void *data,
|
||||||
elm_widget_event_propagate(obj, type, event_info, event_flags);
|
elm_widget_event_propagate(obj, type, event_info, event_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If elm_widget_focus_region_get() returns EINA_FALSE, this function will
|
||||||
|
* ignore region show action.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
_elm_widget_focus_region_show(const Evas_Object *obj)
|
_elm_widget_focus_region_show(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -894,7 +898,9 @@ _elm_widget_focus_region_show(const Evas_Object *obj)
|
||||||
o = elm_widget_parent_get(obj);
|
o = elm_widget_parent_get(obj);
|
||||||
if (!o) return;
|
if (!o) return;
|
||||||
|
|
||||||
elm_widget_focus_region_get(obj, &x, &y, &w, &h);
|
if (!elm_widget_focus_region_get(obj, &x, &y, &w, &h))
|
||||||
|
return;
|
||||||
|
|
||||||
evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
|
evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
|
||||||
|
|
||||||
while (o)
|
while (o)
|
||||||
|
@ -907,7 +913,11 @@ _elm_widget_focus_region_show(const Evas_Object *obj)
|
||||||
|
|
||||||
s_iface->content_region_show(o, x, y, w, h);
|
s_iface->content_region_show(o, x, y, w, h);
|
||||||
|
|
||||||
elm_widget_focus_region_get(o, &x, &y, &w, &h);
|
if (!elm_widget_focus_region_get(o, &x, &y, &w, &h))
|
||||||
|
{
|
||||||
|
o = elm_widget_parent_get(o);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2775,12 +2785,13 @@ elm_widget_show_region_get(const Evas_Object *obj,
|
||||||
*
|
*
|
||||||
* Get the focus region of the given widget.
|
* Get the focus region of the given widget.
|
||||||
*
|
*
|
||||||
|
* @return show region or not
|
||||||
|
* (@c EINA_TRUE = show region/@c EINA_FALSE = do not show region). Default is @c EINA_FALSE.
|
||||||
|
*
|
||||||
* The focus region is the area of a widget that should brought into the
|
* The focus region is the area of a widget that should brought into the
|
||||||
* visible area when the widget is focused. Mostly used to show the part of
|
* visible area when the widget is focused. Mostly used to show the part of
|
||||||
* an entry where the cursor is, for example. The area returned is relative
|
* an entry where the cursor is, for example. The area returned is relative
|
||||||
* to the object @p obj.
|
* to the object @p obj.
|
||||||
* If the @p obj doesn't have the proper on_focus_region_hook set, this
|
|
||||||
* function will return the full size of the object.
|
|
||||||
*
|
*
|
||||||
* @param obj The widget object
|
* @param obj The widget object
|
||||||
* @param x Where to store the x coordinate of the area
|
* @param x Where to store the x coordinate of the area
|
||||||
|
@ -2790,7 +2801,7 @@ elm_widget_show_region_get(const Evas_Object *obj,
|
||||||
*
|
*
|
||||||
* @ingroup Widget
|
* @ingroup Widget
|
||||||
*/
|
*/
|
||||||
EAPI void
|
EAPI Eina_Bool
|
||||||
elm_widget_focus_region_get(const Evas_Object *obj,
|
elm_widget_focus_region_get(const Evas_Object *obj,
|
||||||
Evas_Coord *x,
|
Evas_Coord *x,
|
||||||
Evas_Coord *y,
|
Evas_Coord *y,
|
||||||
|
@ -2802,12 +2813,12 @@ elm_widget_focus_region_get(const Evas_Object *obj,
|
||||||
evas_object_geometry_get(obj, NULL, NULL, w, h);
|
evas_object_geometry_get(obj, NULL, NULL, w, h);
|
||||||
if (x) *x = 0;
|
if (x) *x = 0;
|
||||||
if (y) *y = 0;
|
if (y) *y = 0;
|
||||||
return;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ELM_WIDGET_DATA_GET(obj, sd);
|
ELM_WIDGET_DATA_GET(obj, sd);
|
||||||
|
|
||||||
sd->api->on_focus_region(obj, x, y, w, h);
|
return sd->api->on_focus_region(obj, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_List *
|
EAPI Eina_List *
|
||||||
|
|
|
@ -422,7 +422,7 @@ typedef struct _Elm_Widget_Smart_Class
|
||||||
Evas_Object *source,
|
Evas_Object *source,
|
||||||
Evas_Callback_Type type,
|
Evas_Callback_Type type,
|
||||||
void *event_info); /**< 'Virtual' function handling input events on the widget */
|
void *event_info); /**< 'Virtual' function handling input events on the widget */
|
||||||
void (*on_focus_region)(const Evas_Object *obj,
|
Eina_Bool (*on_focus_region)(const Evas_Object *obj,
|
||||||
Evas_Coord *x,
|
Evas_Coord *x,
|
||||||
Evas_Coord *y,
|
Evas_Coord *y,
|
||||||
Evas_Coord *w,
|
Evas_Coord *w,
|
||||||
|
@ -715,7 +715,7 @@ EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabl
|
||||||
EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj);
|
EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj);
|
||||||
EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool forceshow);
|
EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool forceshow);
|
||||||
EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
||||||
EAPI void elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
EAPI Eina_Bool elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
||||||
EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
|
EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
|
||||||
EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
|
EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
|
||||||
EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
|
EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
|
||||||
|
|
Loading…
Reference in New Issue