}
}
-EOLIAN static void
-_efl_ui_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;
-}
-
/*
* @internal
*
/* Legacy APIs */
+EAPI void
+elm_widget_on_show_region_hook_set(Eo *obj, void *data, Efl_Ui_Scrollable_On_Show_Region func, Eina_Free_Cb func_free_cb)
+{
+ ELM_WIDGET_DATA_GET(obj, sd);
+
+ 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;
+}
+
+EAPI void
+elm_widget_show_region_set(Eo *obj, Eina_Rect sr, Eina_Bool forceshow)
+{
+ Evas_Object *parent_obj, *child_obj;
+ Evas_Coord px, py, cx, cy, nx = 0, ny = 0;
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd);
+
+ evas_smart_objects_calculate(evas_object_evas_get(obj));
+
+ if (!forceshow && eina_rectangle_equal(&sr.rect, &sd->show_region.rect)) return;
+
+ sd->show_region = sr;
+ if (sd->on_show_region)
+ {
+ sd->on_show_region(sd->on_show_region_data, obj, sr);
+
+ if (_elm_scrollable_is(obj))
+ {
+ if (elm_widget_is_legacy(obj))
+ {
+ elm_interface_scrollable_content_pos_get(obj, &nx, &ny);
+ sr.x -= nx;
+ sr.y -= ny;
+ }
+ else
+ {
+ Eina_Position2D pos;
+ pos = efl_ui_scrollable_content_pos_get(obj);
+ sr.x -= pos.x;
+ sr.y -= pos.y;
+ }
+ }
+ }
+
+ do
+ {
+ parent_obj = sd->parent_obj;
+ child_obj = sd->obj;
+ if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break;
+ sd = efl_data_scope_get(parent_obj, MY_CLASS);
+ if (!sd) break;
+
+ evas_object_geometry_get(parent_obj, &px, &py, NULL, NULL);
+ evas_object_geometry_get(child_obj, &cx, &cy, NULL, NULL);
+
+ sr.x += (cx - px);
+ sr.y += (cy - py);
+ sd->show_region = sr;
+
+ if (sd->on_show_region)
+ sd->on_show_region(sd->on_show_region_data, parent_obj, sr);
+ }
+ while (parent_obj);
+}
+
+EAPI Eina_Rect
+elm_widget_show_region_get(const Eo *obj)
+{
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd, EINA_RECT_EMPTY());
+ return (Eina_Rect) sd->show_region;
+}
/* elm_object_content_xxx APIs are supposed to work on all objects for which
* elm_object_widget_check() returns true. The below checks avoid printing out
* undesired ERR messages. */
theme or default theme was used.]]
}
- /* Scroll API. */
- @property on_show_region_hook @protected {
- [[Hook function called when the @.show_region is changed.
-
- See also @.show_region.
- ]]
- set {}
- values {
- func: Efl.Ui.Scrollable_On_Show_Region @nullable; [[Region hook function]]
- }
- }
- @property show_region @protected {
- [[Region inside the widget to show.
-
- See also @.on_show_region_hook.
- ]]
- set {
- [[Request parent scrollers to pan around so that this region
- of the widget becomes visible.
-
- If $force is $true this will trigger scroller changes and
- the @.on_show_region_hook to be called even if the region is
- unchanged.
- ]]
- values {
- region: Eina.Rect; [[The region to show.]]
- force: bool; [[Set to $true to force show even if unchanged.]]
- }
- }
- get {
- [[Returns the current region to show.]]
- values {
- region: Eina.Rect; [[The region to show.]]
- }
- }
- }
/* FIXME: Scroll API. Not sure how those APIs should be exposed with
* the new scrollable API. */
scroll_hold_push {
}
}
@property interest_region_mode {
- [[Defines how @.show_region should be calculated.
+ [[Defines how @.interest_region should be calculated.
- It is up to the implementation of @.show_region.get to take this
+ It is up to the implementation of @.interest_region.get to take this
value into account (or ignore it).
]]
get {