forked from enlightenment/efl
widget: Use EO function pointer for on_show_region
This is as much a test of the EO function pointer as it is a clean up of this widget API.
This commit is contained in:
parent
509ed86cdf
commit
06ec847a7c
|
@ -1234,12 +1234,9 @@ _efl_ui_text_elm_widget_on_focus_region(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *s
|
|||
}
|
||||
|
||||
static void
|
||||
_show_region_hook(void *data EINA_UNUSED,
|
||||
Evas_Object *obj)
|
||||
_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rectangle r)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
||||
elm_interface_scrollable_content_region_show(obj, x, y, w, h);
|
||||
elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
|
@ -3731,7 +3728,7 @@ _efl_ui_text_scrollable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool scroll)
|
|||
elm_interface_scrollable_policy_set(obj, sd->policy_h, sd->policy_v);
|
||||
elm_interface_scrollable_content_set(obj, sd->entry_edje);
|
||||
elm_interface_scrollable_content_viewport_resize_cb_set(obj, _efl_ui_text_content_viewport_resize_cb);
|
||||
elm_widget_on_show_region_hook_set(obj, _show_region_hook, NULL);
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3747,7 +3744,7 @@ _efl_ui_text_scrollable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool scroll)
|
|||
|
||||
elm_interface_scrollable_objects_set(obj, sd->entry_edje, sd->hit_rect);
|
||||
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, NULL);
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, NULL, NULL);
|
||||
}
|
||||
_update_decorations(obj);
|
||||
elm_obj_widget_theme_apply(obj);
|
||||
|
|
|
@ -1351,14 +1351,9 @@ _elm_entry_elm_widget_on_focus_region(Eo *obj, Elm_Entry_Data *sd, Evas_Coord *x
|
|||
}
|
||||
|
||||
static void
|
||||
_show_region_hook(void *data EINA_UNUSED,
|
||||
Evas_Object *obj)
|
||||
_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rectangle r)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
||||
|
||||
elm_interface_scrollable_content_region_show(obj, x, y, w, h);
|
||||
elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
|
@ -5047,7 +5042,7 @@ _elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll)
|
|||
elm_interface_scrollable_policy_set(obj, sd->policy_h, sd->policy_v);
|
||||
elm_interface_scrollable_content_set(obj, sd->entry_edje);
|
||||
elm_interface_scrollable_content_viewport_resize_cb_set(obj, _elm_entry_content_viewport_resize_cb);
|
||||
elm_widget_on_show_region_hook_set(obj, _show_region_hook, NULL);
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5063,7 +5058,7 @@ _elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll)
|
|||
|
||||
elm_interface_scrollable_objects_set(obj, sd->entry_edje, sd->hit_rect);
|
||||
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, NULL);
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, NULL, NULL);
|
||||
}
|
||||
sd->last_w = -1;
|
||||
elm_obj_widget_theme_apply(obj);
|
||||
|
|
|
@ -3462,18 +3462,14 @@ _elm_genlist_elm_widget_theme_apply(Eo *obj, Elm_Genlist_Data *sd)
|
|||
/* FIXME: take off later. maybe this show region coords belong in the
|
||||
* interface (new api functions, set/get)? */
|
||||
static void
|
||||
_show_region_hook(void *data EINA_UNUSED,
|
||||
Evas_Object *obj)
|
||||
_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rectangle r)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
ELM_GENLIST_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
||||
//x & y are screen coordinates, Add with pan coordinates
|
||||
x += sd->pan_x;
|
||||
y += sd->pan_y;
|
||||
elm_interface_scrollable_content_region_show(obj, x, y, w, h);
|
||||
r.x += sd->pan_x;
|
||||
r.y += sd->pan_y;
|
||||
elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -5602,7 +5598,7 @@ _elm_genlist_efl_canvas_group_group_add(Eo *obj, Elm_Genlist_Data *priv)
|
|||
evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
|
||||
|
||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||
elm_widget_on_show_region_hook_set(obj, _show_region_hook, NULL);
|
||||
elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL);
|
||||
|
||||
if (!elm_layout_theme_set
|
||||
(obj, "genlist", "base", elm_widget_style_get(obj)))
|
||||
|
|
|
@ -1027,13 +1027,9 @@ _size_hints_changed_cb(void *data,
|
|||
/* FIXME: take off later. maybe this show region coords belong in the
|
||||
* interface (new api functions, set/get)? */
|
||||
static void
|
||||
_show_region_hook(void *data EINA_UNUSED,
|
||||
Evas_Object *obj)
|
||||
_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rectangle r)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
elm_widget_show_region_get(obj, &x, &y, &w, &h);
|
||||
elm_interface_scrollable_content_region_set(obj, x, y, w, h);
|
||||
elm_interface_scrollable_content_region_set(obj, r.x, r.y, r.w, r.h);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
|
@ -2432,7 +2428,7 @@ _elm_list_efl_canvas_group_group_add(Eo *obj, Elm_List_Data *priv)
|
|||
elm_interface_atspi_accessible_type_set(priv->box, ELM_ATSPI_TYPE_DISABLED);
|
||||
|
||||
/* FIXME: change this ugly code path later */
|
||||
elm_widget_on_show_region_hook_set(priv->box, _show_region_hook, obj);
|
||||
elm_widget_on_show_region_hook_set(priv->box, obj, _show_region_hook, NULL);
|
||||
elm_widget_sub_object_add(obj, priv->box);
|
||||
|
||||
elm_interface_scrollable_content_set(obj, priv->box);
|
||||
|
|
|
@ -536,13 +536,9 @@ _elm_scroller_elm_widget_focus_direction(Eo *obj, Elm_Scroller_Data *sd, const E
|
|||
}
|
||||
|
||||
static void
|
||||
_show_region_hook(void *data,
|
||||
Evas_Object *content_obj)
|
||||
_show_region_hook(void *data, Evas_Object *content_obj EINA_UNUSED, Eina_Rectangle r)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
elm_widget_show_region_get(content_obj, &x, &y, &w, &h);
|
||||
elm_interface_scrollable_content_region_show(data, x, y, w, h);
|
||||
elm_interface_scrollable_content_region_show(data, r.x, r.y, r.w, r.h);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -564,7 +560,7 @@ _elm_scroller_elm_widget_sub_object_del(Eo *obj, Elm_Scroller_Data *sd, Evas_Obj
|
|||
if (sobj == sd->content)
|
||||
{
|
||||
if (elm_widget_is(sobj))
|
||||
elm_widget_on_show_region_hook_set(sd->content, NULL, NULL);
|
||||
elm_widget_on_show_region_hook_set(sd->content, NULL, NULL, NULL);
|
||||
|
||||
sd->content = NULL;
|
||||
}
|
||||
|
@ -741,7 +737,7 @@ _loop_content_set(Evas_Object *obj, Elm_Scroller_Data *sd, Evas_Object *content)
|
|||
evas_object_size_hint_align_set(sd->contents, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
|
||||
elm_widget_sub_object_add(obj, sd->contents);
|
||||
elm_widget_on_show_region_hook_set(sd->contents, _show_region_hook, obj);
|
||||
elm_widget_on_show_region_hook_set(sd->contents, obj, _show_region_hook, NULL);
|
||||
|
||||
efl_ui_mirrored_automatic_set(sd->contents, EINA_FALSE);
|
||||
efl_ui_mirrored_set(sd->contents, EINA_FALSE);
|
||||
|
@ -796,7 +792,7 @@ _elm_scroller_content_set(Eo *obj, Elm_Scroller_Data *sd, const char *part, Evas
|
|||
if (content)
|
||||
{
|
||||
if (elm_widget_is(content))
|
||||
elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
|
||||
elm_widget_on_show_region_hook_set(content, obj, _show_region_hook, NULL);
|
||||
elm_widget_sub_object_add(obj, content);
|
||||
|
||||
if (sd->loop_h || sd->loop_v)
|
||||
|
@ -1373,7 +1369,7 @@ elm_scroller_loop_set(Evas_Object *obj,
|
|||
{
|
||||
elm_interface_scrollable_content_set(obj, sd->contents);
|
||||
elm_widget_sub_object_add(obj, sd->contents);
|
||||
elm_widget_on_show_region_hook_set(sd->contents, _show_region_hook, obj);
|
||||
elm_widget_on_show_region_hook_set(sd->contents, obj, _show_region_hook, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1341,10 +1341,17 @@ _elm_widget_efl_ui_base_mirrored_automatic_set(Eo *obj, Elm_Widget_Smart_Data *s
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_widget_on_show_region_hook_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, region_hook_func_type func, void *data)
|
||||
_elm_widget_on_show_region_hook_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, void *data, Efl_Ui_Scrollable_On_Show_Region func, Eina_Free_Cb func_free_cb)
|
||||
{
|
||||
if ((sd->on_show_region_data == data) && (sd->on_show_region == func))
|
||||
return;
|
||||
|
||||
if (sd->on_show_region_data && sd->on_show_region_data_free)
|
||||
sd->on_show_region_data_free(sd->on_show_region_data);
|
||||
|
||||
sd->on_show_region = func;
|
||||
sd->on_show_region_data = data;
|
||||
sd->on_show_region_data_free = func_free_cb;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3396,8 +3403,8 @@ _elm_widget_show_region_set(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Coord x, Ev
|
|||
sd->rh = h;
|
||||
if (sd->on_show_region)
|
||||
{
|
||||
sd->on_show_region
|
||||
(sd->on_show_region_data, obj);
|
||||
const Eina_Rectangle r = { x, y, w, h };
|
||||
sd->on_show_region(sd->on_show_region_data, obj, r);
|
||||
|
||||
if (_elm_scrollable_is(obj))
|
||||
{
|
||||
|
@ -3427,8 +3434,8 @@ _elm_widget_show_region_set(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Coord x, Ev
|
|||
|
||||
if (sd->on_show_region)
|
||||
{
|
||||
sd->on_show_region
|
||||
(sd->on_show_region_data, parent_obj);
|
||||
const Eina_Rectangle r = { x, y, w, h };
|
||||
sd->on_show_region(sd->on_show_region_data, parent_obj, r);
|
||||
}
|
||||
}
|
||||
while (parent_obj);
|
||||
|
|
|
@ -3,7 +3,14 @@ import efl_input_types;
|
|||
|
||||
/* FIXME: This shouldn't be here. */
|
||||
type list_data_get_func_type: __undefined_type; [[Elementary list data get function type]]
|
||||
type region_hook_func_type: __undefined_type; [[Elementary region hook function type]]
|
||||
|
||||
function Efl.Ui.Scrollable_On_Show_Region
|
||||
{
|
||||
params {
|
||||
@in obj: Efl.Canvas.Object;
|
||||
@in region: Eina.Rectangle;
|
||||
}
|
||||
};
|
||||
|
||||
enum Elm.Activate
|
||||
{
|
||||
|
@ -172,6 +179,15 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
|||
}
|
||||
}
|
||||
|
||||
/* Not sure if the following are internal only? */
|
||||
@property on_show_region_hook {
|
||||
[[Region hook on show property]]
|
||||
set {}
|
||||
values {
|
||||
func: Efl.Ui.Scrollable_On_Show_Region @nullable; [[Region hook function]]
|
||||
}
|
||||
}
|
||||
|
||||
@property drag_lock_y {
|
||||
[[Lock the Y axis from being dragged]]
|
||||
values {
|
||||
|
@ -299,17 +315,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
|
|||
sobj: Efl.Canvas.Object @nullable; [[Hover sub object]]
|
||||
}
|
||||
}
|
||||
/* internal only - most objects use data = null as they work on
|
||||
themselves except scroller itself */
|
||||
@property on_show_region_hook {
|
||||
[[Region hook on show property]]
|
||||
set {
|
||||
}
|
||||
values {
|
||||
func: region_hook_func_type @nullable; [[Region hook function]]
|
||||
data: void_ptr @optional; [[Data pointer]]
|
||||
}
|
||||
}
|
||||
/* this is a part api */
|
||||
@property domain_part_text_translatable {
|
||||
[[Translate domain text part property]]
|
||||
|
|
|
@ -313,7 +313,7 @@ typedef Eina_Bool (*Elm_Widget_Focus_Get_Cb)(const void *data);
|
|||
|
||||
typedef void (*Elm_Access_On_Highlight_Cb)(void *data);
|
||||
|
||||
typedef void (*region_hook_func_type)(void *data, Evas_Object *obj);
|
||||
typedef void (*region_hook_func_type)(void *data, Evas_Object *obj, Eina_Rectangle region);
|
||||
typedef void * (*list_data_get_func_type)(const Eina_List * l);
|
||||
|
||||
#include "elm_widget.eo.h"
|
||||
|
@ -424,8 +424,8 @@ typedef struct _Elm_Widget_Smart_Data
|
|||
* handling the request of showing a specific region from an inner
|
||||
* widget (mainly issued by entries, on cursor moving) */
|
||||
void *on_show_region_data;
|
||||
void (*on_show_region)(void *data,
|
||||
Evas_Object *obj);
|
||||
Efl_Ui_Scrollable_On_Show_Region on_show_region;
|
||||
Eina_Free_Cb on_show_region_data_free;
|
||||
|
||||
int orient_mode; /* -1 is disabled */
|
||||
Elm_Focus_Move_Policy focus_move_policy;
|
||||
|
@ -640,7 +640,7 @@ EAPI Eina_Bool elm_widget_access(Evas_Object *obj, Eina_Bool is_access);
|
|||
EAPI Efl_Ui_Theme_Apply elm_widget_theme(Evas_Object *obj);
|
||||
EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
|
||||
EAPI void elm_widget_translate(Evas_Object *obj);
|
||||
EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
|
||||
EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void *data, Efl_Ui_Scrollable_On_Show_Region func, Eina_Free_Cb data_free);
|
||||
EAPI Eina_Bool elm_widget_sub_object_parent_add(Evas_Object *sobj);
|
||||
EAPI Eina_Bool elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
|
||||
EAPI Eina_Bool elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
|
||||
|
|
Loading…
Reference in New Issue