forked from enlightenment/efl
widget: Merge on_focus_region and focus_region_get
This simplifies code and API. Ref T5363
This commit is contained in:
parent
ff3a723003
commit
d928ba989a
|
@ -1203,7 +1203,7 @@ _efl_ui_text_elm_widget_on_focus(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Object_Item
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_text_elm_widget_on_focus_region(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
_efl_ui_text_elm_widget_focus_region_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
Evas_Coord edje_x, edje_y, elm_x, elm_y;
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
|||
Elm.Widget.focus_direction_manager_is;
|
||||
Elm.Widget.theme_apply;
|
||||
Elm.Widget.on_focus;
|
||||
Elm.Widget.on_focus_region;
|
||||
Elm.Widget.focus_region { get; }
|
||||
Elm.Widget.on_disabled_update;
|
||||
Elm.Widget.widget_sub_object_del;
|
||||
Elm.Widget.focus_next_manager_is;
|
||||
|
|
|
@ -1309,7 +1309,7 @@ _elm_entry_elm_widget_on_focus(Eo *obj, Elm_Entry_Data *sd, Elm_Object_Item *ite
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_entry_elm_widget_on_focus_region(Eo *obj, Elm_Entry_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
_elm_entry_elm_widget_focus_region_get(Eo *obj, Elm_Entry_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
Evas_Coord cx, cy, cw, ch;
|
||||
Evas_Coord edx, edy;
|
||||
|
|
|
@ -961,7 +961,7 @@ class Elm.Entry (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
|||
Elm.Widget.focus_direction_manager_is;
|
||||
Elm.Widget.theme_apply;
|
||||
Elm.Widget.on_focus;
|
||||
Elm.Widget.on_focus_region;
|
||||
Elm.Widget.focus_region { get; }
|
||||
Elm.Widget.on_disabled_update;
|
||||
Elm.Widget.widget_sub_object_del;
|
||||
Elm.Widget.focus_next_manager_is;
|
||||
|
|
|
@ -3540,9 +3540,9 @@ _elm_gengrid_elm_widget_on_focus(Eo *obj, Elm_Gengrid_Data *sd, Elm_Object_Item
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_gengrid_elm_widget_on_focus_region(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
_elm_gengrid_elm_widget_focus_region_get(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
if (!sd->focused_item) return EINA_FALSE;
|
||||
if (!sd->focused_item) goto end;
|
||||
if (elm_object_focus_region_show_mode_get(obj) == ELM_FOCUS_REGION_SHOW_ITEM)
|
||||
{
|
||||
Evas_Coord vx, vy;
|
||||
|
@ -3555,7 +3555,9 @@ _elm_gengrid_elm_widget_on_focus_region(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coor
|
|||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
|
||||
end:
|
||||
return elm_obj_widget_focus_region_get(efl_super(obj, MY_CLASS), x, y, w, h);
|
||||
}
|
||||
|
||||
static Eina_Bool _elm_gengrid_smart_focus_next_enable = EINA_FALSE;
|
||||
|
|
|
@ -554,7 +554,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Elm.Interface_Scrollable,
|
|||
Elm.Widget.focus_next;
|
||||
Elm.Widget.focus_direction;
|
||||
Elm.Widget.on_focus;
|
||||
Elm.Widget.on_focus_region;
|
||||
Elm.Widget.focus_region { get; }
|
||||
Elm.Widget.widget_event;
|
||||
Elm.Widget.focus_highlight_geometry_get;
|
||||
Elm.Widget.focused_item { get; }
|
||||
|
|
|
@ -1107,7 +1107,7 @@ _elm_panel_toggle(Eo *obj, Elm_Panel_Data *_pd EINA_UNUSED)
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_panel_elm_widget_on_focus_region(Eo *obj,
|
||||
_elm_panel_elm_widget_focus_region_get(Eo *obj,
|
||||
Elm_Panel_Data *sd,
|
||||
Evas_Coord *x,
|
||||
Evas_Coord *y,
|
||||
|
|
|
@ -85,7 +85,7 @@ class Elm.Panel (Efl.Ui.Layout, Elm.Interface_Scrollable,
|
|||
Elm.Widget.on_disabled_update;
|
||||
Elm.Widget.on_access_update;
|
||||
Elm.Widget.widget_event;
|
||||
Elm.Widget.on_focus_region;
|
||||
Elm.Widget.focus_region { get; }
|
||||
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
|
||||
Efl.Part.part;
|
||||
}
|
||||
|
|
|
@ -465,15 +465,6 @@ _elm_widget_mirrored_reload(Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_widget_on_focus_region(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Coord *x EINA_UNUSED, Evas_Coord *y EINA_UNUSED, Evas_Coord *w EINA_UNUSED, Evas_Coord *h EINA_UNUSED)
|
||||
{
|
||||
DBG("The %s widget does not implement the \"on_focus_region\" function.",
|
||||
efl_class_name_get(efl_class_get(obj)));
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_parents_focus(Evas_Object *obj)
|
||||
{
|
||||
|
@ -3487,14 +3478,9 @@ _elm_widget_show_region_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd
|
|||
EOLIAN static Eina_Bool
|
||||
_elm_widget_focus_region_get(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
Eina_Bool int_ret = EINA_FALSE;
|
||||
int_ret = elm_obj_widget_on_focus_region((Eo *)obj, x, y, w, h);
|
||||
if (!int_ret)
|
||||
{
|
||||
evas_object_geometry_get(obj, NULL, NULL, w, h);
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
}
|
||||
efl_gfx_size_get(obj, w, h);
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if ((*w <= 0) || (*h <= 0)) return EINA_FALSE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -437,16 +437,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
|||
}
|
||||
return: bool; [[$true if this widget can handle focus, $false otherwise]]
|
||||
}
|
||||
on_focus_region {
|
||||
[['Virtual' function returning an inner area of a widget that should be brought into the visible area of a broader viewport, may this context arise.]]
|
||||
params {
|
||||
@out x: int; [[X coordinate]]
|
||||
@out y: int; [[Y coordinate]]
|
||||
@out w: int; [[Width]]
|
||||
@out h: int; [[Height]]
|
||||
}
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
|
||||
/* Scroll API. */
|
||||
@property on_show_region_hook {
|
||||
|
@ -508,9 +498,23 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
|||
|
||||
/* Old focus API. FIXME: Needs massive clean up! */
|
||||
@property focus_region {
|
||||
[[Focus region property]]
|
||||
[[Region to show when focus changes within this widget.
|
||||
|
||||
When this widget or one of its subwidgets is given focus, this
|
||||
region should be shown, which means any parent scroller should
|
||||
attempt to display the given area of this widget. For instance, an
|
||||
entry given focus should scroll to show the text cursor if that
|
||||
cursor moves. In this example, this region defines the relative
|
||||
geometry of the cursor within the widget.
|
||||
|
||||
Note: The region is relative to the top-left corner of the widget,
|
||||
i.e. X,Y start from 0,0 to indicate the top-left corner of the
|
||||
widget.
|
||||
|
||||
See also @.focus_region_show.
|
||||
]]
|
||||
get {
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
return: bool; [[If $false, @.focus_region_show will not do anything.]]
|
||||
}
|
||||
values {
|
||||
x: int; [[X coordinate]]
|
||||
|
|
Loading…
Reference in New Issue